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 -d --no-show-raw-insn %t.so | FileCheck %s 5// RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL %s 6 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 13 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. 17 18// CHECK: 10298: adrp x0, #65536 19// CHECK-NEXT: 1029c: ldr x1, [x0, #856] 20// CHECK-NEXT: 102a0: add x0, x0, #856 21// CHECK-NEXT: 102a4: blr x1 22 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 28 29// CHECK: 102a8: adrp x0, #65536 30// CHECK-NEXT: 102ac: ldr x1, [x0, #872] 31// CHECK-NEXT: 102b0: add x0, x0, #872 32// CHECK-NEXT: 102b4: blr x1 33 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 39 40// CHECK: 102b8: adrp x0, #65536 41// CHECK-NEXT: 102bc: ldr x1, [x0, #888] 42// CHECK-NEXT: 102c0: add x0, x0, #888 43// CHECK-NEXT: 102c4: blr x1 44 45 .section .tbss,"awT",@nobits 46 .type local1,@object 47 .p2align 2 48local1: 49 .word 0 50 .size local1, 4 51 52 .type local2,@object 53 .p2align 3 54local2: 55 .xword 0 56 .size local2, 8 57 58 59// 0x1000 + 4096 + 160 = 0x20A0 60// 0x1000 + 4096 + 176 = 0x20B0 61// 0x1000 + 4096 + 144 = 0x2090 62 63// R_AARCH64_TLSDESC - 0x0 -> start of tls block 64// R_AARCH64_TLSDESC - 0x8 -> align (sizeof (local1), 8) 65 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: ] 73