• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -s -symbols | FileCheck %s
2
3; CHECK: Format: WASM
4; CHECK-NEXT:Arch: wasm32
5; CHECK-NEXT:AddressSize: 32bit
6; CHECK-NEXT:Sections [
7; CHECK-NEXT:  Section {
8; CHECK-NEXT:    Type: TYPE (0x1)
9; CHECK-NEXT:    Size: 4
10; CHECK-NEXT:    Offset: 8
11; CHECK-NEXT:  }
12; CHECK-NEXT:  Section {
13; CHECK-NEXT:    Type: IMPORT (0x2)
14; CHECK-NEXT:    Size: 58
15; CHECK-NEXT:    Offset: 18
16; CHECK-NEXT:  }
17; CHECK-NEXT:  Section {
18; CHECK-NEXT:    Type: FUNCTION (0x3)
19; CHECK-NEXT:    Size: 2
20; CHECK-NEXT:    Offset: 82
21; CHECK-NEXT:  }
22; CHECK-NEXT:  Section {
23; CHECK-NEXT:    Type: ELEM (0x9)
24; CHECK-NEXT:    Size: 7
25; CHECK-NEXT:    Offset: 90
26; CHECK-NEXT:  }
27; CHECK-NEXT:  Section {
28; CHECK-NEXT:    Type: CODE (0xA)
29; CHECK-NEXT:    Size: 4
30; CHECK-NEXT:    Offset: 103
31; CHECK-NEXT:  }
32; CHECK-NEXT:  Section {
33; CHECK-NEXT:    Type: DATA (0xB)
34; CHECK-NEXT:    Size: 19
35; CHECK-NEXT:    Offset: 113
36; CHECK-NEXT:    Segments [
37; CHECK-NEXT:      Segment {
38; CHECK-NEXT:        Name: .data.foo
39; CHECK-NEXT:        Size: 4
40; CHECK-NEXT:        Offset: 0
41; CHECK-NEXT:      }
42; CHECK-NEXT:      Segment {
43; CHECK-NEXT:        Name: .data.ptr2
44; CHECK-NEXT:        Size: 4
45; CHECK-NEXT:        Offset: 4
46; CHECK-NEXT:      }
47; CHECK-NEXT:    ]
48; CHECK-NEXT:  }
49; CHECK-NEXT:  Section {
50; CHECK-NEXT:    Type: CUSTOM (0x0)
51; CHECK-NEXT:    Size: 121
52; CHECK-NEXT:    Offset: 138
53; CHECK-NEXT:    Name: .debug_str
54; CHECK-NEXT:  }
55; CHECK-NEXT:  Section {
56; CHECK-NEXT:    Type: CUSTOM (0x0)
57; CHECK-NEXT:    Size: 84
58; CHECK-NEXT:    Offset: 276
59; CHECK-NEXT:    Name: .debug_abbrev
60; CHECK-NEXT:  }
61; CHECK-NEXT:  Section {
62; CHECK-NEXT:    Type: CUSTOM (0x0)
63; CHECK-NEXT:    Size: 106
64; CHECK-NEXT:    Offset: 380
65; CHECK-NEXT:    Name: .debug_info
66; CHECK-NEXT:  }
67; CHECK-NEXT:  Section {
68; CHECK-NEXT:    Type: CUSTOM (0x0)
69; CHECK-NEXT:    Size: 1
70; CHECK-NEXT:    Offset: 504
71; CHECK-NEXT:    Name: .debug_macinfo
72; CHECK-NEXT:  }
73; CHECK-NEXT:  Section {
74; CHECK-NEXT:    Type: CUSTOM (0x0)
75; CHECK-NEXT:    Size: 42
76; CHECK-NEXT:    Offset: 526
77; CHECK-NEXT:    Name: .debug_pubnames
78; CHECK-NEXT:  }
79; CHECK-NEXT:  Section {
80; CHECK-NEXT:    Type: CUSTOM (0x0)
81; CHECK-NEXT:    Size: 26
82; CHECK-NEXT:    Offset: 590
83; CHECK-NEXT:    Name: .debug_pubtypes
84; CHECK-NEXT:  }
85; CHECK-NEXT:  Section {
86; CHECK-NEXT:    Type: CUSTOM (0x0)
87; CHECK-NEXT:    Size: 57
88; CHECK-NEXT:    Offset: 638
89; CHECK-NEXT:    Name: .debug_line
90; CHECK-NEXT:  }
91; CHECK-NEXT:  Section {
92; CHECK-NEXT:    Type: CUSTOM (0x0)
93; CHECK-NEXT:    Size: 88
94; CHECK-NEXT:    Offset: 713
95; CHECK-NEXT:    Name: linking
96; CHECK-NEXT:  }
97; CHECK-NEXT:  Section {
98; CHECK-NEXT:    Type: CUSTOM (0x0)
99; CHECK-NEXT:    Size: 9
100; CHECK-NEXT:    Offset: 815
101; CHECK-NEXT:    Name: reloc.DATA
102; CHECK-NEXT:  }
103; CHECK-NEXT:  Section {
104; CHECK-NEXT:    Type: CUSTOM (0x0)
105; CHECK-NEXT:    Size: 58
106; CHECK-NEXT:    Offset: 841
107; CHECK-NEXT:    Name: reloc..debug_info
108; CHECK-NEXT:  }
109; CHECK-NEXT:  Section {
110; CHECK-NEXT:    Type: CUSTOM (0x0)
111; CHECK-NEXT:    Size: 6
112; CHECK-NEXT:    Offset: 923
113; CHECK-NEXT:    Name: reloc..debug_pubnames
114; CHECK-NEXT:  }
115; CHECK-NEXT:  Section {
116; CHECK-NEXT:    Type: CUSTOM (0x0)
117; CHECK-NEXT:    Size: 6
118; CHECK-NEXT:    Offset: 957
119; CHECK-NEXT:    Name: reloc..debug_pubtypes
120; CHECK-NEXT:  }
121; CHECK-NEXT:  Section {
122; CHECK-NEXT:    Type: CUSTOM (0x0)
123; CHECK-NEXT:    Size: 6
124; CHECK-NEXT:    Offset: 991
125; CHECK-NEXT:    Name: reloc..debug_line
126; CHECK-NEXT:  }
127; CHECK-NEXT:]
128; CHECK-NEXT:Relocations [
129; CHECK-NEXT:  Section (6) DATA {
130; CHECK-NEXT:    0x6 R_WEBASSEMBLY_MEMORY_ADDR_I32 myextern 0
131; CHECK-NEXT:    0xF R_WEBASSEMBLY_TABLE_INDEX_I32 f2
132; CHECK-NEXT:  }
133; CHECK-NEXT:  Section (9) .debug_info {
134; CHECK-NEXT:    0x6 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_abbrev 0
135; CHECK-NEXT:    0xC R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 0
136; CHECK-NEXT:    0x12 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 55
137; CHECK-NEXT:    0x16 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_line 0
138; CHECK-NEXT:    0x1A R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 62
139; CHECK-NEXT:    0x1E R_WEBASSEMBLY_FUNCTION_OFFSET_I32 f2 0
140; CHECK-NEXT:    0x27 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 105
141; CHECK-NEXT:    0x33 R_WEBASSEMBLY_MEMORY_ADDR_I32 foo 0
142; CHECK-NEXT:    0x3D R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 109
143; CHECK-NEXT:    0x44 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 113
144; CHECK-NEXT:    0x50 R_WEBASSEMBLY_MEMORY_ADDR_I32 ptr2 0
145; CHECK-NEXT:    0x5B R_WEBASSEMBLY_FUNCTION_OFFSET_I32 f2 0
146; CHECK-NEXT:    0x63 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_str 118
147; CHECK-NEXT:  }
148; CHECK-NEXT:  Section (11) .debug_pubnames {
149; CHECK-NEXT:    0x6 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_info 0
150; CHECK-NEXT:  }
151; CHECK-NEXT:  Section (12) .debug_pubtypes {
152; CHECK-NEXT:    0x6 R_WEBASSEMBLY_SECTION_OFFSET_I32 .debug_info 0
153; CHECK-NEXT:  }
154; CHECK-NEXT:  Section (13) .debug_line {
155; CHECK-NEXT:    0x2B R_WEBASSEMBLY_FUNCTION_OFFSET_I32 f2 0
156; CHECK-NEXT:  }
157; CHECK-NEXT:]
158; CHECK-NEXT:Symbols [
159; CHECK-NEXT:  Symbol {
160; CHECK-NEXT:    Name: f2
161; CHECK-NEXT:    Type: FUNCTION (0x0)
162; CHECK-NEXT:    Flags: 0x4
163; CHECK-NEXT:  }
164; CHECK-NEXT:  Symbol {
165; CHECK-NEXT:    Name: foo
166; CHECK-NEXT:    Type: DATA (0x1)
167; CHECK-NEXT:    Flags: 0x4
168; CHECK-NEXT:  }
169; CHECK-NEXT:  Symbol {
170; CHECK-NEXT:    Name: myextern
171; CHECK-NEXT:    Type: DATA (0x1)
172; CHECK-NEXT:    Flags: 0x10
173; CHECK-NEXT:  }
174; CHECK-NEXT:  Symbol {
175; CHECK-NEXT:    Name: ptr2
176; CHECK-NEXT:    Type: DATA (0x1)
177; CHECK-NEXT:    Flags: 0x4
178; CHECK-NEXT:  }
179; CHECK-NEXT:  Symbol {
180; CHECK-NEXT:    Name: .debug_str
181; CHECK-NEXT:    Type: SECTION (0x3)
182; CHECK-NEXT:    Flags: 0x2
183; CHECK-NEXT:  }
184; CHECK-NEXT:  Symbol {
185; CHECK-NEXT:    Name: .debug_abbrev
186; CHECK-NEXT:    Type: SECTION (0x3)
187; CHECK-NEXT:    Flags: 0x2
188; CHECK-NEXT:  }
189; CHECK-NEXT:  Symbol {
190; CHECK-NEXT:    Name: .debug_info
191; CHECK-NEXT:    Type: SECTION (0x3)
192; CHECK-NEXT:    Flags: 0x2
193; CHECK-NEXT:  }
194; CHECK-NEXT:  Symbol {
195; CHECK-NEXT:    Name: .debug_line
196; CHECK-NEXT:    Type: SECTION (0x3)
197; CHECK-NEXT:    Flags: 0x2
198; CHECK-NEXT:  }
199; CHECK-NEXT:]
200
201; generated from the following C code using: clang --target=wasm32 -g -O0 -S -emit-llvm test.c
202; extern int myextern;
203; void f2(void) { return; }
204;
205; int* foo = &myextern;
206; void (*ptr2)(void) = f2;
207
208target triple = "wasm32-unknown-unknown"
209
210source_filename = "test.c"
211
212@myextern = external global i32, align 4
213@foo = hidden global i32* @myextern, align 4, !dbg !0
214@ptr2 = hidden global void ()* @f2, align 4, !dbg !6
215
216; Function Attrs: noinline nounwind optnone
217define hidden void @f2() #0 !dbg !17 {
218entry:
219  ret void, !dbg !18
220}
221
222attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
223
224!llvm.dbg.cu = !{!2}
225!llvm.module.flags = !{!13, !14, !15}
226!llvm.ident = !{!16}
227
228!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
229!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true)
230!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 332303) (llvm/trunk 332406)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
231!3 = !DIFile(filename: "test.c", directory: "/usr/local/google/home/sbc/dev/wasm/simple")
232!4 = !{}
233!5 = !{!0, !6}
234!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
235!7 = distinct !DIGlobalVariable(name: "ptr2", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true)
236!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32)
237!9 = !DISubroutineType(types: !10)
238!10 = !{null}
239!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32)
240!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
241!13 = !{i32 2, !"Dwarf Version", i32 4}
242!14 = !{i32 2, !"Debug Info Version", i32 3}
243!15 = !{i32 1, !"wchar_size", i32 4}
244!16 = !{!"clang version 7.0.0 (trunk 332303) (llvm/trunk 332406)"}
245!17 = distinct !DISubprogram(name: "f2", scope: !3, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
246!18 = !DILocation(line: 2, column: 17, scope: !17)
247