public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Cupertino Miranda <cupertino.miranda@oracle.com>
To: binutils@sourceware.org
Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com,
	cupertino.miranda@oracle.com, nickc@redhat.com
Subject: [PATCH 1/2] Reloc howto access broken for BPF
Date: Fri, 17 Mar 2023 16:00:44 +0000	[thread overview]
Message-ID: <20230317160045.502282-2-cupertino.miranda@oracle.com> (raw)
In-Reply-To: <20230317160045.502282-1-cupertino.miranda@oracle.com>

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


  reply	other threads:[~2023-03-17 16:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 16:00 [PATCH-BPF] Fixes in recent BPF commit Cupertino Miranda
2023-03-17 16:00 ` Cupertino Miranda [this message]
2023-03-17 16:00 ` [PATCH 2/2] Changed ld and gas BPF tests Cupertino Miranda
2023-03-20 14:57   ` Jose E. Marchesi
2023-03-20 15:31     ` Cupertino Miranda
2023-03-20 16:01       ` Jose E. Marchesi
2023-03-20 11:34 ` [PATCH-BPF] Fixes in recent BPF commit Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230317160045.502282-2-cupertino.miranda@oracle.com \
    --to=cupertino.miranda@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=elena.zannoni@oracle.com \
    --cc=jose.marchesi@oracle.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).