From 4a9699735b04d4629bd3dc418c265e7f0bc1f9ce Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 29 Aug 2018 13:28:21 +0930 Subject: PowerPC64 higher REL16 relocations There are occasions where someone might want to build a 64-bit pc-relative offset from 16-bit pieces. This adds the necessary REL16 relocs corresponding to existing ADDR16 relocs that can be used to build 64-bit absolute values. include/ * elf/ppc64.h (R_PPC64_REL16_HIGH, R_PPC64_REL16_HIGHA), (R_PPC64_REL16_HIGHER, R_PPC64_REL16_HIGHERA), (R_PPC64_REL16_HIGHEST, R_PPC64_REL16_HIGHESTA): Define. (R_PPC64_LO_DS_OPT, R_PPC64_16DX_HA): Bump value. bfd/ * reloc.c (BFD_RELOC_PPC64_REL16_HIGH, BFD_RELOC_PPC64_REL16_HIGHA), (BFD_RELOC_PPC64_REL16_HIGHER, BFD_RELOC_PPC64_REL16_HIGHERA), (BFD_RELOC_PPC64_REL16_HIGHEST, BFD_RELOC_PPC64_REL16_HIGHESTA): Define. * elf64-ppc.c (ppc64_elf_howto_raw): Add new REL16 howtos. (ppc64_elf_reloc_type_lookup): Translate new REL16 relocs. (ppc64_elf_check_relocs, ppc64_elf_relocate_section): Handle them. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): Allow ADDR16 HIGH, HIGHA, HIGHER, HIGHERA, HIGHEST, and HIGHESTA relocs. Group 16-bit relocs. * config/tc-ppc.c (md_apply_fix): Translate those ADDR16 relocs to REL16 when pcrel. Sort relocs. --- bfd/libbfd.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bfd/libbfd.h') diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 6c1e1ea..34f05dd 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1467,6 +1467,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_PPC64_PLTGOT16_LO_DS", "BFD_RELOC_PPC64_ADDR16_HIGH", "BFD_RELOC_PPC64_ADDR16_HIGHA", + "BFD_RELOC_PPC64_REL16_HIGH", + "BFD_RELOC_PPC64_REL16_HIGHA", + "BFD_RELOC_PPC64_REL16_HIGHER", + "BFD_RELOC_PPC64_REL16_HIGHERA", + "BFD_RELOC_PPC64_REL16_HIGHEST", + "BFD_RELOC_PPC64_REL16_HIGHESTA", "BFD_RELOC_PPC64_ADDR64_LOCAL", "BFD_RELOC_PPC64_ENTRY", "BFD_RELOC_PPC64_REL24_NOTOC", -- cgit v1.1