diff options
Diffstat (limited to 'lld/wasm/Driver.cpp')
| -rw-r--r-- | lld/wasm/Driver.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index 8c83d17db02f..5368fe79b7eb 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -949,6 +949,17 @@ static void processStubLibrariesPreLTO() { auto* needed = symtab->find(dep); if (needed ) { needed->isUsedInRegularObj = true; + // Like with handleLibcall we have to extract any LTO archive + // members that might need to be exported due to stub library + // symbols being referenced. Without this the LTO object could be + // extracted during processStubLibraries, which is too late since + // LTO has already being performed at that point. + if (needed->isLazy() && isa<BitcodeFile>(needed->getFile())) { + if (!config->whyExtract.empty()) + ctx.whyExtractRecords.emplace_back(toString(stub_file), + needed->getFile(), *needed); + cast<LazySymbol>(needed)->extract(); + } } } } |
