Re: optimize __gp location

From: Keith Owens <kaos_at_sgi.com>
Date: 2005-01-22 14:09:32
On Fri, 21 Jan 2005 18:20:51 -0800, 
"Chen, Kenneth W" <kenneth.w.chen@intel.com> wrote:
>Luck, Tony wrote on Friday, January 21, 2005 5:03 PM
>> >-  __gp = ADDR(.got) + 0x200000;
>> >+  __gp = _end - 0x200000;
>>
>> Did we used to link the ".got" section earlier?  It's after "data" now,
>> but the expression used there might have made sense if ".got" was before
>> the "data".
>>
>> _end - 0x200000 may work for you now, but won't this be very configuration
>> dependent?  If I configure lots of drivers with "=y" option, and they
>> declare lots of "bss" objects, then __gp may still be too high to reach the
>> interesting data objects.
>>
>> Would an expression anchoring on the ".sdata" section be better?
>
>I wish I can do that.  But I'm frustrated that __gp is jailed in between
>GOT section and the linker symbol _end.  There are references to _end from a
>couple of functions like reserve_memory(), mem_init() that compiler insist on
>using gp relative to calculate value of _end.

Compiled and linked but not booted.  The references to _end and _stext
are now DIR64LSB in .sdata.  That makes for a couple of extra
instructions to get the value of _end and _stext in mem_init(), but the
code is only executed once, so who cares?

Index: linux/arch/ia64/mm/init.c
===================================================================
--- linux.orig/arch/ia64/mm/init.c	2005-01-20 11:05:56.000000000 +1100
+++ linux/arch/ia64/mm/init.c	2005-01-22 14:02:52.000000000 +1100
@@ -535,6 +535,8 @@ nolwsys_setup (char *s)
 
 __setup("nolwsys", nolwsys_setup);
 
+static char *p_end = _end, *p_stext = _stext;
+
 void
 mem_init (void)
 {
@@ -563,7 +565,7 @@ mem_init (void)
 
 	kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE);
 	kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
-	kclist_add(&kcore_kernel, _stext, _end - _stext);
+	kclist_add(&kcore_kernel, _stext, p_end - p_stext);
 
 	for_each_pgdat(pgdat)
 		totalram_pages += free_all_bootmem_node(pgdat);


-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Jan 21 22:11:24 2005

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