Re: Setting up of GP in static, non-PIC version of glibc?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Monday, February 25, 2002, at 11:34 AM, Ralf Baechle wrote:

> On Mon, Feb 25, 2002 at 04:16:20PM +0100, Hartvig Ekner wrote:
>
>>         .globl ENTRY_POINT
>>         .type ENTRY_POINT,@function
>> ENTRY_POINT:
>> #ifdef __PIC__
>>         SET_GP
>> #else
>>         la  $28, _gp
>> #endif
>>
>> Makes things work (this code ends in crt1.o). Is this the right place 
>> to
>> fix it?
>
> Non-PIC code doesn't use $gp, so any reference to $gp is a bug.  Note
> that we don't support global data optimization for ELF either that is,
> -G 0 is the default.

By default non-PIC code *does* use $gp due to the brain damage in gas; 
gas defaults to -G 8 unless told otherwise (-KPIC implies -G0 so we 
don't see this in PIC code.)  gcc won't know anything about this, of 
course.

What I'm doing in SUBTARGET_ASM_SPEC is to write something like 
"%{fno-pic: %{!G: -G0}}"--if we're not in PIC mode, pass -G0 to gas by 
default.

Anyway, once that's straightened out, -G8 does appear to work the way 
you'd expect, with the code that Hartvig pasted above---I had written a 
byte-for-byte identical patch :-)

Jay


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux