1# REQUIRES: mips
2# Check handling TLS related relocations and symbols when linking
3# a static executable.
4
5# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t
6# RUN: ld.lld -static %t -o %t.exe
7# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
8
9# CHECK: SYMBOL TABLE:
10# CHECK:  [[TGA:[0-9a-f]+]] g      .text           00000000 __tls_get_addr
11# CHECK:           00000000 g    O .tdata          00000000 tls1
12#
13# CHECK:      Contents of section .data:
14# CHECK-NEXT:  {{.*}} [[TGA]] ffff8004 ffff9004
15# CHECK:      Contents of section .got:
16# CHECK-NEXT:  {{.*}} 00000000 80000000 ffff9000 00000001
17# CHECK-NEXT:  {{.*}} ffff8000 00000001 00000000
18
19  .text
20  .global __start
21__start:
22  addiu $2, $3, %tlsgd(tls1)      # R_MIPS_TLS_GD
23  addiu $2, $3, %tlsldm(tls2)     # R_MIPS_TLS_LDM
24  addiu $2, $3, %gottprel(tls1)   # R_MIPS_TLS_GOTTPREL
25
26  .global __tls_get_addr
27__tls_get_addr:
28  nop
29
30  .data
31loc:
32  .word __tls_get_addr
33  .dtprelword tls1+4    # R_MIPS_TLS_DTPREL32
34  .tprelword tls1+4     # R_MIPS_TLS_TPREL32
35
36 .section .tdata,"awT",%progbits
37 .global tls1
38tls1:
39 .word __tls_get_addr
40tls2:
41 .word 0
42