[binutils-gdb] x86-64: Use x86_64_elf_howto_table for standard relocations

H.J. Lu hjl@sourceware.org
Mon Feb 10 00:45:49 GMT 2025


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

commit 64da7fa527463f505bd085cd29cf57d8d5b6e8ef
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 10 08:38:57 2025 +0800

    x86-64: Use x86_64_elf_howto_table for standard relocations
    
    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>

Diff:
---
 bfd/elf64-x86-64.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index feb8827b3c1..9244f86405b 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -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,


More information about the Binutils-cvs mailing list