Re: optimize __gp location

From: Keith Owens <>
Date: 2005-01-22 12:02:26
On Fri, 21 Jan 2005 15:22:18 -0800, 
"Chen, Kenneth W" <> wrote:
>__gp is positioned so far out that it is almost at the end of all data
>sections.  On 2.6.11-rc1, 80% of kernel data symbols are out of 22-bit
>immediate offset from __gp.  This means accessing these symbols are 
>unnecessarily expansive such that they have to go through global offset
>table (a memory load to get the symbol address).  Among these out of
>reach symbols from __gp, some are very frequently used, like Jiffies,
>Can we position the __gp somewhat more optimally, to cover more of these
>symbols? Something like the following patch would make all of them fall
>into the 22-bit immediate offset relative to gp.

The best place for __gp is in the exact middle of the range
.data.init_task through the end of .sbss.  Unfortunately a large .data
section could result in .got and .sbss being out of range of a median
__gp.  Is it possible in the linker script to first try (.sbss.end -
.data.init_task) / 2, then test the result for reachability to .sbss
and adjust __gp if necessary?

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Fri Jan 21 20:02:55 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:34 EST