[binutils-gdb] x86-64: use BFD_RELOC_64_PLTOFF in favor of custom type
Jan Beulich
jbeulich@sourceware.org
Fri Dec 5 09:21:26 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=168846aabe352c0556549cfad9c39d5fb58d5c31
commit 168846aabe352c0556549cfad9c39d5fb58d5c31
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Dec 5 10:18:34 2025 +0100
x86-64: use BFD_RELOC_64_PLTOFF 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 | 16 ++++++----------
5 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 1d2e2c380a4..03649e6a461 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3892,7 +3892,6 @@ enum bfd_reloc_code_real
BFD_RELOC_X86_64_GOTPCREL64,
BFD_RELOC_X86_64_GOTPC64,
BFD_RELOC_X86_64_GOTPLT64,
- BFD_RELOC_X86_64_PLTOFF64,
BFD_RELOC_X86_64_GOTPC32_TLSDESC,
BFD_RELOC_X86_64_TLSDESC_CALL,
BFD_RELOC_X86_64_TLSDESC,
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 1bffced9a30..7b399ae6149 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -260,7 +260,7 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
{ BFD_RELOC_X86_64_GOTPCREL64,R_X86_64_GOTPCREL64, },
{ BFD_RELOC_X86_64_GOTPC64, R_X86_64_GOTPC64, },
{ BFD_RELOC_X86_64_GOTPLT64, R_X86_64_GOTPLT64, },
- { BFD_RELOC_X86_64_PLTOFF64, R_X86_64_PLTOFF64, },
+ { BFD_RELOC_64_PLTOFF, R_X86_64_PLTOFF64, },
{ BFD_RELOC_SIZE32, R_X86_64_SIZE32, },
{ BFD_RELOC_SIZE64, R_X86_64_SIZE64, },
{ BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, },
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index f349e342766..a2883f964cf 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1466,7 +1466,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_X86_64_GOTPCREL64",
"BFD_RELOC_X86_64_GOTPC64",
"BFD_RELOC_X86_64_GOTPLT64",
- "BFD_RELOC_X86_64_PLTOFF64",
"BFD_RELOC_X86_64_GOTPC32_TLSDESC",
"BFD_RELOC_X86_64_TLSDESC_CALL",
"BFD_RELOC_X86_64_TLSDESC",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index a44b99596a8..6c65bbdd22b 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2457,8 +2457,6 @@ ENUMX
BFD_RELOC_X86_64_GOTPC64
ENUMX
BFD_RELOC_X86_64_GOTPLT64
-ENUMX
- BFD_RELOC_X86_64_PLTOFF64
ENUMX
BFD_RELOC_X86_64_GOTPC32_TLSDESC
ENUMX
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index cb57ecd037e..03eaf63701f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1395,7 +1395,7 @@ gotrel[] =
{ .bitfield = { .imm32 = 1, .imm64 = 1 } }, false },
#endif
{ STRING_COMMA_LEN ("PLTOFF"), { _dummy_first_bfd_reloc_code_real,
- BFD_RELOC_X86_64_PLTOFF64 },
+ BFD_RELOC_64_PLTOFF },
{ .bitfield = { .imm64 = 1 } }, true },
{ STRING_COMMA_LEN ("PLT"), { BFD_RELOC_386_PLT32,
BFD_RELOC_X86_64_PLT32 },
@@ -3965,15 +3965,11 @@ _reloc (unsigned int size,
if (size == 8)
switch (other)
{
+ case BFD_RELOC_64_PLTOFF:
+ case BFD_RELOC_X86_64_GOTPLT64:
+ return other;
case BFD_RELOC_X86_64_GOT32:
return BFD_RELOC_X86_64_GOT64;
- break;
- case BFD_RELOC_X86_64_GOTPLT64:
- return BFD_RELOC_X86_64_GOTPLT64;
- break;
- case BFD_RELOC_X86_64_PLTOFF64:
- return BFD_RELOC_X86_64_PLTOFF64;
- break;
case BFD_RELOC_X86_64_GOTPC32:
other = BFD_RELOC_X86_64_GOTPC64;
break;
@@ -18471,7 +18467,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
case BFD_RELOC_X86_64_GOTPCREL64:
case BFD_RELOC_X86_64_GOTPC64:
case BFD_RELOC_X86_64_GOTPLT64:
- case BFD_RELOC_X86_64_PLTOFF64:
+ case BFD_RELOC_64_PLTOFF:
case BFD_RELOC_X86_64_GOTPC32_TLSDESC:
case BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC:
case BFD_RELOC_X86_64_CODE_5_GOTPC32_TLSDESC:
@@ -18585,7 +18581,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
case BFD_RELOC_X86_64_GOTPCREL64:
case BFD_RELOC_X86_64_GOTPC64:
case BFD_RELOC_X86_64_GOTPLT64:
- case BFD_RELOC_X86_64_PLTOFF64:
+ case BFD_RELOC_64_PLTOFF:
as_bad_where (fixp->fx_file, fixp->fx_line,
_("cannot represent relocation type %s in x32 mode"),
bfd_get_reloc_code_name (code));
More information about the Binutils-cvs
mailing list