2 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-readobj --file-headers --sections -l %t | FileCheck %s
6 # exits with return code 42 on linux
15 # CHECK-NEXT: Magic: (7F 45 4C 46)
16 # CHECK-NEXT: Class: 32-bit (0x1)
17 # CHECK-NEXT: DataEncoding: LittleEndian (0x1)
18 # CHECK-NEXT: FileVersion: 1
19 # CHECK-NEXT: OS/ABI: SystemV (0x0)
20 # CHECK-NEXT: ABIVersion: 0
21 # CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
23 # CHECK-NEXT: Type: Executable (0x2)
24 # CHECK-NEXT: Machine: EM_386 (0x3)
25 # CHECK-NEXT: Version: 1
26 # CHECK-NEXT: Entry: 0x4010B4
27 # CHECK-NEXT: ProgramHeaderOffset: 0x34
28 # CHECK-NEXT: SectionHeaderOffset: 0x11C
29 # CHECK-NEXT: Flags [ (0x0)
31 # CHECK-NEXT: HeaderSize: 52
32 # CHECK-NEXT: ProgramHeaderEntrySize: 32
33 # CHECK-NEXT: ProgramHeaderCount: 4
34 # CHECK-NEXT: SectionHeaderEntrySize: 40
35 # CHECK-NEXT: SectionHeaderCount: 6
36 # CHECK-NEXT: StringTableSectionIndex: 4
38 # CHECK-NEXT: Sections [
39 # CHECK-NEXT: Section {
40 # CHECK-NEXT: Index: 0
41 # CHECK-NEXT: Name: (0)
42 # CHECK-NEXT: Type: SHT_NULL (0x0)
43 # CHECK-NEXT: Flags [ (0x0)
45 # CHECK-NEXT: Address: 0x0
46 # CHECK-NEXT: Offset: 0x0
50 # CHECK-NEXT: AddressAlignment: 0
51 # CHECK-NEXT: EntrySize: 0
53 # CHECK-NEXT: Section {
54 # CHECK-NEXT: Index: 1
55 # CHECK-NEXT: Name: .text
56 # CHECK-NEXT: Type: SHT_PROGBITS (0x1)
57 # CHECK-NEXT: Flags [ (0x6)
58 # CHECK-NEXT: SHF_ALLOC (0x2)
59 # CHECK-NEXT: SHF_EXECINSTR (0x4)
61 # CHECK-NEXT: Address: 0x4010B4
62 # CHECK-NEXT: Offset: 0xB4
63 # CHECK-NEXT: Size: 12
66 # CHECK-NEXT: AddressAlignment: 4
67 # CHECK-NEXT: EntrySize: 0
69 # CHECK-NEXT: Section {
70 # CHECK-NEXT: Index: 2
71 # CHECK-NEXT: Name: .comment
72 # CHECK-NEXT: Type: SHT_PROGBITS (0x1)
73 # CHECK-NEXT: Flags [ (0x30)
74 # CHECK-NEXT: SHF_MERGE (0x10)
75 # CHECK-NEXT: SHF_STRINGS (0x20)
77 # CHECK-NEXT: Address: 0x0
78 # CHECK-NEXT: Offset: 0xC0
82 # CHECK-NEXT: AddressAlignment: 1
83 # CHECK-NEXT: EntrySize: 1
85 # CHECK-NEXT: Section {
86 # CHECK-NEXT: Index: 3
87 # CHECK-NEXT: Name: .symtab
88 # CHECK-NEXT: Type: SHT_SYMTAB
91 # CHECK-NEXT: Address: 0x0
92 # CHECK-NEXT: Offset: 0xC8
93 # CHECK-NEXT: Size: 32
96 # CHECK-NEXT: AddressAlignment: 4
97 # CHECK-NEXT: EntrySize: 16
99 # CHECK-NEXT: Section {
100 # CHECK-NEXT: Index: 4
101 # CHECK-NEXT: Name: .shstrtab
102 # CHECK-NEXT: Type: SHT_STRTAB (0x3)
103 # CHECK-NEXT: Flags [ (0x0)
105 # CHECK-NEXT: Address: 0x0
106 # CHECK-NEXT: Offset: 0xE8
107 # CHECK-NEXT: Size: 42
108 # CHECK-NEXT: Link: 0
109 # CHECK-NEXT: Info: 0
110 # CHECK-NEXT: AddressAlignment: 1
111 # CHECK-NEXT: EntrySize: 0
113 # CHECK-NEXT: Section {
114 # CHECK-NEXT: Index: 5
115 # CHECK-NEXT: Name: .strtab
116 # CHECK-NEXT: Type: SHT_STRTAB (0x3)
117 # CHECK-NEXT: Flags [ (0x0)
119 # CHECK-NEXT: Address: 0x0
120 # CHECK-NEXT: Offset: 0x112
121 # CHECK-NEXT: Size: 8
122 # CHECK-NEXT: Link: 0
123 # CHECK-NEXT: Info: 0
124 # CHECK-NEXT: AddressAlignment: 1
125 # CHECK-NEXT: EntrySize: 0
128 # CHECK-NEXT: ProgramHeaders [
129 # CHECK-NEXT: ProgramHeader {
130 # CHECK-NEXT: Type: PT_PHDR (0x6)
131 # CHECK-NEXT: Offset: 0x34
132 # CHECK-NEXT: VirtualAddress: 0x400034
133 # CHECK-NEXT: PhysicalAddress: 0x400034
134 # CHECK-NEXT: FileSize: 128
135 # CHECK-NEXT: MemSize: 128
136 # CHECK-NEXT: Flags [ (0x4)
137 # CHECK-NEXT: PF_R (0x4)
139 # CHECK-NEXT: Alignment: 4
141 # CHECK-NEXT: ProgramHeader {
142 # CHECK-NEXT: Type: PT_LOAD (0x1)
143 # CHECK-NEXT: Offset: 0x0
144 # CHECK-NEXT: VirtualAddress: 0x400000
145 # CHECK-NEXT: PhysicalAddress: 0x400000
146 # CHECK-NEXT: FileSize: 180
147 # CHECK-NEXT: MemSize: 180
148 # CHECK-NEXT: Flags [
151 # CHECK-NEXT: Alignment: 4096
153 # CHECK-NEXT: ProgramHeader {
154 # CHECK-NEXT: Type: PT_LOAD (0x1)
155 # CHECK-NEXT: Offset: 0xB4
156 # CHECK-NEXT: VirtualAddress: 0x4010B4
157 # CHECK-NEXT: PhysicalAddress: 0x4010B4
158 # CHECK-NEXT: FileSize: 12
159 # CHECK-NEXT: MemSize: 12
160 # CHECK-NEXT: Flags [ (0x5)
161 # CHECK-NEXT: PF_R (0x4)
162 # CHECK-NEXT: PF_X (0x1)
164 # CHECK-NEXT: Alignment: 4096
166 # CHECK-NEXT: ProgramHeader {
167 # CHECK-NEXT: Type: PT_GNU_STACK
168 # CHECK-NEXT: Offset: 0x0
169 # CHECK-NEXT: VirtualAddress: 0x0
170 # CHECK-NEXT: PhysicalAddress: 0x0
171 # CHECK-NEXT: FileSize: 0
172 # CHECK-NEXT: MemSize: 0
173 # CHECK-NEXT: Flags [
177 # CHECK-NEXT: Alignment: 0