2 # Check MIPS R_MIPS_TLS_DTPREL_HI16/LO16 and R_MIPS_TLS_TPREL_HI16/LO16
3 # relocations handling.
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
6 # RUN: ld.lld %t.o -o %t.exe
7 # RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck --check-prefix=DIS %s
8 # RUN: llvm-readobj -r -A %t.exe | FileCheck %s
10 # RUN: not ld.lld %t.o -shared -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
12 # ERR: error: relocation R_MIPS_TLS_TPREL_HI16 against loc0 cannot be used with -shared
13 # ERR: error: relocation R_MIPS_TLS_TPREL_LO16 against loc0 cannot be used with -shared
15 # DIS: 00000000 l .tdata 00000000 loc0
18 # DIS-NEXT: addiu $2, $3, 0
19 # ^-- %hi(loc0 - .tdata - 0x8000)
20 # DIS-NEXT: addiu $2, $3, -32768
21 # ^-- %lo(loc0 - .tdata - 0x8000)
22 # DIS-NEXT: addiu $2, $3, 0
23 # ^-- %hi(loc0 - .tdata - 0x7000)
24 # DIS-NEXT: addiu $2, $3, -28672
25 # ^-- %lo(loc0 - .tdata - 0x7000)
27 # CHECK: Relocations [
29 # CHECK-NOT: Primary GOT
36 # SO-NEXT: Global entries [
38 # SO-NEXT: Number of TLS and multi-GOT entries: 0
43 .type __start,@function
45 addiu $
2, $
3, %dtprel_hi
(loc0
) # R_MIPS_TLS_DTPREL_HI16
46 addiu $
2, $
3, %dtprel_lo
(loc0
) # R_MIPS_TLS_DTPREL_LO16
47 addiu $
2, $
3, %tprel_hi
(loc0
) # R_MIPS_TLS_TPREL_HI16
48 addiu $
2, $
3, %tprel_lo
(loc0
) # R_MIPS_TLS_TPREL_LO16
50 .section .tdata,"awT",%progbits