or1k: Avoid R_OR1K_GOT16 signed overflow by using special howto
authorStafford Horne <shorne@gmail.com>
Wed, 2 Feb 2022 11:11:56 +0000 (20:11 +0900)
committerStafford Horne <shorne@gmail.com>
Wed, 2 Feb 2022 11:11:56 +0000 (20:11 +0900)
commitc7c6e55b60b072cdcc5c3fc27164b890a0f34520
tree107c07240dc4eb049999322d336551e7fd8212fd
parent14f983573850419b8354a112f6ab048cb4bc130d
or1k: Avoid R_OR1K_GOT16 signed overflow by using special howto

Previously when fixing PR 21464 we masked out upper bits of the
relocation value in order to avoid overflow complaints when acceptable.
It turns out this does not work when the relocation value ends up being
signed.

To fix this this patch introduces a special howto with
complain_on_overflow set to complain_overflow_dont.  This is used in
place of the normal R_OR1K_GOT16 howto when we detect R_OR1K_GOT_AHI16
relocations.

bfd/ChangeLog:

PR 28735
* elf32-or1k.c (or1k_elf_got16_no_overflow_howto): Define.
(or1k_elf_relocate_section): Use new howto instead of trying to
mask out relocation bits.
bfd/ChangeLog
bfd/elf32-or1k.c