[LLD] [COFF] Fix the mingw --export-all-symbols behaviour with comdat symbols
authorMartin Storsjö <martin@martin.st>
Thu, 29 Apr 2021 08:57:33 +0000 (11:57 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 29 Apr 2021 20:35:10 +0000 (23:35 +0300)
commit2b01a417d7ccb001ccc1185ef5fdc967c9fac8d7
tree0083cf3b7ee2dac45a0faa1767a7ba791724c031
parent8f5a2a5836cc8e4c1def2bdeb022e7b496623439
[LLD] [COFF] Fix the mingw --export-all-symbols behaviour with comdat symbols

When looking for the "all" symbols that are supposed to be exported,
we can't look at the live flag - the symbols we mark as to be
exported will become GC roots even if they aren't yet marked as live.

With this in place, building an LLVM library with BUILD_SHARED_LIBS
produces the same set of symbols exported regardless of whether the
--gc-sections flag is specified, both with and without being built
with -ffunction-sections.

Differential Revision: https://reviews.llvm.org/D101522
lld/COFF/MinGW.cpp
lld/test/COFF/export-all.s