public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* problems with sparc32 build
@ 2003-01-29 19:56 Andreas Jaeger
  2003-01-29 21:25 ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Jaeger @ 2003-01-29 19:56 UTC (permalink / raw)
  To: GNU libc hacker


Building glibc for sparc fails with current CVS with:

In file included from ../linuxthreads/sysdeps/sparc/tls.h:25,
                 from ../include/tls.h:3,
                 from ../linuxthreads/internals.h:28,
                 from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
                 from cxa_atexit.c:19:
../linuxthreads/sysdeps/sparc/sparc32/pt-machine.h:59: warning: call-clobbered register used for global register variable

What's going on here?  Is my GCC 3.3 CVS version to old?  I cannot
find tls patches for sparc in GCC mainline either...

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with sparc32 build
  2003-01-29 19:56 problems with sparc32 build Andreas Jaeger
@ 2003-01-29 21:25 ` Jakub Jelinek
  2003-01-29 22:05   ` Thorsten Kukuk
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-01-29 21:25 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

On Wed, Jan 29, 2003 at 08:56:35PM +0100, Andreas Jaeger wrote:
> 
> Building glibc for sparc fails with current CVS with:
> 
> In file included from ../linuxthreads/sysdeps/sparc/tls.h:25,
>                  from ../include/tls.h:3,
>                  from ../linuxthreads/internals.h:28,
>                  from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
>                  from cxa_atexit.c:19:
> ../linuxthreads/sysdeps/sparc/sparc32/pt-machine.h:59: warning: call-clobbered register used for global register variable
> 
> What's going on here?  Is my GCC 3.3 CVS version to old?  I cannot
> find tls patches for sparc in GCC mainline either...

By any change, aren't you using -fcall-used-g7?

	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with sparc32 build
  2003-01-29 21:25 ` Jakub Jelinek
@ 2003-01-29 22:05   ` Thorsten Kukuk
  2003-01-30  9:45     ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Kukuk @ 2003-01-29 22:05 UTC (permalink / raw)
  To: GNU libc hacker

On Wed, Jan 29, Jakub Jelinek wrote:

> On Wed, Jan 29, 2003 at 08:56:35PM +0100, Andreas Jaeger wrote:
> > 
> > Building glibc for sparc fails with current CVS with:
> > 
> > In file included from ../linuxthreads/sysdeps/sparc/tls.h:25,
> >                  from ../include/tls.h:3,
> >                  from ../linuxthreads/internals.h:28,
> >                  from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
> >                  from cxa_atexit.c:19:
> > ../linuxthreads/sysdeps/sparc/sparc32/pt-machine.h:59: warning: call-clobbered register used for global register variable
> > 
> > What's going on here?  Is my GCC 3.3 CVS version to old?  I cannot
> > find tls patches for sparc in GCC mainline either...
> 
> By any change, aren't you using -fcall-used-g7?

compiler options are
gcc -m32 -c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes \
	-Wwrite-strings -fcall-used-g7 -g -mtune=ultrasparc

so, -fcall-used-g7 is used (same compiler options as we used the
last years for compiling glibc on sparc32).

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Deutschherrnstr. 15-19        D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with sparc32 build
  2003-01-29 22:05   ` Thorsten Kukuk
@ 2003-01-30  9:45     ` Jakub Jelinek
  2003-01-31  8:15       ` Andreas Jaeger
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-01-30  9:45 UTC (permalink / raw)
  To: Thorsten Kukuk; +Cc: GNU libc hacker

On Wed, Jan 29, 2003 at 11:05:09PM +0100, Thorsten Kukuk wrote:
> On Wed, Jan 29, Jakub Jelinek wrote:
> 
> > On Wed, Jan 29, 2003 at 08:56:35PM +0100, Andreas Jaeger wrote:
> > > 
> > > Building glibc for sparc fails with current CVS with:
> > > 
> > > In file included from ../linuxthreads/sysdeps/sparc/tls.h:25,
> > >                  from ../include/tls.h:3,
> > >                  from ../linuxthreads/internals.h:28,
> > >                  from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
> > >                  from cxa_atexit.c:19:
> > > ../linuxthreads/sysdeps/sparc/sparc32/pt-machine.h:59: warning: call-clobbered register used for global register variable
> > > 
> > > What's going on here?  Is my GCC 3.3 CVS version to old?  I cannot
> > > find tls patches for sparc in GCC mainline either...
> > 
> > By any change, aren't you using -fcall-used-g7?
> 
> compiler options are
> gcc -m32 -c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes \
> 	-Wwrite-strings -fcall-used-g7 -g -mtune=ultrasparc
> 
> so, -fcall-used-g7 is used (same compiler options as we used the
> last years for compiling glibc on sparc32).

That obviously needs to be changed to -fcall-used-g6 when the roles of the
2 registers swapped.

	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with sparc32 build
  2003-01-30  9:45     ` Jakub Jelinek
@ 2003-01-31  8:15       ` Andreas Jaeger
  2003-02-01 11:27         ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Jaeger @ 2003-01-31  8:15 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Thorsten Kukuk, GNU libc hacker

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),

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problems with sparc32 build
  2003-01-31  8:15       ` Andreas Jaeger
@ 2003-02-01 11:27         ` Jakub Jelinek
  2003-02-02 23:46           ` [PATCH] " Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-02-01 11:27 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Thorsten Kukuk, GNU libc hacker

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?
When testing this I was using binutils-2.13.90.0.16 + the SPARC32
TLS+reloc rework patch and haven't seen such problems (only tst-tls4
failed in make check).

	Jakub

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Re: problems with sparc32 build
  2003-02-01 11:27         ` Jakub Jelinek
@ 2003-02-02 23:46           ` Jakub Jelinek
  2003-02-04  8:41             ` Ulrich Drepper
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-02-02 23:46 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Andreas Jaeger, Thorsten Kukuk, GNU libc hacker

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Re: problems with sparc32 build
  2003-02-02 23:46           ` [PATCH] " Jakub Jelinek
@ 2003-02-04  8:41             ` Ulrich Drepper
  0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Drepper @ 2003-02-04  8:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Andreas Jaeger, Thorsten Kukuk, GNU libc hacker

Jakub Jelinek wrote:
> On Sat, Feb 01, 2003 at 12:26:57PM +0100, Jakub Jelinek wrote:

> 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.

I've applied this patch now.  Thanks,

-- 
--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-02-04  8:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 19:56 problems with sparc32 build Andreas Jaeger
2003-01-29 21:25 ` Jakub Jelinek
2003-01-29 22:05   ` Thorsten Kukuk
2003-01-30  9:45     ` Jakub Jelinek
2003-01-31  8:15       ` Andreas Jaeger
2003-02-01 11:27         ` Jakub Jelinek
2003-02-02 23:46           ` [PATCH] " Jakub Jelinek
2003-02-04  8:41             ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).