This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] MIPS: Use R_MICROMIPS_JALR rather than R_MIPS_JALR in microMIPS code
On Wed, 23 Nov 2016, Joseph Myers wrote:
> > OK to apply?
> It would probably make sense to add at least one mips16 and one microMIPS
> configuration to build-many-glibcs.py so build failures for such
> configurations are more readily detected (though I suppose a wrong
> relocation like this might not result in a build failure?).
In the R_MIPS_JALR case BFD linker code checks the opcode of the
instruction at the relocation location so that JALR and JR (for tail
calls) are substituted with BAL and J respectively, and the microMIPS
encodings are different, so no match happens and an invalid relocation is
silently ignored. So no build failure will ever happen indeed.
The R_MICROMIPS_JALR case is more complicated and currently not handled
by the BFD linker at all, with the relocation always silently ignored,
though I plan to get to it sometime. Most transformations are limited by
the assymetry of the 16-bit instruction set, however some can still be
made, e.g. JR16 can be changed into B16, and all can still be made in the
`-minsn32' mode (which is however hardly ever used). This is probably the
reason why it hasn't been implemented with the original microMIPS effort.
I have no idea what GOLD does with these relocations, although I suppose
any handling will have been semantically copied from the BFD linker.