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