Is this a bug in GNU ld?
Wolfram Gloger
wmglo@dent.med.uni-muenchen.de
Wed Dec 1 01:42:00 GMT 1999
[wrong code generated on mips]
> 688 is the offset from the beginning of the caller to the beginning of the
> callee (they're in the same file). Presumably, then, ld will change the lw
> into $t9 to load the address of the caller. What actually gets generated,
> though, is
>
> cd28: 8f99801c lw $t9,-32740($gp)
> cd2c: 00000000 nop
> cd30: 2739cf90 addiu $t9,$t9,-12400
> cd34: 00000000 nop
> cd38: 0320f809 jalr $t9
>
> The offset -32740 points to an uninitialized memory location, and -12400
> would be the offset to the callee from the start of the text section if it
> weren't sign-extended.
>
> I'm running Redhat 6.0, gcc version egcs-2.90.29 980515 (egcs-1.0.3
> release), and binutils version 2.8.1 (mips-linux), using BFD version 2.8.1.
Some months ago I was looking at random crashes on mips-irix6 that
could be tracked down to instructions just like the above. That only
happened when compiling with optimization, though, and at the time I
was using egcs-1.1.
So I would encourage you to try to turn off optimization, or even
better to upgrade to gcc-2.95.2 (my problem was fixed in gcc-2.95).
Regards,
Wolfram.
More information about the Gcc
mailing list