[PATCH] MIPS/binutils: microMIPS linker relaxation fixes

Richard Sandiford rdsandiford@googlemail.com
Tue Nov 15 17:01:00 GMT 2011
"Maciej W. Rozycki" <macro@codesourcery.com> writes:
>  So I have actually given it some more thought and my understanding of the 
> ABI remains that while orphaned R_MIPS_LO16 relocations are indeed 
> permitted, they still must be preceded by a corresponding R_MIPS_HI16, 
> although that is not required to be adjacent.  I believe this is only 
> permitted to allow cases like you quoted to avoid unnecessary extra code 
> to add missing R_MIPS_HI16 relocations.

There are still potential problems though.  We deliberately allow things like:

        lui     $4,%hi(foo)
        lw      $6,%lo(foo)($4)
        lw      $7,%lo(foo+4)($4)
        ...
        .align  8
foo:
        .word   X, Y

and foo is allowed to be in a text section.  Does your patch ensure that
foo remains 8-byte aligned, even if we relax code earlier in the section?

>  Do you have a better idea?

TBH, my inclination is to remove it from trunk too.  I imagine
GCC's LTO will catch many of the interesting cases (because then
we assemble the output object's text section at once).

Richard



More information about the Binutils mailing list