51 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=armv7a-linux-gnueabihf %p/Inputs/arm-shared.s -o %t-lib.o3// RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=armv7a-linux-gnueabihf %s -o %t.o4// RUN: ld.lld %t-lib.o --shared -o %t.so5// RUN: echo "SECTIONS { \6// RUN: .text : { *(.text) } \7// RUN: .rela.dyn : { *(.rel.dyn) *(.rel.plt) } \8// RUN: } " > %t.script9// RUN: ld.lld %t.o -o %t.axf %t.so --script %t.script10// RUN: llvm-readobj --section-headers --dynamic-table %t.axf | FileCheck %s11 12// The linker script above combines the .rela.dyn and .rela.plt into a single13// table. ELF is clear that the DT_PLTRELSZ should match the subset of14// relocations that is associated with the PLT. It is less clear about what15// the value of DT_RELASZ should be. ELF implies that it should be the size16// of the single table so that DT_RELASZ includes DT_PLTRELSZ. The loader in17// glibc permits this as long as .rela.plt comes after .rela.dyn in the18// combined table. In the ARM case irelative relocations do not count as PLT19// relocs.20 21.text22.globl indirect23.type indirect,%gnu_indirect_function24indirect:25 bx lr26 27.globl bar2 // from Inputs/arm-shared.s28 29.text30.globl _start31.type _start,%function32main:33 bl indirect34 bl bar235 .word indirect(got)36 .word bar2(got)37 bx lr38 39// CHECK: Name: .rela.dyn40// CHECK-NEXT: Type: SHT_REL41// CHECK-NEXT: Flags [42// CHECK-NEXT: SHF_ALLOC43// CHECK-NEXT: SHF_INFO_LINK44// CHECK-NEXT: ]45// CHECK-NEXT: Address:46// CHECK-NEXT: Offset:47// CHECK-NEXT: Size: 2448 49// CHECK: 0x00000012 RELSZ 24 (bytes)50// CHECK: 0x00000002 PLTRELSZ 8 (bytes)51