[PATCH] D45797: [WebAssebmly] Add Module name to WasmSymbol

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 18 21:27:31 PDT 2018


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jfb.

Imports in a wasm module can have custom module name.  This change
adds the module name to the WasmSymbol structure so that the linker
can preserve this module name.

This is needed to fix: https://bugs.llvm.org/show_bug.cgi?id=37168


Repository:
  rL LLVM

https://reviews.llvm.org/D45797

Files:
  include/llvm/BinaryFormat/Wasm.h
  lib/Object/WasmObjectFile.cpp


Index: lib/Object/WasmObjectFile.cpp
===================================================================
--- lib/Object/WasmObjectFile.cpp
+++ lib/Object/WasmObjectFile.cpp
@@ -418,6 +418,7 @@
         wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex];
         FunctionType = &Signatures[Import.SigIndex];
         Info.Name = Import.Field;
+        Info.Module = Import.Module;
       }
       break;
 
Index: include/llvm/BinaryFormat/Wasm.h
===================================================================
--- include/llvm/BinaryFormat/Wasm.h
+++ include/llvm/BinaryFormat/Wasm.h
@@ -144,8 +144,9 @@
   StringRef Name;
   uint8_t Kind;
   uint32_t Flags;
+  StringRef Module; // For undefined symbols the module name of the import
   union {
-    // For function or global symbols, the index in function of global index
+    // For function or global symbols, the index in function or global index
     // space.
     uint32_t ElementIndex;
     // For a data symbols, the address of the data relative to segment.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45797.143039.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/43df6e3c/attachment.bin>


More information about the llvm-commits mailing list