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

124 lines
4.2 KiB
Plaintext

# Tests that the dynamic variables created by the linker are set to the right
# values.
#RUN: yaml2obj --format elf -docnum 1 %s -o %t.o
#RUN: lld -flavor gnu -target x86_64 -e main %t.o -o %t1 --noinhibit-exec
#RUN: llvm-readobj -sections -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s
#CHECKSYMS: Name: .dynamic
#CHECKSYMS: Type: SHT_DYNAMIC
#CHECKSYMS: Address: [[TARGETA:[0xa-fA-f0-9]+]]
#CHECKSYMS: Name: .got.plt
#CHECKSYMS: Type: SHT_PROGBITS
#CHECKSYMS: Address: [[TARGETB:[0xa-fA-f0-9]+]]
#CHECKSYMS: Name: _DYNAMIC
#CHECKSYMS: Value: [[TARGETA]]
#CHECKSYMS: Section: .dynamic
#CHECKSYMS: Name: _GLOBAL_OFFSET_TABLE_
#CHECKSYMS: Value: [[TARGETB]]
#CHECKSYMS: Section: .got.plt
---
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: 554889E54883EC10488B0500000000C745FC00000000C7000A000000E80000000031C98945F889C84883C4105DC36690554889E531C05DC3
- Name: .rela.text
Type: SHT_RELA
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .text
Relocations:
- Offset: 0x000000000000000B
Symbol: a
Type: R_X86_64_GOTPCREL
Addend: -4
- Offset: 0x000000000000001D
Symbol: foo
Type: R_X86_64_PLT32
Addend: -4
- 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: .comment
Type: SHT_PROGBITS
Flags: [ SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000001
Content: 00636C616E672076657273696F6E20332E362E302000
- Name: .note.GNU-stack
Type: SHT_PROGBITS
AddressAlign: 0x0000000000000001
Content: ''
- Name: .eh_frame
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 0x0000000000000008
Content: 1400000000000000037A5200017810011B0C070890010000180000001C000000000000002E00000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000
- 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: .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
Value: 0x0000000000000004
Size: 0x0000000000000004
- Name: foo
Type: STT_FUNC
Section: .text
Value: 0x0000000000000030
Size: 0x0000000000000008
- Name: main
Type: STT_FUNC
Section: .text
Size: 0x000000000000002E
- Name: _GLOBAL_OFFSET_TABLE_
...