Subject: Re: 'make build' fail
To: None <bouyer@antioche.lip6.fr, port-sparc64@netbsd.org>
From: None <eeh@netbsd.org>
List: port-sparc64
Date: 11/21/2000 18:21:03
	Hi,
	I installed from scatch the 1.5_BETA2 snapshot on an Ultra/1. I then tried
	to to a 'make build' from 1.5 sources (modified 1.5, I pulled up
	802.1q support, but this shouldn't matter). a 'make build' fails
	with tons of error messages in libc like:
	building shared c library (version 12.62.1)
	ld -x -shared -soname libc.so.12 -o libc.so.12.62.1  /usr/lib/crtbeginS.o  --who
	le-archive libc_pic.a --no-whole-archive   /usr/lib/crtendS.o
	libc_pic.a(__posix_rename.so): In function `___posix_rename':
	__posix_rename.so(.text+0x1c): relocation truncated to fit: R_SPARC_GOT13 ___cerror
	libc_pic.a(__posix_lchown.so): In function `___posix_lchown':
	__posix_lchown.so(.text+0x1c): relocation truncated to fit: R_SPARC_GOT13 ___cerror
	[...]
	libc_pic.a(accept.so): In function `_accept':
	accept.so(.text+0x1c): relocation truncated to fit: R_SPARC_GOT13 ___cerror
	*** Error code 1

	Only the ___cerror symbol appeas.

	Anyone else see this ?
	I didn't have problems with yet_another_local.tar.gz


Seems to be a -pic/-PIC issue.  The assembly language stub
generated by src/lib/libc/arch/sparc64/SYS.h uses -pic
relocations for ___cerror, while it appears that this
library is too large for that.  Eventually we should
fix the assembly stubs so -pic or -PIC can be selected
with a compiler option.  In the mean time try the following
fix:

Index: lib/libc/arch/sparc64/SYS.h
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/arch/sparc64/SYS.h,v
retrieving revision 1.4
diff -u -u -r1.4 SYS.h
--- lib/libc/arch/sparc64/SYS.h 2000/07/18 22:39:25     1.4
+++ lib/libc/arch/sparc64/SYS.h 2000/11/21 18:20:49
@@ -56,8 +56,8 @@
  */
 #ifdef PIC
 #define        ERROR() \
-       PIC_PROLOGUE(%g1,%g2); \
-       ldx [%g1+_C_LABEL(__cerror)],%g2; jmp %g2; nop
+       PIC_PROLOGUE(%g1,%g2); sethi %hi(_C_LABEL(__cerror)),%g2; \
+       or %g2,%lo(_C_LABEL(__cerror)),%g2; ldx [%g1+%g2],%g2; jmp %g2; nop
 #else
 #define        ERROR() \
        sethi %hi(_C_LABEL(__cerror)),%g1; or %lo(_C_LABEL(__cerror)),%g1,%g1; \