[to-be-committed][PATCH 0/2] MIPS: Properly handle o32 RELA relocations
Maciej W. Rozycki
macro@orcam.me.uk
Mon Oct 13 15:57:06 GMT 2025
Hi,
While working on tightening REL HI16/LO16 relocation pairing in response
to Alan's proposed fix[1] I have tripped over an issue with MIPS/VxWorks
targets where regressions have triggered in the GAS testsuite over missing
pairing despite the targets using RELA relocations.
Upon a closer look I've realised that with MIPS/VxWorks targets we output
"hybrid" relocations where despite the relocations being of the RELA type
the addend is also provided in the field being relocated. And it's not a
regression as it's always been like this with MIPS/VxWorks targets, ever
since support for them has been added[2].
Sadly no justification has been added with the original submission nor
any concern raised in the review, so it's not clear to me if this design
was a deliberate choice or the result of an oversight. In any case it's
questionable whether the resulting link object files actually comply with
the ELF specification, and there is breakage with the generic linker.
I could have well ignored this issue and work it around for the purpose
of REL HI16/LO16 relocation pairing with more code infrastructure, but I
chose to do this properly so as to reduce code clutter and in preparation
for possible more clean-ups with REL vs RELA relocation handling in the
MIPS backend. I can self-approve these changes, but I'll give people some
time to chime in, say a fortnight, just in case there's something I'm
missing here.
For the record these changes have caused no regression across any of the
MIPS targets.
References:
[1] "Move mips_hi16_list to mips_elf_section_data",
<https://inbox.sourceware.org/binutils/20231219093546.2112095-2-amodra@gmail.com/>
[2] commit 0a44bf6950b3 ("mips-vxworks support"),
<https://inbox.sourceware.org/binutils/877j6yavu7.fsf@talisman.home/>
Maciej
More information about the Binutils
mailing list