[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / aarch64-tlsdesc.s
blob8496c099594c4b0244929fdb3cd8c6d73f847e0e
1 // REQUIRES: aarch64
2 // RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux %s -o %t.o
3 // RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
4 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.so | FileCheck %s
5 // RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL %s
7 .text
8 adrp x0, :tlsdesc:a
9 ldr x1, [x0, :tlsdesc_lo12:a]
10 add x0, x0, :tlsdesc_lo12:a
11 .tlsdesccall a
12 blr x1
14 // Create relocation against local TLS symbols where linker should
15 // create target specific dynamic TLSDESC relocation where addend is
16 // the symbol VMA in tls block.
18 // CHECK: 10298: adrp x0, 0x20000
19 // CHECK-NEXT: 1029c: ldr x1, [x0, #856]
20 // CHECK-NEXT: 102a0: add x0, x0, #856
21 // CHECK-NEXT: 102a4: blr x1
23 adrp x0, :tlsdesc:local1
24 ldr x1, [x0, :tlsdesc_lo12:local1]
25 add x0, x0, :tlsdesc_lo12:local1
26 .tlsdesccall a
27 blr x1
29 // CHECK: 102a8: adrp x0, 0x20000
30 // CHECK-NEXT: 102ac: ldr x1, [x0, #872]
31 // CHECK-NEXT: 102b0: add x0, x0, #872
32 // CHECK-NEXT: 102b4: blr x1
34 adrp x0, :tlsdesc:local2
35 ldr x1, [x0, :tlsdesc_lo12:local2]
36 add x0, x0, :tlsdesc_lo12:local2
37 .tlsdesccall a
38 blr x1
40 // CHECK: 102b8: adrp x0, 0x20000
41 // CHECK-NEXT: 102bc: ldr x1, [x0, #888]
42 // CHECK-NEXT: 102c0: add x0, x0, #888
43 // CHECK-NEXT: 102c4: blr x1
45 .section .tbss,"awT",@nobits
46 .type local1,@object
47 .p2align 2
48 local1:
49 .word 0
50 .size local1, 4
52 .type local2,@object
53 .p2align 3
54 local2:
55 .xword 0
56 .size local2, 8
59 // 0x1000 + 4096 + 160 = 0x20A0
60 // 0x1000 + 4096 + 176 = 0x20B0
61 // 0x1000 + 4096 + 144 = 0x2090
63 // R_AARCH64_TLSDESC - 0x0 -> start of tls block
64 // R_AARCH64_TLSDESC - 0x8 -> align (sizeof (local1), 8)
66 // REL: Relocations [
67 // REL-NEXT: Section (4) .rela.dyn {
68 // REL-NEXT: 0x20368 R_AARCH64_TLSDESC - 0x0
69 // REL-NEXT: 0x20378 R_AARCH64_TLSDESC - 0x8
70 // REL-NEXT: 0x20358 R_AARCH64_TLSDESC a 0x0
71 // REL-NEXT: }
72 // REL-NEXT: ]