2016-06-03 03:49:53 +08:00
|
|
|
// REQUIRES: aarch64
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux %s -o %t.o
|
2017-10-06 17:37:44 +08:00
|
|
|
// RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
|
2019-07-19 14:33:36 +08:00
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s
|
2016-06-03 03:49:53 +08:00
|
|
|
// RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=REL %s
|
|
|
|
|
2016-12-19 19:58:01 +08:00
|
|
|
.text
|
2016-06-03 03:49:53 +08:00
|
|
|
adrp x0, :tlsdesc:a
|
|
|
|
ldr x1, [x0, :tlsdesc_lo12:a]
|
|
|
|
add x0, x0, :tlsdesc_lo12:a
|
|
|
|
.tlsdesccall a
|
|
|
|
blr x1
|
|
|
|
|
2016-12-19 19:58:01 +08:00
|
|
|
// Create relocation against local TLS symbols where linker should
|
|
|
|
// create target specific dynamic TLSDESC relocation where addend is
|
|
|
|
// the symbol VMA in tls block.
|
|
|
|
|
2020-12-17 01:20:55 +08:00
|
|
|
// CHECK: 10298: adrp x0, 0x20000
|
2019-08-20 16:34:56 +08:00
|
|
|
// CHECK-NEXT: 1029c: ldr x1, [x0, #856]
|
|
|
|
// CHECK-NEXT: 102a0: add x0, x0, #856
|
|
|
|
// CHECK-NEXT: 102a4: blr x1
|
2016-06-03 03:49:53 +08:00
|
|
|
|
2016-12-19 19:58:01 +08:00
|
|
|
adrp x0, :tlsdesc:local1
|
|
|
|
ldr x1, [x0, :tlsdesc_lo12:local1]
|
|
|
|
add x0, x0, :tlsdesc_lo12:local1
|
|
|
|
.tlsdesccall a
|
|
|
|
blr x1
|
|
|
|
|
2020-12-17 01:20:55 +08:00
|
|
|
// CHECK: 102a8: adrp x0, 0x20000
|
2019-08-20 16:34:56 +08:00
|
|
|
// CHECK-NEXT: 102ac: ldr x1, [x0, #872]
|
|
|
|
// CHECK-NEXT: 102b0: add x0, x0, #872
|
|
|
|
// CHECK-NEXT: 102b4: blr x1
|
2016-12-19 19:58:01 +08:00
|
|
|
|
|
|
|
adrp x0, :tlsdesc:local2
|
|
|
|
ldr x1, [x0, :tlsdesc_lo12:local2]
|
|
|
|
add x0, x0, :tlsdesc_lo12:local2
|
|
|
|
.tlsdesccall a
|
|
|
|
blr x1
|
|
|
|
|
2020-12-17 01:20:55 +08:00
|
|
|
// CHECK: 102b8: adrp x0, 0x20000
|
2019-08-20 16:34:56 +08:00
|
|
|
// CHECK-NEXT: 102bc: ldr x1, [x0, #888]
|
|
|
|
// CHECK-NEXT: 102c0: add x0, x0, #888
|
|
|
|
// CHECK-NEXT: 102c4: blr x1
|
2016-12-19 19:58:01 +08:00
|
|
|
|
|
|
|
.section .tbss,"awT",@nobits
|
|
|
|
.type local1,@object
|
|
|
|
.p2align 2
|
|
|
|
local1:
|
|
|
|
.word 0
|
|
|
|
.size local1, 4
|
|
|
|
|
|
|
|
.type local2,@object
|
|
|
|
.p2align 3
|
|
|
|
local2:
|
|
|
|
.xword 0
|
|
|
|
.size local2, 8
|
|
|
|
|
|
|
|
|
|
|
|
// 0x1000 + 4096 + 160 = 0x20A0
|
|
|
|
// 0x1000 + 4096 + 176 = 0x20B0
|
2016-06-03 03:49:53 +08:00
|
|
|
// 0x1000 + 4096 + 144 = 0x2090
|
|
|
|
|
2016-12-19 19:58:01 +08:00
|
|
|
// R_AARCH64_TLSDESC - 0x0 -> start of tls block
|
|
|
|
// R_AARCH64_TLSDESC - 0x8 -> align (sizeof (local1), 8)
|
|
|
|
|
2016-06-03 03:49:53 +08:00
|
|
|
// REL: Relocations [
|
|
|
|
// REL-NEXT: Section (4) .rela.dyn {
|
2019-08-20 16:34:56 +08:00
|
|
|
// REL-NEXT: 0x20368 R_AARCH64_TLSDESC - 0x0
|
|
|
|
// REL-NEXT: 0x20378 R_AARCH64_TLSDESC - 0x8
|
|
|
|
// REL-NEXT: 0x20358 R_AARCH64_TLSDESC a 0x0
|
2016-06-03 03:49:53 +08:00
|
|
|
// REL-NEXT: }
|
|
|
|
// REL-NEXT: ]
|