Query in MIPS HI and LO relocations

Eric Christopher echristo@apple.com
Thu Apr 20 15:36:00 GMT 2006


On Apr 20, 2006, at 7:29 AM, Amarnath wrote:

> Hi all,
>
> I am having a query in the MIPS ABI. As per the SYSTEM V ABI,
> R_MIPS_HI16 relocation should be immediately followed by its
> corresponding R_MIPS_LO16.
>
> I would like to know whether this is specific to SYSTEM V architecture
> alone / the linker specification can be changed as per our own
> architecture.

You're free to do whatever you want. I'd look at some of the comments  
in elfxx-mips.c for guidance, e.g.

               /* The combined value is the sum of the HI16 addend,
                      left-shifted by sixteen bits, and the LO16
                      addend, sign extended.  (Usually, the code does
                      a `lui' of the HI16 value, and then an `addiu' of
                      the LO16 value.)

                      Scan ahead to find a matching LO16 relocation.

                      According to the MIPS ELF ABI, the R_MIPS_LO16
                      relocation must be immediately following.
                      However, for the IRIX6 ABI, the next relocation
                      may be a composed relocation consisting of
                      several relocations for the same address.  In
                      that case, the R_MIPS_LO16 relocation may occur
                      as one of these.  We permit a similar extension
                      in general, as that is useful for GCC.  */

-eric



More information about the Binutils mailing list