llvm-project/lld/test/elf/phdr.test

100 lines
2.9 KiB
Plaintext

# This test checks emission for program header for ELF binaries
RUN: lld -flavor gnu -target i386-linux -o %t1 -e main %p/Inputs/phdr.i386 \
RUN: && llvm-readobj -program-headers %t1 | FileCheck -check-prefix=I386 %s
RUN: lld -flavor gnu -target x86_64-linux -o %t1 -e _start %p/Inputs/relocs.x86-64 -static \
RUN: && llvm-objdump -p %t1 | FileCheck %s -check-prefix=X86_64
I386: ProgramHeaders [
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_PHDR (0x6)
I386-NEXT: Offset: 0x34
I386-NEXT: VirtualAddress: 0x34
I386-NEXT: PhysicalAddress: 0x34
I386-NEXT: FileSize: 224
I386-NEXT: MemSize: 224
I386-NEXT: Flags [ (0x5)
I386-NEXT: PF_R (0x4)
I386-NEXT: PF_X (0x1)
I386-NEXT: ]
I386-NEXT: Alignment: 8
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_INTERP (0x3)
I386-NEXT: Offset: 0x114
I386-NEXT: VirtualAddress: 0x114
I386-NEXT: PhysicalAddress: 0x114
I386-NEXT: FileSize: 28
I386-NEXT: MemSize: 28
I386-NEXT: Flags [ (0x4)
I386-NEXT: PF_R (0x4)
I386-NEXT: ]
I386-NEXT: Alignment: 1
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_LOAD (0x1)
I386-NEXT: Offset: 0x0
I386-NEXT: VirtualAddress: 0x0
I386-NEXT: PhysicalAddress: 0x0
I386-NEXT: FileSize: 556
I386-NEXT: MemSize: 556
I386-NEXT: Flags [ (0x5)
I386-NEXT: PF_R (0x4)
I386-NEXT: PF_X (0x1)
I386-NEXT: ]
I386-NEXT: Alignment: 4096
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_LOAD (0x1)
I386-NEXT: Offset: 0x1000
I386-NEXT: VirtualAddress: 0x1000
I386-NEXT: PhysicalAddress: 0x1000
I386-NEXT: FileSize: 260
I386-NEXT: MemSize: 260
I386-NEXT: Flags [ (0x6)
I386-NEXT: PF_R (0x4)
I386-NEXT: PF_W (0x2)
I386-NEXT: ]
I386-NEXT: Alignment: 4096
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_LOAD (0x1)
I386-NEXT: Offset: 0x4000
I386-NEXT: VirtualAddress: 0x4000
I386-NEXT: PhysicalAddress: 0x4000
I386-NEXT: FileSize: 4
I386-NEXT: MemSize: 8
I386-NEXT: Flags [ (0x6)
I386-NEXT: PF_R (0x4)
I386-NEXT: PF_W (0x2)
I386-NEXT: ]
I386-NEXT: Alignment: 16384
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_GNU_EH_FRAME (0x6474E550)
I386-NEXT: Offset: 0x1F4
I386-NEXT: VirtualAddress: 0x1F4
I386-NEXT: PhysicalAddress: 0x1F4
I386-NEXT: FileSize: 8
I386-NEXT: MemSize: 8
I386-NEXT: Flags [ (0x4)
I386-NEXT: PF_R (0x4)
I386-NEXT: ]
I386-NEXT: Alignment: 4
I386-NEXT: }
I386-NEXT: ProgramHeader {
I386-NEXT: Type: PT_DYNAMIC (0x2)
I386-NEXT: Offset: 0x1FC
I386-NEXT: VirtualAddress: 0x1FC
I386-NEXT: PhysicalAddress: 0x1FC
I386-NEXT: FileSize: 48
I386-NEXT: MemSize: 48
I386-NEXT: Flags [ (0x4)
I386-NEXT: PF_R (0x4)
I386-NEXT: ]
I386-NEXT: Alignment: 4
I386-NEXT: }
X86_64: LOAD off 0x0000000000000000
X86_64: LOAD off 0x0000000000001000