llvm-project/lld/test/elf/X86_64/nmagic.test

240 lines
7.8 KiB
Plaintext

# This tests verifies functionality of NMAGIC that we create only two segments,
# PT_LOAD, PT_TLS
# The data segment should be aligned to a page boundary
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/nmagic.o \
RUN: --noinhibit-exec -o %t --nmagic
RUN: llvm-readobj -sections %t | FileCheck -check-prefix=NMAGICSECTIONS %s
RUN: llvm-readobj -program-headers %t | FileCheck -check-prefix=NMAGICPROGRAMHEADERS %s
NMAGICSECTIONS: Sections [
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 0
NMAGICSECTIONS: Name: (0)
NMAGICSECTIONS: Type: SHT_NULL (0x0)
NMAGICSECTIONS: Flags [ (0x0)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x0
NMAGICSECTIONS: Offset: 0x0
NMAGICSECTIONS: Size: 0
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 0
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 1
NMAGICSECTIONS: Name: .text (1)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x6)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: SHF_EXECINSTR (0x4)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x4000B0
NMAGICSECTIONS: Offset: 0xB0
NMAGICSECTIONS: Size: 11
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 4
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 2
NMAGICSECTIONS: Name: .note.GNU-stack (7)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x2)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x4000BB
NMAGICSECTIONS: Offset: 0xBB
NMAGICSECTIONS: Size: 0
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 1
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 3
NMAGICSECTIONS: Name: .comment (23)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x2)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x4000BB
NMAGICSECTIONS: Offset: 0xBB
NMAGICSECTIONS: Size: 43
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 1
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 4
NMAGICSECTIONS: Name: .eh_frame (32)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x2)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x4000E8
NMAGICSECTIONS: Offset: 0xE8
NMAGICSECTIONS: Size: 56
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 8
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 5
NMAGICSECTIONS: Name: .tdata (42)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x403)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: SHF_TLS (0x400)
NMAGICSECTIONS: SHF_WRITE (0x1)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x401000
NMAGICSECTIONS: Offset: 0x1000
NMAGICSECTIONS: Size: 4
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 4
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 6
NMAGICSECTIONS: Name: .tbss (49)
NMAGICSECTIONS: Type: SHT_NOBITS (0x8)
NMAGICSECTIONS: Flags [ (0x403)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: SHF_TLS (0x400)
NMAGICSECTIONS: SHF_WRITE (0x1)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x401004
NMAGICSECTIONS: Offset: 0x1004
NMAGICSECTIONS: Size: 8
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 4
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 7
NMAGICSECTIONS: Name: .got.plt (55)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x3)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: SHF_WRITE (0x1)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x401008
NMAGICSECTIONS: Offset: 0x1008
NMAGICSECTIONS: Size: 0
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 8
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 8
NMAGICSECTIONS: Name: .data (64)
NMAGICSECTIONS: Type: SHT_PROGBITS (0x1)
NMAGICSECTIONS: Flags [ (0x3)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: SHF_WRITE (0x1)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x401008
NMAGICSECTIONS: Offset: 0x1008
NMAGICSECTIONS: Size: 4
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 4
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 9
NMAGICSECTIONS: Name: .bss (70)
NMAGICSECTIONS: Type: SHT_NOBITS (0x8)
NMAGICSECTIONS: Flags [ (0x3)
NMAGICSECTIONS: SHF_ALLOC (0x2)
NMAGICSECTIONS: SHF_WRITE (0x1)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x40100C
NMAGICSECTIONS: Offset: 0x100C
NMAGICSECTIONS: Size: 0
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 4
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 10
NMAGICSECTIONS: Name: .shstrtab (75)
NMAGICSECTIONS: Type: SHT_STRTAB (0x3)
NMAGICSECTIONS: Flags [ (0x0)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x0
NMAGICSECTIONS: Offset: 0x100C
NMAGICSECTIONS: Size: 101
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 1
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 11
NMAGICSECTIONS: Name: .symtab (85)
NMAGICSECTIONS: Type: SHT_SYMTAB (0x2)
NMAGICSECTIONS: Flags [ (0x0)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x0
NMAGICSECTIONS: Offset: 0x1078
NMAGICSECTIONS: Size: 528
NMAGICSECTIONS: Link: 12
NMAGICSECTIONS: Info: 2
NMAGICSECTIONS: AddressAlignment: 8
NMAGICSECTIONS: EntrySize: 24
NMAGICSECTIONS: }
NMAGICSECTIONS: Section {
NMAGICSECTIONS: Index: 12
NMAGICSECTIONS: Name: .strtab (93)
NMAGICSECTIONS: Type: SHT_STRTAB (0x3)
NMAGICSECTIONS: Flags [ (0x0)
NMAGICSECTIONS: ]
NMAGICSECTIONS: Address: 0x0
NMAGICSECTIONS: Offset: 0x1288
NMAGICSECTIONS: Size: 246
NMAGICSECTIONS: Link: 0
NMAGICSECTIONS: Info: 0
NMAGICSECTIONS: AddressAlignment: 1
NMAGICSECTIONS: EntrySize: 0
NMAGICSECTIONS: }
NMAGICSECTIONS: ]
NMAGICPROGRAMHEADERS: ProgramHeaders [
NMAGICPROGRAMHEADERS: ProgramHeader {
NMAGICPROGRAMHEADERS: Type: PT_LOAD (0x1)
NMAGICPROGRAMHEADERS: Offset: 0x0
NMAGICPROGRAMHEADERS: VirtualAddress: 0x400000
NMAGICPROGRAMHEADERS: PhysicalAddress: 0x400000
NMAGICPROGRAMHEADERS: FileSize: 4108
NMAGICPROGRAMHEADERS: MemSize: 4108
NMAGICPROGRAMHEADERS: Flags [ (0x7)
NMAGICPROGRAMHEADERS: PF_R (0x4)
NMAGICPROGRAMHEADERS: PF_W (0x2)
NMAGICPROGRAMHEADERS: PF_X (0x1)
NMAGICPROGRAMHEADERS: ]
NMAGICPROGRAMHEADERS: Alignment: 8
NMAGICPROGRAMHEADERS: }
NMAGICPROGRAMHEADERS: ProgramHeader {
NMAGICPROGRAMHEADERS: Type: PT_TLS (0x7)
NMAGICPROGRAMHEADERS: Offset: 0x1000
NMAGICPROGRAMHEADERS: VirtualAddress: 0x401000
NMAGICPROGRAMHEADERS: PhysicalAddress: 0x401000
NMAGICPROGRAMHEADERS: FileSize: 4
NMAGICPROGRAMHEADERS: MemSize: 12
NMAGICPROGRAMHEADERS: Flags [ (0x6)
NMAGICPROGRAMHEADERS: PF_R (0x4)
NMAGICPROGRAMHEADERS: PF_W (0x2)
NMAGICPROGRAMHEADERS: ]
NMAGICPROGRAMHEADERS: Alignment: 4
NMAGICPROGRAMHEADERS: }
NMAGICPROGRAMHEADERS: ]