2 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
3 // RUN: ld.lld %t -o %t2
4 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
5 // RUN: llvm-objdump -s %t2 | FileCheck %s
6 // RUN: ld.lld --hash-style=sysv %t --shared -o %t3.so
7 // RUN: llvm-objdump -s %t3.so | FileCheck -check-prefix=CHECK-SHARED %s
9 // For an executable, we write the module index 1 and the offset into the TLS
10 // directly into the GOT. For a shared library we can only write the offset
11 // into the TLS directly if the symbol is non-preemptible
16 .type __tls_get_addr,%function
22 .type _start,%function
33 // Generate R_ARM_TLS_GD32 relocations
34 // These can be resolved at static link time for executables as 1 is always the
35 // module index and the offset into tls is known at static link time
36 .Lt0: .word x1(TLSGD) + (. - .L0 - 8)
37 .Lt1: .word x2(TLSGD) + (. - .L1 - 8)
38 .Lt2: .word x3(TLSGD) + (. - .L2 - 8)
39 .Lt3: .word x4(TLSGD) + (. - .L3 - 8)
47 .section .tdata,"awT",%progbits
57 .section .tbss,"awT",%nobits
66 // CHECK: Contents of section .got:
67 // CHECK-NEXT: 12008 01000000 00000000 01000000 04000000
68 // CHECK-NEXT: 12018 01000000 08000000 01000000 0c000000
70 // CHECK-SHARED: Contents of section .got:
71 // CHECK-SHARED-NEXT: 2050 00000000 00000000 00000000 04000000
72 // CHECK-SHARED-NEXT: 2060 00000000 00000000 00000000 00000000