[llvm] [WebAssembly] Support parsing .lto_set_conditional (PR #126546)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 09:54:24 PST 2025
================
@@ -1817,7 +1817,18 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
assert(WasmIndices.count(&WS) > 0);
Info.ElementIndex = WasmIndices.find(&WS)->second;
} else if (WS.isDefined()) {
- assert(DataLocations.count(&WS) > 0);
+ if (!DataLocations.count(&WS))
+ // In bitcode generated by split-LTO-unit mode in ThinLTO, these lines
+ // can appear:
+ // module asm ".lto_set_conditional symbolA,symbolA.[moduleId]"
+ // ...
+ // (Here [moduleId] will be replaced by a real module hash ID)
+ //
+ // Here the original symbols (symbolA here) have been renamed to symbol
+ // new names created by attaching their module IDs and the original
+ // symbols do not appear in the bitcode anymore, and thus not in
+ // DataLocations. We should ignore them.
----------------
sbc100 wrote:
I wonder if we should instead add an early return right that top of this function (before `LLVM_DEBUG(dbgs() << "adding to symtab: " << WS << "\n");`).
Something like:
`if (WS.isData() && !DataLocations.count(&WS)) contionue`
Or maybe we could have `isInSymtab` return false for these symbols which is already handled with a continue above.
https://github.com/llvm/llvm-project/pull/126546
More information about the llvm-commits
mailing list