[binutils-gdb] x86-64: use BFD_RELOC_32_PLT_PCREL in favor of custom type
Jan Beulich
jbeulich@sourceware.org
Fri Dec 5 09:21:31 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d181d22cb383ca7d90946a51994b4dfee34a5610
commit d181d22cb383ca7d90946a51994b4dfee34a5610
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Dec 5 10:19:03 2025 +0100
x86-64: use BFD_RELOC_32_PLT_PCREL in favor of custom type
No reason to have a separate type when the generic one has no (other)
meaning for this target.
Diff:
---
bfd/bfd-in2.h | 1 -
bfd/elf64-x86-64.c | 2 +-
bfd/libbfd.h | 1 -
bfd/reloc.c | 2 --
gas/config/tc-i386.c | 20 ++++++++++----------
5 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 03649e6a461..c89fe7ad8ac 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3871,7 +3871,6 @@ enum bfd_reloc_code_real
/* x86-64/elf relocations. */
BFD_RELOC_X86_64_GOT32,
- BFD_RELOC_X86_64_PLT32,
BFD_RELOC_X86_64_COPY,
BFD_RELOC_X86_64_GLOB_DAT,
BFD_RELOC_X86_64_JUMP_SLOT,
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 7b399ae6149..3eb2fe0aefa 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -233,7 +233,7 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
{ BFD_RELOC_64, R_X86_64_64, },
{ BFD_RELOC_32_PCREL, R_X86_64_PC32, },
{ BFD_RELOC_X86_64_GOT32, R_X86_64_GOT32,},
- { BFD_RELOC_X86_64_PLT32, R_X86_64_PLT32,},
+ { BFD_RELOC_32_PLT_PCREL, R_X86_64_PLT32,},
{ BFD_RELOC_X86_64_COPY, R_X86_64_COPY, },
{ BFD_RELOC_X86_64_GLOB_DAT, R_X86_64_GLOB_DAT, },
{ BFD_RELOC_X86_64_JUMP_SLOT, R_X86_64_JUMP_SLOT, },
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index a2883f964cf..6a2eff436a7 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1445,7 +1445,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_386_IRELATIVE",
"BFD_RELOC_386_GOT32X",
"BFD_RELOC_X86_64_GOT32",
- "BFD_RELOC_X86_64_PLT32",
"BFD_RELOC_X86_64_COPY",
"BFD_RELOC_X86_64_GLOB_DAT",
"BFD_RELOC_X86_64_JUMP_SLOT",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 6c65bbdd22b..45ba8612e97 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2415,8 +2415,6 @@ ENUMDOC
ENUM
BFD_RELOC_X86_64_GOT32
-ENUMX
- BFD_RELOC_X86_64_PLT32
ENUMX
BFD_RELOC_X86_64_COPY
ENUMX
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 03eaf63701f..54c66789522 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1398,7 +1398,7 @@ gotrel[] =
BFD_RELOC_64_PLTOFF },
{ .bitfield = { .imm64 = 1 } }, true },
{ STRING_COMMA_LEN ("PLT"), { BFD_RELOC_386_PLT32,
- BFD_RELOC_X86_64_PLT32 },
+ BFD_RELOC_32_PLT_PCREL },
OPERAND_TYPE_IMM32_32S_DISP32, false },
{ STRING_COMMA_LEN ("GOTPLT"), { _dummy_first_bfd_reloc_code_real,
BFD_RELOC_X86_64_GOTPLT64 },
@@ -4140,7 +4140,7 @@ tc_i386_fix_adjustable (fixS *fixP)
/* Resolve PLT32 relocation against local symbol to section only for
PC-relative relocations. */
if (fixP->fx_r_type == BFD_RELOC_386_PLT32
- || fixP->fx_r_type == BFD_RELOC_X86_64_PLT32)
+ || fixP->fx_r_type == BFD_RELOC_32_PLT_PCREL)
return fixP->fx_pcrel;
return 1;
}
@@ -11780,7 +11780,7 @@ output_jump (void)
if (flag_code == CODE_64BIT && size == 4
&& jump_reloc == NO_RELOC && i.op[0].disps->X_add_number == 0
&& need_plt32_p (i.op[0].disps->X_add_symbol))
- jump_reloc = BFD_RELOC_X86_64_PLT32;
+ jump_reloc = BFD_RELOC_32_PLT_PCREL;
#endif
jump_reloc = reloc (size, 1, 1, jump_reloc);
@@ -13426,7 +13426,7 @@ x86_cons (expressionS *exp, int size)
*input_line_pointer = c;
}
else if ((got_reloc == BFD_RELOC_386_PLT32
- || got_reloc == BFD_RELOC_X86_64_PLT32)
+ || got_reloc == BFD_RELOC_32_PLT_PCREL)
&& exp->X_op != O_symbol)
{
char c = *input_line_pointer;
@@ -15770,7 +15770,7 @@ elf_symbol_resolved_in_segment_p (symbolS *fr_symbol, offsetT fr_var)
switch ((enum bfd_reloc_code_real) fr_var)
{
case BFD_RELOC_386_PLT32:
- case BFD_RELOC_X86_64_PLT32:
+ case BFD_RELOC_32_PLT_PCREL:
/* Symbol with PLT relocation may be preempted. */
return 0;
default:
@@ -16231,7 +16231,7 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
&& fragP->tc_frag_data.code == CODE_64BIT
&& fragP->fr_offset == 0
&& need_plt32_p (fragP->fr_symbol))
- reloc_type = BFD_RELOC_X86_64_PLT32;
+ reloc_type = BFD_RELOC_32_PLT_PCREL;
#endif
old_fr_fix = fragP->fr_fix;
@@ -16635,7 +16635,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
switch (fixP->fx_r_type)
{
case BFD_RELOC_386_PLT32:
- case BFD_RELOC_X86_64_PLT32:
+ case BFD_RELOC_32_PLT_PCREL:
/* Make the jump instruction point to the address of the operand.
At runtime we merely add the offset to the actual PLT entry.
NB: Subtract the offset size only for jump instructions. */
@@ -18352,7 +18352,7 @@ i386_validate_fix (fixS *fixp)
if (fixp->fx_addsy
&& fixp->fx_pcrel
&& (fixp->fx_r_type == BFD_RELOC_386_PLT32
- || fixp->fx_r_type == BFD_RELOC_X86_64_PLT32)
+ || fixp->fx_r_type == BFD_RELOC_32_PLT_PCREL)
&& symbol_section_p (fixp->fx_addsy))
fixp->fx_r_type = BFD_RELOC_32_PCREL;
if (!object_64bit)
@@ -18428,7 +18428,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
#endif
/* Fall through. */
- case BFD_RELOC_X86_64_PLT32:
+ case BFD_RELOC_32_PLT_PCREL:
case BFD_RELOC_X86_64_GOT32:
case BFD_RELOC_X86_64_GOTPCREL:
case BFD_RELOC_X86_64_GOTPCRELX:
@@ -18595,7 +18595,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
else
switch (code)
{
- case BFD_RELOC_X86_64_PLT32:
+ case BFD_RELOC_32_PLT_PCREL:
case BFD_RELOC_X86_64_GOT32:
case BFD_RELOC_X86_64_GOTPCREL:
case BFD_RELOC_X86_64_GOTPCRELX:
More information about the Binutils-cvs
mailing list