This is the mail archive of the 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

On Thu, Aug 01, 2002 at 10:26:32AM +0930, Alan Modra wrote:
> The underlying confusion here is really that in
> 	call	L1
> L1:
> 	popl	%ebx
> 	addl	$_GLOBAL_OFFSET_TABLE_+[.-L1],%ebx
> we want the `.' in "$_GLOBAL_OFFSET_TABLE_+[.-L1]" to mean something
> quite different from its standard meaning.  It's a very poor choice of
> syntax, but I guess we're stuck with it.

That seems like an odd way to characterize it to me.  The meaning of .
and of the arithmetic is perfectly sane and normal here.  What is bizarre
is that (because of the magic symbol name) we produce a PC relative reloc
in this instruction.  Like any PC-relative reloc, the value being computed
is relative to the start of the instruction, but the location the reloc
applies to is a byte or two into the instruction where the immediate sits.
The . always means "start of this instruction", but the final value stuck
into the immediate slot needs to account for the distance between the
start of the instruction and the start of the immediate.

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