A very "strange" bug in gcc 2.96
Jakub Jelinek
jakub@redhat.com
Sun May 21 12:07:00 GMT 2000
On Sun, May 21, 2000 at 11:59:08AM -0700, H . J . Lu wrote:
> There is the ia32 asm ouput from gcc 2.96 with -O2. Please notice that
>
> jmp foo
>
> is generated, instead of
>
> call foo
> leave
> ret
>
> It is ok if foo () is a static function. But for extern, they are
> not the same. The GNU linker supports shared libraries even without
> -fPIC. With "jmp foo", it doesn't work anymore. If it is intentional,
> we should declare PIC is required for building shared libraries.
> Personally, I don't like compiler does this behind my back. It took
> me several days to figure out why things stopped working.
IMHO we should just declare that -foptimize-sibling-calls is incompatible
with non-fPIC shared libraries.
I don't think we should kill useful optimizations by default just because
people are lazy to compile with -fPIC.
It is not only ia32 where this breaks, although on SPARC this might change
(because linker can optimize the tailcall using call instruction but cannot
do it with sethi/jmpl).
Jakub
More information about the Binutils
mailing list