public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: Cupertino Miranda <cupertino.miranda@oracle.com>
Cc: binutils@sourceware.org, nickc@redhat.com, elena.zannoni@oracle.com
Subject: Re: [PATCH] bpf: Added linker support for R_BPF_64_NODYLD32.
Date: Wed, 03 Jan 2024 11:34:12 +0100	[thread overview]
Message-ID: <874jfug0yj.fsf@oracle.com> (raw)
In-Reply-To: <20231220132305.459519-1-cupertino.miranda@oracle.com> (Cupertino Miranda's message of "Wed, 20 Dec 2023 13:23:05 +0000")


Hi Cuper.

> Hi everyone,
>
> This patch is in context of Nick Cliftons request in thread:
>   https://sourceware.org/pipermail/binutils/2023-October/130194.html
> due to bug reported in:
>   https://bugzilla.redhat.com/show_bug.cgi?id=2245296
>
> For the time being the linker is not used in BPF infrastructure.
> Considering that and without a proper way to validate the code, the
> following patch is what I think is missing in order to add linker
> support for the particular relocation.
>
> Looking forward to your review.
>
> Best regards,
> Cupertino
>
> This patch adds linker support to patch R_BPF_64_NODYLD32 relocations.
> The implementation was based on comments and code in LLVM, as the GNU
> toolchain does not uses this relocation type.
> ---
>  bfd/elf64-bpf.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c
> index aefad7da5ac..5820dd3d7d4 100644
> --- a/bfd/elf64-bpf.c
> +++ b/bfd/elf64-bpf.c
> @@ -276,6 +276,7 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
>            }
>  	case R_BPF_64_ABS64:
>  	case R_BPF_64_ABS32:
> +	case R_BPF_64_NODYLD32:

I would add here a comment explaining that R_BPF_64_NODYLD32 shall be
handled/resolved like R_BPF_64_ABS32 and that it differs from ABS32 only
in that the LLVM execution engine is not supposed to resolve it.

Given that, the patch is OK.
Thanks!

>  	  {
>  	    addend = bfd_get (howto->bitsize, input_bfd, where);
>  	    relocation += addend;

  reply	other threads:[~2024-01-03 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 13:23 Cupertino Miranda
2024-01-03 10:34 ` Jose E. Marchesi [this message]
2024-01-08 10:16   ` Cupertino Miranda
2024-01-08 18:45     ` Jose E. Marchesi
2024-01-08 20:45       ` Cupertino Miranda

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=874jfug0yj.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=elena.zannoni@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).