ELF/AArch64: Check linker created dynamic variables

Check the values of _GLOBAL_OFFSET_TABLE_ and _DYNAMIC variables created by
linker.  AArch64 version.

llvm-svn: 234744
This commit is contained in:
Adhemerval Zanella 2015-04-13 11:43:33 +00:00
parent c55179f847
commit 9fc8102457
1 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,114 @@
# 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 aarch64 -e main %t.o -o %t1 --noinhibit-exec
# RUN: llvm-readobj -sections -symbols %t1 | FileCheck %s
# CHECK: Name: .dynamic
# CHECK: Type: SHT_DYNAMIC
# CHECK: Address: [[TARGETA:[0xa-fA-f0-9]+]]
# CHECK: Name: .got.plt
# CHECK: Type: SHT_PROGBITS
# CHECK: Address: [[TARGETB:[0xa-fA-f0-9]+]]
# CHECK: Name: _DYNAMIC
# CHECK: Value: [[TARGETA]]
# CHECK: Section: .dynamic
# CHECK: Name: _GLOBAL_OFFSET_TABLE_
# CHECK: Value: [[TARGETB]]
# CHECK: Section: .got.plt
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_AARCH64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .text.startup
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000004
Content: FD7BBFA900000090FD030091000000910000009400008052FD7BC1A8C0035FD6
- Name: .rela.text.startup
Type: SHT_RELA
Flags: [ SHF_INFO_LINK ]
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .text.startup
Relocations:
- Offset: 0x0000000000000004
Symbol: .rodata.str1.8
Type: R_AARCH64_ADR_PREL_PG_HI21
- Offset: 0x000000000000000C
Symbol: .rodata.str1.8
Type: R_AARCH64_ADD_ABS_LO12_NC
- Offset: 0x0000000000000010
Symbol: puts
Type: R_AARCH64_CALL26
- Name: .rodata.str1.8
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000008
Content: '7465737400000000'
- Name: .comment
Type: SHT_PROGBITS
Flags: [ SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000001
Content: 004743433A2028474E552920342E392E33203230313530333234202870726572656C656173652900
- Name: .note.GNU-stack
Type: SHT_PROGBITS
AddressAlign: 0x0000000000000001
Content: ''
Symbols:
Local:
- Name: test.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.startup
Type: STT_SECTION
Section: .text.startup
- Name: '$x'
Section: .text.startup
- Name: .rodata.str1.8
Type: STT_SECTION
Section: .rodata.str1.8
- Name: '$d'
Section: .rodata.str1.8
- Name: .note.GNU-stack
Type: STT_SECTION
Section: .note.GNU-stack
- Name: .comment
Type: STT_SECTION
Section: .comment
Global:
- Name: main
Type: STT_FUNC
Section: .text.startup
Size: 0x0000000000000020
- Name: puts
...