[lld] [lld][WebAssembly] Fix bitcode LTO order in archive parsing (PR #73095)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 11:55:43 PST 2023


================
@@ -50,8 +50,10 @@ void SymbolTable::addFile(InputFile *file, StringRef symName) {
 
   // LLVM bitcode file
   if (auto *f = dyn_cast<BitcodeFile>(file)) {
-    f->parse(symName);
+    // This order, first adding to `bitcodeFiles` and then parsing is necessary.
+    // See https://github.com/llvm/llvm-project/pull/73095
     bitcodeFiles.push_back(f);
+    f->parse(symName);
----------------
sbc100 wrote:

This looks like a good change to me.   The fact that ELF does it this way makes me even more confident this is correct: https://github.com/llvm/llvm-project/blob/3a6f02a6581b49b269710eea944dc114166403ed/lld/ELF/InputFiles.cpp#L314-L315

https://github.com/llvm/llvm-project/pull/73095


More information about the llvm-commits mailing list