43 lines · plain
1// REQUIRES: aarch642// RUN: llvm-mc --triple=aarch64-linux-gnu -filetype=obj -o %t.o %s3// RUN: echo "SECTIONS { \4// RUN: .text : { *(.text) } \5// RUN: .rela.dyn : { *(.rela.dyn) *(.rela.plt) } \6// RUN: } " > %t.script7// RUN: ld.lld %t.o -o %t.so --shared --script %t.script8// RUN: llvm-readobj --section-headers --dynamic-table %t.so | FileCheck %s9 10// The linker script above combines the .rela.dyn and .rela.plt into a single11// table. ELF is clear that the DT_PLTRELSZ should match the subset of12// relocations that is associated with the PLT. It is less clear about what13// the value of DT_RELASZ should be. ELF implies that it should be the size14// of the single table so that DT_RELASZ includes DT_PLTRELSZ. The loader in15// glibc permits this as long as .rela.plt comes after .rela.dyn in the16// combined table.17 .text18 .globl func19 .type func, %function20 .globl foo21 .type foo, %object22 23 .globl _start24 .type _start, %function25_start:26 bl func27 adrp x8, :got:foo28 ldr x8, [x8, :got_lo12:foo]29 ret30 31// CHECK: Name: .rela.dyn32// CHECK-NEXT: Type: SHT_RELA33// CHECK-NEXT: Flags [34// CHECK-NEXT: SHF_ALLOC35// CHECK-NEXT: SHF_INFO_LINK36// CHECK-NEXT: ]37// CHECK-NEXT: Address:38// CHECK-NEXT: Offset:39// CHECK-NEXT: Size: 4840 41// CHECK: 0x0000000000000008 RELASZ 4842// CHECK: 0x0000000000000002 PLTRELSZ 2443