[PATCH] D60928: [WebAssembly] Fix R_WASM_FUNCTION_OFFSET_I32 relocation warnings
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 16:48:48 PDT 2019
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.
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: #40503
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60928
Files:
lld/wasm/InputFiles.cpp
Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -117,12 +117,13 @@
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60928.195940.patch
Type: text/x-patch
Size: 940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190419/90eac693/attachment.bin>
More information about the llvm-commits
mailing list