[PATCH 03/11] alpha: allocate R_ALPHA_IRELATIVE
Matt Turner <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
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.
---
bfd/elf64-alpha.c | 19 +++++++++++++++++++
include/elf/alpha.h | 2 ++
2 files changed, 21 insertions(+)
diff --git ./bfd/elf64-alpha.c ./bfd/elf64-alpha.c
index a97acdc41de..86a59ba0937 100644
--- ./bfd/elf64-alpha.c
+++ ./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 ./include/elf/alpha.h ./include/elf/alpha.h
index 9b7b4cfe16a..f7a0f040508 100644
--- ./include/elf/alpha.h
+++ ./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
--
2.54.0