A very "strange" bug in gcc 2.96

Eric W. Biederman eric@biederman.org
Sun May 21 15:23:00 GMT 2000


"H . J . Lu" <hjl@lucon.org> writes:

> 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.

What would need to change with gnu as and gnu ld to cause this to work?
Is it simply that as needs to emit a location record when jumping
to labels declared .globl?

Or do we need to emit a special variant of the jmp instruction to cause
gnu as to do the right thing? (yuck...)

In scheme this optimization is required, so it would be worth figuring
out how to do safely.

Eric



More information about the Binutils mailing list