This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IA-32 gas _GLOBAL_OFFSET_TABLE_ handling bugs


I don't have access to any non-gas x86 assemblers so I have no
idea what they might do.  It's definitely all loopy if you ask me.
Why there was been magic attached to _GLOBAL_OFFSET_TABLE_ rather
than just a @GOTPC suffix is beyond me.

The GCC features in question are quite young and still in flux,
so they can certainly change.  The GCC code seems to have been
written on the assumption that a normal non-PIC reloc cannot be 
generated for _GLOBAL_OFFSET_TABLE_, but that is just a guess.
It might just have been the intention to keep the code closer to
the PIC case by just replacing the call+pop with the movl, or 
just unintentional laziness, I don't know.

I don't know what to presume about "should" for the screwy magic,
'cause it's screwy magic.  But with that proviso, I would tend to
agree with you.

On Thu, Aug 01, 2002 at 12:08:18PM +0930, Alan Modra wrote:
> On Wed, Jul 31, 2002 at 06:31:15PM -0700, Roland McGrath wrote:
> > Actually, the case generated by GCC that bit me does not use `.' at all.
> > It looks like this:
> > 
> > 	movl	$.L30, %eax
> > .L30:
> > 	addl	$_GLOBAL_OFFSET_TABLE_, %eax
> 
> Eep.  We really have dug a pit for ourselves with this syntax.  Does
> this work on other assemblers?  Can gcc be fixed to not emit the
> above?
> 
> This is really taking "do what I mean rather than what I say" to new
> heights.  Presumably, the magic _GLOBAL_OFFSET_TABLE_ transformations
> should only happen on "add" or "lea" type instructions, so that
> 
>  mov $_GLOBAL_OFFSET_TABLE_, %eax
> 
> does the right thing.
> 
> -- 
> Alan Modra
> IBM OzLabs - Linux Technology Centre


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