[WebAssembly] MC: Use zero for provisional value of undefined symbols
This is more in line with what happens in the final
executable when symbols are undefined (i.e. weak
references).
Differential Revision: https://reviews.llvm.org/D41840
llvm-svn: 322130
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 0f0b645..782479e 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -492,9 +492,9 @@
WasmObjectWriter::getProvisionalValue(const WasmRelocationEntry &RelEntry) {
const MCSymbolWasm *Sym = ResolveSymbol(*RelEntry.Symbol);
- // For undefined symbols, use a hopefully invalid value.
+ // For undefined symbols, use zero
if (!Sym->isDefined(/*SetUsed=*/false))
- return UINT32_MAX;
+ return 0;
uint32_t GlobalIndex = SymbolIndices[Sym];
const WasmGlobal& Global = Globals[GlobalIndex - NumGlobalImports];