public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Frédéric Rivière" <frederic.riviere@microej.com>
To: binutils@sourceware.org
Subject: load of in-place relocation addend in AArch64
Date: Wed, 6 Dec 2023 09:08:37 +0100	[thread overview]
Message-ID: <aaffe6f2-af55-41f1-9ee4-a00fbdce6feb@microej.com> (raw)

Dear binutils group,

I'm actually working on an in-house compiler that generates AArch64 ELF 
object files.

I'm actually fighting with the following issue:

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).

The addend is initialized to 0 
(https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-aarch64.c;h=4faf642b422ffdff5c7879bff6bd08991b38eab8;hb=HEAD#l6931)

Then in elf32_arm_final_link_relocate, the addend is added from the 
relocation field "r_addend" (always 0 in case of REL)

https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-aarch64.c;h=4faf642b422ffdff5c7879bff6bd08991b38eab8;hb=HEAD#l5674

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

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

https://github.com/ARM-software/abi-aa/blob/2982a9f3b512a5bfdc9e3fea5d3b298f9165c36b/aaelf64/aaelf64.rst#572addends-and-pc-bias

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

Thanks for your help.

Best Regards,

--Frédéric RIVIERE


	





             reply	other threads:[~2023-12-06  8:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  8:08 Frédéric Rivière [this message]
2023-12-06 11:14 ` Nick Clifton
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=aaffe6f2-af55-41f1-9ee4-a00fbdce6feb@microej.com \
    --to=frederic.riviere@microej.com \
    --cc=binutils@sourceware.org \
    /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).