summaryrefslogtreecommitdiffstats
path: root/lld/wasm/InputFiles.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-04-22 05:26:44 +0000
committerSam Clegg <sbc@chromium.org>2019-04-22 05:26:44 +0000
commit7868fb6fdd79927a1f3b2e7185183bf4702f290c (patch)
treea36d8a66ef851ac90313fa4d8b3c743a76182274 /lld/wasm/InputFiles.cpp
parentbc4b159bb1121ed9e1c00df35a4f5dd5712de8de (diff)
downloadbcm5719-llvm-7868fb6fdd79927a1f3b2e7185183bf4702f290c.tar.gz
bcm5719-llvm-7868fb6fdd79927a1f3b2e7185183bf4702f290c.zip
[WebAssembly] Fix R_WASM_FUNCTION_OFFSET_I32 relocation warnings
We were incorrectly used the symbol table version of the function rather than the object-local version when checking the existing relocation value. This was causing erroneous warnings for comat symbols defined in multiple object.s Fixes: https://bugs.llvm.org/show_bug.cgi?id=40503 Differential Revision: https://reviews.llvm.org/D60928 llvm-svn: 358871
Diffstat (limited to 'lld/wasm/InputFiles.cpp')
-rw-r--r--lld/wasm/InputFiles.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index e118b041ca0..2929379b973 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -117,12 +117,13 @@ uint32_t ObjFile::calcExpectedValue(const WasmRelocation &Reloc) const {
return Segment.Data.Offset.Value.Int32 + Sym.Info.DataRef.Offset +
Reloc.Addend;
}
- case R_WASM_FUNCTION_OFFSET_I32:
- if (auto *Sym = dyn_cast<DefinedFunction>(getFunctionSymbol(Reloc.Index))) {
- return Sym->Function->getFunctionInputOffset() +
- Sym->Function->getFunctionCodeOffset() + Reloc.Addend;
- }
- return 0;
+ case R_WASM_FUNCTION_OFFSET_I32: {
+ const WasmSymbol &Sym = WasmObj->syms()[Reloc.Index];
+ InputFunction *F =
+ Functions[Sym.Info.ElementIndex - WasmObj->getNumImportedFunctions()];
+ return F->getFunctionInputOffset() + F->getFunctionCodeOffset() +
+ Reloc.Addend;
+ }
case R_WASM_SECTION_OFFSET_I32:
return Reloc.Addend;
case R_WASM_TYPE_INDEX_LEB:
OpenPOWER on IntegriCloud