aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-01-07 07:49:16 +1030
committerAlan Modra <amodra@gmail.com>2022-01-18 11:18:45 +1030
commit1657026ccd8aa05a97cb35f1d9bff646937a244e (patch)
treeb21238f5d3e2c272a9d6a27642d7047a99b29a92 /ld/emulparams
parent97da0e2677c4a38df2406576428ec27d1da26e7c (diff)
downloadgdb-1657026ccd8aa05a97cb35f1d9bff646937a244e.zip
gdb-1657026ccd8aa05a97cb35f1d9bff646937a244e.tar.gz
gdb-1657026ccd8aa05a97cb35f1d9bff646937a244e.tar.bz2
PowerPC64 DT_RELR
PowerPC64 takes a more traditional approach to DT_RELR than x86. Count relative relocs in check_relocs, allocate space for them and output in the usual places but not doing so when enable_dt_relr. DT_RELR is sized in the existing ppc stub relaxation machinery, run via the linker's ldemul_after_allocation hook. DT_RELR is output in the same function that writes ppc stubs, run via ldemul_finish. This support should be considered experimental. bfd/ * elf64-ppc.c (struct ppc_local_dyn_relocs): Renamed from ppc_dyn_relocs. Add rel_count field. Update uses. (struct ppc_dyn_relocs): New. Replace all uses of elf_dyn_relocs. (struct ppc_link_hash_table): Add relr_alloc, relr_count and relr_addr. (ppc64_elf_copy_indirect_symbol): Merge rel_count. (ppc64_elf_check_relocs): Init rel_count for global and local syms. (dec_dynrel_count): Change r_info param to reloc pointer. Update all callers. Handle decrementing rel_count. (allocate_got): Don't allocate space for relative relocs when enable_dt_relr. (allocate_dynrelocs): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. Handle srelrdyn. (ppc_build_one_stub): Don't emit relative relocs on .branch_lt. (compare_relr_address, append_relr_off): New functions. (got_and_plt_relr_for_local_syms, got_and_plt_relr): Likewise. (ppc64_elf_size_stubs): Size .relr.syn. (ppc64_elf_build_stubs): Emit .relr.dyn. (build_global_entry_stubs_and_plt): Don't output relative relocs when enable_dt_relr. (write_plt_relocs_for_local_syms): Likewise. (ppc64_elf_relocate_section): Likewise. binutils/ * testsuite/lib/binutils-common.exp (supports_dt_relr): Add powerpc64. ld/ * emulparams/elf64ppc.sh: Source dt-relr.sh. * testsuite/ld-elf/dt-relr-2b.d: Adjust for powerpc. * testsuite/ld-elf/dt-relr-2c.d: Likewise. * testsuite/ld-elf/dt-relr-2d.d: Likewise. * testsuite/ld-elf/dt-relr-2e.d: Likewise.
Diffstat (limited to 'ld/emulparams')
-rw-r--r--ld/emulparams/elf64ppc.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh
index 15221b8..a18393b 100644
--- a/ld/emulparams/elf64ppc.sh
+++ b/ld/emulparams/elf64ppc.sh
@@ -1,5 +1,6 @@
source_sh ${srcdir}/emulparams/elf32ppccommon.sh
source_sh ${srcdir}/emulparams/plt_unwind.sh
+source_sh ${srcdir}/emulparams/dt-relr.sh
EXTRA_EM_FILE=ppc64elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-powerpc"