[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / aarch64-tlsdesc-zrel.s
blob83e6894ddb3b5efe6714e5e6c1fd45e17cf71997
1 /// Check that we write addends for AArch64 TLSDESC relocations with -z rel
2 /// See https://bugs.llvm.org/show_bug.cgi?id=47009
3 // REQUIRES: aarch64
4 // RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
5 // RUN: ld.lld -shared %t.o -o %t-rela.so
6 // RUN: llvm-readobj -W -r -x .got %t-rela.so | FileCheck %s --check-prefixes=RELA,RELA-NO-ADDENDS
7 // RUN: ld.lld -shared %t.o -o %t-rela-addends.so --apply-dynamic-relocs
8 // RUN: llvm-readobj -W -r -x .got %t-rela-addends.so | FileCheck %s --check-prefixes=RELA,RELA-WITH-ADDENDS
10 // RELA: Relocations [
11 // RELA-NEXT: Section (5) .rela.dyn {
12 // RELA-NEXT: 0x[[#%x,ADDR:]] R_AARCH64_TLSDESC - 0x0
13 // RELA-NEXT: 0x[[#ADDR+16]] R_AARCH64_TLSDESC - 0x4
14 // RELA-NEXT: }
15 // RELA-NEXT: ]
16 // RELA-EMPTY:
17 // RELA-NEXT: Hex dump of section '.got':
18 // RELA-NEXT: 0x000[[#ADDR]] 00000000 00000000 00000000 00000000
19 // RELA-NO-ADDENDS-NEXT: 0x000[[#ADDR+16]] 00000000 00000000 00000000 00000000
20 // RELA-WITH-ADDENDS-NEXT: 0x000[[#ADDR+16]] 00000000 00000000 04000000 00000000
21 /// Addend 0x4 for R_AARCH64_TLSDESC -----^
22 // RELA-EMPTY:
24 // RUN: ld.lld -shared %t.o -o %t-rel.so -z rel
25 // RUN: llvm-readobj -W -r -x .got %t-rel.so | FileCheck %s --check-prefix=REL
26 // REL: Relocations [
27 // REL-NEXT: Section (5) .rel.dyn {
28 // REL-NEXT: 0x[[#%x,ADDR:]] R_AARCH64_TLSDESC -{{$}}
29 // REL-NEXT: 0x[[#ADDR+16]] R_AARCH64_TLSDESC -{{$}}
30 // REL-NEXT: }
31 // REL-NEXT: ]
32 // REL-EMPTY:
33 // REL-NEXT: Hex dump of section '.got':
34 // REL-NEXT: 0x000[[#ADDR]] 00000000 00000000 00000000 00000000
35 // REL-NEXT: 0x000[[#ADDR+16]] 00000000 00000000 04000000 00000000
36 /// Addend 0x4 for R_AARCH64_TLSDESC -----^
37 // REL-EMPTY:
39 .text
40 foo:
41 adrp x0, :tlsdesc:x
42 ldr x1, [x0, :tlsdesc_lo12:x]
43 add x0, x0, :tlsdesc_lo12:x
44 .tlsdesccall x
45 blr x1
46 adrp x0, :tlsdesc:y
47 ldr x1, [x0, :tlsdesc_lo12:y]
48 add x0, x0, :tlsdesc_lo12:y
49 .tlsdesccall y
50 blr x1
51 ret
53 .section .tbss,"awT",@nobits
54 .p2align 2
55 .hidden x
57 .word 0
59 .p2align 2
60 .hidden y
62 .word 0