load of in-place relocation addend in AArch64

Frédéric Rivière frederic.riviere@microej.com
Wed Dec 6 08:08:37 GMT 2023


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


	






More information about the Binutils mailing list