llvm.org GIT mirror llvm / bfeca0b
[WebAssembly] Section symbols must have local binding Summary: Also test for symbols information in test/MC/WebAssembly/debug-info.ll. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D46160 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331005 91177308-0d34-0410-b5e6-96231b3b80d8 Sam Clegg 2 years ago
7 changed file(s) with 69 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
12191219 wasm::WasmSymbolInfo Info;
12201220 Info.Name = SectionSym->getName();
12211221 Info.Kind = wasm::WASM_SYMBOL_TYPE_SECTION;
1222 Info.Flags = 0;
1222 Info.Flags = wasm::WASM_SYMBOL_BINDING_LOCAL;
12231223 Info.ElementIndex = ElementIndex;
12241224 SymbolIndices[SectionSym] = SymbolInfos.size();
12251225 SymbolInfos.emplace_back(Info);
465465 break;
466466
467467 case wasm::WASM_SYMBOL_TYPE_SECTION: {
468 if ((Info.Flags & wasm::WASM_SYMBOL_BINDING_MASK) !=
469 wasm::WASM_SYMBOL_BINDING_LOCAL)
470 return make_error("Section symbol must have local binding",
471 object_error::parse_failed);
468472 Info.ElementIndex = readVaruint32(Ptr);
469473 // Use somewhat unique section name as symbol name.
470474 StringRef SectionName = Sections[Info.ElementIndex].Name;
None ; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -s | FileCheck %s
0 ; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -s -symbols | FileCheck %s
11
22 ; CHECK: Format: WASM
33 ; CHECK-NEXT:Arch: wasm32
158158 ; CHECK-NEXT: }
159159 ; CHECK-NEXT: Section (14) .debug_line {
160160 ; CHECK-NEXT: 0x2B R_WEBASSEMBLY_FUNCTION_OFFSET_I32[8] 0
161 ; CHECK-NEXT: }
162 ; CHECK-NEXT:]
163 ; CHECK-NEXT:Symbols [
164 ; CHECK-NEXT: Symbol {
165 ; CHECK-NEXT: Name: .debug_str
166 ; CHECK-NEXT: Type: SECTION (0x3)
167 ; CHECK-NEXT: Flags: 0x2
168 ; CHECK-NEXT: }
169 ; CHECK-NEXT: Symbol {
170 ; CHECK-NEXT: Name: .debug_abbrev
171 ; CHECK-NEXT: Type: SECTION (0x3)
172 ; CHECK-NEXT: Flags: 0x2
173 ; CHECK-NEXT: }
174 ; CHECK-NEXT: Symbol {
175 ; CHECK-NEXT: Name: .debug_info
176 ; CHECK-NEXT: Type: SECTION (0x3)
177 ; CHECK-NEXT: Flags: 0x2
178 ; CHECK-NEXT: }
179 ; CHECK-NEXT: Symbol {
180 ; CHECK-NEXT: Name: .debug_ranges
181 ; CHECK-NEXT: Type: SECTION (0x3)
182 ; CHECK-NEXT: Flags: 0x2
183 ; CHECK-NEXT: }
184 ; CHECK-NEXT: Symbol {
185 ; CHECK-NEXT: Name: .debug_macinfo
186 ; CHECK-NEXT: Type: SECTION (0x3)
187 ; CHECK-NEXT: Flags: 0x2
188 ; CHECK-NEXT: }
189 ; CHECK-NEXT: Symbol {
190 ; CHECK-NEXT: Name: .debug_pubnames
191 ; CHECK-NEXT: Type: SECTION (0x3)
192 ; CHECK-NEXT: Flags: 0x2
193 ; CHECK-NEXT: }
194 ; CHECK-NEXT: Symbol {
195 ; CHECK-NEXT: Name: .debug_pubtypes
196 ; CHECK-NEXT: Type: SECTION (0x3)
197 ; CHECK-NEXT: Flags: 0x2
198 ; CHECK-NEXT: }
199 ; CHECK-NEXT: Symbol {
200 ; CHECK-NEXT: Name: .debug_line
201 ; CHECK-NEXT: Type: SECTION (0x3)
202 ; CHECK-NEXT: Flags: 0x2
203 ; CHECK-NEXT: }
204 ; CHECK-NEXT: Symbol {
205 ; CHECK-NEXT: Name: f2
206 ; CHECK-NEXT: Type: FUNCTION (0x0)
207 ; CHECK-NEXT: Flags: 0x4
208 ; CHECK-NEXT: }
209 ; CHECK-NEXT: Symbol {
210 ; CHECK-NEXT: Name: foo
211 ; CHECK-NEXT: Type: DATA (0x1)
212 ; CHECK-NEXT: Flags: 0x4
213 ; CHECK-NEXT: }
214 ; CHECK-NEXT: Symbol {
215 ; CHECK-NEXT: Name: myextern
216 ; CHECK-NEXT: Type: DATA (0x1)
217 ; CHECK-NEXT: Flags: 0x10
218 ; CHECK-NEXT: }
219 ; CHECK-NEXT: Symbol {
220 ; CHECK-NEXT: Name: ptr2
221 ; CHECK-NEXT: Type: DATA (0x1)
222 ; CHECK-NEXT: Flags: 0x4
161223 ; CHECK-NEXT: }
162224 ; CHECK-NEXT:]
163225
2626 ENUM_ENTRY(FUNCTION),
2727 ENUM_ENTRY(DATA),
2828 ENUM_ENTRY(GLOBAL),
29 ENUM_ENTRY(SECTION),
2930 #undef ENUM_ENTRY
3031 };
3132