42 lines · plain
1# REQUIRES: x862# RUN: llvm-mc --triple=x86_64-pc-linux -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 18 .text19 .globl func20 .type func, %function21 .globl foo22 .type foo, %object23 24 .globl _start25 .type _start, %function26_start:27 call func@plt28 movq func@GOTPCREL (%rip), %rax29 30# CHECK: Name: .rela.dyn31# CHECK-NEXT: Type: SHT_RELA32# CHECK-NEXT: Flags [33# CHECK-NEXT: SHF_ALLOC34# CHECK-NEXT: SHF_INFO_LINK35# CHECK-NEXT: ]36# CHECK-NEXT: Address:37# CHECK-NEXT: Offset:38# CHECK-NEXT: Size: 4839 40# CHECK: 0x0000000000000008 RELASZ 4841# CHECK: 0x0000000000000002 PLTRELSZ 2442