IA-32 gas _GLOBAL_OFFSET_TABLE_ handling bugs

Alan Modra amodra@bigpond.net.au
Wed Jul 31 18:31:00 GMT 2002


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.

  if (code == BFD_RELOC_32
      && GOT_symbol
      && fixp->fx_addsy == GOT_symbol)
    {
      /* We don't support GOTPC on 64bit targets.  */
      if (flag_code == CODE_64BIT)
	abort ();
      code = BFD_RELOC_386_GOTPC;
    }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list