Files
clang-p2996/lld/test/elf/phdr.test
Simon Atanasyan 9931f95bac Linking of shared libraries for MIPS little-endian 32-bit target.
The following are the most significant peculiarities of MIPS target:
- MIPS ABI requires some special tags in the dynamic table.
- GOT consists of two parts local and global. The local part contains
  entries refer locally visible symbols. The global part contains entries
  refer global symbols.
- Entries in the .dynsym section which have corresponded entries in the
  GOT should be:
  * Emitted at the end of .dynsym section
  * Sorted accordingly to theirs GOT counterparts
- There are "paired" relocations. One or more R_MIPS_HI16 and R_MIPS_GOT16
  relocations should be followed by R_MIPS_LO16 relocation. To calculate
  result of R_MIPS_HI16 and R_MIPS_GOT16 relocations we need to combine
  addends from these relocations and paired R_MIPS_LO16 relocation.

The patch reviewed by Michael Spencer, Shankar Easwaran, Rui Ueyama.
http://llvm-reviews.chandlerc.com/D2156

llvm-svn: 197342
2013-12-15 12:57:28 +00:00

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: 572
I386-NEXT: MemSize: 572
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: 4
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: 16392
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_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: 64
I386-NEXT: MemSize: 64
I386-NEXT: Flags [ (0x4)
I386-NEXT: PF_R (0x4)
I386-NEXT: ]
I386-NEXT: Alignment: 2
I386-NEXT: }
X86_64: LOAD off 0x0000000000000000
X86_64: LOAD off 0x0000000000001000