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
16 // RELA-NEXT
: Hex dump of section
'.got':
17 // RELA-NEXT
: 0x000[[#ADDR]] 00000000 00000000 00000000 00000000
18 // RELA-NO-ADDENDS-NEXT
: 0x000[[#ADDR+16]] 00000000 00000000 00000000 00000000
19 // RELA-WITH-ADDENDS-NEXT
: 0x000[[#ADDR+16]] 00000000 00000000 04000000 00000000
20 /// Addend
0x4 for R_AARCH64_TLSDESC
-----^
23 // RUN
: ld.lld
-shared
%t.o
-o
%t-rel.so
-z rel
24 // RUN
: llvm-readobj
-W
-r
-x
.got %t-rel.so | FileCheck %s --check-prefix=REL
26 // REL-NEXT
: Section
(5) .rel.dyn {
27 // REL-NEXT
: 0x
[[#%x,ADDR:]] R_AARCH64_TLSDESC -{{$}}
28 // REL-NEXT
: 0x
[[#ADDR+16]] R_AARCH64_TLSDESC -{{$}}
31 // REL-NEXT
: Hex dump of section
'.got':
32 // REL-NEXT
: 0x000[[#ADDR]] 00000000 00000000 00000000 00000000
33 // REL-NEXT
: 0x000[[#ADDR+16]] 00000000 00000000 04000000 00000000
34 /// Addend
0x4 for R_AARCH64_TLSDESC
-----^
40 ldr x1
, [x0
, :tlsdesc_lo12
:x
]
41 add x0
, x0
, :tlsdesc_lo12
:x
45 ldr x1
, [x0
, :tlsdesc_lo12
:y
]
46 add x0
, x0
, :tlsdesc_lo12
:y
51 .section .tbss,"awT",@nobits