[PATCH 1/2] Reloc howto access broken for BPF

Cupertino Miranda cupertino.miranda@oracle.com
Fri Mar 17 16:00:44 GMT 2023


Forgot to change the logic to access the reloc howto from
bpf_elf_relocate_section.
Problem was introduced in previous BPF commit.
---
 bfd/elf64-bpf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c
index ef34d62df01..65418d1d740 100644
--- a/bfd/elf64-bpf.c
+++ b/bfd/elf64-bpf.c
@@ -190,6 +190,7 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
   for (rel = relocs; rel < relend; rel ++)
     {
       reloc_howto_type *	   howto;
+      unsigned int		   howto_index;
       unsigned long		   r_symndx;
       Elf_Internal_Sym *	   sym;
       asection *		   sec;
@@ -203,7 +204,9 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 
       r_type = ELF64_R_TYPE (rel->r_info);
       r_symndx = ELF64_R_SYM (rel->r_info);
-      howto  = bpf_elf_howto_table + ELF64_R_TYPE (rel->r_info);
+
+      howto_index = bpf_index_for_rtype (ELF64_R_TYPE (rel->r_info));
+      howto  = &bpf_elf_howto_table[howto_index];
       h      = NULL;
       sym    = NULL;
       sec    = NULL;
-- 
2.30.2



More information about the Binutils mailing list