[lld] d9a5680 - [lld][WebAssembly] update error to continue for R_WASM_FUNCTION_INDEX_I32 (#162403)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 19:54:28 PDT 2025


Author: Kyungtak Woo
Date: 2025-10-08T02:54:23Z
New Revision: d9a568034ff817060dc0a83dc3ea160b058a5935

URL: https://github.com/llvm/llvm-project/commit/d9a568034ff817060dc0a83dc3ea160b058a5935
DIFF: https://github.com/llvm/llvm-project/commit/d9a568034ff817060dc0a83dc3ea160b058a5935.diff

LOG: [lld][WebAssembly] update error to continue for R_WASM_FUNCTION_INDEX_I32 (#162403)

with some builds we're getting
`[libcxx/include/optional:874](libcxx/include/optional): libc++
Hardening assertion this->has_value() failed: optional operator* called
on a disengaged value` since error() adds the errmsg into the stream and
continues, but given it's an unsupported relocation type it eventually
crashes.

Given that I see that we're already using Fatal() in some of the other
places where it hits unsupported relocation type, my uneducated guess is
that this should be fine.

Added: 
    

Modified: 
    lld/wasm/InputChunks.cpp

Removed: 
    


################################################################################
diff  --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index 009869f1dcde1..44927e7a432bc 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -439,9 +439,11 @@ bool InputChunk::generateRelocationCode(raw_ostream &os) const {
     if (!requiresRuntimeReloc)
       continue;
 
-    if (!isValidRuntimeRelocation(rel.getType()))
+    if (!isValidRuntimeRelocation(rel.getType())) {
       error("invalid runtime relocation type in data section: " +
             relocTypetoString(rel.Type));
+      continue;
+    }
 
     uint64_t offset = getVA(rel.Offset) - getInputSectionOffset();
     LLVM_DEBUG(dbgs() << "gen reloc: type=" << relocTypeToString(rel.Type)


        


More information about the llvm-commits mailing list