There is one g++ LTO test case (g++.lto/20090303) that fails on sparc,
it compiles the intermediate objects with -fPIC but the final
compilation creates an executable.

The problem is that when LTO re-instantiates the options for the
individual builds, the proper ASM specs of the target are not
executed, so in this case "-K PIC" is not passed down to the assembler
in response to "-fPIC".

As a consequence, relocations against _GLOBAL_OFFSET_TABLE_
in code like this:

        sethi   %hi(_GLOBAL_OFFSET_TABLE_), %g1

use the R_SPARC_HI22 relocation instead of R_SPARC_PC22.

Thus the program crashes.

I couldn't figure out immediately how to fix this as the
way LTO does spec overriding and such looked non-trivial.

Thanks.

Reply via email to