xref: /llvm-project/llvm/test/CodeGen/PowerPC/aix-dwarf.ll (revision a51712751c184ebe056718c938d2526693a31564)
1
2; RUN: llc -mtriple powerpc-ibm-aix-xcoff -mcpu=ppc -filetype=obj -o %t.o < %s
3; RUN: llvm-readobj --section-headers %t.o | FileCheck %s --check-prefixes=SEC,SEC32
4; RUN: llvm-objdump -r %t.o | FileCheck %s --check-prefix=RELO
5
6; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -mcpu=ppc -filetype=obj -o %t64.o < %s
7; RUN: llvm-readobj --section-headers %t64.o | FileCheck %s --check-prefixes=SEC,SEC64
8; RUN: llvm-objdump -r %t64.o | FileCheck %s --check-prefix=RELO64
9
10; This file is copied from test/DebugInfo/XCOFF/empty.ll.
11; In this test, we focus on XCOFF related formats, like section headers,
12; relocation entries.
13
14source_filename = "1.c"
15target datalayout = "E-m:a-p:32:32-i64:64-n32"
16
17; Function Attrs: noinline nounwind optnone
18define i32 @main() #0 !dbg !8 {
19entry:
20  %retval = alloca i32, align 4
21  store i32 0, ptr %retval, align 4
22  ret i32 0, !dbg !12
23}
24
25!llvm.dbg.cu = !{!0}
26!llvm.module.flags = !{!3, !4, !5, !6}
27!llvm.ident = !{!7}
28
29!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
30!1 = !DIFile(filename: "1.c", directory: "debug")
31!2 = !{}
32!3 = !{i32 7, !"Dwarf Version", i32 4}
33!4 = !{i32 2, !"Debug Info Version", i32 3}
34!5 = !{i32 1, !"wchar_size", i32 2}
35!6 = !{i32 7, !"PIC Level", i32 2}
36!7 = !{!"clang version 12.0.0"}
37!8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
38!9 = !DISubroutineType(types: !10)
39!10 = !{!11}
40!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
41!12 = !DILocation(line: 3, column: 3, scope: !8)
42
43; SEC:       Sections [
44; SEC-NEXT:    Section {
45; SEC-NEXT:      Index: 1
46; SEC-NEXT:      Name: .text
47; SEC-NEXT:      PhysicalAddress: 0x0
48; SEC-NEXT:      VirtualAddress: 0x0
49; SEC-NEXT:      Size: 0x28
50; SEC32-NEXT:    RawDataOffset: 0xDC
51; SEC64-NEXT:    RawDataOffset: 0x180
52; SEC-NEXT:      RelocationPointer: 0x0
53; SEC-NEXT:      LineNumberPointer: 0x0
54; SEC-NEXT:      NumberOfRelocations: 0
55; SEC-NEXT:      NumberOfLineNumbers: 0
56; SEC-NEXT:      Type: STYP_TEXT (0x20)
57; SEC-NEXT:    }
58; SEC-NEXT:    Section {
59; SEC-NEXT:      Index: 2
60; SEC-NEXT:      Name: .data
61; SEC-NEXT:      PhysicalAddress: 0x28
62; SEC-NEXT:      VirtualAddress: 0x28
63; SEC32-NEXT:    Size: 0xC
64; SEC32-NEXT:    RawDataOffset: 0x104
65; SEC32-NEXT:    RelocationPointer: 0x1F4
66; SEC64-NEXT:    Size: 0x18
67; SEC64-NEXT:    RawDataOffset: 0x1A8
68; SEC64-NEXT:    RelocationPointer: 0x2C8
69; SEC-NEXT:      LineNumberPointer: 0x0
70; SEC-NEXT:      NumberOfRelocations: 2
71; SEC-NEXT:      NumberOfLineNumbers: 0
72; SEC-NEXT:      Type: STYP_DATA (0x40)
73; SEC-NEXT:    }
74; SEC-NEXT:    Section {
75; SEC-NEXT:      Index: 3
76; SEC-NEXT:      Name: .dwabrev
77; SEC-NEXT:      PhysicalAddress: 0x0
78; SEC-NEXT:      VirtualAddress: 0x0
79; SEC-NEXT:      Size: 0x36
80; SEC32-NEXT:    RawDataOffset: 0x11C
81; SEC64-NEXT:    RawDataOffset: 0x1C0
82; SEC-NEXT:      RelocationPointer: 0x0
83; SEC-NEXT:      LineNumberPointer: 0x0
84; SEC-NEXT:      NumberOfRelocations: 0
85; SEC-NEXT:      NumberOfLineNumbers: 0
86; SEC-NEXT:      Type: STYP_DWARF (0x10)
87; SEC-NEXT:      DWARFSubType: SSUBTYP_DWABREV (0x60000)
88; SEC-NEXT:    }
89; SEC-NEXT:    Section {
90; SEC-NEXT:      Index: 4
91; SEC-NEXT:      Name: .dwinfo
92; SEC-NEXT:      PhysicalAddress: 0x0
93; SEC-NEXT:      VirtualAddress: 0x0
94; SEC32-NEXT:    Size: 0x57
95; SEC32-NEXT:    RawDataOffset: 0x15C
96; SEC32-NEXT:    RelocationPointer: 0x208
97; SEC64-NEXT:    Size: 0x6F
98; SEC64-NEXT:    RawDataOffset: 0x200
99; SEC64-NEXT:    RelocationPointer: 0x2E4
100; SEC-NEXT:      LineNumberPointer: 0x0
101; SEC-NEXT:      NumberOfRelocations: 4
102; SEC-NEXT:      NumberOfLineNumbers: 0
103; SEC-NEXT:      Type: STYP_DWARF (0x10)
104; SEC-NEXT:      DWARFSubType: SSUBTYP_DWINFO (0x10000)
105; SEC-NEXT:    }
106; SEC-NEXT:    Section {
107; SEC-NEXT:      Index: 5
108; SEC-NEXT:      Name: .dwline
109; SEC-NEXT:      PhysicalAddress: 0x0
110; SEC-NEXT:      VirtualAddress: 0x0
111; SEC32-NEXT:    Size: 0x36
112; SEC32-NEXT:    RawDataOffset: 0x1BC
113; SEC32-NEXT:    RelocationPointer: 0x230
114; SEC64-NEXT:    Size: 0x46
115; SEC64-NEXT:    RawDataOffset: 0x280
116; SEC64-NEXT:    RelocationPointer: 0x31C
117; SEC-NEXT:      LineNumberPointer: 0x0
118; SEC-NEXT:      NumberOfRelocations: 1
119; SEC-NEXT:      NumberOfLineNumbers: 0
120; SEC-NEXT:      Type: STYP_DWARF (0x10)
121; SEC-NEXT:      DWARFSubType: SSUBTYP_DWLINE (0x20000)
122; SEC-NEXT:    }
123; SEC-NEXT:  ]
124
125; RELO:      RELOCATION RECORDS FOR [.dwinfo]:
126; RELO-NEXT:  OFFSET   TYPE                     VALUE
127; RELO-NEXT:  00000006 R_POS                    .dwabrev
128; RELO-NEXT:  00000027 R_POS                    .dwline
129; RELO-NEXT:  00000009 R_POS
130; RELO-NEXT:  0000003a R_POS
131; RELO:       RELOCATION RECORDS FOR [.dwline]:
132; RELO-NEXT:  OFFSET   TYPE                     VALUE
133; RELO-NEXT:  00000000 R_POS
134
135; RELO64:      RELOCATION RECORDS FOR [.dwinfo]:
136; RELO64-NEXT: OFFSET           TYPE                     VALUE
137; RELO64-NEXT: 000000000000000e R_POS                    .dwabrev
138; RELO64-NEXT: 000000000000000b R_POS                    .dwline
139; RELO64-NEXT: 0000000000000041 R_POS
140; RELO64-NEXT: 000000000000004e R_POS
141; RELO64:      RELOCATION RECORDS FOR [.dwline]:
142; RELO64-NEXT: OFFSET           TYPE                     VALUE
143; RELO64-NEXT: 000000000000000c R_POS
144