Workaround linker bug
PATCH 1/1 Workaround linker bug
Building 2.6.6-ia64-040521, using GNU ld version 2.14.90.0.4 20030523. __gp is sometimes set incorrectly. Instead of being .got + 0x2000000, it is set to .data + 0x2000000, which breaks some LTOFF22 and GPREL22 entries.
This is non-deterministic, changing the path name to the kernel tree which changes the size of some messages in .data is enough to make the linker get it right. Force __gp to be based on .got.
Index: linux/arch/ia64/kernel/vmlinux.lds.S
=================================--- linux.orig/arch/ia64/kernel/vmlinux.lds.S Thu May 27 15:08:02 2004
+++ linux/arch/ia64/kernel/vmlinux.lds.S Thu May 27 15:16:11 2004
@@ -202,11 +202,10 @@ SECTIONS
.data : AT(ADDR(.data) - LOAD_OFFSET)
{ *(.data) *(.data1) *(.gnu.linkonce.d*) CONSTRUCTORS }
- . = ALIGN(16);
- __gp = . + 0x200000; /* gp must be 16-byte aligned for exc. table */
-
+ . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */
.got : AT(ADDR(.got) - LOAD_OFFSET)
{ *(.got.plt) *(.got) }
+ __gp = ADDR(.got) + 0x200000;
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */
Quoted 5 lines · Keith Owens
Building 2.6.6-ia64-040521, using GNU ld version 2.14.90.0.4 20030523.
__gpis sometimes set incorrectly. Instead of being .got +0x2000000, it is set to .data +0x2000000, which breaks some LTOFF22 and GPREL22 entries.
There are a few ia64 linker fixes since 2.14.90.0.4. One of them is
http://sources.redhat.com/ml/binutils/2003-11/msg00000.html
among many others. May I suggest you try 2.15.90.0.3?
H.J.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens
Keith> Building 2.6.6-ia64-040521, using GNU ld version 2.14.90.0.4 Keith> 20030523. __gp is sometimes set incorrectly. Instead of Keith> being .got + 0x2000000, it is set to .data + 0x2000000, which Keith> breaks some LTOFF22 and GPREL22 entries.
Keith> This is non-deterministic, changing the path name to the Keith> kernel tree which changes the size of some messages in .data Keith> is enough to make the linker get it right. Force __gp to be Keith> based on .got.
I can't say I have seen this myself, but the workaround is sensible enough, so I applied the patch.
Thanks, and sorry for the delay (still working through my backlog...).
--david