[llvm] r359602 - [WebAssembly] Support EXPLICIT_NAME symbols in llvm-readobj
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 12:30:24 PDT 2019
Author: djg
Date: Tue Apr 30 12:30:24 2019
New Revision: 359602
URL: http://llvm.org/viewvc/llvm-project?rev=359602&view=rev
Log:
[WebAssembly] Support EXPLICIT_NAME symbols in llvm-readobj
Teach llvm-readobj about WASM_SYMBOL_EXPLICIT_NAME.
Differential Revision: https://reviews.llvm.org/D61323
Reviewer: sbc100
Added:
llvm/trunk/test/tools/llvm-readobj/wasm-imports.test
Modified:
llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
Modified: llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/WasmYAML.cpp?rev=359602&r1=359601&r2=359602&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/WasmYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/WasmYAML.cpp Tue Apr 30 12:30:24 2019
@@ -533,6 +533,7 @@ void ScalarBitSetTraits<WasmYAML::Symbol
BCaseMask(VISIBILITY_MASK, VISIBILITY_HIDDEN);
BCaseMask(UNDEFINED, UNDEFINED);
BCaseMask(EXPORTED, EXPORTED);
+ BCaseMask(EXPLICIT_NAME, EXPLICIT_NAME);
#undef BCaseMask
}
Added: llvm/trunk/test/tools/llvm-readobj/wasm-imports.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/wasm-imports.test?rev=359602&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/wasm-imports.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/wasm-imports.test Tue Apr 30 12:30:24 2019
@@ -0,0 +1,135 @@
+# RUN: yaml2obj %s | llvm-readobj --symbols | FileCheck %s
+
+# Test symbols with custom import module and name attributes.
+
+--- !WASM
+FileHeader:
+ Version: 0x00000001
+Sections:
+ - Type: TYPE
+ Signatures:
+ - Index: 0
+ ReturnType: I32
+ ParamTypes: []
+ - Index: 1
+ ReturnType: NORESULT
+ ParamTypes: []
+ - Type: IMPORT
+ Imports:
+ - Module: env
+ Field: __linear_memory
+ Kind: MEMORY
+ Memory:
+ Initial: 0x00000000
+ - Module: env
+ Field: __indirect_function_table
+ Kind: TABLE
+ Table:
+ ElemType: FUNCREF
+ Limits:
+ Initial: 0x00000000
+ - Module: red
+ Field: foo
+ Kind: FUNCTION
+ SigIndex: 1
+ - Module: env
+ Field: green
+ Kind: FUNCTION
+ SigIndex: 1
+ - Module: blue
+ Field: purple
+ Kind: FUNCTION
+ SigIndex: 1
+ - Type: FUNCTION
+ FunctionTypes: [ 0 ]
+ - Type: CODE
+ Relocations:
+ - Type: R_WASM_FUNCTION_INDEX_LEB
+ Index: 1
+ Offset: 0x00000004
+ - Type: R_WASM_FUNCTION_INDEX_LEB
+ Index: 2
+ Offset: 0x0000000A
+ - Type: R_WASM_FUNCTION_INDEX_LEB
+ Index: 3
+ Offset: 0x00000010
+ Functions:
+ - Index: 3
+ Locals: []
+ Body: 10808080800010818080800010828080800041000B
+ - Type: CUSTOM
+ Name: linking
+ Version: 2
+ SymbolTable:
+ - Index: 0
+ Kind: FUNCTION
+ Name: test
+ Flags: [ VISIBILITY_HIDDEN ]
+ Function: 3
+ - Index: 1
+ Kind: FUNCTION
+ Name: foo
+ Flags: [ UNDEFINED ]
+ Function: 0
+ - Index: 2
+ Kind: FUNCTION
+ Name: bar
+ Flags: [ UNDEFINED, EXPLICIT_NAME ]
+ Function: 1
+ - Index: 3
+ Kind: FUNCTION
+ Name: qux
+ Flags: [ UNDEFINED, EXPLICIT_NAME ]
+ Function: 2
+ - Type: CUSTOM
+ Name: producers
+ Tools:
+ - Name: clang
+ Version: '9.0.0 (trunk 359436)'
+...
+
+# CHECK: Format: WASM
+# CHECK-NEXT: Arch: wasm32
+# CHECK-NEXT: AddressSize: 32bit
+# CHECK-NEXT: Symbols [
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: test
+# CHECK-NEXT: Type: FUNCTION (0x0)
+# CHECK-NEXT: Flags [ (0x4)
+# CHECK-NEXT: VISIBILITY_HIDDEN (0x4)
+# CHECK-NEXT: ]
+# CHECK-NEXT: ElementIndex: 0x3
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: foo
+# CHECK-NEXT: Type: FUNCTION (0x0)
+# CHECK-NEXT: Flags [ (0x10)
+# CHECK-NEXT: UNDEFINED (0x10)
+# CHECK-NEXT: ]
+# CHECK-NEXT: ImportName: foo
+# CHECK-NEXT: ImportModule: red
+# CHECK-NEXT: ElementIndex: 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: bar
+# CHECK-NEXT: Type: FUNCTION (0x0)
+# CHECK-NEXT: Flags [ (0x50)
+# CHECK-NEXT: EXPLICIT_NAME (0x40)
+# CHECK-NEXT: UNDEFINED (0x10)
+# CHECK-NEXT: ]
+# CHECK-NEXT: ImportName: green
+# CHECK-NEXT: ImportModule: env
+# CHECK-NEXT: ElementIndex: 0x1
+# CHECK-NEXT: }
+# CHECK-NEXT: Symbol {
+# CHECK-NEXT: Name: qux
+# CHECK-NEXT: Type: FUNCTION (0x0)
+# CHECK-NEXT: Flags [ (0x50)
+# CHECK-NEXT: EXPLICIT_NAME (0x40)
+# CHECK-NEXT: UNDEFINED (0x10)
+# CHECK-NEXT: ]
+# CHECK-NEXT: ImportName: purple
+# CHECK-NEXT: ImportModule: blue
+# CHECK-NEXT: ElementIndex: 0x2
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
Modified: llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/WasmDumper.cpp?rev=359602&r1=359601&r2=359602&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/WasmDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/WasmDumper.cpp Tue Apr 30 12:30:24 2019
@@ -50,6 +50,7 @@ static const EnumEntry<unsigned> WasmSym
ENUM_ENTRY(VISIBILITY_HIDDEN),
ENUM_ENTRY(UNDEFINED),
ENUM_ENTRY(EXPORTED),
+ ENUM_ENTRY(EXPLICIT_NAME),
#undef ENUM_ENTRY
};
More information about the llvm-commits
mailing list