[binutils-gdb] bfd/x86-64: support COFF relocation type R_AMD64_ABS
Jan Beulich
jbeulich@sourceware.org
Fri Nov 13 13:16:54 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5980ed87404e648c194bffcac561f778783ffb77
commit 5980ed87404e648c194bffcac561f778783ffb77
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Nov 13 14:14:14 2026 +0100
bfd/x86-64: support COFF relocation type R_AMD64_ABS
Much like ELF's R_X86_64_NONE it can be of use, and it is known in the
Windows world as well (as IMAGE_REL_AMD64_ABSOLUTE).
Diff:
---
bfd/coff-x86_64.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 2c434624052..331757d5c36 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -224,6 +224,7 @@ static bool
in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
{
return ! howto->pc_relative
+ && howto->type != R_AMD64_ABS
&& howto->type != R_AMD64_IMAGEBASE
&& howto->type != R_AMD64_SECREL
&& howto->type != R_AMD64_SECTION;
@@ -236,7 +237,19 @@ in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
static reloc_howto_type howto_table[] =
{
- EMPTY_HOWTO (0),
+ HOWTO (R_AMD64_ABS, /* type 0 */
+ 0, /* rightshift */
+ 0, /* size */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,
+ NULL, /* special_function */
+ "IMAGE_REL_AMD64_ABSOLUTE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
HOWTO (R_AMD64_DIR64, /* type 1*/
0, /* rightshift */
8, /* size */
@@ -811,6 +824,8 @@ coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_ty
{
switch (code)
{
+ case BFD_RELOC_NONE:
+ return howto_table + R_AMD64_ABS;
case BFD_RELOC_RVA:
return howto_table + R_AMD64_IMAGEBASE;
case BFD_RELOC_32:
More information about the Binutils-cvs
mailing list