ruiu added a comment.
Thank you for the explanation. I think I'm convinced that undefined symbols with thunks are not really that odd concept.
================
Comment at: ELF/Symbols.h:250
+ // If non-null the symbol has a Thunk that may be used as an alternative
+ // destination for callers of this Symbol.
----------------
Can you also mention that remaining undefined symbols when creating a DSO are resolved by the dynamic linker, and relocation against such undefined symbols need thunk in some architecture such as AArch64?
================
Comment at: ELF/Target.cpp:1706
+ if (S.isUndefined() &&
+ ((!S.isLocal() && S.symbol()->isWeak()) || !Config->Shared))
return Expr;
----------------
This code is subtle. So, if there is a remaining undefined symbol with a weak linkage when creating a DSO, we'll let the dynamic linker resolve it, instead of handling it as an undefined symbol. Is this consistent with other code in LLD and other linkers? It would be nice to add a comment to clarify.
https://reviews.llvm.org/D27709