1// REQUIRES: AArch64 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 9 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 16// combined table. 17 .text 18 .globl func 19 .type func, %function 20 .globl foo 21 .type foo, %object 22 23 .globl _start 24 .type _start, %function 25_start: 26 bl func 27 adrp x8, :got:foo 28 ldr x8, [x8, :got_lo12:foo] 29 ret 30 31// CHECK: Name: .rela.dyn 32// CHECK-NEXT: Type: SHT_RELA 33// CHECK-NEXT: Flags [ 34// CHECK-NEXT: SHF_ALLOC 35// CHECK-NEXT: ] 36// CHECK-NEXT: Address: 37// CHECK-NEXT: Offset: 38// CHECK-NEXT: Size: 48 39 40// CHECK: 0x0000000000000008 RELASZ 48 41// CHECK: 0x0000000000000002 PLTRELSZ 24 42