[PATCH] D52602: [LLD] [COFF] Cope with GCC produced weak aliases referring to comdat functions

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 28 00:02:43 PDT 2018


mstorsjo added a comment.

In https://reviews.llvm.org/D52602#1248674, @ruiu wrote:

> Do you know why gcc creates this .weak.* symbol in the first place, and is there any real use of .weak.* symbol in the wild?


For the normal case of weak symbols (if the user explicitly uses `__attribute__((weak))`), GCC creates such a symbol because there is no other symbol available for the concrete implementation of the function. For this particular case in combination with inline functions, I think GCC didn't need to produce such a symbol (and didn't need to produce any weak alias at all), as GCC 6.x and newer no longer does it.

If you mean if any actual code in the wild intentionally uses `__attribute__((weak))` for COFF targets? Very little I think, but I have seen it in use within libgcc use it in a few places at least.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D52602





More information about the llvm-commits mailing list