1 /// Check that we write addends for AArch64 TLSDESC relocations with
-z rel
2 /// See https
://bugs.llvm.org
/show_bug.cgi?id
=47009
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
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
-----^
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
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 -{{$}}
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
-----^
42 ldr x1
, [x0
, :tlsdesc_lo12
:x
]
43 add x0
, x0
, :tlsdesc_lo12
:x
47 ldr x1
, [x0
, :tlsdesc_lo12
:y
]
48 add x0
, x0
, :tlsdesc_lo12
:y
53 .section .tbss,"awT",@nobits