1// REQUIRES: arm
2// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %p/Inputs/arm-tls-get-addr.s -o %t1.o
3// RUN: ld.lld %t1.o --shared -soname=t1.so -o %t1.so
4// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
5// RUN: ld.lld %t1.so %t.o -o %t
6// RUN: llvm-objdump -s %t | FileCheck %s
7
8/// This tls global-dynamic sequence is with respect to a non-preemptible
9/// symbol in an application so a relaxation to Local Exec would normally be
10/// possible. This would result in an assertion failure on ARM as the
11/// relaxation functions can't be implemented on ARM. Check that the sequence
12/// is handled as global dynamic
13
14 .text
15 .syntax unified
16 .globl  func
17 .p2align        2
18 .type   func,%function
19func:
20.L0:
21 .globl __tls_get_addr
22 bl __tls_get_addr
23 bx lr
24 .p2align 2
25 .Lt0: .word   x(TLSGD) + (. - .L0 - 8)
26
27 .globl  x
28.section       .tbss,"awT",%nobits
29 .p2align  2
30x:
31 .space 4
32 .type  x, %object
33
34// CHECK:       Contents of section .got:
35/// Module index is always 1 for executable
36// CHECK-NEXT:  30268 01000000 00000000
37
38
39/// Without any definition of __tls_get_addr we get an error
40// RUN: not ld.lld  %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
41// ERR: error: undefined symbol: __tls_get_addr
42