[PATCH] D60928: [WebAssembly] Fix R_WASM_FUNCTION_OFFSET_I32 relocation warnings

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 22:26:07 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL358871: [WebAssembly] Fix R_WASM_FUNCTION_OFFSET_I32 relocation warnings (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60928?vs=195940&id=196034#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60928/new/

https://reviews.llvm.org/D60928

Files:
  lld/trunk/wasm/InputFiles.cpp


Index: lld/trunk/wasm/InputFiles.cpp
===================================================================
--- lld/trunk/wasm/InputFiles.cpp
+++ lld/trunk/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.196034.patch
Type: text/x-patch
Size: 958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190422/3a5540ce/attachment.bin>


More information about the llvm-commits mailing list