Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / llvm-readobj / program-headers.test
blob960248eb0fae79b06b4e7902e1a36781c868df73
1 RUN: llvm-readobj --program-headers %p/../../Object/Inputs/program-headers.elf-i386 \
2 RUN:     | FileCheck %s -check-prefix ELF-I386
3 RUN: llvm-readobj -l %p/../../Object/Inputs/program-headers.elf-i386 \
4 RUN:     | FileCheck %s -check-prefix ELF-I386
5 RUN: llvm-readobj -l %p/../../Object/Inputs/program-headers.elf-x86-64 \
6 RUN:     | FileCheck %s -check-prefix ELF-X86-64
7 RUN: llvm-readobj -l %p/../../Object/Inputs/program-headers.mips \
8 RUN:     | FileCheck %s -check-prefix ELF-MIPS
9 RUN: llvm-readobj -l %p/../../Object/Inputs/program-headers.mips64 \
10 RUN:     | FileCheck %s -check-prefix ELF-MIPS64
12 ## openbsd-phdrs.elf-x86-64 was generated using GNU ld (GNU Binutils for Ubuntu) 2.26.1.
13 ## llvm-mc -filetype=obj -triple=x86_64-pc-linux test.s -o main.o
14 ## ld -script linker.script main.o -o openbsd-phdrs.elf-x86-64
16 ## test.s is an empty file.
17 ## linker.script:
18 ## PHDRS { text PT_LOAD FILEHDR PHDRS; foo 0x65a3dbe6; bar 0x65a3dbe7; zed 0x65a41be6; }
19 ##   Where 0x65a3dbe6 is the value of PT_OPENBSD_RANDOMIZE,
20 ##         0x65a3dbe7 is the value of PT_OPENBSD_WXNEEDED,
21 ##         0x65a41be6 is the value of PT_OPENBSD_BOOTDATA
22 ## SECTIONS { . = SIZEOF_HEADERS; .all : { *(.*) } : text }
23 RUN: llvm-readobj -l %p/../../Object/Inputs/openbsd-phdrs.elf-x86-64 \
24 RUN:     | FileCheck %s -check-prefix OPENBSD-X86-64
26 ELF-I386:      ProgramHeaders [
27 ELF-I386-NEXT:   ProgramHeader {
28 ELF-I386-NEXT:     Type: PT_LOAD (0x1)
29 ELF-I386-NEXT:     Offset: 0x0
30 ELF-I386-NEXT:     VirtualAddress: 0x8048000
31 ELF-I386-NEXT:     PhysicalAddress: 0x8048000
32 ELF-I386-NEXT:     FileSize: 308
33 ELF-I386-NEXT:     MemSize: 308
34 ELF-I386-NEXT:     Flags [ (0x5)
35 ELF-I386-NEXT:       PF_R (0x4)
36 ELF-I386-NEXT:       PF_X (0x1)
37 ELF-I386-NEXT:     ]
38 ELF-I386-NEXT:     Alignment: 4096
39 ELF-I386-NEXT:   }
40 ELF-I386-NEXT:   ProgramHeader {
41 ELF-I386-NEXT:     Type: PT_GNU_STACK (0x6474E551)
42 ELF-I386-NEXT:     Offset: 0x0
43 ELF-I386-NEXT:     VirtualAddress: 0x0
44 ELF-I386-NEXT:     PhysicalAddress: 0x0
45 ELF-I386-NEXT:     FileSize: 0
46 ELF-I386-NEXT:     MemSize: 0
47 ELF-I386-NEXT:     Flags [ (0x6)
48 ELF-I386-NEXT:       PF_R (0x4)
49 ELF-I386-NEXT:       PF_W (0x2)
50 ELF-I386-NEXT:     ]
51 ELF-I386-NEXT:     Alignment: 4
52 ELF-I386-NEXT:   }
53 ELF-I386-NEXT: ]
55 ELF-X86-64:      ProgramHeaders [
56 ELF-X86-64-NEXT:   ProgramHeader {
57 ELF-X86-64-NEXT:     Type: PT_LOAD (0x1)
58 ELF-X86-64-NEXT:     Offset: 0x0
59 ELF-X86-64-NEXT:     VirtualAddress: 0x400000
60 ELF-X86-64-NEXT:     PhysicalAddress: 0x400000
61 ELF-X86-64-NEXT:     FileSize: 312
62 ELF-X86-64-NEXT:     MemSize: 312
63 ELF-X86-64-NEXT:     Flags [ (0x5)
64 ELF-X86-64-NEXT:       PF_R (0x4)
65 ELF-X86-64-NEXT:       PF_X (0x1)
66 ELF-X86-64-NEXT:     ]
67 ELF-X86-64-NEXT:     Alignment: 2097152
68 ELF-X86-64-NEXT:   }
69 ELF-X86-64-NEXT:   ProgramHeader {
70 ELF-X86-64-NEXT:     Type: PT_GNU_EH_FRAME (0x6474E550)
71 ELF-X86-64-NEXT:     Offset: 0xF4
72 ELF-X86-64-NEXT:     VirtualAddress: 0x4000F4
73 ELF-X86-64-NEXT:     PhysicalAddress: 0x4000F4
74 ELF-X86-64-NEXT:     FileSize: 20
75 ELF-X86-64-NEXT:     MemSize: 20
76 ELF-X86-64-NEXT:     Flags [ (0x4)
77 ELF-X86-64-NEXT:       PF_R (0x4)
78 ELF-X86-64-NEXT:     ]
79 ELF-X86-64-NEXT:     Alignment: 4
80 ELF-X86-64-NEXT:   }
81 ELF-X86-64-NEXT:   ProgramHeader {
82 ELF-X86-64-NEXT:     Type: PT_GNU_STACK (0x6474E551)
83 ELF-X86-64-NEXT:     Offset: 0x0
84 ELF-X86-64-NEXT:     VirtualAddress: 0x0
85 ELF-X86-64-NEXT:     PhysicalAddress: 0x0
86 ELF-X86-64-NEXT:     FileSize: 0
87 ELF-X86-64-NEXT:     MemSize: 0
88 ELF-X86-64-NEXT:     Flags [ (0x6)
89 ELF-X86-64-NEXT:       PF_R (0x4)
90 ELF-X86-64-NEXT:       PF_W (0x2)
91 ELF-X86-64-NEXT:     ]
92 ELF-X86-64-NEXT:     Alignment: 8
93 ELF-X86-64-NEXT:   }
94 ELF-X86-64-NEXT: ]
96 ELF-MIPS:      Format: ELF32-mips
97 ELF-MIPS-NEXT: Arch: mips
98 ELF-MIPS-NEXT: AddressSize: 32bit
99 ELF-MIPS-NEXT: LoadName:
100 ELF-MIPS-NEXT: ProgramHeaders [
101 ELF-MIPS-NEXT:   ProgramHeader {
102 ELF-MIPS-NEXT:     Type: PT_MIPS_ABIFLAGS (0x70000003)
103 ELF-MIPS-NEXT:     Offset: 0x98
104 ELF-MIPS-NEXT:     VirtualAddress: 0x400098
105 ELF-MIPS-NEXT:     PhysicalAddress: 0x400098
106 ELF-MIPS-NEXT:     FileSize: 24
107 ELF-MIPS-NEXT:     MemSize: 24
108 ELF-MIPS-NEXT:     Flags [ (0x4)
109 ELF-MIPS-NEXT:       PF_R (0x4)
110 ELF-MIPS-NEXT:     ]
111 ELF-MIPS-NEXT:     Alignment: 8
112 ELF-MIPS-NEXT:   }
113 ELF-MIPS-NEXT:   ProgramHeader {
114 ELF-MIPS-NEXT:     Type: PT_MIPS_REGINFO (0x70000000)
115 ELF-MIPS-NEXT:     Offset: 0xB0
116 ELF-MIPS-NEXT:     VirtualAddress: 0x4000B0
117 ELF-MIPS-NEXT:     PhysicalAddress: 0x4000B0
118 ELF-MIPS-NEXT:     FileSize: 24
119 ELF-MIPS-NEXT:     MemSize: 24
120 ELF-MIPS-NEXT:     Flags [ (0x4)
121 ELF-MIPS-NEXT:       PF_R (0x4)
122 ELF-MIPS-NEXT:     ]
123 ELF-MIPS-NEXT:     Alignment: 4
124 ELF-MIPS-NEXT:   }
125 ELF-MIPS-NEXT:   ProgramHeader {
126 ELF-MIPS-NEXT:     Type: PT_LOAD (0x1)
127 ELF-MIPS-NEXT:     Offset: 0x0
128 ELF-MIPS-NEXT:     VirtualAddress: 0x400000
129 ELF-MIPS-NEXT:     PhysicalAddress: 0x400000
130 ELF-MIPS-NEXT:     FileSize: 224
131 ELF-MIPS-NEXT:     MemSize: 224
132 ELF-MIPS-NEXT:     Flags [ (0x5)
133 ELF-MIPS-NEXT:       PF_R (0x4)
134 ELF-MIPS-NEXT:       PF_X (0x1)
135 ELF-MIPS-NEXT:     ]
136 ELF-MIPS-NEXT:     Alignment: 65536
137 ELF-MIPS-NEXT:   }
138 ELF-MIPS-NEXT: ]
140 ELF-MIPS64:      Format: ELF64-mips
141 ELF-MIPS64-NEXT: Arch: mips64
142 ELF-MIPS64-NEXT: AddressSize: 64bit
143 ELF-MIPS64-NEXT: LoadName:
144 ELF-MIPS64-NEXT: ProgramHeaders [
145 ELF-MIPS64-NEXT:   ProgramHeader {
146 ELF-MIPS64-NEXT:     Type: PT_LOAD (0x1)
147 ELF-MIPS64-NEXT:     Offset: 0x0
148 ELF-MIPS64-NEXT:     VirtualAddress: 0x120000000
149 ELF-MIPS64-NEXT:     PhysicalAddress: 0x120000000
150 ELF-MIPS64-NEXT:     FileSize: 136
151 ELF-MIPS64-NEXT:     MemSize: 136
152 ELF-MIPS64-NEXT:     Flags [ (0x5)
153 ELF-MIPS64-NEXT:       PF_R (0x4)
154 ELF-MIPS64-NEXT:       PF_X (0x1)
155 ELF-MIPS64-NEXT:     ]
156 ELF-MIPS64-NEXT:     Alignment: 65536
157 ELF-MIPS64-NEXT:   }
158 ELF-MIPS64-NEXT: ]
160 OPENBSD-X86-64:      ProgramHeaders [
161 OPENBSD-X86-64:        ProgramHeader {
162 OPENBSD-X86-64:          Type:  PT_OPENBSD_RANDOMIZE
163 OPENBSD-X86-64-NEXT:     Offset:
164 OPENBSD-X86-64-NEXT:     VirtualAddress:
165 OPENBSD-X86-64-NEXT:     PhysicalAddress:
166 OPENBSD-X86-64-NEXT:     FileSize:
167 OPENBSD-X86-64-NEXT:     MemSize:
168 OPENBSD-X86-64-NEXT:     Flags [
169 OPENBSD-X86-64-NEXT:     ]
170 OPENBSD-X86-64-NEXT:     Alignment:
171 OPENBSD-X86-64-NEXT:   }
172 OPENBSD-X86-64-NEXT:   ProgramHeader {
173 OPENBSD-X86-64-NEXT:     Type:  PT_OPENBSD_WXNEEDED
174 OPENBSD-X86-64-NEXT:     Offset:
175 OPENBSD-X86-64-NEXT:     VirtualAddress:
176 OPENBSD-X86-64-NEXT:     PhysicalAddress:
177 OPENBSD-X86-64-NEXT:     FileSize:
178 OPENBSD-X86-64-NEXT:     MemSize:
179 OPENBSD-X86-64-NEXT:     Flags [
180 OPENBSD-X86-64-NEXT:     ]
181 OPENBSD-X86-64-NEXT:     Alignment:
182 OPENBSD-X86-64-NEXT:   }
183 OPENBSD-X86-64-NEXT:   ProgramHeader {
184 OPENBSD-X86-64-NEXT:     Type:  PT_OPENBSD_BOOTDATA
185 OPENBSD-X86-64-NEXT:     Offset:
186 OPENBSD-X86-64-NEXT:     VirtualAddress:
187 OPENBSD-X86-64-NEXT:     PhysicalAddress:
188 OPENBSD-X86-64-NEXT:     FileSize:
189 OPENBSD-X86-64-NEXT:     MemSize:
190 OPENBSD-X86-64-NEXT:     Flags [
191 OPENBSD-X86-64-NEXT:     ]
192 OPENBSD-X86-64-NEXT:     Alignment:
193 OPENBSD-X86-64-NEXT:   }