summaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/tls-3-64-static.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Mips/tls-3-64-static.test')
-rw-r--r--test/old-elf/Mips/tls-3-64-static.test70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/old-elf/Mips/tls-3-64-static.test b/test/old-elf/Mips/tls-3-64-static.test
new file mode 100644
index 000000000000..2183d1fd6833
--- /dev/null
+++ b/test/old-elf/Mips/tls-3-64-static.test
@@ -0,0 +1,70 @@
+# Check handling of R_MIPS_TLS_GOTTPREL relocation in case of -static linking.
+
+# RUN: yaml2obj -format=elf -o %t.o %s
+# RUN: lld -flavor old-gnu -target mips64el -e T0 -static -o %t.exe %t.o
+# RUN: llvm-objdump -s %t.exe | FileCheck %s
+
+# CHECK: Contents of section .text:
+# CHECK-NEXT: 120000120 20800000 28800000
+# ^ -32736 ^ -32728
+# CHECK-NEXT: Contents of section .tdata:
+# CHECK-NEXT: 120001000 00000000 00000000
+# CHECK-NEXT: Contents of section .got:
+# CHECK-NEXT: 120002000 00000000 00000000 00000000 00000080
+# CHECK-NEXT: 120002010 0490ffff ffffffff 0c90ffff ffffffff
+# D1 0x120001000 + 4 - (0x120001000 + 0x7000) = 0xffff9004 => 0490ffff
+# D2 0x120001004 + 8 - (0x120001000 + 0x7000) = 0xffff900c => 0c90ffff
+
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC, EF_MIPS_PIC, EF_MIPS_ARCH_64]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 4
+ Size: 8
+
+ - Name: .rel.text
+ Type: SHT_RELA
+ Link: .symtab
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0
+ Symbol: D1
+ Type: R_MIPS_TLS_GOTTPREL
+ Addend: 4
+ - Offset: 4
+ Symbol: D2
+ Type: R_MIPS_TLS_GOTTPREL
+ Addend: 8
+
+ - Name: .tdata
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
+ AddressAlign: 4
+ Size: 8
+
+Symbols:
+ Global:
+ - Name: D1
+ Type: STT_TLS
+ Section: .tdata
+ Value: 0
+ Size: 4
+ - Name: D2
+ Type: STT_TLS
+ Section: .tdata
+ Value: 4
+ Size: 4
+ - Name: T0
+ Type: STT_FUNC
+ Section: .text
+ Size: 8
+...