120 lines
4.0 KiB
Plaintext
120 lines
4.0 KiB
Plaintext
# Checks that segments are aligned as per ELF spec. The segment virtual address
|
|
# modulo page alignment should be equal to offset modulo page alignment.
|
|
|
|
# Build executable
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s -o %t.o
|
|
# RUN: lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \
|
|
# RUN: --no-align-segments --rosegment --noinhibit-exec
|
|
# RUN: llvm-readobj -program-headers %t.exe | FileCheck %s
|
|
#
|
|
#CHECK: Offset: 0x15C
|
|
#CHECK: VirtualAddress: 0x40015C
|
|
#CHECK: PhysicalAddress: 0x40015C
|
|
#
|
|
#
|
|
#const int a = 0;
|
|
#int main() {
|
|
# foo();
|
|
# return 0;
|
|
#}
|
|
#
|
|
#int foo() { return 0; }
|
|
|
|
# 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: 0x0000000000000010
|
|
Content: 554889E54883EC10C745FC00000000E81C000000B9000000008945F889C84883C4105DC36666662E0F1F840000000000554889E5B8000000005DC3
|
|
- 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
|
|
Content: ''
|
|
- Name: .rodata
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC ]
|
|
AddressAlign: 0x0000000000000004
|
|
Content: '00000000'
|
|
- 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: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000002400000000410E108602430D060000001800000038000000000000000B00000000410E108602430D06000000
|
|
- Name: .rela.eh_frame
|
|
Type: SHT_RELA
|
|
Link: .symtab
|
|
AddressAlign: 0x0000000000000008
|
|
Info: .eh_frame
|
|
Relocations:
|
|
- Offset: 0x0000000000000020
|
|
Symbol: .text
|
|
Type: R_X86_64_PC32
|
|
Addend: 0
|
|
- Offset: 0x000000000000003C
|
|
Symbol: .text
|
|
Type: R_X86_64_PC32
|
|
Addend: 48
|
|
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: .rodata
|
|
Type: STT_SECTION
|
|
Section: .rodata
|
|
- 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: a
|
|
Type: STT_OBJECT
|
|
Section: .rodata
|
|
Size: 0x0000000000000004
|
|
- Name: foo
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x0000000000000030
|
|
Size: 0x000000000000000B
|
|
- Name: main
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 0x0000000000000024
|
|
...
|