D64136 and D65584, while fixing STB_WEAK issues and improving our
compatibility with ld.bfd, can cause another STB_WEAK problem related to
LTO:
If %tundef.o has an undefined reference on f,
and %tweakundef.o has a weak undefined reference on f,
%tdef.o has a definition of f
ld.lld %tundef.o %tweakundef.o --start-lib %tdef.o --end-lib
- %tundef.o doesn't set referenced bit.
- %weakundef.o changes the binding from STB_GLOBAL to STB_WEAK
- %tdef.o is not fetched because the binding is weak.
Step (1) is incorrect. This patch sets the referenced bit of Undefined
created by bitcode files.