[ELF] Make section member orders consistent
[llvm-project.git] / lld / test / ELF / basic-i386.s
blob24d4ff451826fbf45f91ecdb5f7a9743e71b1bfb
1 # REQUIRES: x86
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
7 .globl _start
8 _start:
9 mov $1, %eax
10 mov $42, %ebx
11 int $0x80
13 # CHECK: ElfHeader {
14 # CHECK-NEXT: Ident {
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)
22 # CHECK-NEXT: }
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)
30 # CHECK-NEXT: ]
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
37 # CHECK-NEXT: }
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)
44 # CHECK-NEXT: ]
45 # CHECK-NEXT: Address: 0x0
46 # CHECK-NEXT: Offset: 0x0
47 # CHECK-NEXT: Size: 0
48 # CHECK-NEXT: Link: 0
49 # CHECK-NEXT: Info: 0
50 # CHECK-NEXT: AddressAlignment: 0
51 # CHECK-NEXT: EntrySize: 0
52 # CHECK-NEXT: }
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)
60 # CHECK-NEXT: ]
61 # CHECK-NEXT: Address: 0x4010B4
62 # CHECK-NEXT: Offset: 0xB4
63 # CHECK-NEXT: Size: 12
64 # CHECK-NEXT: Link: 0
65 # CHECK-NEXT: Info: 0
66 # CHECK-NEXT: AddressAlignment: 4
67 # CHECK-NEXT: EntrySize: 0
68 # CHECK-NEXT: }
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)
76 # CHECK-NEXT: ]
77 # CHECK-NEXT: Address: 0x0
78 # CHECK-NEXT: Offset: 0xC0
79 # CHECK-NEXT: Size: 8
80 # CHECK-NEXT: Link: 0
81 # CHECK-NEXT: Info: 0
82 # CHECK-NEXT: AddressAlignment: 1
83 # CHECK-NEXT: EntrySize: 1
84 # CHECK-NEXT: }
85 # CHECK-NEXT: Section {
86 # CHECK-NEXT: Index: 3
87 # CHECK-NEXT: Name: .symtab
88 # CHECK-NEXT: Type: SHT_SYMTAB
89 # CHECK-NEXT: Flags [
90 # CHECK-NEXT: ]
91 # CHECK-NEXT: Address: 0x0
92 # CHECK-NEXT: Offset: 0xC8
93 # CHECK-NEXT: Size: 32
94 # CHECK-NEXT: Link: 5
95 # CHECK-NEXT: Info: 1
96 # CHECK-NEXT: AddressAlignment: 4
97 # CHECK-NEXT: EntrySize: 16
98 # CHECK-NEXT: }
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)
104 # CHECK-NEXT: ]
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
112 # CHECK-NEXT: }
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)
118 # CHECK-NEXT: ]
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
126 # CHECK-NEXT: }
127 # CHECK-NEXT: ]
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)
138 # CHECK-NEXT: ]
139 # CHECK-NEXT: Alignment: 4
140 # CHECK-NEXT: }
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 [
149 # CHECK-NEXT: PF_R
150 # CHECK-NEXT: ]
151 # CHECK-NEXT: Alignment: 4096
152 # CHECK-NEXT: }
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)
163 # CHECK-NEXT: ]
164 # CHECK-NEXT: Alignment: 4096
165 # CHECK-NEXT: }
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 [
174 # CHECK-NEXT: PF_R
175 # CHECK-NEXT: PF_W
176 # CHECK-NEXT: ]
177 # CHECK-NEXT: Alignment: 0
178 # CHECK-NEXT: }
179 # CHECK-NEXT: ]