llvm.org GIT mirror llvm / f8e418c
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359602 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 1 year, 5 months ago
3 changed file(s) with 137 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
532532 BCaseMask(VISIBILITY_MASK, VISIBILITY_HIDDEN);
533533 BCaseMask(UNDEFINED, UNDEFINED);
534534 BCaseMask(EXPORTED, EXPORTED);
535 BCaseMask(EXPLICIT_NAME, EXPLICIT_NAME);
535536 #undef BCaseMask
536537 }
537538
0 # RUN: yaml2obj %s | llvm-readobj --symbols | FileCheck %s
1
2 # Test symbols with custom import module and name attributes.
3
4 --- !WASM
5 FileHeader:
6 Version: 0x00000001
7 Sections:
8 - Type: TYPE
9 Signatures:
10 - Index: 0
11 ReturnType: I32
12 ParamTypes: []
13 - Index: 1
14 ReturnType: NORESULT
15 ParamTypes: []
16 - Type: IMPORT
17 Imports:
18 - Module: env
19 Field: __linear_memory
20 Kind: MEMORY
21 Memory:
22 Initial: 0x00000000
23 - Module: env
24 Field: __indirect_function_table
25 Kind: TABLE
26 Table:
27 ElemType: FUNCREF
28 Limits:
29 Initial: 0x00000000
30 - Module: red
31 Field: foo
32 Kind: FUNCTION
33 SigIndex: 1
34 - Module: env
35 Field: green
36 Kind: FUNCTION
37 SigIndex: 1
38 - Module: blue
39 Field: purple
40 Kind: FUNCTION
41 SigIndex: 1
42 - Type: FUNCTION
43 FunctionTypes: [ 0 ]
44 - Type: CODE
45 Relocations:
46 - Type: R_WASM_FUNCTION_INDEX_LEB
47 Index: 1
48 Offset: 0x00000004
49 - Type: R_WASM_FUNCTION_INDEX_LEB
50 Index: 2
51 Offset: 0x0000000A
52 - Type: R_WASM_FUNCTION_INDEX_LEB
53 Index: 3
54 Offset: 0x00000010
55 Functions:
56 - Index: 3
57 Locals: []
58 Body: 10808080800010818080800010828080800041000B
59 - Type: CUSTOM
60 Name: linking
61 Version: 2
62 SymbolTable:
63 - Index: 0
64 Kind: FUNCTION
65 Name: test
66 Flags: [ VISIBILITY_HIDDEN ]
67 Function: 3
68 - Index: 1
69 Kind: FUNCTION
70 Name: foo
71 Flags: [ UNDEFINED ]
72 Function: 0
73 - Index: 2
74 Kind: FUNCTION
75 Name: bar
76 Flags: [ UNDEFINED, EXPLICIT_NAME ]
77 Function: 1
78 - Index: 3
79 Kind: FUNCTION
80 Name: qux
81 Flags: [ UNDEFINED, EXPLICIT_NAME ]
82 Function: 2
83 - Type: CUSTOM
84 Name: producers
85 Tools:
86 - Name: clang
87 Version: '9.0.0 (trunk 359436)'
88 ...
89
90 # CHECK: Format: WASM
91 # CHECK-NEXT: Arch: wasm32
92 # CHECK-NEXT: AddressSize: 32bit
93 # CHECK-NEXT: Symbols [
94 # CHECK-NEXT: Symbol {
95 # CHECK-NEXT: Name: test
96 # CHECK-NEXT: Type: FUNCTION (0x0)
97 # CHECK-NEXT: Flags [ (0x4)
98 # CHECK-NEXT: VISIBILITY_HIDDEN (0x4)
99 # CHECK-NEXT: ]
100 # CHECK-NEXT: ElementIndex: 0x3
101 # CHECK-NEXT: }
102 # CHECK-NEXT: Symbol {
103 # CHECK-NEXT: Name: foo
104 # CHECK-NEXT: Type: FUNCTION (0x0)
105 # CHECK-NEXT: Flags [ (0x10)
106 # CHECK-NEXT: UNDEFINED (0x10)
107 # CHECK-NEXT: ]
108 # CHECK-NEXT: ImportName: foo
109 # CHECK-NEXT: ImportModule: red
110 # CHECK-NEXT: ElementIndex: 0x0
111 # CHECK-NEXT: }
112 # CHECK-NEXT: Symbol {
113 # CHECK-NEXT: Name: bar
114 # CHECK-NEXT: Type: FUNCTION (0x0)
115 # CHECK-NEXT: Flags [ (0x50)
116 # CHECK-NEXT: EXPLICIT_NAME (0x40)
117 # CHECK-NEXT: UNDEFINED (0x10)
118 # CHECK-NEXT: ]
119 # CHECK-NEXT: ImportName: green
120 # CHECK-NEXT: ImportModule: env
121 # CHECK-NEXT: ElementIndex: 0x1
122 # CHECK-NEXT: }
123 # CHECK-NEXT: Symbol {
124 # CHECK-NEXT: Name: qux
125 # CHECK-NEXT: Type: FUNCTION (0x0)
126 # CHECK-NEXT: Flags [ (0x50)
127 # CHECK-NEXT: EXPLICIT_NAME (0x40)
128 # CHECK-NEXT: UNDEFINED (0x10)
129 # CHECK-NEXT: ]
130 # CHECK-NEXT: ImportName: purple
131 # CHECK-NEXT: ImportModule: blue
132 # CHECK-NEXT: ElementIndex: 0x2
133 # CHECK-NEXT: }
134 # CHECK-NEXT: ]
4949 ENUM_ENTRY(VISIBILITY_HIDDEN),
5050 ENUM_ENTRY(UNDEFINED),
5151 ENUM_ENTRY(EXPORTED),
52 ENUM_ENTRY(EXPLICIT_NAME),
5253 #undef ENUM_ENTRY
5354 };
5455