GP Question

Ian Lance Taylor ian@airs.com
Thu Jul 1 00:00:00 GMT 1999


   Date: Wed, 9 Jun 1999 12:36:33 -0700
   From: Richard Henderson <rth@cygnus.com>

   On Tue, Jun 08, 1999 at 11:33:19PM -0700, mark@codesourcery.com wrote:
   > What code in elf32-mips.c is supposed to be responsible for assigning
   > a GP value for an executable?  I see mips_elf_final_gp, but it just
   > looks for a symbol named "_gp".

   The link script.  Which is a horrible horrible mistake, IMO.

Actually, I think the linker script is the correct way to set the GP
register value.  How else should it be set?  What else knows how the
small data sections are arranged?  Certainly the linker script should
be able to control the GP value, for complex situations.  I admit it
would make sense for the linker to pick a default value.

Setting it by setting a magic symbol name is definitely a hack.
Setting it in the linker script somehow is not.

Ian


More information about the Binutils mailing list