[PATCH] D42306: [WebAssembly] Symbol changes #4d: export import flags, LLD only
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 13:52:39 PST 2018
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322994: [WebAssembly] Include SYMBOL_INFO for imports as well as exports (authored by sbc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42306?vs=130652&id=130687#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42306
Files:
lld/trunk/test/wasm/init-fini.ll
lld/trunk/test/wasm/relocatable.ll
lld/trunk/wasm/Writer.cpp
Index: lld/trunk/test/wasm/relocatable.ll
===================================================================
--- lld/trunk/test/wasm/relocatable.ll
+++ lld/trunk/test/wasm/relocatable.ll
@@ -229,6 +229,8 @@
; CHECK-NEXT: Name: linking
; CHECK-NEXT: DataSize: 31
; CHECK-NEXT: SymbolInfo:
+; CHECK-NEXT: - Name: bar_import
+; CHECK-NEXT: Flags: [ BINDING_WEAK ]
; CHECK-NEXT: - Name: hello
; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; CHECK-NEXT: - Name: my_func
Index: lld/trunk/test/wasm/init-fini.ll
===================================================================
--- lld/trunk/test/wasm/init-fini.ll
+++ lld/trunk/test/wasm/init-fini.ll
@@ -108,6 +108,8 @@
; RELOC: Name: linking
; RELOC-NEXT: DataSize: 0
; RELOC-NEXT: SymbolInfo:
+; RELOC-NEXT: - Name: __dso_handle
+; RELOC-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN ]
; RELOC-NEXT: - Name: func1
; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
; RELOC-NEXT: - Name: func2
Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -386,14 +386,21 @@
return;
std::vector<std::pair<StringRef, uint32_t>> SymbolInfo;
- for (const WasmExportEntry &E : ExportedSymbols) {
+ auto addSymInfo = [&](const Symbol *Sym, StringRef ExternalName) {
uint32_t Flags =
- (E.Sym->isLocal() ? WASM_SYMBOL_BINDING_LOCAL :
- E.Sym->isWeak() ? WASM_SYMBOL_BINDING_WEAK : 0) |
- (E.Sym->isHidden() ? WASM_SYMBOL_VISIBILITY_HIDDEN : 0);
+ (Sym->isLocal() ? WASM_SYMBOL_BINDING_LOCAL :
+ Sym->isWeak() ? WASM_SYMBOL_BINDING_WEAK : 0) |
+ (Sym->isHidden() ? WASM_SYMBOL_VISIBILITY_HIDDEN : 0);
if (Flags)
- SymbolInfo.emplace_back(E.FieldName, Flags);
- }
+ SymbolInfo.emplace_back(ExternalName, Flags);
+ };
+ // (Imports can't have internal linkage, their names don't need to be budged.)
+ for (const Symbol *Sym : ImportedFunctions)
+ addSymInfo(Sym, Sym->getName());
+ for (const Symbol *Sym : ImportedGlobals)
+ addSymInfo(Sym, Sym->getName());
+ for (const WasmExportEntry &E : ExportedSymbols)
+ addSymInfo(E.Sym, E.FieldName);
if (!SymbolInfo.empty()) {
SubSection SubSection(WASM_SYMBOL_INFO);
writeUleb128(SubSection.getStream(), SymbolInfo.size(), "num sym info");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42306.130687.patch
Type: text/x-patch
Size: 2578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180119/fd83240c/attachment.bin>
More information about the llvm-commits
mailing list