This is the mail archive of the binutils@sourceware.cygnus.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]

Re: GP Question


On Wed, Jun 09, 1999 at 06:48:49PM -0400, Ian Lance Taylor wrote:
> 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?

final_link knows how to set it.  It can tell where all the
SHF_MIPS_GPREL sections wound up and choose a span that
covers them all.

Now I remember what I'd been doing once upon a time --

#define ELF_MIPS_GP_OFFSET(abfd) (SGI_COMPAT (abfd) ? 0x7ff0 : 0x8000)

Currently SGI_COMPAT is always 1.  This macro is wrong when
SGI_COMPAT is 0, since the link script hard codes 0x7ff0.

Arguably it's this macro and its use in mips_elf_relocate_got_local
that is wrong.

> Certainly the linker script should be able to control the GP value,
> for complex situations.

I can't think of any sufficiently complex situation that requires
the user to be able to control the exact _gp address.  Either 
there exists a 64k span that covers all GPREL sections or not.
What else is there?


r~

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