This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A very "strange" bug in gcc 2.96


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

|> On Mon, May 22, 2000 at 12:00:15PM +1000, Alan Modra wrote:
|> > On 21 May 2000, Eric W. Biederman wrote:
|> > 
|> > > "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?
|> > 
|> > For x86, gas/config/tc-i386.c:md_estimate_size_before_relax needs to be
|> > taught how to handle this case properly.  (I think that's all that's
|> > needed...)
|> > 
|> 
|> That is only ia32. What about others?

AFAIK the m68k assembler does this correctly (ie, not relaxing references
to global symbols, see gas/config/tc-m68k.c:relaxable_symbol).  The ia32
assembler should do the same, IMHO.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]