summaryrefslogtreecommitdiffstats
path: root/lld/wasm/InputFiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/wasm/InputFiles.cpp')
-rw-r--r--lld/wasm/InputFiles.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index 7ecbafd732c..cda72c173d8 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -149,8 +149,9 @@ uint32_t ObjFile::calcNewValue(const WasmRelocation &Reloc) const {
return getGlobalSymbol(Reloc.Index)->getGlobalIndex();
case R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
if (auto *Sym = dyn_cast<DefinedFunction>(getFunctionSymbol(Reloc.Index))) {
- return Sym->Function->OutputOffset +
- Sym->Function->getFunctionCodeOffset() + Reloc.Addend;
+ if (Sym->isLive())
+ return Sym->Function->OutputOffset +
+ Sym->Function->getFunctionCodeOffset() + Reloc.Addend;
}
return 0;
case R_WEBASSEMBLY_SECTION_OFFSET_I32:
OpenPOWER on IntegriCloud