[PATCH] D139764: [COFF] Respect weak externals for mangled symbol searching

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 14:05:58 PST 2022


mstorsjo accepted this revision.
mstorsjo added a comment.
This revision is now accepted and ready to land.

This looks reasonable to me!



================
Comment at: lld/COFF/SymbolTable.cpp:817
+      // the weakAlias member variable. This matches link.exe's behavior.
+      if (Symbol *weakAlias = u->getWeakAlias())
+        return weakAlias;
----------------
smeenai wrote:
> mstorsjo wrote:
> > What this symbol is non-null but is `Undefined` (with itself possibly might be a weak symbol)? Do we need to make this a loop which inspects that aspect? Or is it not relevant for the usecases of `findMangle` where it is enough to see that we apparently did hit a real symbol and don’t need to check for prefixes?
> `getWeakAlias` does that loop: https://github.com/llvm/llvm-project/blob/bbcffb08f0fdc0be8c8cba48410f9cb556ea661d/lld/COFF/Symbols.cpp#L123-L129
Ah, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139764/new/

https://reviews.llvm.org/D139764



More information about the llvm-commits mailing list