This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Re: problems with sparc32 build


On Sat, Feb 01, 2003 at 12:26:57PM +0100, Jakub Jelinek wrote:
> On Fri, Jan 31, 2003 at 09:15:53AM +0100, Andreas Jaeger wrote:
> > Jakub Jelinek <jakub@redhat.com> writes:
> > 
> > > That obviously needs to be changed to -fcall-used-g6 when the roles of the
> > > 2 registers swapped.
> > 
> > Thanks, that helped.  Now it's failing in a different place but this
> > looks like a binutils bug:
> > 
> > CPP='gcc -m32 -E -x c-header'  /usr/src/packages/BUILD/glibc-2.3/cc/elf/ld-linux.so.2 --library-path /usr/src/packages/BUILD/glibc-2.3/cc:/usr/src/packages/BUILD/glibc-2.3/cc/math:/usr/src/packages/BUILD/glibc-2.3/cc/elf:/usr/src/packages/BUILD/glibc-2.3/cc/dlfcn:/usr/src/packages/BUILD/glibc-2.3/cc/nss:/usr/src/packages/BUILD/glibc-2.3/cc/nis:/usr/src/packages/BUILD/glibc-2.3/cc/rt:/usr/src/packages/BUILD/glibc-2.3/cc/resolv:/usr/src/packages/BUILD
> > /glibc-2.3/cc/crypt:/usr/src/packages/BUILD/glibc-2.3/cc/linuxthreads /usr/src/packages/BUILD/glibc-2.3/cc/sunrpc/rpcgen -Y ../scripts -c rpcsvc/bootparam_prot.x -o /usr/src/packages/BUILD/glibc-2.3/cc/sunrpc/xbootparam_prot.T
> > /usr/src/packages/BUILD/glibc-2.3/cc/sunrpc/rpcgen: error while loading shared libraries: /usr/src/packages/BUILD/glibc-2.3/cc/libc.so.6: unexpected reloc type 0x08
> > 
> > $ readelf -r libc.so.6 |grep R_SPARC_WDISP22
> > Relocation section '.rela.dyn' at offset 0x11ec4 contains 3498 entries:
> >  Offset     Info    Type            Sym.Value  Sym. Name + Addend
> > [...]
> > 000c0208  00000a08 R_SPARC_WDISP22   0001c5c0   .text + c0180
> > 
> > Might be a bug in binutils's hidden support (this is version
> > 2.13.90.0.18),
> 
> Can you try CVS binutils?

Something like the attached patch could do the trick I think.
Can you try it? I just watched configure with broken and fixed ld,
but haven't actually built it.

2003-02-03  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/sparc/sparc32/elf/configure.in (BROKEN_SPARC_WDISP22): New
	check.
	* sysdeps/sparc/sparc32/elf/configure: Rebuilt.
	* config.h.in (BROKEN_SPARC_WDISP22): Add.
linuxthreads/
	* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S (__vfork): If
	BROKEN_SPARC_WDISP22, handle SHARED the same way as non-SHARED.

--- libc/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S.jj	Wed Jan 29 08:37:11 2003
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S	Sun Feb  2 22:54:28 2003
@@ -23,7 +23,7 @@
 ENTRY(__vfork)
 	ld	[%g7 + MULTIPLE_THREADS_OFFSET], %o0
 	cmp	%o0, 0
-#ifdef SHARED
+#if defined SHARED && !defined BROKEN_SPARC_WDISP22
 	bne	HIDDEN_JUMPTARGET(__fork)
 #else
 	bne	1f
@@ -35,7 +35,7 @@ ENTRY(__vfork)
 	sub	%o1, 1, %o1
 	retl
 	 and	%o0, %o1, %o0
-#ifndef SHARED
+#if !defined SHARED || defined BROKEN_SPARC_WDISP22
 1:	mov	%o7, %g1
 	call	HIDDEN_JUMPTARGET(__fork)
 	 mov	%g1, %o7
--- libc/sysdeps/sparc/sparc32/elf/configure.in.jj	Wed Jan 29 08:37:52 2003
+++ libc/sysdeps/sparc/sparc32/elf/configure.in	Sun Feb  2 22:46:59 2003
@@ -41,3 +41,20 @@ if test $libc_cv_sparc32_tls = yes; then
   AC_DEFINE(HAVE_TLS_SUPPORT)
 fi
 fi
+
+# Check for broken WDISP22 in the linker.
+AC_CACHE_CHECK(for sparc32 ld WDISP22 handling, libc_cv_sparc32_wdisp22, [dnl
+echo 'bne foo; nop' > conftest1.s
+echo '.globl foo; .hidden foo; foo: nop' > conftest2.s
+libc_cv_sparc32_wdisp22=unknown
+if AC_TRY_COMMAND(${CC-cc} -nostdlib -shared $CFLAGS conftest1.s conftest2.s -o conftest.so 1>&AS_MESSAGE_LOG_FD); then
+  if readelf -r conftest.so | grep -q R_SPARC_WDISP22; then
+    libc_cv_sparc32_wdisp22=broken
+  else
+    libc_cv_sparc32_wdisp22=ok
+  fi
+fi
+rm -f conftest*])
+if test $libc_cv_sparc32_wdisp22 != ok; then
+  AC_DEFINE(BROKEN_SPARC_WDISP22)
+fi
--- libc/sysdeps/sparc/sparc32/elf/configure.jj	Thu Jan 30 21:00:33 2003
+++ libc/sysdeps/sparc/sparc32/elf/configure	Sun Feb  2 22:47:30 2003
@@ -55,3 +55,35 @@ _ACEOF
 
 fi
 fi
+
+# Check for broken WDISP22 in the linker.
+echo "$as_me:$LINENO: checking for sparc32 ld WDISP22 handling" >&5
+echo $ECHO_N "checking for sparc32 ld WDISP22 handling... $ECHO_C" >&6
+if test "${libc_cv_sparc32_wdisp22+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  echo 'bne foo; nop' > conftest1.s
+echo '.globl foo; .hidden foo; foo: nop' > conftest2.s
+libc_cv_sparc32_wdisp22=unknown
+if { ac_try='${CC-cc} -nostdlib -shared $CFLAGS conftest1.s conftest2.s -o conftest.so 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  if readelf -r conftest.so | grep -q R_SPARC_WDISP22; then
+    libc_cv_sparc32_wdisp22=broken
+  else
+    libc_cv_sparc32_wdisp22=ok
+  fi
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_sparc32_wdisp22" >&5
+echo "${ECHO_T}$libc_cv_sparc32_wdisp22" >&6
+if test $libc_cv_sparc32_wdisp22 != ok; then
+  cat >>confdefs.h <<\_ACEOF
+#define BROKEN_SPARC_WDISP22 1
+_ACEOF
+
+fi
--- libc/config.h.in.jj	Wed Nov 27 06:28:59 2002
+++ libc/config.h.in	Sun Feb  2 22:50:33 2003
@@ -109,6 +109,10 @@
    certain registers (CR0, MQ, CTR, LR) in asm statements.  */
 #undef	BROKEN_PPC_ASM_CR0
 
+/* Defined on SPARC if ld doesn't handle R_SPARC_WDISP22 against .hidden
+   symbol.  sysdeps/sparc/sparc32/elf/configure.  */
+#undef	BROKEN_SPARC_WDISP22
+
 /* Define if the linker supports the -z combreloc option.  */
 #undef	HAVE_Z_COMBRELOC
 

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]