public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: "Frédéric Rivière" <frederic.riviere@microej.com>,
	binutils@sourceware.org
Subject: Re: load of in-place relocation addend in AArch64
Date: Wed, 6 Dec 2023 11:14:42 +0000	[thread overview]
Message-ID: <2747d24e-1331-4970-8660-421f4479dc62@redhat.com> (raw)
In-Reply-To: <aaffe6f2-af55-41f1-9ee4-a00fbdce6feb@microej.com>

Hi Frédéric,

> My compiler generates REL relocations with an in-place addend but the addend is not taken into account for computing the final relocated symbol address (S+A).

Is there any particular reason for this ?

Ie, if your compiler generated RELA relocations then all of your problems
with the binutils should go away...

> So it seems the that I'm the first one that generates REL relocations for AArch64 target.

True.

> However, I don't see any limitation on using REL relocations in the AARCH64 ABI.

Correct.  There are - in theory - allowed.

> I would appreciate any comment/feedback that would help me understanding the reasons behind that.

As a general rule RELA relocations are preferable in that they
are simpler - it is easier to extract the addend - and in theory
they have the possibility to express a wider range of addends
than would be available to REL relocations.

Have you tried modifying the AArch64 code in the BFD library to
support REL relocations ?  In theory all that you need to do is
to change a few lines in bfd/elfnn-aarch64.c:

   #define elf_backend_may_use_rel_p      0

and maybe:

   #define elf_backend_may_use_rela_p     1
   #define elf_backend_default_use_rela_p 1
   #define elf_backend_rela_normal	 1

In practice I am pretty sure that there will be assumptions of RELA
relocs elsewhere in the AArch64 specific code, so I doubt it will be
as simple as I have suggested.

Cheers
   Nick


  reply	other threads:[~2023-12-06 11:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  8:08 Frédéric Rivière
2023-12-06 11:14 ` Nick Clifton [this message]
2023-12-06 15:02   ` Frédéric Rivière
2023-12-06 15:31     ` Nick Clifton
2023-12-06 16:56       ` Frédéric Rivière
2023-12-07 17:16         ` Nick Clifton
2023-12-11  7:51           ` Frédéric Rivière
2024-03-28  7:10             ` Fangrui Song

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=2747d24e-1331-4970-8660-421f4479dc62@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=frederic.riviere@microej.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).