From: Sam Clegg Date: Wed, 25 Apr 2018 18:24:08 +0000 (+0000) Subject: [WebAssebmly] Add Module name to WasmSymbol X-Git-Tag: llvmorg-7.0.0-rc1~7390 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9067b46e1b6d6331a90a1b9875bbf3fbd82a15ac;p=platform%2Fupstream%2Fllvm.git [WebAssebmly] Add Module name to WasmSymbol 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 Differential Revision: https://reviews.llvm.org/D45797 llvm-svn: 330854 --- diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index 700bcd8..dc28a3c 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -145,6 +145,7 @@ struct WasmSymbolInfo { 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 or global index // space. diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 6eb0d05..3e8f73d 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -412,6 +412,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(const uint8_t *&Ptr, wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex]; FunctionType = &Signatures[Import.SigIndex]; Info.Name = Import.Field; + Info.Module = Import.Module; } break;