This is the mail archive of the libc-hacker@sourceware.org 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] sparc64 glibc fixes


Hi!

The sysdep.h changes are needed to actually build sparc64 glibc.
configure changes are because the CFI directive test fails for sparc64,
because of the stack bias (.cfi_rel_offset 1, 0) is not biased and
therefore not aligned.
sysdep-cancel.h is the first part of changes to make cancellation
actually work properly on sparc64, fixes some tests, but will
need to build debugging libgcc_s now to study up the remaining
failures.

2006-01-06  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Include tls.h.
	(SYSCALL_ERROR_HANDLER_ENTRY): Use %g4 instead of %g2, to avoid
	the need of .register directive for it.
	* configure.in (libc_cv_asm_cfi_directives): Use CFI rel offset
	2047 instead of 0 in the test on sparc64.
	* configure: Rebuilt.
nptl/
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h (PSEUDO):
	Add cfi directives.

--- libc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h.jj	2006-01-02 15:48:07.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h	2006-01-04 12:40:51.000000000 -0500
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -25,6 +26,7 @@
 #ifdef IS_IN_rtld
 # include <dl-sysdep.h>		/* Defines RTLD_PRIVATE_ERRNO.  */
 #endif
+#include <tls.h>
 
 #undef SYS_ify
 #define SYS_ify(syscall_name) __NR_##syscall_name
@@ -124,10 +126,10 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_er
 #  define SYSCALL_ERROR_HANDLER						\
 SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
 	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g2;			\
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g4;			\
 	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	add	%g2, %lo(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	ldx	[%g2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);	\
+	add	%g4, %lo(_GLOBAL_OFFSET_TABLE_), %g4;			\
+	ldx	[%g4 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);	\
 	st	%o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO);	\
 	jmpl	%o7+8, %g0;						\
 	 mov	-1, %o0;						\
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h.jj	2004-07-06 00:25:43.000000000 -0400
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h	2006-01-06 05:55:54.000000000 -0500
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -40,7 +40,11 @@ __##syscall_name##_nocancel:						      
 	 nop;								      \
 .size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
 	.subsection 2;							      \
+	cfi_startproc;							      \
 1:	save %sp, -192, %sp;						      \
+	cfi_def_cfa_register (%fp);					      \
+	cfi_window_save;						      \
+	cfi_register (%o7, %i7);					      \
 	CENABLE;							      \
 	 nop;								      \
 	mov %o0, %l0;							      \
@@ -53,6 +57,7 @@ __##syscall_name##_nocancel:						      
 	 mov %l0, %o0;							      \
 	jmpl %i7 + 8, %g0;						      \
 	 restore %g0, %l1, %o0;						      \
+	cfi_endproc;							      \
 	.previous;							      \
 	SYSCALL_ERROR_HANDLER						      \
 	SYSCALL_ERROR_HANDLER2
--- libc/configure.in.jj	2006-01-04 01:24:42.000000000 -0500
+++ libc/configure.in	2006-01-06 06:01:47.000000000 -0500
@@ -1676,13 +1676,17 @@ elif test $libc_cv_asm_weakext_directive
 fi
 
 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
+case $machine in
+  sparc/sparc64*) cfi_offset=2047;;
+  *) cfi_offset=0;;
+esac
 cat > conftest.s <<EOF
         .text
         .type   func,%function
 func:
         .cfi_startproc
 	.cfi_remember_state
-	.cfi_rel_offset 1, 0
+	.cfi_rel_offset 1, $cfi_offset
         .cfi_endproc
 EOF
 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
--- libc/configure.jj	2006-01-04 10:33:34.000000000 -0500
+++ libc/configure	2006-01-06 06:02:03.000000000 -0500
@@ -6135,13 +6135,17 @@ echo $ECHO_N "checking whether CFI direc
 if test "${libc_cv_asm_cfi_directives+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.s <<EOF
+  case $machine in
+  sparc/sparc64*) cfi_offset=2047;;
+  *) cfi_offset=0;;
+esac
+cat > conftest.s <<EOF
         .text
         .type   func,%function
 func:
         .cfi_startproc
 	.cfi_remember_state
-	.cfi_rel_offset 1, 0
+	.cfi_rel_offset 1, $cfi_offset
         .cfi_endproc
 EOF
 if { ac_try='${CC-cc} $ASFLAGS -c conftest.s 1>&5'

	Jakub


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