Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / arm-tls-gd-nonpreemptible.s
blob489f293db1cb4e05249617369778c44496e0aa6d
1 // REQUIRES: arm
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 %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
13 .text
14 .syntax unified
15 .globl __tls_get_addr
16 .type __tls_get_addr,%function
17 __tls_get_addr:
18 bx lr
20 .globl _start
21 .p2align 2
22 .type _start,%function
23 func:
24 .L0:
25 nop
26 .L1:
27 nop
28 .L2:
29 nop
30 .L3:
31 nop
32 .p2align 2
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)
40 .hidden x1
41 .globl x1
42 .hidden x2
43 .globl x2
44 .globl x3
45 .globl x4
47 .section .tdata,"awT",%progbits
48 .p2align 2
49 .TLSSTART:
50 .type x1, %object
51 x1:
52 .word 10
53 .type x2, %object
54 x2:
55 .word 20
57 .section .tbss,"awT",%nobits
58 .p2align 2
59 .type x3, %object
60 x3:
61 .space 4
62 .type x4, %object
63 x4:
64 .space 4
66 // CHECK: Contents of section .got:
67 // CHECK-NEXT: 30140 01000000 00000000 01000000 04000000
68 // CHECK-NEXT: 30150 01000000 08000000 01000000 0c000000
70 // CHECK-SHARED: Contents of section .got:
71 // CHECK-SHARED-NEXT: 202a8 00000000 00000000 00000000 04000000
72 // CHECK-SHARED-NEXT: 202b8 00000000 00000000 00000000 00000000