[binutils-gdb] Simplify elf64_alpha_relocate_section

Alan Modra via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b5aaee6990cf4227bf579debd8053e246e3cc097

commit b5aaee6990cf4227bf579debd8053e246e3cc097
Author: Alan Modra <[email protected]>
Date:   Sun May 3 21:06:37 2026 +0930

    Simplify elf64_alpha_relocate_section
    
    Prior to Nick implementing _bfd_elf_make_dynamic_reloc_section, alpha
    made no use of elf_section_data(sec)->sreloc to store the dynamic
    relocation section associated with sec.  After commit 83bac4b01082 the
    elf_section_data was set but not used in relocate_section.
    
            * elf64-alpha.c (elf64_alpha_relocate_section): Use
            elf_section_data to get dynamic relocation section associated
            with the input section.

Diff:
---
 bfd/elf64-alpha.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index f28b9b60265..0a63ca0bbdb 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -4117,7 +4117,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
   asection *sgot, *srel, *srelgot;
-  bfd *dynobj, *gotobj;
+  bfd *gotobj;
   bfd_vma gp, tp_base, dtp_base;
   struct alpha_elf_got_entry **local_got_entries;
   bool ret_val;
@@ -4136,20 +4136,8 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 
   symtab_hdr = &elf_symtab_hdr (input_bfd);
 
-  dynobj = elf_hash_table (info)->dynobj;
   srelgot = elf_hash_table (info)->srelgot;
-
-  if (input_section->flags & SEC_ALLOC)
-    {
-      const char *section_name;
-      section_name = (bfd_elf_string_from_elf_section
-		      (input_bfd, elf_elfheader(input_bfd)->e_shstrndx,
-		       _bfd_elf_single_rel_hdr (input_section)->sh_name));
-      BFD_ASSERT(section_name != NULL);
-      srel = bfd_get_linker_section (dynobj, section_name);
-    }
-  else
-    srel = NULL;
+  srel = elf_section_data (input_section)->sreloc;
 
   /* Find the gp value for this input bfd.  */
   gotobj = alpha_elf_tdata (input_bfd)->gotobj;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.