summaryrefslogtreecommitdiff
path: root/test/elf/Mips/tls-2-micro.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/Mips/tls-2-micro.test')
-rw-r--r--test/elf/Mips/tls-2-micro.test70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/elf/Mips/tls-2-micro.test b/test/elf/Mips/tls-2-micro.test
new file mode 100644
index 0000000000000..5a1fe2904ac96
--- /dev/null
+++ b/test/elf/Mips/tls-2-micro.test
@@ -0,0 +1,70 @@
+# Check handling of R_MICROMIPS_TLS_GOTTPREL and R_MICROMIPS_TLS_GD relocations
+# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32,
+# R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of shared library.
+
+# Create a shared library with thread symbol D1.
+# RUN: yaml2obj -format=elf -o %t-so.o %s
+# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
+
+# Check dynamic relocations and GOT in the shared library.
+# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s
+# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s
+# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s
+# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s
+
+# REL: Section (4) .rel.dyn {
+# REL-NEXT: 0x2008 R_MIPS_TLS_DTPMOD32 D1 0x0
+# REL-NEXT: 0x200C R_MIPS_TLS_DTPREL32 D1 0x0
+# REL-NEXT: }
+
+# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2
+# DYN: 0x70000013 MIPS_GOTSYM 0x3
+
+# SYM: Name: T1@ (1)
+# SYM: Name: D1@ (4)
+
+# GOT: Contents of section .got:
+# GOT-NEXT: 2000 00000000 00000080 00000000 00000000 ................
+
+---
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
+ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Size: 0x04
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ Info: .text
+ AddressAlign: 0x04
+ Relocations:
+ - Offset: 0x00
+ Symbol: D1
+ Type: R_MICROMIPS_TLS_GD
+ - Name: .tdata
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
+ AddressAlign: 0x04
+ Size: 0x04
+
+Symbols:
+ Global:
+ - Name: T1
+ Type: STT_FUNC
+ Section: .text
+ Size: 0x04
+ Other: [ STO_MIPS_MICROMIPS ]
+ - Name: D1
+ Type: STT_TLS
+ Section: .tdata
+ Size: 0x04
+...