This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
A very "strange" bug in gcc 2.96
- To: egcs at egcs dot cygnus dot com
- Subject: A very "strange" bug in gcc 2.96
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Sun, 21 May 2000 11:59:08 -0700
- Cc: binutils at sourceware dot cygnus dot com
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.
Thanks.
H.J.
---x.c--
int foo ()
{
return 8;
}
int bar ()
{
return foo ();
}
---x.s--
.file "x.c"
.version "01.01"
gcc2_compiled.:
.text
.align 16
.globl foo
.type foo,@function
foo:
pushl %ebp
movl $8, %eax
movl %esp, %ebp
popl %ebp
ret
.Lfe1:
.size foo,.Lfe1-foo
.align 16
.globl bar
.type bar,@function
bar:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl %ebp, %esp
popl %ebp
jmp foo
.Lfe2:
.size bar,.Lfe2-bar
.ident "GCC: (GNU) 2.96 20000517 (experimental)"