2 # RUN: llvm-mc -filetype=obj -triple=sparc64-unknown-openbsd %s -o %t
3 # RUN: ld.lld %t -o %t2
4 # RUN: llvm-readobj --file-headers --sections -l --symbols %t2 \
7 # exits with return code 42 on OpenBSD/sparc64
16 # CHECK-NEXT: Magic: (7F 45 4C 46)
17 # CHECK-NEXT: Class: 64-bit (0x2)
18 # CHECK-NEXT: DataEncoding: BigEndian (0x2)
19 # CHECK-NEXT: FileVersion: 1
20 # CHECK-NEXT: OS/ABI: OpenBSD (0xC)
21 # CHECK-NEXT: ABIVersion: 0
22 # CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
24 # CHECK-NEXT: Type: Executable (0x2)
25 # CHECK-NEXT: Machine: EM_SPARCV9 (0x2B)
26 # CHECK-NEXT: Version: 1
27 # CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
28 # CHECK-NEXT: ProgramHeaderOffset: 0x40
29 # CHECK-NEXT: SectionHeaderOffset: 0x1A0
30 # CHECK-NEXT: Flags [ (0x0)
32 # CHECK-NEXT: HeaderSize: 64
33 # CHECK-NEXT: ProgramHeaderEntrySize: 56
34 # CHECK-NEXT: ProgramHeaderCount: 4
35 # CHECK-NEXT: SectionHeaderEntrySize: 64
36 # CHECK-NEXT: SectionHeaderCount: 6
37 # CHECK-NEXT: StringTableSectionIndex: 4
39 # CHECK-NEXT: Sections [
40 # CHECK-NEXT: Section {
41 # CHECK-NEXT: Index: 0
42 # CHECK-NEXT: Name: (0)
43 # CHECK-NEXT: Type: SHT_NULL (0x0)
44 # CHECK-NEXT: Flags [ (0x0)
46 # CHECK-NEXT: Address: 0x0
47 # CHECK-NEXT: Offset: 0x0
51 # CHECK-NEXT: AddressAlignment: 0
52 # CHECK-NEXT: EntrySize: 0
54 # CHECK-NEXT: Section {
55 # CHECK-NEXT: Index: 1
56 # CHECK-NEXT: Name: .text
57 # CHECK-NEXT: Type: SHT_PROGBITS (0x1)
58 # CHECK-NEXT: Flags [ (0x6)
59 # CHECK-NEXT: SHF_ALLOC (0x2)
60 # CHECK-NEXT: SHF_EXECINSTR (0x4)
62 # CHECK-NEXT: Address: 0x200120
63 # CHECK-NEXT: Offset: 0x120
64 # CHECK-NEXT: Size: 12
67 # CHECK-NEXT: AddressAlignment: 4
68 # CHECK-NEXT: EntrySize: 0
70 # CHECK-NEXT: Section {
71 # CHECK-NEXT: Index: 2
72 # CHECK-NEXT: Name: .comment
73 # CHECK-NEXT: Type: SHT_PROGBITS (0x1)
74 # CHECK-NEXT: Flags [ (0x30)
75 # CHECK-NEXT: SHF_MERGE (0x10)
76 # CHECK-NEXT: SHF_STRINGS (0x20)
78 # CHECK-NEXT: Address: 0x0
79 # CHECK-NEXT: Offset: 0x12C
83 # CHECK-NEXT: AddressAlignment: 1
84 # CHECK-NEXT: EntrySize: 1
86 # CHECK-NEXT: Section {
87 # CHECK-NEXT: Index: 3
88 # CHECK-NEXT: Name: .symtab
89 # CHECK-NEXT: Type: SHT_SYMTAB (0x2)
90 # CHECK-NEXT: Flags [ (0x0)
92 # CHECK-NEXT: Address: 0x0
93 # CHECK-NEXT: Offset: 0x138
94 # CHECK-NEXT: Size: 48
97 # CHECK-NEXT: AddressAlignment: 8
98 # CHECK-NEXT: EntrySize: 24
100 # CHECK-NEXT: Section {
101 # CHECK-NEXT: Index: 4
102 # CHECK-NEXT: Name: .shstrtab
103 # CHECK-NEXT: Type: SHT_STRTAB (0x3)
104 # CHECK-NEXT: Flags [ (0x0)
106 # CHECK-NEXT: Address: 0x0
107 # CHECK-NEXT: Offset: 0x168
108 # CHECK-NEXT: Size: 42
109 # CHECK-NEXT: Link: 0
110 # CHECK-NEXT: Info: 0
111 # CHECK-NEXT: AddressAlignment: 1
112 # CHECK-NEXT: EntrySize: 0
114 # CHECK-NEXT: Section {
115 # CHECK-NEXT: Index: 5
116 # CHECK-NEXT: Name: .strtab
117 # CHECK-NEXT: Type: SHT_STRTAB (0x3)
118 # CHECK-NEXT: Flags [ (0x0)
120 # CHECK-NEXT: Address: 0x0
121 # CHECK-NEXT: Offset: 0x192
122 # CHECK-NEXT: Size: 8
123 # CHECK-NEXT: Link: 0
124 # CHECK-NEXT: Info: 0
125 # CHECK-NEXT: AddressAlignment: 1
126 # CHECK-NEXT: EntrySize: 0
129 # CHECK-NEXT: ProgramHeaders [
130 # CHECK-NEXT: ProgramHeader {
131 # CHECK-NEXT: Type: PT_PHDR (0x6)
132 # CHECK-NEXT: Offset: 0x40
133 # CHECK-NEXT: VirtualAddress: 0x100040
134 # CHECK-NEXT: PhysicalAddress: 0x100040
135 # CHECK-NEXT: FileSize: 224
136 # CHECK-NEXT: MemSize: 224
137 # CHECK-NEXT: Flags [ (0x4)
138 # CHECK-NEXT: PF_R (0x4)
140 # CHECK-NEXT: Alignment: 8
142 # CHECK-NEXT: ProgramHeader {
143 # CHECK-NEXT: Type: PT_LOAD (0x1)
144 # CHECK-NEXT: Offset: 0x0
145 # CHECK-NEXT: VirtualAddress: 0x100000
146 # CHECK-NEXT: PhysicalAddress: 0x100000
147 # CHECK-NEXT: FileSize: 288
148 # CHECK-NEXT: MemSize: 288
149 # CHECK-NEXT: Flags [
152 # CHECK-NEXT: Alignment: 1048576
154 # CHECK-NEXT: ProgramHeader {
155 # CHECK-NEXT: Type: PT_LOAD (0x1)
156 # CHECK-NEXT: Offset: 0x120
157 # CHECK-NEXT: VirtualAddress: 0x200120
158 # CHECK-NEXT: PhysicalAddress: 0x200120
159 # CHECK-NEXT: FileSize: 12
160 # CHECK-NEXT: MemSize: 12
161 # CHECK-NEXT: Flags [ (0x5)
162 # CHECK-NEXT: PF_R (0x4)
163 # CHECK-NEXT: PF_X (0x1)
165 # CHECK-NEXT: Alignment: 1048576
167 # CHECK-NEXT: ProgramHeader {
168 # CHECK-NEXT: Type: PT_GNU_STACK
169 # CHECK-NEXT: Offset: 0x0
170 # CHECK-NEXT: VirtualAddress: 0x0
171 # CHECK-NEXT: PhysicalAddress: 0x0
172 # CHECK-NEXT: FileSize: 0
173 # CHECK-NEXT: MemSize: 0
174 # CHECK-NEXT: Flags [
178 # CHECK-NEXT: Alignment: 0
181 # CHECK-NEXT: Symbols [
182 # CHECK-NEXT: Symbol {
183 # CHECK-NEXT: Name: (0)
184 # CHECK-NEXT: Value: 0x0
185 # CHECK-NEXT: Size: 0
186 # CHECK-NEXT: Binding: Local (0x0)
187 # CHECK-NEXT: Type: None (0x0)
188 # CHECK-NEXT: Other: 0
189 # CHECK-NEXT: Section: Undefined (0x0)
191 # CHECK-NEXT: Symbol {
192 # CHECK-NEXT: Name: _start
193 # CHECK-NEXT: Value: [[ENTRY]]
194 # CHECK-NEXT: Size: 0
195 # CHECK-NEXT: Binding: Global (0x1)
196 # CHECK-NEXT: Type: None (0x0)
197 # CHECK-NEXT: Other: 0
198 # CHECK-NEXT: Section: .text