]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
MIPS HI16 and LO16 reloc howtos
authorAlan Modra <amodra@gmail.com>
Fri, 1 Mar 2024 21:40:34 +0000 (08:10 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 4 Apr 2024 10:32:40 +0000 (21:02 +1030)
commitf38e9921479a00b4e7a72a79088106859ec5fabc
tree770cb5581e3cf393fbe451e82c53296001b3fe3f
parentfab240554b76603775e8a0fec45c8b5808380684
MIPS HI16 and LO16 reloc howtos

All the HI16 reloc howtos should have a rightshift of 16, and all the
LO16 relocs shouldn't complain on overflow.  This was correct for
R_MIPS_LO16 and R_MIPS_LO16 (at least on the howto_table_rel entries),
and corresponding MIPS16, MICROMIPS and MIPS64 relocs, but not on many
other HI16 and LO16 relocs.

While we're at it, fix the HIGHER and HIGHEST rightshift too.

These changes are necessary to support addends outside the range
[0,32767] when those addends are stored in section contents.  Note
that some of the reloc howtos changed here will always have zero
addends (GOT_HI16, CALL_HI16).  Those don't really need changing, but
use what is clearly correct for hi16 relocs anyway.

PR 19977
* elf32-mips.c: Correct rightshift for HI16, HIGHER and HIGHEST
reloc howtos.  Correct complain_on_overflow for LO16 relocs.
* elf64-mips.c: Likewise.
* elfn32-mips.c: Likewise.
bfd/elf32-mips.c
bfd/elf64-mips.c
bfd/elfn32-mips.c