llvm.org GIT mirror llvm / 15d6598
[WebAssembly] Reorder symbol table to match MC order This removes a TODO introduced in rL325860 Differential Revision: https://reviews.llvm.org/D43685 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326334 91177308-0d34-0410-b5e6-96231b3b80d8 Nicholas Wilson 2 years ago
10 changed file(s) with 127 addition(s) and 128 deletion(s). Raw diff Collapse all Expand all
973973 SmallVector SymbolInfos;
974974 SmallVector, 2> InitFuncs;
975975 std::map> Comdats;
976 unsigned NumSymbols = 0;
977976 uint32_t DataSize = 0;
978
979 auto AddSymbol = [&](const MCSymbolWasm &WS) {
980 uint32_t Flags = 0;
981 if (WS.isWeak())
982 Flags |= wasm::WASM_SYMBOL_BINDING_WEAK;
983 if (WS.isHidden())
984 Flags |= wasm::WASM_SYMBOL_VISIBILITY_HIDDEN;
985 if (!WS.isExternal() && WS.isDefined())
986 Flags |= wasm::WASM_SYMBOL_BINDING_LOCAL;
987 if (WS.isUndefined())
988 Flags |= wasm::WASM_SYMBOL_UNDEFINED;
989
990 wasm::WasmSymbolInfo Info;
991 Info.Name = WS.getName();
992 Info.Kind = WS.getType();
993 Info.Flags = Flags;
994 if (!WS.isData())
995 Info.ElementIndex = WasmIndices[&WS];
996 else if (WS.isDefined())
997 Info.DataRef = DataLocations[&WS];
998 SymbolInfos.emplace_back(Info);
999 SymbolIndices[&WS] = NumSymbols++;
1000 };
1001977
1002978 // For now, always emit the memory import, since loads and stores are not
1003979 // valid without it. In the future, we could perhaps be more clever and omit
1022998 TableImport.Table.ElemType = wasm::WASM_TYPE_ANYFUNC;
1023999 Imports.push_back(TableImport);
10241000
1025 // Populate FunctionTypeIndices and Imports.
1001 // Populate FunctionTypeIndices, and Imports and WasmIndices for undefined
1002 // symbols. This must be done before populating WasmIndices for defined
1003 // symbols.
10261004 for (const MCSymbol &S : Asm.symbols()) {
10271005 const auto &WS = static_cast(S);
10281006
10531031 Imports.push_back(Import);
10541032 WasmIndices[&WS] = NumGlobalImports++;
10551033 }
1056
1057 // TODO(ncw) We shouldn't be adding the symbol to the symbol table here!
1058 // Instead it should be done by removing the "if (WS.isDefined())" block
1059 // in the big loop below (line ~1284). However - that would reorder all
1060 // the symbols and thus require all the tests to be updated. I think it's
1061 // better to make that change therefore in a future commit, to isolate
1062 // each test update from the change that caused it.
1063 AddSymbol(WS);
1064 }
1065 }
1066
1034 }
1035 }
1036
1037 // Populate DataSegments, which must be done before populating DataLocations.
10671038 for (MCSection &Sec : Asm) {
10681039 auto &Section = static_cast(Sec);
10691040 if (!Section.isWasmData())
10921063 }
10931064 }
10941065
1095 // Handle regular defined and undefined symbols.
1066 // Populate WasmIndices and DataLocations for defined symbols.
10961067 for (const MCSymbol &S : Asm.symbols()) {
10971068 // Ignore unnamed temporary symbols, which aren't ever exported, imported,
10981069 // or used in relocations.
11811152 DEBUG(dbgs() << " -> global index: " << WasmIndices.find(&WS)->second
11821153 << "\n");
11831154 }
1184
1185 if (WS.isDefined())
1186 AddSymbol(WS);
1187 }
1188
1189 // Handle weak aliases. We need to process these in a separate pass because
1190 // we need to have processed the target of the alias before the alias itself
1191 // and the symbols are not necessarily ordered in this way.
1155 }
1156
1157 // Populate WasmIndices and DataLocations for aliased symbols. We need to
1158 // process these in a separate pass because we need to have processed the
1159 // target of the alias before the alias itself and the symbols are not
1160 // necessarily ordered in this way.
11921161 for (const MCSymbol &S : Asm.symbols()) {
11931162 if (!S.isVariable())
11941163 continue;
12141183 } else {
12151184 report_fatal_error("don't yet support global aliases");
12161185 }
1217
1218 AddSymbol(WS);
1186 }
1187
1188 // Finally, populate the symbol table itself, in its "natural" order.
1189 for (const MCSymbol &S : Asm.symbols()) {
1190 const auto &WS = static_cast(S);
1191 if (WS.isTemporary() && WS.getName().empty())
1192 continue;
1193 if (WS.isComdat() && !WS.isDefined())
1194 continue;
1195 if (WS.isTemporary() && WS.isData() && !WS.getSize())
1196 continue;
1197
1198 uint32_t Flags = 0;
1199 if (WS.isWeak())
1200 Flags |= wasm::WASM_SYMBOL_BINDING_WEAK;
1201 if (WS.isHidden())
1202 Flags |= wasm::WASM_SYMBOL_VISIBILITY_HIDDEN;
1203 if (!WS.isExternal() && WS.isDefined())
1204 Flags |= wasm::WASM_SYMBOL_BINDING_LOCAL;
1205 if (WS.isUndefined())
1206 Flags |= wasm::WASM_SYMBOL_UNDEFINED;
1207
1208 wasm::WasmSymbolInfo Info;
1209 Info.Name = WS.getName();
1210 Info.Kind = WS.getType();
1211 Info.Flags = Flags;
1212 if (!WS.isData())
1213 Info.ElementIndex = WasmIndices.find(&WS)->second;
1214 else if (WS.isDefined())
1215 Info.DataRef = DataLocations.find(&WS)->second;
1216 SymbolIndices[&WS] = SymbolInfos.size();
1217 SymbolInfos.emplace_back(Info);
12191218 }
12201219
12211220 {
5252 ; CHECK-NEXT: - Type: CODE
5353 ; CHECK-NEXT: Relocations:
5454 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
55 ; CHECK-NEXT: Index: 0
55 ; CHECK-NEXT: Index: 1
5656 ; CHECK-NEXT: Offset: 0x00000004
5757 ; CHECK-NEXT: Functions:
5858 ; CHECK-NEXT: - Index: 1
7777 ; CHECK-NEXT: SymbolTable:
7878 ; CHECK-NEXT: - Index: 0
7979 ; CHECK-NEXT: Kind: FUNCTION
80 ; CHECK-NEXT: Name: callImport
81 ; CHECK-NEXT: Flags: [ ]
82 ; CHECK-NEXT: Function: 1
83 ; CHECK-NEXT: - Index: 1
84 ; CHECK-NEXT: Kind: FUNCTION
8085 ; CHECK-NEXT: Name: funcImport
8186 ; CHECK-NEXT: Flags: [ UNDEFINED ]
8287 ; CHECK-NEXT: Function: 0
83 ; CHECK-NEXT: - Index: 1
84 ; CHECK-NEXT: Kind: FUNCTION
85 ; CHECK-NEXT: Name: callImport
86 ; CHECK-NEXT: Flags: [ ]
87 ; CHECK-NEXT: Function: 1
8888 ; CHECK-NEXT: - Index: 2
8989 ; CHECK-NEXT: Kind: FUNCTION
9090 ; CHECK-NEXT: Name: basicInlineFn
1212 ; CHECK: - Type: DATA
1313 ; CHECK-NEXT: Relocations:
1414 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_I32
15 ; CHECK-NEXT: Index: 0
15 ; CHECK-NEXT: Index: 2
1616 ; CHECK-NEXT: Offset: 0x00000013
1717 ; CHECK-NEXT: Segments:
1818 ; CHECK-NEXT: - SectionOffset: 6
4343 ; CHECK: - Type: DATA
4444 ; CHECK-NEXT: Relocations:
4545 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_I32
46 ; CHECK-NEXT: Index: 0
46 ; CHECK-NEXT: Index: 1
4747 ; CHECK-NEXT: Offset: 0x00000006
3333 ; CHECK: Relocation {
3434 ; CHECK: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
3535 ; CHECK: Offset: 0x4
36 ; CHECK: Index: 0x0
36 ; CHECK: Index: 0x1
3737 ; CHECK: }
3838 ; CHECK: Relocation {
3939 ; CHECK: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
4040 ; CHECK: Offset: 0xB
41 ; CHECK: Index: 0x1
41 ; CHECK: Index: 0x2
4242 ; CHECK: }
4343 ; CHECK: Relocation {
4444 ; CHECK: Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB (1)
4545 ; CHECK: Offset: 0x1E
46 ; CHECK: Index: 0x3
46 ; CHECK: Index: 0x5
4747 ; CHECK: }
4848 ; CHECK: }
6363 ; CHECK-NEXT: - Type: CODE
6464 ; CHECK-NEXT: Relocations:
6565 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
66 ; CHECK-NEXT: Index: 0
66 ; CHECK-NEXT: Index: 1
6767 ; CHECK-NEXT: Offset: 0x00000004
6868 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB
69 ; CHECK-NEXT: Index: 6
69 ; CHECK-NEXT: Index: 0
7070 ; CHECK-NEXT: Offset: 0x0000000F
7171 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB
72 ; CHECK-NEXT: Index: 1
72 ; CHECK-NEXT: Index: 3
7373 ; CHECK-NEXT: Offset: 0x00000017
7474 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
75 ; CHECK-NEXT: Index: 2
75 ; CHECK-NEXT: Index: 4
7676 ; CHECK-NEXT: Offset: 0x0000001D
7777 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
78 ; CHECK-NEXT: Index: 3
78 ; CHECK-NEXT: Index: 6
7979 ; CHECK-NEXT: Offset: 0x0000002C
8080 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB
81 ; CHECK-NEXT: Index: 8
81 ; CHECK-NEXT: Index: 5
8282 ; CHECK-NEXT: Offset: 0x00000037
8383 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_SLEB
84 ; CHECK-NEXT: Index: 1
84 ; CHECK-NEXT: Index: 3
8585 ; CHECK-NEXT: Offset: 0x0000003F
8686 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
87 ; CHECK-NEXT: Index: 2
87 ; CHECK-NEXT: Index: 4
8888 ; CHECK-NEXT: Offset: 0x00000045
8989 ; CHECK-NEXT: Functions:
9090 ; CHECK-NEXT: - Index: 5
112112 ; CHECK-NEXT: SymbolTable:
113113 ; CHECK-NEXT: - Index: 0
114114 ; CHECK-NEXT: Kind: FUNCTION
115 ; CHECK-NEXT: Name: .Lcall_dtors.42
116 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
117 ; CHECK-NEXT: Function: 5
118 ; CHECK-NEXT: - Index: 1
119 ; CHECK-NEXT: Kind: FUNCTION
115120 ; CHECK-NEXT: Name: func3
116121 ; CHECK-NEXT: Flags: [ UNDEFINED ]
117122 ; CHECK-NEXT: Function: 0
118 ; CHECK-NEXT: - Index: 1
123 ; CHECK-NEXT: - Index: 2
124 ; CHECK-NEXT: Kind: FUNCTION
125 ; CHECK-NEXT: Name: .Lregister_call_dtors.42
126 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
127 ; CHECK-NEXT: Function: 6
128 ; CHECK-NEXT: - Index: 3
119129 ; CHECK-NEXT: Kind: DATA
120130 ; CHECK-NEXT: Name: __dso_handle
121131 ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, UNDEFINED ]
122 ; CHECK-NEXT: - Index: 2
132 ; CHECK-NEXT: - Index: 4
123133 ; CHECK-NEXT: Kind: FUNCTION
124134 ; CHECK-NEXT: Name: __cxa_atexit
125135 ; CHECK-NEXT: Flags: [ UNDEFINED ]
126136 ; CHECK-NEXT: Function: 1
127 ; CHECK-NEXT: - Index: 3
137 ; CHECK-NEXT: - Index: 5
138 ; CHECK-NEXT: Kind: FUNCTION
139 ; CHECK-NEXT: Name: .Lcall_dtors
140 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
141 ; CHECK-NEXT: Function: 7
142 ; CHECK-NEXT: - Index: 6
128143 ; CHECK-NEXT: Kind: FUNCTION
129144 ; CHECK-NEXT: Name: func2
130145 ; CHECK-NEXT: Flags: [ UNDEFINED ]
131146 ; CHECK-NEXT: Function: 2
132 ; CHECK-NEXT: - Index: 4
133 ; CHECK-NEXT: Kind: FUNCTION
134 ; CHECK-NEXT: Name: func1
135 ; CHECK-NEXT: Flags: [ UNDEFINED ]
136 ; CHECK-NEXT: Function: 3
137 ; CHECK-NEXT: - Index: 5
138 ; CHECK-NEXT: Kind: FUNCTION
139 ; CHECK-NEXT: Name: func0
140 ; CHECK-NEXT: Flags: [ UNDEFINED ]
141 ; CHECK-NEXT: Function: 4
142 ; CHECK-NEXT: - Index: 6
143 ; CHECK-NEXT: Kind: FUNCTION
144 ; CHECK-NEXT: Name: .Lcall_dtors.42
145 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
146 ; CHECK-NEXT: Function: 5
147147 ; CHECK-NEXT: - Index: 7
148 ; CHECK-NEXT: Kind: FUNCTION
149 ; CHECK-NEXT: Name: .Lregister_call_dtors.42
150 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
151 ; CHECK-NEXT: Function: 6
152 ; CHECK-NEXT: - Index: 8
153 ; CHECK-NEXT: Kind: FUNCTION
154 ; CHECK-NEXT: Name: .Lcall_dtors
155 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
156 ; CHECK-NEXT: Function: 7
157 ; CHECK-NEXT: - Index: 9
158148 ; CHECK-NEXT: Kind: FUNCTION
159149 ; CHECK-NEXT: Name: .Lregister_call_dtors
160150 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ]
161151 ; CHECK-NEXT: Function: 8
162 ; CHECK-NEXT: - Index: 10
152 ; CHECK-NEXT: - Index: 8
163153 ; CHECK-NEXT: Kind: DATA
164154 ; CHECK-NEXT: Name: global1
165155 ; CHECK-NEXT: Flags: [ ]
166156 ; CHECK-NEXT: Segment: 0
167157 ; CHECK-NEXT: Size: 4
168 ; CHECK-NEXT: SegmentInfo:
158 ; CHECK-NEXT: - Index: 9
159 ; CHECK-NEXT: Kind: FUNCTION
160 ; CHECK-NEXT: Name: func1
161 ; CHECK-NEXT: Flags: [ UNDEFINED ]
162 ; CHECK-NEXT: Function: 3
163 ; CHECK-NEXT: - Index: 10
164 ; CHECK-NEXT: Kind: FUNCTION
165 ; CHECK-NEXT: Name: func0
166 ; CHECK-NEXT: Flags: [ UNDEFINED ]
167 ; CHECK-NEXT: Function: 4
168 ; CHECK-NEXT: SegmentInfo:
169169 ; CHECK-NEXT: - Index: 0
170170 ; CHECK-NEXT: Name: .data.global1
171171 ; CHECK-NEXT: Alignment: 8
172172 ; CHECK-NEXT: Flags: [ ]
173173 ; CHECK-NEXT: InitFunctions:
174174 ; CHECK-NEXT: - Priority: 42
175 ; CHECK-NEXT: Symbol: 4
175 ; CHECK-NEXT: Symbol: 9
176176 ; CHECK-NEXT: - Priority: 42
177 ; CHECK-NEXT: Symbol: 2
178 ; CHECK-NEXT: - Priority: 65535
179 ; CHECK-NEXT: Symbol: 10
180 ; CHECK-NEXT: - Priority: 65535
177181 ; CHECK-NEXT: Symbol: 7
178 ; CHECK-NEXT: - Priority: 65535
179 ; CHECK-NEXT: Symbol: 5
180 ; CHECK-NEXT: - Priority: 65535
181 ; CHECK-NEXT: Symbol: 9
182182 ; CHECK-NEXT: ...
2727 ; CHECK-NEXT: Relocation {
2828 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB (3)
2929 ; CHECK-NEXT: Offset: 0x9
30 ; CHECK-NEXT: Index: 0x3
30 ; CHECK-NEXT: Index: 0x1
3131 ; CHECK-NEXT: Addend: 0
3232 ; CHECK-NEXT: }
3333 ; CHECK-NEXT: Relocation {
3434 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB (3)
3535 ; CHECK-NEXT: Offset: 0x14
36 ; CHECK-NEXT: Index: 0x4
36 ; CHECK-NEXT: Index: 0x2
3737 ; CHECK-NEXT: Addend: 0
3838 ; CHECK-NEXT: }
3939 ; CHECK-NEXT: Relocation {
4949 ; CHECK-NEXT: Relocation {
5050 ; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
5151 ; CHECK-NEXT: Offset: 0x2D
52 ; CHECK-NEXT: Index: 0x0
52 ; CHECK-NEXT: Index: 0x3
5353 ; CHECK-NEXT: }
5454 ; CHECK-NEXT: Relocation {
5555 ; CHECK-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
5656 ; CHECK-NEXT: Offset: 0x34
57 ; CHECK-NEXT: Index: 0x1
57 ; CHECK-NEXT: Index: 0x4
5858 ; CHECK-NEXT: }
5959 ; CHECK-NEXT: }
6060 ; CHECK-NEXT: ]
1616 ; CHECK-NEXT: Relocation {
1717 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
1818 ; CHECK-NEXT: Offset: 0x13
19 ; CHECK-NEXT: Index: 0x0
19 ; CHECK-NEXT: Index: 0x2
2020 ; CHECK-NEXT: Addend: 8
2121 ; CHECK-NEXT: }
2222 ; CHECK-NEXT: Relocation {
2323 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
2424 ; CHECK-NEXT: Offset: 0x1C
25 ; CHECK-NEXT: Index: 0x1
25 ; CHECK-NEXT: Index: 0x0
2626 ; CHECK-NEXT: Addend: -16
2727 ; CHECK-NEXT: }
2828 ; CHECK-NEXT: Relocation {
2929 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
3030 ; CHECK-NEXT: Offset: 0x25
31 ; CHECK-NEXT: Index: 0x0
31 ; CHECK-NEXT: Index: 0x2
3232 ; CHECK-NEXT: Addend: 0
3333 ; CHECK-NEXT: }
3434 ; CHECK-NEXT: Relocation {
3535 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
3636 ; CHECK-NEXT: Offset: 0x29
37 ; CHECK-NEXT: Index: 0x0
37 ; CHECK-NEXT: Index: 0x2
3838 ; CHECK-NEXT: Addend: 0
3939 ; CHECK-NEXT: }
4040 ; CHECK-NEXT: Relocation {
4141 ; CHECK-NEXT: Type: R_WEBASSEMBLY_MEMORY_ADDR_I32 (5)
4242 ; CHECK-NEXT: Offset: 0x2D
43 ; CHECK-NEXT: Index: 0x0
43 ; CHECK-NEXT: Index: 0x2
4444 ; CHECK-NEXT: Addend: 0
4545 ; CHECK-NEXT: }
4646 ; CHECK-NEXT: }
7878 ; CHECK-NEXT: Index: 0
7979 ; CHECK-NEXT: Offset: 0x00000009
8080 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB
81 ; CHECK-NEXT: Index: 8
81 ; CHECK-NEXT: Index: 3
8282 ; CHECK-NEXT: Offset: 0x00000012
8383 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB
84 ; CHECK-NEXT: Index: 4
84 ; CHECK-NEXT: Index: 5
8585 ; CHECK-NEXT: Offset: 0x0000001E
8686 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_TYPE_INDEX_LEB
8787 ; CHECK-NEXT: Index: 0
8888 ; CHECK-NEXT: Offset: 0x00000024
8989 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_MEMORY_ADDR_LEB
90 ; CHECK-NEXT: Index: 6
90 ; CHECK-NEXT: Index: 7
9191 ; CHECK-NEXT: Offset: 0x00000031
9292 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_TYPE_INDEX_LEB
9393 ; CHECK-NEXT: Index: 0
114114 ; CHECK-NEXT: Index: 0
115115 ; CHECK-NEXT: Offset: 0x0000000F
116116 ; CHECK-NEXT: - Type: R_WEBASSEMBLY_TABLE_INDEX_I32
117 ; CHECK-NEXT: Index: 8
117 ; CHECK-NEXT: Index: 3
118118 ; CHECK-NEXT: Offset: 0x00000018
119119 ; CHECK-NEXT: Segments:
120120 ; CHECK-NEXT: - SectionOffset: 6
155155 ; CHECK-NEXT: Function: 2
156156 ; CHECK-NEXT: - Index: 3
157157 ; CHECK-NEXT: Kind: FUNCTION
158 ; CHECK-NEXT: Name: foo_alias
159 ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN ]
160 ; CHECK-NEXT: Function: 0
161 ; CHECK-NEXT: - Index: 4
162 ; CHECK-NEXT: Kind: FUNCTION
158163 ; CHECK-NEXT: Name: call_direct_ptr
159164 ; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
160165 ; CHECK-NEXT: Function: 3
161 ; CHECK-NEXT: - Index: 4
166 ; CHECK-NEXT: - Index: 5
162167 ; CHECK-NEXT: Kind: DATA
163168 ; CHECK-NEXT: Name: direct_address
164169 ; CHECK-NEXT: Flags: [ ]
165170 ; CHECK-NEXT: Segment: 1
166171 ; CHECK-NEXT: Size: 4
167 ; CHECK-NEXT: - Index: 5
172 ; CHECK-NEXT: - Index: 6
168173 ; CHECK-NEXT: Kind: FUNCTION
169174 ; CHECK-NEXT: Name: call_alias_ptr
170175 ; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
171176 ; CHECK-NEXT: Function: 4
172 ; CHECK-NEXT: - Index: 6
177 ; CHECK-NEXT: - Index: 7
173178 ; CHECK-NEXT: Kind: DATA
174179 ; CHECK-NEXT: Name: alias_address
175180 ; CHECK-NEXT: Flags: [ ]
176181 ; CHECK-NEXT: Segment: 2
177182 ; CHECK-NEXT: Size: 4
178 ; CHECK-NEXT: - Index: 7
183 ; CHECK-NEXT: - Index: 8
179184 ; CHECK-NEXT: Kind: DATA
180185 ; CHECK-NEXT: Name: bar
181186 ; CHECK-NEXT: Flags: [ ]
182187 ; CHECK-NEXT: Segment: 0
183188 ; CHECK-NEXT: Size: 4
184 ; CHECK-NEXT: - Index: 8
185 ; CHECK-NEXT: Kind: FUNCTION
186 ; CHECK-NEXT: Name: foo_alias
187 ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN ]
188 ; CHECK-NEXT: Function: 0
189189 ; CHECK-NEXT: - Index: 9
190190 ; CHECK-NEXT: Kind: DATA
191191 ; CHECK-NEXT: Name: bar_alias
211211 ; CHECK-SYMS-NEXT: 00000000 g F CODE .hidden foo
212212 ; CHECK-SYMS-NEXT: 00000001 g F CODE .hidden call_direct
213213 ; CHECK-SYMS-NEXT: 00000002 g F CODE .hidden call_alias
214 ; CHECK-SYMS-NEXT: 00000000 gw F CODE .hidden foo_alias
214215 ; CHECK-SYMS-NEXT: 00000003 g F CODE .hidden call_direct_ptr
215216 ; CHECK-SYMS-NEXT: 00000008 g DATA direct_address
216217 ; CHECK-SYMS-NEXT: 00000004 g F CODE .hidden call_alias_ptr
217218 ; CHECK-SYMS-NEXT: 00000010 g DATA alias_address
218219 ; CHECK-SYMS-NEXT: 00000000 g DATA bar
219 ; CHECK-SYMS-NEXT: 00000000 gw F CODE .hidden foo_alias
220220 ; CHECK-SYMS-NEXT: 00000000 gw DATA .hidden bar_alias
2323 ; CHECK-NEXT: Name: linking
2424 ; CHECK-NEXT: SymbolTable:
2525 ; CHECK-NEXT: - Index: 0
26 ; CHECK-NEXT: Kind: DATA
27 ; CHECK-NEXT: Name: weak_external_data
28 ; CHECK-NEXT: Flags: [ BINDING_WEAK, UNDEFINED ]
29 ; CHECK-NEXT: - Index: 1
3026 ; CHECK-NEXT: Kind: FUNCTION
3127 ; CHECK-NEXT: Name: weak_function
3228 ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN ]
3329 ; CHECK-NEXT: Function: 0
30 ; CHECK-NEXT: - Index: 1
31 ; CHECK-NEXT: Kind: DATA
32 ; CHECK-NEXT: Name: weak_external_data
33 ; CHECK-NEXT: Flags: [ BINDING_WEAK, UNDEFINED ]
3434 ; CHECK-NEXT: ...