]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ALPHA_R_OP_STORE
authorAlan Modra <amodra@gmail.com>
Mon, 26 May 2025 02:16:05 +0000 (11:46 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 26 May 2025 23:32:12 +0000 (09:02 +0930)
commit998d4443ea1e7da6ffa86abc95502152fda80f35
tree1f4b8af6e4ad8343c7295aaddd4c0a4056f21f51
parent2adbf167cae8812417a38d834e6878540632e0b8
ALPHA_R_OP_STORE

In commit db4ab410dec3 I rewrote OP_STORE handling to support writing
near the end of a section.  The rewrite had some bugs, fixed in commit
3e02c4891dcb.  However I wasn't entirely happy with the code writing
the bitfield:
- it doesn't support 64-bit fields with a bit offset,
- the code is duplicated and inelegant,
- the stack ought to be popped whenever seeing one of these relocs,
  even if the reloc can't be applied.
This patch fixes all of the above.

In addition, it is clear from the OP_STORE description in the ABI that
a 64-bit field is encoded as 0 in r_size, so I've decoded that in
alpha_ecoff_swap_reloc_in.  The aborts there are not appropriate as
they can be triggered by user input (fuzzed object files).  Also,
stack underflow wasn't checked in alpha_relocate_section.

* coff-alpha.c (alpha_ecoff_swap_reloc_in): Replace aborts
with asserts.  Decode ALPHA_R_OP_STORE r_size of zero.
(write_bit_field): New function.
(alpha_ecoff_get_relocated_section_contents): Use it.
(alpha_relocate_section): Here too.  Catch stack underflow.
bfd/coff-alpha.c