This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A very "strange" bug in gcc 2.96
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: A very "strange" bug in gcc 2.96
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Sun, 21 May 2000 21:12:35 +0200
- Cc: egcs at egcs dot cygnus dot com, binutils at sourceware dot cygnus dot com
- References: <20000521115908.A8267@lucon.org>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
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