2 // RUN
: llvm-mc
--triple
=aarch64-linux-gnu
-filetype
=obj
-o
%t.o
%s
3 // RUN
: echo
"SECTIONS { \
4 // RUN: .text : { *(.text) } \
5 // RUN: .rela.dyn : { *(.rela.dyn) *(.rela.plt) } \
6 // RUN: } " > %t.script
7 // RUN
: ld.lld
%t.o
-o
%t.so
--shared
--script
%t.script
8 // RUN
: llvm-readobj
--section-headers
--dynamic-table
%t.so | FileCheck
%s
10 // The linker script above combines the
.rela.dyn and .rela.plt into a single
11 // table. ELF is clear that the DT_PLTRELSZ should match the subset of
12 // relocations that is associated with the PLT. It is less clear about what
13 // the value of DT_RELASZ should be. ELF implies that it should
be the size
14 // of the single table so that DT_RELASZ includes DT_PLTRELSZ. The loader in
15 // glibc permits this as long as
.rela.plt comes after .rela.dyn in the
24 .type _start, %function
28 ldr x8
, [x8
, :got_lo12
:foo
]
31 // CHECK
: Name
: .rela.dyn
32 // CHECK-NEXT
: Type
: SHT_RELA
33 // CHECK-NEXT
: Flags
[
34 // CHECK-NEXT
: SHF_ALLOC
35 // CHECK-NEXT
: SHF_INFO_LINK
37 // CHECK-NEXT
: Address
:
38 // CHECK-NEXT
: Offset
:
39 // CHECK-NEXT
: Size
: 48
41 // CHECK
: 0x0000000000000008 RELASZ
48
42 // CHECK
: 0x0000000000000002 PLTRELSZ
24