Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Static variables and "gp"
@ 2003-03-02  9:07 Gilad Benjamini
  2003-03-02 11:18 ` Ralf Baechle
  0 siblings, 1 reply; 5+ messages in thread
From: Gilad Benjamini @ 2003-03-02  9:07 UTC (permalink / raw)
  To: linux-mips

Hi,
How can I force a specific static variable to be used by the "gp" register
rather than by a two-step load ?
Compiling a mips-linux using gcc.

I was poking around for information and stumbled across the "-G" flag,
the "__attribute__ ((section (".sdata")))" (or sbss), the "-msdata" but to no avail.
I only got more confused.

Any help will be appreciated

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Static variables and "gp"
  2003-03-02  9:07 Gilad Benjamini
@ 2003-03-02 11:18 ` Ralf Baechle
  2003-03-03 12:54   ` Johannes Stezenbach
  0 siblings, 1 reply; 5+ messages in thread
From: Ralf Baechle @ 2003-03-02 11:18 UTC (permalink / raw)
  To: Gilad Benjamini; +Cc: linux-mips

On Sun, Mar 02, 2003 at 09:07:28AM +0000, Gilad Benjamini wrote:

> How can I force a specific static variable to be used by the "gp" register
> rather than by a two-step load ?
> Compiling a mips-linux using gcc.

That feature doesn't work in gcc for userspace code ...

  Ralf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Static variables and "gp"
@ 2003-03-02 11:46 Gilad Benjamini
  2003-03-02 14:12 ` Ralf Baechle
  0 siblings, 1 reply; 5+ messages in thread
From: Gilad Benjamini @ 2003-03-02 11:46 UTC (permalink / raw)
  To: linux-mips

Who said user-code ?
Strictly kernel

-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org]
Sent: Sunday, March 02, 2003 1:18 PM
To: Gilad Benjamini
Cc: linux-mips@linux-mips.org
Subject: Re: Static variables and "gp"


On Sun, Mar 02, 2003 at 09:07:28AM +0000, Gilad Benjamini wrote:

> How can I force a specific static variable to be used by the "gp" register
> rather than by a two-step load ?
> Compiling a mips-linux using gcc.

That feature doesn't work in gcc for userspace code ...

  Ralf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Static variables and "gp"
  2003-03-02 11:46 Static variables and "gp" Gilad Benjamini
@ 2003-03-02 14:12 ` Ralf Baechle
  0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2003-03-02 14:12 UTC (permalink / raw)
  To: Gilad Benjamini; +Cc: linux-mips

On Sun, Mar 02, 2003 at 11:46:07AM +0000, Gilad Benjamini wrote:

> Who said user-code ?
> Strictly kernel

Well ...  Register $28 is already used for the current pointer.  You'd
have to get rid of the $28 optimization first before GP optimization could
work.

  Ralf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Static variables and "gp"
  2003-03-02 11:18 ` Ralf Baechle
@ 2003-03-03 12:54   ` Johannes Stezenbach
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Stezenbach @ 2003-03-03 12:54 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Gilad Benjamini, linux-mips

On Sun, Mar 02, 2003 at 12:18:20PM +0100, Ralf Baechle wrote:
> On Sun, Mar 02, 2003 at 09:07:28AM +0000, Gilad Benjamini wrote:
> 
> > How can I force a specific static variable to be used by the "gp" register
> > rather than by a two-step load ?
> > Compiling a mips-linux using gcc.
> 
> That feature doesn't work in gcc for userspace code ...

It works with diet libc (http://dietlibc.org/).
You need a static, non-PIC libgcc.a which supports it, though,
which means a bit of gcc config hackery...

Regards,
Johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-03 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-02 11:46 Static variables and "gp" Gilad Benjamini
2003-03-02 14:12 ` Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2003-03-02  9:07 Gilad Benjamini
2003-03-02 11:18 ` Ralf Baechle
2003-03-03 12:54   ` Johannes Stezenbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox