]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86-64: Use x86_64_elf_howto_table for standard relocations
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 10 Feb 2025 00:38:57 +0000 (08:38 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 10 Feb 2025 00:44:02 +0000 (08:44 +0800)
For standard relocations, use x86_64_elf_howto_table, instead of calling
elf_x86_64_rtype_to_howto.

* elf64-x86-64.c (elf_x86_64_tls_transition): Use
x86_64_elf_howto_table, instead of elf_x86_64_rtype_to_howto.
(elf_x86_64_convert_load_reloc): Use x86_64_elf_howto_table,
instead of elf_x86_64_rtype_to_howto, for R_X86_64_PC32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
bfd/elf64-x86-64.c

index feb8827b3c1d116f7ef12bad367a3e3d0c681eed..9244f86405b2445bfcfb20fe13ccd0fd098f1a2e 100644 (file)
@@ -1649,8 +1649,8 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
     {
       reloc_howto_type *from, *to;
 
-      from = elf_x86_64_rtype_to_howto (abfd, from_type);
-      to = elf_x86_64_rtype_to_howto (abfd, to_type);
+      from = &x86_64_elf_howto_table[from_type];
+      to = &x86_64_elf_howto_table[to_type];
 
       if (from == NULL || to == NULL)
        return false;
@@ -2065,7 +2065,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
       r_type = R_X86_64_PC32;
 
       /* Skip if the converted relocation will overflow.  */
-      howto = elf_x86_64_rtype_to_howto (abfd, r_type);
+      howto = &x86_64_elf_howto_table[r_type];
       r = _bfd_final_link_relocate (howto, abfd, input_section,
                                    contents, irel->r_offset,
                                    relocation, raddend);
@@ -2250,7 +2250,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
              r_type = R_X86_64_PC32;
 
              /* Skip if the converted relocation will overflow.  */
-             howto = elf_x86_64_rtype_to_howto (abfd, r_type);
+             howto = &x86_64_elf_howto_table[r_type];
              r = _bfd_final_link_relocate (howto, abfd, input_section,
                                            contents, irel->r_offset,
                                            relocation,