1# REQUIRES: ppc
2# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t.o
3# RUN: ld.lld %t.o -o %t
4# RUN: llvm-readobj --file-headers --sections --section-data -l %t | FileCheck %s
5
6# exits with return code 42 on FreeBSD
7.text
8 li      0,1
9 li      3,1
10 sc
11
12// CHECK:      Format: elf32-powerpc
13// CHECK-NEXT: Arch: powerpc
14// CHECK-NEXT: AddressSize: 32bit
15// CHECK-NEXT: LoadName:
16// CHECK-NEXT: ElfHeader {
17// CHECK-NEXT:   Ident {
18// CHECK-NEXT:     Magic: (7F 45 4C 46)
19// CHECK-NEXT:     Class: 32-bit (0x1)
20// CHECK-NEXT:     DataEncoding: BigEndian (0x2)
21// CHECK-NEXT:     FileVersion: 1
22// CHECK-NEXT:     OS/ABI: FreeBSD (0x9)
23// CHECK-NEXT:     ABIVersion: 0
24// CHECK-NEXT:     Unused: (00 00 00 00 00 00 00)
25// CHECK-NEXT:   }
26// CHECK-NEXT:   Type: Executable (0x2)
27// CHECK-NEXT:   Machine: EM_PPC (0x14)
28// CHECK-NEXT:   Version: 1
29// CHECK-NEXT:   Entry: 0x100100B4
30// CHECK-NEXT:   ProgramHeaderOffset: 0x34
31// CHECK-NEXT:   SectionHeaderOffset: 0x104
32// CHECK-NEXT:   Flags [ (0x0)
33// CHECK-NEXT:   ]
34// CHECK-NEXT:   HeaderSize: 52
35// CHECK-NEXT:   ProgramHeaderEntrySize: 32
36// CHECK-NEXT:   ProgramHeaderCount: 4
37// CHECK-NEXT:   SectionHeaderEntrySize: 40
38// CHECK-NEXT:   SectionHeaderCount: 6
39// CHECK-NEXT:   StringTableSectionIndex: 4
40// CHECK-NEXT: }
41// CHECK-NEXT: Sections [
42// CHECK-NEXT:   Section {
43// CHECK-NEXT:     Index: 0
44// CHECK-NEXT:     Name:  (0)
45// CHECK-NEXT:     Type: SHT_NULL (0x0)
46// CHECK-NEXT:     Flags [ (0x0)
47// CHECK-NEXT:     ]
48// CHECK-NEXT:     Address: 0x0
49// CHECK-NEXT:     Offset: 0x0
50// CHECK-NEXT:     Size: 0
51// CHECK-NEXT:     Link: 0
52// CHECK-NEXT:     Info: 0
53// CHECK-NEXT:     AddressAlignment: 0
54// CHECK-NEXT:     EntrySize: 0
55// CHECK-NEXT:     SectionData (
56// CHECK-NEXT:     )
57// CHECK-NEXT:   }
58// CHECK-NEXT:   Section {
59// CHECK-NEXT:     Index: 1
60// CHECK-NEXT:     Name: .text
61// CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
62// CHECK-NEXT:     Flags [ (0x6)
63// CHECK-NEXT:       SHF_ALLOC (0x2)
64// CHECK-NEXT:       SHF_EXECINSTR (0x4)
65// CHECK-NEXT:     ]
66// CHECK-NEXT:     Address: 0x100100B4
67// CHECK-NEXT:     Offset: 0xB4
68// CHECK-NEXT:     Size: 12
69// CHECK-NEXT:     Link: 0
70// CHECK-NEXT:     Info: 0
71// CHECK-NEXT:     AddressAlignment: 4
72// CHECK-NEXT:     EntrySize: 0
73// CHECK-NEXT:     SectionData (
74// CHECK-NEXT:       0000: 38000001 38600001 44000002           |8...8`..D...|
75// CHECK-NEXT:     )
76// CHECK-NEXT:   }
77// CHECK-NEXT:   Section {
78// CHECK-NEXT:     Index: 2
79// CHECK-NEXT:     Name: .comment
80// CHECK-NEXT:     Type: SHT_PROGBITS (0x1)
81// CHECK-NEXT:     Flags [ (0x30)
82// CHECK-NEXT:       SHF_MERGE (0x10)
83// CHECK-NEXT:       SHF_STRINGS (0x20)
84// CHECK-NEXT:     ]
85// CHECK-NEXT:     Address: 0x0
86// CHECK-NEXT:     Offset: 0xC0
87// CHECK-NEXT:     Size: 8
88// CHECK-NEXT:     Link: 0
89// CHECK-NEXT:     Info: 0
90// CHECK-NEXT:     AddressAlignment: 1
91// CHECK-NEXT:     EntrySize: 1
92// CHECK:        }
93// CHECK-NEXT:   Section {
94// CHECK-NEXT:     Index: 3
95// CHECK-NEXT:     Name: .symtab
96// CHECK-NEXT:     Type: SHT_SYMTAB (0x2)
97// CHECK-NEXT:     Flags [ (0x0)
98// CHECK-NEXT:     ]
99// CHECK-NEXT:     Address: 0x0
100// CHECK-NEXT:     Offset: 0xC8
101// CHECK-NEXT:     Size: 16
102// CHECK-NEXT:     Link: 5
103// CHECK-NEXT:     Info: 1
104// CHECK-NEXT:     AddressAlignment: 4
105// CHECK-NEXT:     EntrySize: 16
106// CHECK-NEXT:     SectionData (
107// CHECK-NEXT:       0000: 00000000 00000000 00000000 00000000  |................|
108// CHECK-NEXT:     )
109// CHECK-NEXT:   }
110// CHECK-NEXT:   Section {
111// CHECK-NEXT:     Index: 4
112// CHECK-NEXT:     Name: .shstrtab
113// CHECK-NEXT:     Type: SHT_STRTAB (0x3)
114// CHECK-NEXT:     Flags [ (0x0)
115// CHECK-NEXT:     ]
116// CHECK-NEXT:     Address: 0x0
117// CHECK-NEXT:     Offset: 0xD8
118// CHECK-NEXT:     Size: 42
119// CHECK-NEXT:     Link: 0
120// CHECK-NEXT:     Info: 0
121// CHECK-NEXT:     AddressAlignment: 1
122// CHECK-NEXT:     EntrySize: 0
123// CHECK:        }
124// CHECK-NEXT:   Section {
125// CHECK-NEXT:     Index: 5
126// CHECK-NEXT:     Name: .strtab
127// CHECK-NEXT:     Type: SHT_STRTAB (0x3)
128// CHECK-NEXT:     Flags [ (0x0)
129// CHECK-NEXT:     ]
130// CHECK-NEXT:     Address: 0x0
131// CHECK-NEXT:     Offset: 0x102
132// CHECK-NEXT:     Size: 1
133// CHECK-NEXT:     Link: 0
134// CHECK-NEXT:     Info: 0
135// CHECK-NEXT:     AddressAlignment: 1
136// CHECK-NEXT:     EntrySize: 0
137// CHECK-NEXT:     SectionData (
138// CHECK-NEXT:       0000: 00
139// CHECK-NEXT:     )
140// CHECK-NEXT:   }
141// CHECK-NEXT: ]
142// CHECK-NEXT: ProgramHeaders [
143// CHECK-NEXT:   ProgramHeader {
144// CHECK-NEXT:     Type: PT_PHDR (0x6)
145// CHECK-NEXT:     Offset: 0x34
146// CHECK-NEXT:     VirtualAddress: 0x10000034
147// CHECK-NEXT:     PhysicalAddress: 0x10000034
148// CHECK-NEXT:     FileSize: 128
149// CHECK-NEXT:     MemSize: 128
150// CHECK-NEXT:     Flags [ (0x4)
151// CHECK-NEXT:       PF_R (0x4)
152// CHECK-NEXT:     ]
153// CHECK-NEXT:     Alignment: 4
154// CHECK-NEXT:   }
155// CHECK-NEXT:   ProgramHeader {
156// CHECK-NEXT:     Type: PT_LOAD (0x1)
157// CHECK-NEXT:     Offset: 0x0
158// CHECK-NEXT:     VirtualAddress: 0x10000000
159// CHECK-NEXT:     PhysicalAddress: 0x10000000
160// CHECK-NEXT:     FileSize: 180
161// CHECK-NEXT:     MemSize: 180
162// CHECK-NEXT:     Flags [ (0x4)
163// CHECK-NEXT:       PF_R (0x4)
164// CHECK-NEXT:     ]
165// CHECK-NEXT:     Alignment: 65536
166// CHECK-NEXT:   }
167// CHECK-NEXT:   ProgramHeader {
168// CHECK-NEXT:     Type: PT_LOAD (0x1)
169// CHECK-NEXT:     Offset: 0xB4
170// CHECK-NEXT:     VirtualAddress: 0x100100B4
171// CHECK-NEXT:     PhysicalAddress: 0x100100B4
172// CHECK-NEXT:     FileSize: 12
173// CHECK-NEXT:     MemSize: 12
174// CHECK-NEXT:     Flags [ (0x5)
175// CHECK-NEXT:       PF_R (0x4)
176// CHECK-NEXT:       PF_X (0x1)
177// CHECK-NEXT:     ]
178// CHECK-NEXT:     Alignment: 65536
179// CHECK-NEXT:   }
180// CHECK-NEXT:   ProgramHeader {
181// CHECK-NEXT:     Type: PT_GNU_STACK (0x6474E551)
182// CHECK-NEXT:     Offset: 0x0
183// CHECK-NEXT:     VirtualAddress: 0x0
184// CHECK-NEXT:     PhysicalAddress: 0x0
185// CHECK-NEXT:     FileSize: 0
186// CHECK-NEXT:     MemSize: 0
187// CHECK-NEXT:     Flags [ (0x6)
188// CHECK-NEXT:       PF_R (0x4)
189// CHECK-NEXT:       PF_W (0x2)
190// CHECK-NEXT:     ]
191// CHECK-NEXT:     Alignment: 0
192// CHECK-NEXT:   }
193// CHECK-NEXT: ]
194