summaryrefslogtreecommitdiff
path: root/test/elf/Mips/tls-4-micro.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/Mips/tls-4-micro.test')
-rw-r--r--test/elf/Mips/tls-4-micro.test126
1 files changed, 126 insertions, 0 deletions
diff --git a/test/elf/Mips/tls-4-micro.test b/test/elf/Mips/tls-4-micro.test
new file mode 100644
index 0000000000000..1b0d03fa88753
--- /dev/null
+++ b/test/elf/Mips/tls-4-micro.test
@@ -0,0 +1,126 @@
+# Check handling of R_MICROMIPS_TLS_LDM relocation and generation
+# of corresponding dynamic relocation R_MICROMIPS_TLS_DTPMOD32.
+
+# RUN: yaml2obj -format=elf -docnum 1 -o %t-so1.o %s
+# RUN: yaml2obj -format=elf -docnum 2 -o %t-so2.o %s
+# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so1.o %t-so2.o
+
+# 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 - 0x0
+# REL-NEXT: }
+
+# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2
+# DYN: 0x70000013 MIPS_GOTSYM 0x4
+
+# SYM: Name: @ (0)
+# SYM: Name: T1@ (1)
+# SYM: Name: T2@ (4)
+# SYM: Name: T3@ (7)
+
+# GOT: Contents of section .got:
+# GOT-NEXT: 2000 00000000 00000080 00000000 00000000 ................
+# Two LDM entries --^--------^
+
+# so1.o
+---
+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: 0x08
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x04
+ Info: .text
+ Relocations:
+ - Offset: 0x00
+ Symbol: L01
+ Type: R_MICROMIPS_TLS_LDM
+ - Offset: 0x04
+ Symbol: L01
+ Type: R_MICROMIPS_TLS_LDM
+ - Name: .tdata
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
+ AddressAlign: 0x04
+ Size: 0x04
+
+Symbols:
+ Local:
+ - Name: L01
+ Type: STT_TLS
+ Section: .tdata
+ Size: 0x04
+ Global:
+ - Name: T1
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x00
+ Size: 0x04
+ Other: [ STO_MIPS_MICROMIPS ]
+ - Name: T2
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x04
+ Size: 0x04
+ Other: [ STO_MIPS_MICROMIPS ]
+
+# so2.o
+---
+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
+ AddressAlign: 0x04
+ Info: .text
+ Relocations:
+ - Offset: 0x00
+ Symbol: L02
+ Type: R_MICROMIPS_TLS_LDM
+ - Name: .tdata
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
+ AddressAlign: 0x04
+ Size: 0x04
+
+Symbols:
+ Local:
+ - Name: L02
+ Type: STT_TLS
+ Section: .tdata
+ Size: 0x04
+ Global:
+ - Name: T3
+ Type: STT_FUNC
+ Section: .text
+ Size: 0x04
+ Other: [ STO_MIPS_MICROMIPS ]
+...