This is the mail archive of the
mailing list for the binutils project.
Re: IA-32 gas _GLOBAL_OFFSET_TABLE_ handling bugs
On Thu, Aug 01, 2002 at 10:42:18AM +0930, Alan Modra wrote:
> On Wed, Jul 31, 2002 at 03:20:58PM +0200, Jakub Jelinek wrote:
> > movl $_GLOBAL_OFFSET_TABLE_+[.-test], _GLOBAL_OFFSET_TABLE_
> That's an interesting one.
> > 4b: c7 05 00 00 00 00 4d movl $0x4d,0x0
> > 52: 00 00 00
> > 4d: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
> > 51: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
> Quite wrong. The first reloc should be R_386_32. This code in
> tc_gen_reloc needs extra checks as per output_imm.
Hmm, then you have
> movl _GLOBAL_OFFSET_TABLE_+[.-test], %eax
> 55: a1 55 00 00 00 mov 0x55,%eax
> 56: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
which has the wrong addend for R_386_GOTPC. It ought to be 0x56.
Perhaps the cleanest fix is to recognize the _GLOBAL_OFFSET_TABLE_+[.-sym]
syntax in i386_immediate (and i386_displacement), set the reloc type
to R_386_GOTPC there, then adjust addends for R_386_GOTPC later.
IBM OzLabs - Linux Technology Centre