From: Jan Beulich Date: Mon, 15 Dec 2025 10:27:56 +0000 (+0100) Subject: bfd/ELF: fold BFD_RELOC__IRELATIVE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cad8bc7491334fd4cb6b5dd50df8462833591ef3;p=thirdparty%2Fbinutils-gdb.git bfd/ELF: fold BFD_RELOC__IRELATIVE There's no need to have a separate reloc per arch; just like for other more or less generic ones a single one will (mostly) do. Arm64, C-Sky, and KVX - sadly - are exceptions. --- diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 0b9cdb996a0..18f5cd960f8 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -3323,6 +3323,7 @@ enum bfd_reloc_code_real BFD_RELOC_HI16_PLTOFF, BFD_RELOC_HI16_S_PLTOFF, BFD_RELOC_8_PLTOFF, + BFD_RELOC_IRELATIVE, /* Size relocations. */ BFD_RELOC_SIZE32, @@ -3407,7 +3408,6 @@ enum bfd_reloc_code_real BFD_RELOC_SPARC_GOTDATA_OP_LOX10, BFD_RELOC_SPARC_GOTDATA_OP, BFD_RELOC_SPARC_JMP_IREL, - BFD_RELOC_SPARC_IRELATIVE, /* I think these are specific to SPARC a.out (e.g., Sun 4). */ BFD_RELOC_SPARC_BASE13, @@ -3864,7 +3864,6 @@ enum bfd_reloc_code_real BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_386_TLS_DESC, - BFD_RELOC_386_IRELATIVE, BFD_RELOC_386_GOT32X, /* x86-64/elf relocations. */ @@ -3892,7 +3891,6 @@ enum bfd_reloc_code_real BFD_RELOC_X86_64_GOTPC32_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL, BFD_RELOC_X86_64_TLSDESC, - BFD_RELOC_X86_64_IRELATIVE, BFD_RELOC_X86_64_PC32_BND, BFD_RELOC_X86_64_PLT32_BND, BFD_RELOC_X86_64_GOTPCRELX, @@ -4261,9 +4259,6 @@ enum bfd_reloc_code_real /* Annotation of BX instructions. */ BFD_RELOC_ARM_V4BX, - /* ARM support for STT_GNU_IFUNC. */ - BFD_RELOC_ARM_IRELATIVE, - /* Thumb1 relocations to support execute-only code. */ BFD_RELOC_ARM_THUMB_ALU_ABS_G0_NC, BFD_RELOC_ARM_THUMB_ALU_ABS_G1_NC, @@ -5606,9 +5601,6 @@ enum bfd_reloc_code_real BFD_RELOC_390_GOTPLT20, BFD_RELOC_390_TLS_GOTIE20, - /* STT_GNU_IFUNC relocation. */ - BFD_RELOC_390_IRELATIVE, - /* Score relocations. Low 16 bit for load/store. */ BFD_RELOC_SCORE_GPREL15, diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index ba477dc6e47..b3054b4efa5 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2043,7 +2043,7 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] = {BFD_RELOC_ARM_TLS_TPOFF32, R_ARM_TLS_TPOFF32}, {BFD_RELOC_ARM_TLS_IE32, R_ARM_TLS_IE32}, {BFD_RELOC_ARM_TLS_LE32, R_ARM_TLS_LE32}, - {BFD_RELOC_ARM_IRELATIVE, R_ARM_IRELATIVE}, + {BFD_RELOC_IRELATIVE, R_ARM_IRELATIVE}, {BFD_RELOC_ARM_GOTFUNCDESC, R_ARM_GOTFUNCDESC}, {BFD_RELOC_ARM_GOTOFFFUNCDESC, R_ARM_GOTOFFFUNCDESC}, {BFD_RELOC_ARM_FUNCDESC, R_ARM_FUNCDESC}, diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index dd2d49a2636..66a3a0aefa4 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -322,8 +322,8 @@ elf_i386_reloc_type_lookup (bfd *abfd, TRACE ("BFD_RELOC_386_TLS_DESC"); return &elf_howto_table[R_386_TLS_DESC - R_386_tls_offset]; - case BFD_RELOC_386_IRELATIVE: - TRACE ("BFD_RELOC_386_IRELATIVE"); + case BFD_RELOC_IRELATIVE: + TRACE ("BFD_RELOC_IRELATIVE"); return &elf_howto_table[R_386_IRELATIVE - R_386_tls_offset]; case BFD_RELOC_386_GOT32X: diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 80939c1c735..4c355f4db2e 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -289,7 +289,7 @@ elf_s390_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return &elf_howto_table[(int) R_390_GOTPLT20]; case BFD_RELOC_390_TLS_GOTIE20: return &elf_howto_table[(int) R_390_TLS_GOTIE20]; - case BFD_RELOC_390_IRELATIVE: + case BFD_RELOC_IRELATIVE: return &elf_howto_table[(int) R_390_IRELATIVE]; case BFD_RELOC_VTABLE_INHERIT: return &elf32_s390_vtinherit_howto; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 9e58bb21e70..d9192de79e4 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -317,7 +317,7 @@ elf_s390_reloc_type_lookup (bfd *abfd, return &elf_howto_table[(int) R_390_GOTPLT20]; case BFD_RELOC_390_TLS_GOTIE20: return &elf_howto_table[(int) R_390_TLS_GOTIE20]; - case BFD_RELOC_390_IRELATIVE: + case BFD_RELOC_IRELATIVE: return &elf_howto_table[(int) R_390_IRELATIVE]; case BFD_RELOC_VTABLE_INHERIT: return &elf64_s390_vtinherit_howto; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f39e0f66ba4..f5ab6b8bddb 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -266,7 +266,7 @@ static const struct elf_reloc_map x86_64_reloc_map[] = { BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, }, { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, }, { BFD_RELOC_X86_64_TLSDESC, R_X86_64_TLSDESC, }, - { BFD_RELOC_X86_64_IRELATIVE, R_X86_64_IRELATIVE, }, + { BFD_RELOC_IRELATIVE, R_X86_64_IRELATIVE, }, { BFD_RELOC_X86_64_PC32_BND, R_X86_64_PC32_BND, }, { BFD_RELOC_X86_64_PLT32_BND, R_X86_64_PLT32_BND, }, { BFD_RELOC_X86_64_GOTPCRELX, R_X86_64_GOTPCRELX, }, diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 780122619a1..4edbd93174f 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -567,7 +567,7 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *abfd, case BFD_RELOC_SPARC_JMP_IREL: return &sparc_jmp_irel_howto; - case BFD_RELOC_SPARC_IRELATIVE: + case BFD_RELOC_IRELATIVE: return &sparc_irelative_howto; case BFD_RELOC_VTABLE_INHERIT: diff --git a/bfd/libbfd.h b/bfd/libbfd.h index e6bb146e7d0..f5a08ebea18 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1099,6 +1099,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_HI16_PLTOFF", "BFD_RELOC_HI16_S_PLTOFF", "BFD_RELOC_8_PLTOFF", + "BFD_RELOC_IRELATIVE", "BFD_RELOC_SIZE32", "BFD_RELOC_SIZE64", "BFD_RELOC_68K_GLOB_DAT", @@ -1157,7 +1158,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_SPARC_GOTDATA_OP_LOX10", "BFD_RELOC_SPARC_GOTDATA_OP", "BFD_RELOC_SPARC_JMP_IREL", - "BFD_RELOC_SPARC_IRELATIVE", "BFD_RELOC_SPARC_BASE13", "BFD_RELOC_SPARC_BASE22", "BFD_RELOC_SPARC_10", @@ -1440,7 +1440,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_386_TLS_GOTDESC", "BFD_RELOC_386_TLS_DESC_CALL", "BFD_RELOC_386_TLS_DESC", - "BFD_RELOC_386_IRELATIVE", "BFD_RELOC_386_GOT32X", "BFD_RELOC_X86_64_GOT32", "BFD_RELOC_X86_64_COPY", @@ -1466,7 +1465,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_X86_64_GOTPC32_TLSDESC", "BFD_RELOC_X86_64_TLSDESC_CALL", "BFD_RELOC_X86_64_TLSDESC", - "BFD_RELOC_X86_64_IRELATIVE", "BFD_RELOC_X86_64_PC32_BND", "BFD_RELOC_X86_64_PLT32_BND", "BFD_RELOC_X86_64_GOTPCRELX", @@ -1757,7 +1755,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_LDC_SB_G1", "BFD_RELOC_ARM_LDC_SB_G2", "BFD_RELOC_ARM_V4BX", - "BFD_RELOC_ARM_IRELATIVE", "BFD_RELOC_ARM_THUMB_ALU_ABS_G0_NC", "BFD_RELOC_ARM_THUMB_ALU_ABS_G1_NC", "BFD_RELOC_ARM_THUMB_ALU_ABS_G2_NC", @@ -2541,7 +2538,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_390_GOT20", "BFD_RELOC_390_GOTPLT20", "BFD_RELOC_390_TLS_GOTIE20", - "BFD_RELOC_390_IRELATIVE", "BFD_RELOC_SCORE_GPREL15", "BFD_RELOC_SCORE_DUMMY2", "BFD_RELOC_SCORE_JMP", diff --git a/bfd/reloc.c b/bfd/reloc.c index 2fca454d26f..f85ec6da83e 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -1470,6 +1470,8 @@ ENUMX BFD_RELOC_HI16_S_PLTOFF ENUMX BFD_RELOC_8_PLTOFF +ENUMX + BFD_RELOC_IRELATIVE ENUMDOC For ELF. @@ -1619,8 +1621,6 @@ ENUMX BFD_RELOC_SPARC_GOTDATA_OP ENUMX BFD_RELOC_SPARC_JMP_IREL -ENUMX - BFD_RELOC_SPARC_IRELATIVE ENUMDOC SPARC ELF relocations. There is probably some overlap with other relocation types already defined. @@ -2402,8 +2402,6 @@ ENUMX BFD_RELOC_386_TLS_DESC_CALL ENUMX BFD_RELOC_386_TLS_DESC -ENUMX - BFD_RELOC_386_IRELATIVE ENUMX BFD_RELOC_386_GOT32X ENUMDOC @@ -2457,8 +2455,6 @@ ENUMX BFD_RELOC_X86_64_TLSDESC_CALL ENUMX BFD_RELOC_X86_64_TLSDESC -ENUMX - BFD_RELOC_X86_64_IRELATIVE ENUMX BFD_RELOC_X86_64_PC32_BND ENUMX @@ -3141,11 +3137,6 @@ ENUM ENUMDOC Annotation of BX instructions. -ENUM - BFD_RELOC_ARM_IRELATIVE -ENUMDOC - ARM support for STT_GNU_IFUNC. - ENUM BFD_RELOC_ARM_THUMB_ALU_ABS_G0_NC ENUMX @@ -5305,11 +5296,6 @@ ENUMX ENUMDOC Long displacement extension. -ENUM - BFD_RELOC_390_IRELATIVE -ENUMDOC - STT_GNU_IFUNC relocation. - ENUM BFD_RELOC_SCORE_GPREL15 ENUMDOC