[lld] [lld][WebAssembly] Fix crash in debug info relocation against shared symbols (PR #176460)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 16 13:06:57 PST 2026


================
@@ -208,7 +208,7 @@ uint64_t ObjFile::calcNewValue(const WasmRelocation &reloc, uint64_t tombstone,
     return getTagSymbol(reloc.Index)->getTagIndex();
   case R_WASM_FUNCTION_OFFSET_I32:
   case R_WASM_FUNCTION_OFFSET_I64: {
-    if (isa<UndefinedFunction>(sym)) {
+    if (isa<UndefinedFunction>(sym) || sym->isShared()) {
----------------
sbc100 wrote:

At the top we are returning the tombstone value for non-live symbols.

This is different to live symbol that happens to be defined in a shared object.   In the latter case many relocation types work fine (e.g. we can get the function index of these function).   Its only in this case of `R_WASM_FUNCTION_OFFSET` that the relocation against a shared symbol doesn't make any sense.

There could be cases we are missing elsewhere, but I don't see any obvious ones.


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


More information about the llvm-commits mailing list