1 # Check handling of R_MICROMIPS_TLS_GOTTPREL and R_MICROMIPS_TLS_GD relocations
2 # and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32,
3 # R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of executable linking.
5 # Create a shared library with thread symbol D1.
6 # RUN: yaml2obj -format=elf -docnum 1 -o %t-so.o %s
7 # RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
9 # Create executable file linked using two object files and the shared library.
10 # The object files defines thread symbols D0 and D2.
11 # RUN: yaml2obj -format=elf -docnum 2 -o %t-o1.o %s
12 # RUN: yaml2obj -format=elf -docnum 3 -o %t-o2.o %s
13 # RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o1.o %t-o2.o %t.so
15 # Check dynamic relocations and GOT in the executable file.
16 # RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
17 # RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=DYN %s
18 # RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s
19 # RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=GOT %s
21 # REL: Section (5) .rel.dyn {
22 # REL-NEXT: 0x402008 R_MIPS_TLS_TPREL32 D1 0x0
23 # REL-NEXT: 0x40200C R_MIPS_TLS_TPREL32 D2 0x0
26 # DYN: 0x7000000A MIPS_LOCAL_GOTNO 2
27 # DYN: 0x70000013 MIPS_GOTSYM 0x3
32 # GOT: Contents of section .got:
33 # GOT-NEXT: 402000 00000000 00000080 00000000 00000000 ................
43 Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
44 EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
48 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
59 Type: R_MICROMIPS_TLS_GD
62 Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
72 Other: [ STO_MIPS_MICROMIPS ]
86 Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
87 EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
91 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
102 Type: R_MICROMIPS_TLS_TPREL_HI16
105 Type: R_MICROMIPS_TLS_TPREL_LO16
108 Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
118 Other: [ STO_MIPS_MICROMIPS ]
132 Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
133 EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
137 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
148 Type: R_MICROMIPS_TLS_GOTTPREL
152 Type: R_MICROMIPS_TLS_TPREL_HI16
156 Type: R_MICROMIPS_TLS_TPREL_LO16
160 Type: R_MICROMIPS_TLS_GOTTPREL
164 Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
178 Other: [ STO_MIPS_MICROMIPS ]