[lld] [lld][WebAssembly] LTO: Use PIC reloc model with dynamic imports (PR #165342)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 28 09:03:39 PDT 2025
================
@@ -63,6 +63,12 @@ static lto::Config createConfig() {
c.RelocModel = std::nullopt;
else if (ctx.isPic)
c.RelocModel = Reloc::PIC_;
+ else if (ctx.arg.unresolvedSymbols == UnresolvedPolicy::ImportDynamic)
+ // With ImportDynamic we also need to use the PIC relocation model so that
+ // external symbols are references via the GOT.
+ // TODO(sbc): This should probably be Reloc::DynamicNoPIC, but the backend
+ // doesn't currently support that.
+ c.RelocModel = Reloc::PIC_;
----------------
sbc100 wrote:
The documentatio already talks about how the input file need to be PIC.. so this is really just a bugfix I think. The code better matches the docs now.
https://github.com/llvm/llvm-project/pull/165342
More information about the llvm-commits
mailing list