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

189 lines
6.8 KiB
Plaintext

# Tests that lld does not create separate segment if the input sections are part
# of the same output section
# Build executable
# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o
# RUN: lld -flavor gnu -target x86_64 %t.o -o %t1.exe -static \
# RUN: --no-align-segments --noinhibit-exec
# RUN: lld -flavor gnu -target x86_64 %t.o -o %t2.exe -static \
# RUN: --noinhibit-exec
# RUN: llvm-readobj -program-headers %t1.exe | FileCheck %s -check-prefix=SEGMENTS
# RUN: llvm-readobj -program-headers %t2.exe | FileCheck %s -check-prefix=SEGMENTS
#
#SEGMENTS: VirtualAddress: 0x400000
#SEGMENTS: PhysicalAddress: 0x400000
#SEGMENTS: FileSize: 288
#SEGMENTS: MemSize: 288
#SEGMENTS: VirtualAddress: 0x404000
#SEGMENTS: PhysicalAddress: 0x404000
#SEGMENTS: FileSize: 16608
#SEGMENTS: MemSize: 16608
#SEGMENTS: Alignment: 16384
#
# object
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
OSABI: ELFOSABI_GNU
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000004
Content: ''
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
- Name: .text.foo
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000002000
Content: 554889E54883EC1048BF0000000000000000B000E800000000B9000000008945FC89C84883C4105DC3
- Name: .rela.text.foo
Type: SHT_RELA
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .text.foo
Relocations:
- Offset: 0x000000000000000A
Symbol: .rodata.str1.1
Type: R_X86_64_64
Addend: 0
- Offset: 0x0000000000000015
Symbol: printf
Type: R_X86_64_PC32
Addend: -4
- Name: .text.bar
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000004000
Content: 554889E54883EC1048BF0000000000000000B000E800000000B9000000008945FC89C84883C4105DC3
- Name: .rela.text.bar
Type: SHT_RELA
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .text.bar
Relocations:
- Offset: 0x000000000000000A
Symbol: .rodata.str1.1
Type: R_X86_64_64
Addend: 7
- Offset: 0x0000000000000015
Symbol: printf
Type: R_X86_64_PC32
Addend: -4
- Name: .text.main
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000010
Content: 554889E54883EC10C745FC00000000E8000000008945F8E8000000008B4DF801C189C84883C4105DC3
- Name: .rela.text.main
Type: SHT_RELA
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .text.main
Relocations:
- Offset: 0x0000000000000010
Symbol: foo
Type: R_X86_64_PC32
Addend: -4
- Offset: 0x0000000000000018
Symbol: bar
Type: R_X86_64_PC32
Addend: -4
- Name: .rodata.str1.1
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000001
Content: 48656C6C6F0A00576F726C640A00
- Name: .comment
Type: SHT_PROGBITS
Flags: [ SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000001
Content: 005562756E747520636C616E672076657273696F6E20332E352E302D73766E3231373330342D317E6578703120286272616E636865732F72656C656173655F33352920286261736564206F6E204C4C564D20332E352E302900
- Name: .note.GNU-stack
Type: SHT_PROGBITS
AddressAlign: 0x0000000000000001
Content: ''
- Name: .eh_frame
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 0x0000000000000008
Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000002900000000410E108602430D060000001800000038000000000000002900000000410E108602430D060000001C00000054000000000000002900000000410E108602430D0600000000000000
- Name: .rela.eh_frame
Type: SHT_RELA
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .eh_frame
Relocations:
- Offset: 0x0000000000000020
Symbol: .text.foo
Type: R_X86_64_PC32
Addend: 0
- Offset: 0x000000000000003C
Symbol: .text.bar
Type: R_X86_64_PC32
Addend: 0
- Offset: 0x0000000000000058
Symbol: .text.main
Type: R_X86_64_PC32
Addend: 0
Symbols:
Local:
- Name: 1.c
Type: STT_FILE
- Name: .text
Type: STT_SECTION
Section: .text
- Name: .data
Type: STT_SECTION
Section: .data
- Name: .bss
Type: STT_SECTION
Section: .bss
- Name: .text.foo
Type: STT_SECTION
Section: .text.foo
- Name: .text.bar
Type: STT_SECTION
Section: .text.bar
- Name: .text.main
Type: STT_SECTION
Section: .text.main
- Name: .rodata.str1.1
Type: STT_SECTION
Section: .rodata.str1.1
- Name: .comment
Type: STT_SECTION
Section: .comment
- Name: .note.GNU-stack
Type: STT_SECTION
Section: .note.GNU-stack
- Name: .eh_frame
Type: STT_SECTION
Section: .eh_frame
Global:
- Name: bar
Type: STT_FUNC
Section: .text.bar
Size: 0x0000000000000029
- Name: foo
Type: STT_FUNC
Section: .text.foo
Size: 0x0000000000000029
- Name: main
Type: STT_FUNC
Section: .text.main
Size: 0x0000000000000029
- Name: printf
...