Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / aarch64-tls-le.s
blobacbdb387dfc4a960ca0394a7ce28d51bb3cc5f9c
1 # REQUIRES: aarch64
2 # RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck %s
5 # RUN: llvm-readobj -S -r %t | FileCheck -check-prefix=RELOC %s
7 #Local-Dynamic to Local-Exec relax creates no
8 #RELOC: Relocations [
9 #RELOC-NEXT: ]
11 ## Reject local-exec TLS relocations for -shared.
12 # RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
14 # ERR: error: relocation R_AARCH64_TLSLE_ADD_TPREL_HI12 against v1 cannot be used with -shared
15 # ERR: error: relocation R_AARCH64_TLSLE_ADD_TPREL_LO12_NC against v1 cannot be used with -shared
16 # ERR: error: relocation R_AARCH64_TLSLE_ADD_TPREL_HI12 against v2 cannot be used with -shared
17 # ERR: error: relocation R_AARCH64_TLSLE_ADD_TPREL_LO12_NC against v2 cannot be used with -shared
19 .globl _start
20 _start:
21 mrs x0, TPIDR_EL0
22 add x0, x0, :tprel_hi12:v1
23 add x0, x0, :tprel_lo12_nc:v1
24 mrs x0, TPIDR_EL0
25 add x0, x0, :tprel_hi12:v2
26 add x0, x0, :tprel_lo12_nc:v2
28 # TCB size = 0x16 and foo is first element from TLS register.
29 #CHECK: Disassembly of section .text:
30 #CHECK: <_start>:
31 #CHECK-NEXT: mrs x0, TPIDR_EL0
32 #CHECK-NEXT: add x0, x0, #0, lsl #12
33 #CHECK-NEXT: add x0, x0, #16
34 #CHECK-NEXT: mrs x0, TPIDR_EL0
35 #CHECK-NEXT: add x0, x0, #4095, lsl #12
36 #CHECK-NEXT: add x0, x0, #4088
38 .section .tbss,"awT",@nobits
40 .type v1,@object
41 .globl v1
42 .p2align 2
43 v1:
44 .word 0
45 .size v1, 4
47 # The current offset from the thread pointer is 20. Raise it to just below the
48 # 24-bit limit.
49 .space (0xfffff8 - 20)
51 .type v2,@object
52 .globl v2
53 .p2align 2
54 v2:
55 .word 0
56 .size v2, 4