howto install_addend
authorAlan Modra <amodra@gmail.com>
Mon, 16 Jan 2023 02:19:03 +0000 (12:49 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 19 Jan 2023 07:13:53 +0000 (17:43 +1030)
commit8fb06d7c320cf9d900cc59db5e3fc17980eec434
treefa8787e29dba8eaa793ef08cc74f26f19081f0a2
parentcc67f780ecdb8a5c50eaae9e04b7fc11ce23ddba
howto install_addend

This adds a new flag to the reloc howtos that can be used to
incrementally change targets over to simple bfd_install_relocation
that just installs the addend without any weird adjustments.
I've made a few other changes to bfd_install_relocation, removing dead
code and comments that are really only applicable to
bfd_perform_relocation.

There is also a reloc offset bounds check change.  I've moved the
check to where data is accessed, as it seems reasonable to me to not
perform the check unless it is needed.  There is precedence for this;
Relocations against absolute symbols already avoided the check.

I also tried always performing the reloc offset check, and ran into
testsuite failures due to _NONE and _ALIGN relocs at the end of
sections.  These likely would be fixed if all such reloc howtos had
size set to zero, but I would rather not edit lots of files when it
involves checking that target code does not use the size.

* reloc.c (struct reloc_howto_struct): Add install_addend.
(HOWTO_INSTALL_ADDEND): Define.
(HOWTO): Init new field with HOWTO_INSTALL_ADDEND.
(bfd_install_relocation): Remove comments copied from
bfd_perform_relocation that aren't applicable here.  Remove
code dealing with output_offset and output_section.  Just set
relocation to addend if install_addend.  Move reloc offset
bounds check to just before section data is accessed, avoiding
the check when data is not accessed.
* bfd-in2.h: Regenerate.
bfd/bfd-in2.h
bfd/reloc.c