[PATCH] D60992: [WebAssembly] Fix typo in relocation checking

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 22:03:06 PDT 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.

Runtime relocation are generated for relocations of type
R_WASM_MEMORY_ADDR_I32 when in PIC mode (either -shared or -pie).

Followup on https://reviews.llvm.org/D60882.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60992

Files:
  lld/wasm/InputFiles.cpp


Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -155,7 +155,9 @@
     if (isa<DataSymbol>(Sym) && Sym->isUndefined()) {
       if (Sym->isWeak() || Config->Relocatable)
         return 0;
-      if (Config->Shared && Reloc.Type == R_WASM_MEMORY_ADDR_I32)
+      // R_WASM_MEMORY_ADDR_I32 relocations in PIC code are turned into runtime
+      // fixups in __wasm_apply_relocs
+      if (Config->Pic && Reloc.Type == R_WASM_MEMORY_ADDR_I32)
         return 0;
       if (Reloc.Type != R_WASM_GLOBAL_INDEX_LEB) {
         llvm_unreachable(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60992.196181.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190423/e3998924/attachment.bin>


More information about the llvm-commits mailing list