xref: /llvm-project/lld/test/ELF/mips-tls-hilo.s (revision aa889d7783af050ce5d19af67c7225ee119d625e)
1# REQUIRES: mips
2# Check MIPS R_MIPS_TLS_DTPREL_HI16/LO16 and R_MIPS_TLS_TPREL_HI16/LO16
3# relocations handling.
4
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
9
10# RUN: not ld.lld %t.o -shared -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
11
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
14
15# DIS: 00000000 l      .tdata          00000000 loc0
16
17# DIS:      <__start>:
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)
26
27# CHECK:      Relocations [
28# CHECK-NEXT: ]
29# CHECK-NOT:  Primary GOT
30
31  .text
32  .globl  __start
33  .type __start,@function
34__start:
35  addiu $2, $3, %dtprel_hi(loc0)  # R_MIPS_TLS_DTPREL_HI16
36  addiu $2, $3, %dtprel_lo(loc0)  # R_MIPS_TLS_DTPREL_LO16
37  addiu $2, $3, %tprel_hi(loc0)   # R_MIPS_TLS_TPREL_HI16
38  addiu $2, $3, %tprel_lo(loc0)   # R_MIPS_TLS_TPREL_LO16
39
40 .section .tdata,"awT",%progbits
41loc0:
42 .word 0
43