[lld][COFF] Add support for overriding weak symbols in LLVM bitcode input
authorAlan Zhao <ayzhao@google.com>
Wed, 31 Aug 2022 20:45:40 +0000 (16:45 -0400)
committerAlan Zhao <ayzhao@google.com>
Thu, 8 Sep 2022 17:17:02 +0000 (13:17 -0400)
commitb34006dd0a5126a7b3c2c5ba4d575456ab8a4894
tree922d7950af9372ce70328812364f97d2b7f6e182
parent63a2536f77a4037902be517399cb16b39fb732e7
[lld][COFF] Add support for overriding weak symbols in LLVM bitcode input

LLVM bitcode contains support for weak symbols, so we can add support
for overriding weak symbols in the output COFF even though COFF doesn't
have inherent support for weak symbols.

The motivation for this patch is that Chromium is trying to use libc++'s
assertion handler mechanism, which relies on weak symbols [0], but we're
unable to perform a ThinLTO build on Windows due to this problem [1].

[0]: https://reviews.llvm.org/D121478
[1]: https://crrev.com/c/3863576

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D133165
lld/COFF/InputFiles.cpp
lld/COFF/SymbolTable.cpp
lld/COFF/SymbolTable.h
lld/COFF/Symbols.h
lld/test/COFF/Inputs/strong-def.ll [new file with mode: 0644]
lld/test/COFF/Inputs/weak-def.ll [new file with mode: 0644]
lld/test/COFF/weak-override.ll [new file with mode: 0644]