aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-04-13 11:43:33 +0000
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-04-13 11:43:33 +0000
commit426b4dca704fb33940ef23c75ba5707fe771dd1a (patch)
treeeb45d0c98b3f47c349b92c73b41b35f15a935654
parent91ad3847be68c52eec88804d33546d320c26665b (diff)
ELF/AArch64: Check linker created dynamic variables
Check the values of _GLOBAL_OFFSET_TABLE_ and _DYNAMIC variables created by linker. AArch64 version. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234744 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/elf/AArch64/dynamicvars.test114
1 files changed, 114 insertions, 0 deletions
diff --git a/test/elf/AArch64/dynamicvars.test b/test/elf/AArch64/dynamicvars.test
new file mode 100644
index 00000000..48a83e9e
--- /dev/null
+++ b/test/elf/AArch64/dynamicvars.test
@@ -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
+...