]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ld: bfd: sframe: fix incorrect r_addend in RELA entries users/ibhagat/try-sframe-reloc-link-v1
authorIndu Bhagat <indu.bhagat@oracle.com>
Sun, 2 Mar 2025 15:45:08 +0000 (07:45 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Sat, 8 Mar 2025 04:46:43 +0000 (20:46 -0800)
commit7af1304c2d7de050f2462e9e3c3b766dde036348
tree0c97a5d4f43cbe98832a42d2acd712df1b3b8ac8
parent141e6079582d2f8834674c76c5db7c762ab2ad1b
ld: bfd: sframe: fix incorrect r_addend in RELA entries

With the fix in GAS, we now use a different PC-relative RELA for
updating the SFrame FDE function start address: The value is the offset
of the start PC of the function from the start of the SFrame section.

When RELAs are output (e.g. for relocatable links), there is need to
adjust the r_addend.  This is because the r_addend values still have the
correct values for the _input_ SFrame section being linked / relocated.
The values must now be (before outputing the RELAs) with respect to the
_output_ SFrame section.

PS: This patch should be merged with the previous commits before final
commit (Otherwise the tests will fail).  It is currently a separate
patch as I would like to check if this is OK to do.  If such a "addend
fixup" is risky or wrong, it seems we will need a new type of RELOC for
SFrame sections.

bfd/
        * elf-bfd.h: New declaration.
        * elf-sframe.c (_bfd_elf_sframe_section_addend): New
definition.
        * elflink.c (elf_link_input_bfd): Fixup the r_addend of
SFrame RELAs.
bfd/elf-bfd.h
bfd/elf-sframe.c
bfd/elflink.c