Skip to content

Commit d9a5680

Browse files
authored
[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.
1 parent 34fda63 commit d9a5680

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lld/wasm/InputChunks.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,11 @@ bool InputChunk::generateRelocationCode(raw_ostream &os) const {
439439
if (!requiresRuntimeReloc)
440440
continue;
441441

442-
if (!isValidRuntimeRelocation(rel.getType()))
442+
if (!isValidRuntimeRelocation(rel.getType())) {
443443
error("invalid runtime relocation type in data section: " +
444444
relocTypetoString(rel.Type));
445+
continue;
446+
}
445447

446448
uint64_t offset = getVA(rel.Offset) - getInputSectionOffset();
447449
LLVM_DEBUG(dbgs() << "gen reloc: type=" << relocTypeToString(rel.Type)

0 commit comments

Comments
 (0)