MIPS reloc howto special_function entries

Maciej W. Rozycki macro@orcam.me.uk
Sun Jul 6 18:25:31 GMT 2025


On Tue, 2 Apr 2024, Alan Modra wrote:

> The patch also corrects the mips16 and micromips rela tables to *not*
> use _bfd_mips_elf_{hi,lo}16_reloc.  These special functions are
> inappropriate for RELA relocs where addends are in the reloc rather
> than in the section contents.  See corresponding rela R_MIPS howtos.

 I have now pushed this part of your change, not directly related to PR 
19977, having fixed a long-standing issue with addend calculation in the 
generic linker complemented by a hack in `_bfd_mips_elf_lo16_reloc', now 
removed.

 The hack used to make REL targets work correctly and your fix, otherwise 
perfectly valid and desired, would regress the handling of R_MIPS16_HI16 
and R_MICROMIPS_HI16 relocations by calling `_bfd_mips_elf_generic_reloc' 
directly on RELA targets and therefore bypassing the hack.

 I seem to remember seeing this issue many years ago and I finally got to 
the bottom of it.  It didn't help that we barely have any coverage for the 
generic linker in the testsuite, now slightly expanded and with more test 
cases to come.

 I'll take care of the PR 19977 part of your change once I've fixed other 
issues that interfere with it.  This area seems a real can of worms, all 
owing to the silly choice to use the REL format for a target using data 
relocated by pieces.

 Thank you for your contribution.

  Maciej


More information about the Binutils mailing list