[binutils-gdb] alpha: allocate R_ALPHA_IRELATIVE

Sam James sjames@sourceware.org
Sat Sep 5 08:34:48 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d7e70fd796d7e62b8425d88dd14e5658680072e

commit 0d7e70fd796d7e62b8425d88dd14e5658680072e
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Aug 31 22:33:10 2026 -0400

    alpha: allocate R_ALPHA_IRELATIVE
    
    R_ALPHA_IRELATIVE is the dynamic relocation that runs an IFUNC's
    resolver and stores the address it returns, applied by the dynamic
    linker or, in a static executable, by libc's startup code. Alpha had no
    number for it.
    
    Take 42, the first free number after R_ALPHA_TPREL16. The number is
    being claimed here and in the matching glibc submission; nothing else
    uses it, and no dynamic linker implements the relocation yet. glibc's
    elf/elf.h carries its own copy of these definitions, so the two have to
    be kept in sync.
    
    This adds only the number, the howto, the entry in the BFD reloc map
    that every other target with an IRELATIVE has, and the reloc class. The
    linker support that produces the relocation follows.

Diff:
---
 bfd/elf64-alpha.c   | 19 +++++++++++++++++++
 include/elf/alpha.h |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index a97acdc41de..86a59ba0937 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -1020,6 +1020,22 @@ static reloc_howto_type elf64_alpha_howto_table[] =
 	 0xffff,		/* src_mask */
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
+
+  /* A dynamic relocation to set a 64-bit field to the value returned by
+     the resolver whose address is the addend.  */
+  HOWTO (R_ALPHA_IRELATIVE,
+	 0,
+	 0,
+	 0,
+	 false,
+	 0,
+	 complain_overflow_dont,
+	 bfd_elf_generic_reloc,
+	 "IRELATIVE",
+	 false,
+	 0,
+	 0,
+	 true),
 };
 
 /* A mapping from BFD reloc types to Alpha ELF reloc types.  */
@@ -1062,6 +1078,7 @@ static const struct elf_reloc_map elf64_alpha_reloc_map[] =
   {BFD_RELOC_ALPHA_TPREL_HI16,		R_ALPHA_TPRELHI},
   {BFD_RELOC_ALPHA_TPREL_LO16,		R_ALPHA_TPRELLO},
   {BFD_RELOC_ALPHA_TPREL16,		R_ALPHA_TPREL16},
+  {BFD_RELOC_IRELATIVE,			R_ALPHA_IRELATIVE},
 };
 
 /* Given a BFD reloc type, return a HOWTO structure.  */
@@ -5310,6 +5327,8 @@ elf64_alpha_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
       return reloc_class_plt;
     case R_ALPHA_COPY:
       return reloc_class_copy;
+    case R_ALPHA_IRELATIVE:
+      return reloc_class_ifunc;
     default:
       return reloc_class_normal;
     }
diff --git a/include/elf/alpha.h b/include/elf/alpha.h
index 9b7b4cfe16a..f7a0f040508 100644
--- a/include/elf/alpha.h
+++ b/include/elf/alpha.h
@@ -118,6 +118,8 @@ START_RELOC_NUMBERS (elf_alpha_reloc_type)
   RELOC_NUMBER (R_ALPHA_TPRELLO, 40)
   RELOC_NUMBER (R_ALPHA_TPREL16, 41)
 
+  RELOC_NUMBER (R_ALPHA_IRELATIVE, 42)
+
 END_RELOC_NUMBERS (R_ALPHA_max)
 
 #define LITUSE_ALPHA_ADDR	0


More information about the Binutils-cvs mailing list