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]: CFI assembler markings for Sparc


This adds the necessary CFI markings for the Sparc assembler
sources in GLIBC.

In order to make this set of changes more straightforward, I
simplified the syscall stub error handling.  I choose to use
powerpc's model of just calling a C stub function to set
errno and letting the compiler figure out all of the details
instead of the hand-coded assembler ifdef mess we currently have.

One tricky aspect of that is we need to make sure we can branch
to the destination.  We use a Sparc tail-call sequence which the
linker is able to relax:

	mov	%o7, %g1
	call	__syscall_error
	 mov	%g1, %o7

if the linker finds the __syscall_error is reachable by a branch,
it relaxes the above sequence into:

	mov	%o7, %g1
	b	__syscall_error
	 mov	%g1, %o7

%99.99999 of the time, this relaxation will occur.  Only with
statically linked binaries linking to libc.a and libpthread.a
is it possible for the 8MB branch distance limit to be reached.
And even there it would be rare, but we handle it correctly.

The rest of the patch is the noise of adding the cfi_startproc
and cfi_endproc markings to ENTRY and END, plus the necessary
CFI sequence for Sparc's window save instruction.

I'd like to also mention that I've continually been burned by
glibc defining "ret" to something.  This is a real and commonly
used instruction mnemonic on Sparc, and this aliasing makes
assembler coding quite error prone.  Just by including
<sysdep.h> somewhere, a perfectly functioning piece of code
started to crash, and it was because of this "#define ret"
which glibc uses for it's syscall stub generation framework.

How about we change the name to "PSEUDO_RET" or "SYSCALL_RET"?
:-)

This patch was regression tested on targets: sparc-linux,
sparcv9-linux, sparcv9b-linux, sparc64-linux, and sparc64b-linux.

Jakub Jelinek helped review this patch.

nptl/
	
2006-03-05  David S. Miller  <davem@sunset.davemloft.net>

	* sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S: Use
	__syscall_error.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/Makefile: New file.

/
	
2006-03-05  David S. Miller  <davem@sunset.davemloft.net>

	* sysdeps/sparc/sparc32/dl-trampoline.S: Add CFI markings.
	* sysdeps/sparc/sparc32/elf/start.S: Likewise.
	* sysdeps/sparc/sparc64/dl-trampoline.S: Likewise.
	* sysdeps/sparc/sparc64/elf/start.S: Likewise.
	* sysdeps/sparc/sparc32/memchr.S: Rearrange code to reside
	within ENTRY/END.
	* sysdeps/sparc/sparc32/memcpy.S: Likewise.
	* sysdeps/sparc/sparc32/stpcpy.S: Likewise.
	* sysdeps/sparc/sparc32/strcat.S: Likewise.
	* sysdeps/sparc/sparc32/strchr.S: Likewise.
	* sysdeps/sparc/sparc32/strcmp.S: Likewise.
	* sysdeps/sparc/sparc32/strcpy.S: Likewise.
	* sysdeps/sparc/sparc32/strlen.S: Likewise.
	* sysdeps/sparc/sparc64/memcpy.S: Likewise.
	* sysdeps/sparc/sparc64/sparcv9v/memset.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/Makefile: Add rt-sysdep to
	librt-routines.
	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Add CFI markings
	and use __syscall_error.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S: Use
	__syscall_error.
	* sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/socket.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/socket.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Rewrite to use
	CFI markings and __syscall_error.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S: Rearrange
	code to reside within ENTRY/END.
	* sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/rt-sysdep.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sysdep.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sysdep.S: Delete.
	
Index: nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S,v
retrieving revision 1.1
diff -u -p -r1.1 pt-vfork.S
--- nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S	10 Mar 2004 19:02:47 -0000	1.1
+++ nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S	5 Mar 2006 23:45:43 -0000
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl		__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	sub	%g0, %o5, %o4
@@ -28,15 +29,17 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x10
-	bcs,a	__syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc	2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a	1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 weak_alias (__vfork, vfork)
Index: nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h,v
retrieving revision 1.4
diff -u -p -r1.4 sysdep-cancel.h
--- nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h	6 Jul 2004 04:25:44 -0000	1.4
+++ nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h	5 Mar 2006 23:45:43 -0000
@@ -26,55 +26,48 @@
 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
 
 # undef PSEUDO
-# define PSEUDO(name, syscall_name, args)				      \
-	.text;								      \
-ENTRY(name)								      \
-	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;			      \
-	cmp %g1, 0;							      \
-	bne 1f;								      \
-.type	__##syscall_name##_nocancel,@function;				      \
-.globl	__##syscall_name##_nocancel;					      \
-__##syscall_name##_nocancel:						      \
-	 mov SYS_ify(syscall_name), %g1;				      \
-	ta 0x10;							      \
-	bcs __syscall_error_handler;					      \
-	 nop;								      \
-.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
-	.subsection 2;							      \
-	cfi_startproc;							      \
-1:	save %sp, -96, %sp;						      \
-	cfi_def_cfa_register (%fp);					      \
-	cfi_window_save;						      \
-	cfi_register (%o7, %i7);					      \
-	CENABLE;							      \
-	 nop;								      \
-	mov %o0, %l0;							      \
-	COPY_ARGS_##args						      \
-	mov SYS_ify(syscall_name), %g1;					      \
-	ta 0x10;							      \
-	bcs __syscall_error_handler2;					      \
-	 mov %o0, %l1;							      \
-	CDISABLE;							      \
-	 mov %l0, %o0;							      \
-	jmpl %i7 + 8, %g0;						      \
-	 restore %g0, %l1, %o0;						      \
-	cfi_endproc;							      \
-	.previous;							      \
-	SYSCALL_ERROR_HANDLER						      \
-	SYSCALL_ERROR_HANDLER2
-
-#define SYSCALL_ERROR_HANDLER2						      \
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2)			      \
-	.global __errno_location;					      \
-        .type   __errno_location,@function;				      \
-	CDISABLE;							      \
-	 mov	%l0, %o0;						      \
-	call	__errno_location;					      \
-	 nop;								      \
-	st	%l1, [%o0];						      \
-	jmpl	%i7 + 8, %g0;						      \
-	 restore %g0, -1, %o0;						      \
-	.previous;
+# define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name)					\
+	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\
+	cmp %g1, 0;				\
+	bne 1f;					\
+.type	__##syscall_name##_nocancel,@function;	\
+.globl	__##syscall_name##_nocancel;		\
+__##syscall_name##_nocancel:			\
+	 mov SYS_ify(syscall_name), %g1;	\
+	ta 0x10;				\
+	bcc 8f;					\
+	 mov %o7, %g1;				\
+	call __syscall_error;			\
+	 mov %g1, %o7;				\
+8:	jmpl %o7 + 8, %g0;			\
+	 nop;					\
+.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\
+1:	save %sp, -96, %sp;			\
+	cfi_def_cfa_register(%fp);		\
+	cfi_window_save;			\
+	cfi_register(%o7, %i7);			\
+	CENABLE;				\
+	 nop;					\
+	mov %o0, %l0;				\
+	COPY_ARGS_##args			\
+	mov SYS_ify(syscall_name), %g1;		\
+	ta 0x10;				\
+	bcc 1f;					\
+	 mov %o0, %l1;				\
+	CDISABLE;				\
+	 mov %l0, %o0;				\
+	call __syscall_error;			\
+	 mov %l1, %o0;				\
+	b 2f;					\
+	 mov -1, %l1;				\
+1:	CDISABLE;				\
+	 mov %l0, %o0;				\
+2:	jmpl %i7 + 8, %g0;			\
+	 restore %g0, %l1, %o0;
+
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	call __pthread_enable_asynccancel
Index: nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S,v
retrieving revision 1.2
diff -u -p -r1.2 vfork.S
--- nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S	11 Mar 2004 01:33:36 -0000	1.2
+++ nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S	5 Mar 2006 23:45:43 -0000
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl		__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	cmp	%o5, 0
@@ -31,16 +32,18 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x10
-	bcs,a	__syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc	2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a	1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 weak_alias (__vfork, vfork)
Index: nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S,v
retrieving revision 1.1
diff -u -p -r1.1 pt-vfork.S
--- nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S	10 Mar 2004 19:03:17 -0000	1.1
+++ nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S	5 Mar 2006 23:45:43 -0000
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl	__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	sub	%g0, %o5, %o4
@@ -28,15 +29,17 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x6d
-	bcs,a,pn %xcc, __syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc,pt	%xcc, 2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a,pt %icc, 1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 weak_alias (__vfork, vfork)
Index: nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h,v
retrieving revision 1.5
diff -u -p -r1.5 sysdep-cancel.h
--- nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h	6 Jan 2006 22:56:21 -0000	1.5
+++ nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h	5 Mar 2006 23:45:43 -0000
@@ -26,54 +26,46 @@
 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
 
 # undef PSEUDO
-# define PSEUDO(name, syscall_name, args)				      \
-	.text;								      \
-ENTRY(name)								      \
-	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;			      \
-	brnz,pn %g1, 1f;						      \
-.type	__##syscall_name##_nocancel,@function;				      \
-.globl	__##syscall_name##_nocancel;					      \
-__##syscall_name##_nocancel:						      \
-	 mov SYS_ify(syscall_name), %g1;				      \
-	ta 0x6d;							      \
-	bcs,pn %xcc, __syscall_error_handler;				      \
-	 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;							      \
-	COPY_ARGS_##args						      \
-	mov SYS_ify(syscall_name), %g1;					      \
-	ta 0x6d;							      \
-	bcs,pn %xcc, __syscall_error_handler2;				      \
-	 mov %o0, %l1;							      \
-	CDISABLE;							      \
-	 mov %l0, %o0;							      \
-	jmpl %i7 + 8, %g0;						      \
-	 restore %g0, %l1, %o0;						      \
-	cfi_endproc;							      \
-	.previous;							      \
-	SYSCALL_ERROR_HANDLER						      \
-	SYSCALL_ERROR_HANDLER2
-
-#define SYSCALL_ERROR_HANDLER2						      \
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2)			      \
-	.global __errno_location;					      \
-        .type   __errno_location,@function;				      \
-	CDISABLE;							      \
-	 mov	%l0, %o0;						      \
-	call	__errno_location;					      \
-	 nop;								      \
-	st	%l1, [%o0];						      \
-	jmpl	%i7 + 8, %g0;						      \
-	 restore %g0, -1, %o0;						      \
-	.previous;
+# define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name)					\
+	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\
+	brnz,pn %g1, 1f;			\
+.type	__##syscall_name##_nocancel,@function;	\
+.globl	__##syscall_name##_nocancel;		\
+__##syscall_name##_nocancel:			\
+	 mov SYS_ify(syscall_name), %g1;	\
+	ta 0x6d;				\
+	bcc,pt %xcc, 8f;			\
+	 mov %o7, %g1;				\
+	call __syscall_error;			\
+	 mov %g1, %o7;				\
+8:	jmpl %o7 + 8, %g0;			\
+	 nop;					\
+.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\
+1:	save %sp, -192, %sp;			\
+	cfi_def_cfa_register(%fp);		\
+	cfi_window_save;			\
+	cfi_register(%o7, %i7);			\
+	CENABLE;				\
+	 nop;					\
+	mov %o0, %l0;				\
+	COPY_ARGS_##args			\
+	mov SYS_ify(syscall_name), %g1;		\
+	ta 0x6d;				\
+	bcc,pt %xcc, 1f;			\
+	 mov %o0, %l1;				\
+	CDISABLE;				\
+	 mov %l0, %o0;				\
+	call __syscall_error;			\
+	 mov %l1, %o0;				\
+	ba,pt %xcc, 2f;				\
+	 mov -1, %l1;				\
+1:	CDISABLE;				\
+	 mov %l0, %o0;				\
+2:	jmpl %i7 + 8, %g0;			\
+	 restore %g0, %l1, %o0;
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	call __pthread_enable_asynccancel
Index: nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S,v
retrieving revision 1.2
diff -u -p -r1.2 vfork.S
--- nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S	11 Mar 2004 01:33:36 -0000	1.2
+++ nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S	5 Mar 2006 23:45:43 -0000
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl	__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	sethi	%hi(0x80000000), %o3
@@ -31,16 +32,18 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x6d
-	bcs,a,pn %xcc, __syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc,pt	%xcc, 2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a,pt %icc, 1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 weak_alias (__vfork, vfork)
--- /dev/null	2006-02-15 04:00:56.000000000 -0800
+++ nptl/sysdeps/unix/sysv/linux/sparc/Makefile	2006-03-04 01:01:36.000000000 -0800
@@ -0,0 +1,2 @@
+# pull in __syscall_error routine
+libpthread-routines += sysdep
Index: sysdeps/sparc/sparc32/dl-trampoline.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/dl-trampoline.S,v
retrieving revision 1.2
diff -u -p -r1.2 dl-trampoline.S
--- sysdeps/sparc/sparc32/dl-trampoline.S	11 Apr 2005 20:43:11 -0000	1.2
+++ sysdeps/sparc/sparc32/dl-trampoline.S	5 Mar 2006 23:45:47 -0000
@@ -30,13 +30,22 @@
 	.globl	_dl_runtime_resolve
 	.type	_dl_runtime_resolve, @function
 _dl_runtime_resolve:
+	cfi_startproc
+
 	save	%sp, -104, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register (%o7, %i7)
+
 	ld	[%g2 + 8], %o0
 	srl	%g1, 10, %o1
 	call	_dl_fixup
 	 sub	%o1, 4*12, %o1
 	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve, .-_dl_runtime_resolve
 
 	/* For the profiling cases we pass in our stack frame
@@ -56,6 +65,8 @@ _dl_runtime_resolve:
 	.globl	_dl_profile_save_regs
 	.type	_dl_profile_save_regs, @function
 _dl_profile_save_regs:
+	cfi_startproc
+
 	std	%l0, [%sp + ( 0 * 8)]
 	std	%l2, [%sp + ( 1 * 8)]
 	std	%l4, [%sp + ( 2 * 8)]
@@ -67,6 +78,9 @@ _dl_profile_save_regs:
 	ld	[%sp + (8 * 8)], %l4
 	retl
 	 st	%l4, [%sp + (8 * 8)]
+
+	cfi_endproc
+
 	.size	_dl_profile_save_regs, .-_dl_profile_save_regs
 
 	/* If we are going to call pltexit, then we must replicate
@@ -76,6 +90,8 @@ _dl_profile_save_regs:
 	.globl	_dl_profile_invoke
 	.type	_dl_profile_invoke, @function
 _dl_profile_invoke:
+	cfi_startproc
+
 	sub	%sp, %l0, %sp
 1:
 	srl	%l0, 3, %l7
@@ -112,6 +128,10 @@ _dl_profile_invoke:
 	jmpl	%i7 + 8, %g0
 	 restore
 
+	cfi_endproc
+
+	.size	_dl_profile_invoke, .-_dl_profile_invoke
+
 	/* %g1:	PLT offset loaded by PLT entry
 	 * %g2: callers PC, which is PLT0 + 4, and we store the
 	 *      link map at PLT0 + 12, therefore we add 8 to get
@@ -121,11 +141,17 @@ _dl_profile_invoke:
 	.globl	_dl_runtime_profile
 	.type	_dl_runtime_profile, @function
 _dl_runtime_profile:
+	cfi_startproc
+
 	cmp	%fp, 0
 	be,a	1f
 	 mov	104, %g3
 	sub	%fp, %sp, %g3
 1:	save	%sp, -104, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	ld	[%g2 + 8], %o0
 	srl	%g1, 10, %o1
 	mov	%i7, %o2
@@ -152,4 +178,7 @@ _dl_runtime_profile:
 
 1:	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_profile, .-_dl_runtime_profile
Index: sysdeps/sparc/sparc32/memchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/memchr.S,v
retrieving revision 1.6
diff -u -p -r1.6 memchr.S
--- sysdeps/sparc/sparc32/memchr.S	29 Apr 2003 22:47:18 -0000	1.6
+++ sysdeps/sparc/sparc32/memchr.S	5 Mar 2006 23:45:47 -0000
@@ -32,7 +32,15 @@
 
 	.text
 	.align		4
-0:	cmp		%o2, 0
+ENTRY(__memchr)
+	andcc		%o1, 0xff, %o1
+	sll		%o1, 8, %g6
+	andcc		%o0, 3, %g0
+	or		%o1, %g6, %g6
+	sll		%g6, 16, %o3
+	be		10f
+	 or		%o3, %g6, %g2
+	cmp		%o2, 0
 	be		9f
 	 sethi		%hi(0x80808080), %o4
 	ldub		[%o0], %g4
@@ -64,16 +72,7 @@
 	 clr		%o0
 1:	retl
 	 sub		%o0, 1, %o0
-
-ENTRY(__memchr)
-	andcc		%o1, 0xff, %o1
-	sll		%o1, 8, %g6
-	andcc		%o0, 3, %g0
-	or		%o1, %g6, %g6
-	sll		%g6, 16, %o3
-	bne		0b
-	 or		%o3, %g6, %g2
-	sethi		%hi(0x80808080), %o4
+10:	sethi		%hi(0x80808080), %o4
 	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o5
 5:	and		%o2, 3, %g1
Index: sysdeps/sparc/sparc32/memcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/memcpy.S,v
retrieving revision 1.5
diff -u -p -r1.5 memcpy.S
--- sysdeps/sparc/sparc32/memcpy.S	29 Apr 2003 22:47:18 -0000	1.5
+++ sysdeps/sparc/sparc32/memcpy.S	5 Mar 2006 23:45:47 -0000
@@ -146,28 +146,12 @@
 	.text
 	.align	4
 
-70:	andcc		%o1, 1, %g0
-	be		4f
-	 andcc		%o1, 2, %g0
-
-	ldub		[%o1 - 1], %g2
-	sub		%o1, 1, %o1
-	stb		%g2, [%o0 - 1]
-	sub		%o2, 1, %o2
-	be		3f
-	 sub		%o0, 1, %o0
-4:	lduh		[%o1 - 2], %g2
-	sub		%o1, 2, %o1
-	sth		%g2, [%o0 - 2]
-	sub		%o2, 2, %o2
-	b		3f
-	 sub		%o0, 2, %o0
-
 ENTRY(bcopy)
 	mov		%o0, %o3
 	mov		%o1, %o0
 	mov		%o3, %o1
 END(bcopy)
+
 ENTRY(memmove)
 	cmp		%o0, %o1
 	st		%o0, [%sp + 64]
@@ -185,8 +169,26 @@ ENTRY(memmove)
 	 cmp		%o2, 15
 	bleu		91f
 	 andcc		%o1, 3, %g0
-	bne		70b
-3:	 andcc		%o1, 4, %g0
+	be		3f
+	 nop
+
+	andcc		%o1, 1, %g0
+	be		4f
+	 andcc		%o1, 2, %g0
+
+	ldub		[%o1 - 1], %g2
+	sub		%o1, 1, %o1
+	stb		%g2, [%o0 - 1]
+	sub		%o2, 1, %o2
+	be		3f
+	 sub		%o0, 1, %o0
+4:	lduh		[%o1 - 2], %g2
+	sub		%o1, 2, %o1
+	sth		%g2, [%o0 - 2]
+	sub		%o2, 2, %o2
+	sub		%o0, 2, %o0
+
+3:	andcc		%o1, 4, %g0
 
 	be		2f
 	 mov		%o2, %g1
Index: sysdeps/sparc/sparc32/stpcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/stpcpy.S,v
retrieving revision 1.5
diff -u -p -r1.5 stpcpy.S
--- sysdeps/sparc/sparc32/stpcpy.S	26 May 2005 14:30:45 -0000	1.5
+++ sysdeps/sparc/sparc32/stpcpy.S	5 Mar 2006 23:45:47 -0000
@@ -38,7 +38,13 @@
 
 	.text
 	.align		4
-10:	ldub		[%o1], %o5
+
+ENTRY(__stpcpy)
+	andcc		%o1, 3, %g0
+	be		20f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o1], %o5
 	stb		%o5, [%o0]
 	cmp		%o5, 0
 	add		%o0, 1, %o0
@@ -67,11 +73,7 @@
 1:	retl
 	 add		%o0, -1, %o0
 
-ENTRY(__stpcpy)
-	andcc		%o1, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+20:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	or		%o4, %lo(0x01010101), %o2
 6:	andcc		%o0, 3, %g0
Index: sysdeps/sparc/sparc32/strcat.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/strcat.S,v
retrieving revision 1.5
diff -u -p -r1.5 strcat.S
--- sysdeps/sparc/sparc32/strcat.S	29 Apr 2003 22:47:18 -0000	1.5
+++ sysdeps/sparc/sparc32/strcat.S	5 Mar 2006 23:45:47 -0000
@@ -38,36 +38,14 @@
 
 	.text
 	.align		4
-10:	cmp		%o4, 2
-	be		1f
-	 cmp		%o4, 3
-	ldub		[%o1], %o5
-	add		%o1, 1, %o1
-	stb		%o5, [%o0]
-	be		3f
-	 cmp		%o5, 0
-	be		0f
-	 add		%o0, 1, %o0
-1:	lduh		[%o1], %o5
-	add		%o1, 2, %o1
-	srl		%o5, 8, %o4
-	cmp		%o4, 0
-	stb		%o4, [%o0]
-	bne,a		2f
-	 stb		%o5, [%o0 + 1]
-	retl
-	 mov		%g2, %o0
-2:	andcc		%o5, 0xff, %o5
-	bne		4f
-	 add		%o0, 2, %o0
-	retl
-	 mov 		%g2, %o0
-3:	bne		4f
-	 add		%o0, 1, %o0
-	retl
-	 mov		%g2, %o0
 
-11:	ldub		[%o0], %o5
+ENTRY(strcat)
+	mov		%o0, %g2
+	andcc		%o0, 3, %g0
+	be		30f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o0], %o5
 	cmp		%o5, 0
 	be		1f
 	 add		%o0, 1, %o0
@@ -93,12 +71,7 @@
 	b		3f
 	 sub		%o0, 1, %o0
 
-ENTRY(strcat)
-	mov		%o0, %g2
-	andcc		%o0, 3, %g0
-	bne		11b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+30:	or		%o4, %lo(0x80808080), %o3
 7:	sethi		%hi(0x01010101), %o4
 8:	or		%o4, %lo(0x01010101), %o2
 9:	ld		[%o0], %o5
@@ -128,8 +101,39 @@ ENTRY(strcat)
 	 ld		[%o0], %o5
 	sub		%o0, 1, %o0
 3:	andcc		%o1, 3, %o4
-	bne		10b
-4:	 andcc		%o0, 3, %g3
+	be		4f
+	 nop
+
+	cmp		%o4, 2
+	be		11f
+	 cmp		%o4, 3
+	ldub		[%o1], %o5
+	add		%o1, 1, %o1
+	stb		%o5, [%o0]
+	be		13f
+	 cmp		%o5, 0
+	be		0f
+	 add		%o0, 1, %o0
+11:	lduh		[%o1], %o5
+	add		%o1, 2, %o1
+	srl		%o5, 8, %o4
+	cmp		%o4, 0
+	stb		%o4, [%o0]
+	bne,a		12f
+	 stb		%o5, [%o0 + 1]
+	retl
+	 mov		%g2, %o0
+12:	andcc		%o5, 0xff, %o5
+	bne		4f
+	 add		%o0, 2, %o0
+	retl
+	 mov 		%g2, %o0
+13:	bne		4f
+	 add		%o0, 1, %o0
+	retl
+	 mov		%g2, %o0
+
+4:	andcc		%o0, 3, %g3
 	bne		12f
 1:	ld		[%o1], %o5
 	add		%o1, 4, %o1
Index: sysdeps/sparc/sparc32/strchr.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/strchr.S,v
retrieving revision 1.5
diff -u -p -r1.5 strchr.S
--- sysdeps/sparc/sparc32/strchr.S	26 May 2005 14:30:45 -0000	1.5
+++ sysdeps/sparc/sparc32/strchr.S	5 Mar 2006 23:45:47 -0000
@@ -39,9 +39,20 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %g4
+ENTRY(strchr)
+	andcc		%o1, 0xff, %o1
+	be		12f
+	 sll		%o1, 8, %o2
+	andcc		%o0, 3, %g0
+	or		%o1, %o2, %o2
+	sethi		%hi(0x80808080), %o4
+	sll		%o2, 16, %o3
+	be		13f
+	 or		%o3, %o2, %g2
+
+	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
@@ -50,7 +61,7 @@
 	 or		%o4, %lo(0x80808080), %o3
 	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
@@ -59,27 +70,17 @@
 	 sethi		%hi(0x01010101), %o5
 	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
 	 or		%o5, %lo(0x01010101), %o2
 	b		6f
 	 ld		[%o0], %g4
-1:	retl
+11:	retl
 	 sub		%o0, 1, %o0
 
-ENTRY(strchr)
-	andcc		%o1, 0xff, %o1
-	be		12f
-	 sll		%o1, 8, %o2
-	andcc		%o0, 3, %g0
-	or		%o1, %o2, %o2
-	sethi		%hi(0x80808080), %o4
-	sll		%o2, 16, %o3
-	bne		10b
-	 or		%o3, %o2, %g2
-	or		%o4, %lo(0x80808080), %o3
+13:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o5
 5:	or		%o5, %lo(0x01010101), %o2
 7:	ld		[%o0], %g4
Index: sysdeps/sparc/sparc32/strcmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/strcmp.S,v
retrieving revision 1.4
diff -u -p -r1.4 strcmp.S
--- sysdeps/sparc/sparc32/strcmp.S	29 Apr 2003 22:47:18 -0000	1.4
+++ sysdeps/sparc/sparc32/strcmp.S	5 Mar 2006 23:45:47 -0000
@@ -38,7 +38,13 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %o4
+
+ENTRY(strcmp)
+	andcc		%o0, 3, %g0
+	be		13f
+	 sethi		%hi(0x80808080), %g1
+
+	ldub		[%o0], %o4
 	add		%o0, 1, %o0
 	ldub		[%o1], %o5
 	cmp		%o4, 0
@@ -76,11 +82,7 @@
 2:	retl
 	 mov		%o4, %o0
 
-ENTRY(strcmp)
-	andcc		%o0, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %g1
-	or		%g1, %lo(0x80808080), %o3
+13:	or		%g1, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %g1
 5:	andcc		%o1, 3, %g2
 	bne		12f
Index: sysdeps/sparc/sparc32/strcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/strcpy.S,v
retrieving revision 1.5
diff -u -p -r1.5 strcpy.S
--- sysdeps/sparc/sparc32/strcpy.S	29 Apr 2003 22:47:18 -0000	1.5
+++ sysdeps/sparc/sparc32/strcpy.S	5 Mar 2006 23:45:47 -0000
@@ -38,7 +38,14 @@
 
 	.text
 	.align		4
-1:	ldub		[%o1], %o5
+
+ENTRY(strcpy)
+	mov		%o0, %g2
+	andcc		%o1, 3, %g0
+	be		10f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o1], %o5
 	stb		%o5, [%o0]
 	cmp		%o5, 0
 	add		%o0, 1, %o0
@@ -65,12 +72,7 @@
 	b		6f
 	 andcc		%o0, 3, %g3
 
-ENTRY(strcpy)
-	mov		%o0, %g2
-	andcc		%o1, 3, %g0
-	bne		1b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+10:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	andcc		%o0, 3, %g3
 6:	bne		10f
Index: sysdeps/sparc/sparc32/strlen.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/strlen.S,v
retrieving revision 1.3
diff -u -p -r1.3 strlen.S
--- sysdeps/sparc/sparc32/strlen.S	29 Apr 2003 22:47:18 -0000	1.3
+++ sysdeps/sparc/sparc32/strlen.S	5 Mar 2006 23:45:47 -0000
@@ -38,39 +38,41 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %o5
+
+ENTRY(strlen)
+	mov		%o0, %o1
+	andcc		%o0, 3, %g0
+	be		20f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		1f
+	be		21f
 	 add		%o0, 1, %o0
 	andcc		%o0, 3, %g0
 	be		4f
 	 or		%o4, %lo(0x80808080), %o3
 	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		2f
+	be		22f
 	 add		%o0, 1, %o0
 	andcc		%o0, 3, %g0
 	be		5f
 	 sethi		%hi(0x01010101), %o4
 	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		3f
+	be		23f
 	 add		%o0, 1, %o0
 	b		11f
 	 or		%o4, %lo(0x01010101), %o2
-1:	retl
+21:	retl
 	 mov		0, %o0
-2:	retl
+22:	retl
 	 mov		1, %o0
-3:	retl
+23:	retl
 	 mov		2, %o0
 
-ENTRY(strlen)
-	mov		%o0, %o1
-	andcc		%o0, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+20:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	or		%o4, %lo(0x01010101), %o2
 11:	ld		[%o0], %o5
Index: sysdeps/sparc/sparc32/elf/start.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/elf/start.S,v
retrieving revision 1.8
diff -u -p -r1.8 start.S
--- sysdeps/sparc/sparc32/elf/start.S	17 Apr 2005 22:07:21 -0000	1.8
+++ sysdeps/sparc/sparc32/elf/start.S	5 Mar 2006 23:45:47 -0000
@@ -48,6 +48,7 @@
 	.global _start
 	.type _start,#function
 _start:
+	cfi_startproc
 
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
@@ -59,6 +60,7 @@ _start:
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*4, %sp
+	cfi_adjust_cfa_offset(6*4)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP.  */
@@ -91,6 +93,8 @@ _start:
   /* Die very horribly if exit returns.  */
 	unimp
 
+	cfi_endproc
+
 	.size _start, .-_start
 
 /* Define a symbol for the first piece of initialized data.  */
Index: sysdeps/sparc/sparc64/dl-trampoline.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc64/dl-trampoline.S,v
retrieving revision 1.1
diff -u -p -r1.1 dl-trampoline.S
--- sysdeps/sparc/sparc64/dl-trampoline.S	5 Apr 2005 21:36:52 -0000	1.1
+++ sysdeps/sparc/sparc64/dl-trampoline.S	5 Mar 2006 23:45:47 -0000
@@ -30,7 +30,13 @@
 	.globl	_dl_runtime_resolve_0
 	.type	_dl_runtime_resolve_0, @function
 _dl_runtime_resolve_0:
+	cfi_startproc
+
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	sethi   %hi(1047552), %l2
 	ldx	[%g4 + 32 + 8], %o0
 	sub     %g1, %g4, %l0
@@ -54,6 +60,9 @@ _dl_runtime_resolve_0:
 	 sllx    %l0, 3, %o1
 	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve_0, .-_dl_runtime_resolve_0
 
 	/* %g1:	PLT offset loaded by PLT entry
@@ -64,7 +73,13 @@ _dl_runtime_resolve_0:
 	.globl	_dl_runtime_resolve_1
 	.type	_dl_runtime_resolve_1, @function
 _dl_runtime_resolve_1:
+	cfi_startproc
+
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	srlx	%g1, 12, %o1
 	ldx	[%g4 + 8], %o0
 	add	%o1, %o1, %o3
@@ -73,6 +88,9 @@ _dl_runtime_resolve_1:
 	 add	%o1, %o3, %o1
 	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve_1, .-_dl_runtime_resolve_1
 
 	/* For the profiling cases we pass in our stack frame
@@ -92,6 +110,8 @@ _dl_runtime_resolve_1:
 	.globl	_dl_profile_save_regs
 	.type	_dl_profile_save_regs, @function
 _dl_profile_save_regs:
+	cfi_startproc
+
 	stx	%l0, [%sp + STACK_BIAS + ( 0 * 8)]
 	stx	%l1, [%sp + STACK_BIAS + ( 1 * 8)]
 	stx	%l2, [%sp + STACK_BIAS + ( 2 * 8)]
@@ -125,6 +145,9 @@ _dl_profile_save_regs:
 	std	%f28, [%sp + STACK_BIAS + (30 * 8)]
 	retl
 	 std	%f30, [%sp + STACK_BIAS + (31 * 8)]
+
+	cfi_endproc
+
 	.size	_dl_profile_save_regs, .-_dl_profile_save_regs
 
 	/* If we are going to call pltexit, then we must replicate
@@ -134,6 +157,8 @@ _dl_profile_save_regs:
 	.globl	_dl_profile_invoke
 	.type	_dl_profile_invoke, @function
 _dl_profile_invoke:
+	cfi_startproc
+
 	sub	%sp, %l0, %sp
 1:
 	srlx	%l0, 3, %l7
@@ -180,6 +205,10 @@ _dl_profile_invoke:
 	jmpl	%i7 + 8, %g0
 	 restore
 
+	cfi_endproc
+
+	.size	_dl_profile_invoke, .-_dl_profile_invoke
+
 	/* %g1:	PLT offset loaded by PLT entry
 	 * %g4: callers PC, which is PLT0 + 24, therefore we
 	 *      add (32 + 8) to get the address of PLT2 which
@@ -189,10 +218,16 @@ _dl_profile_invoke:
 	.globl	_dl_runtime_profile_0
 	.type	_dl_runtime_profile_0, @function
 _dl_runtime_profile_0:
+	cfi_startproc
+
 	brz,a,pn %fp, 1f
 	 mov	192, %g5
 	sub	%fp, %sp, %g5
 1:	save	%sp, -336, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	sethi   %hi(1047552), %l2
 	ldx	[%g4 + 32 + 8], %o0
 	sub     %g1, %g4, %l0
@@ -236,6 +271,9 @@ _dl_runtime_profile_0:
 
 1:	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_profile_0, .-_dl_runtime_profile_0
 
 	/* %g1:	PLT offset loaded by PLT entry
@@ -246,10 +284,16 @@ _dl_runtime_profile_0:
 	.globl	_dl_runtime_profile_1
 	.type	_dl_runtime_profile_1, @function
 _dl_runtime_profile_1:
+	cfi_startproc
+
 	brz,a,pn %fp, 1f
 	 mov	192, %g5
 	sub	%fp, %sp, %g5
 1:	save	%sp, -336, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	srlx	%g1, 12, %o1
 	ldx	[%g4 + 8], %o0
 	add	%o1, %o1, %o3
@@ -277,4 +321,7 @@ _dl_runtime_profile_1:
 
 1:	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve_1, .-_dl_runtime_resolve_1
Index: sysdeps/sparc/sparc64/memcpy.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc64/memcpy.S,v
retrieving revision 1.8
diff -u -p -r1.8 memcpy.S
--- sysdeps/sparc/sparc64/memcpy.S	26 May 2005 14:30:46 -0000	1.8
+++ sysdeps/sparc/sparc64/memcpy.S	5 Mar 2006 23:45:47 -0000
@@ -209,6 +209,7 @@ ENTRY(bcopy)
 END(bcopy)
 
 	.align		32
+ENTRY(__memcpy_large)
 200:	be,pt		%xcc, 201f			/* CTI				*/
 	 andcc		%o0, 0x38, %g5			/* IEU1		Group		*/
 	mov		8, %g1				/* IEU0				*/
@@ -443,6 +444,7 @@ END(bcopy)
 	 stb		%o5, [%o0 - 1]			/* Store			*/
 209:	retl
 	 mov		%g4, %o0
+END(__memcpy_large)
 
 #ifdef USE_BPR
 
@@ -698,6 +700,7 @@ ENTRY(memcpy)
 END(memcpy)
 
 	.align		32
+ENTRY(__memmove_slowpath)
 228:	andcc		%o2, 1, %g0			/* IEU1		Group		*/
 	be,pt		%icc, 2f+4			/* CTI				*/
 1:	 ldub		[%o1 - 1], %o5			/* LOAD		Group		*/
@@ -718,6 +721,7 @@ END(memcpy)
 	 mov		%g4, %o0
 219:	retl
 	 nop
+END(__memmove_slowpath)
 
 	.align		32
 ENTRY(memmove)
Index: sysdeps/sparc/sparc64/elf/start.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc64/elf/start.S,v
retrieving revision 1.8
diff -u -p -r1.8 start.S
--- sysdeps/sparc/sparc64/elf/start.S	17 Apr 2005 22:07:20 -0000	1.8
+++ sysdeps/sparc/sparc64/elf/start.S	5 Mar 2006 23:45:47 -0000
@@ -48,6 +48,7 @@
 	.global _start
 	.type _start,#function
 _start:
+	cfi_startproc
 
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
@@ -59,6 +60,7 @@ _start:
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*8, %sp
+	cfi_adjust_cfa_offset(6*8)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP,
@@ -92,6 +94,8 @@ _start:
   /* Die very horribly if exit returns.  */
 	illtrap	0
 
+	cfi_endproc
+
 	.size _start, .-_start
 
 /* Define a symbol for the first piece of initialized data.  */
Index: sysdeps/sparc/sparc64/sparcv9v/memset.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc64/sparcv9v/memset.S,v
retrieving revision 1.1
diff -u -p -r1.1 memset.S
--- sysdeps/sparc/sparc64/sparcv9v/memset.S	1 Mar 2006 09:17:40 -0000	1.1
+++ sysdeps/sparc/sparc64/sparcv9v/memset.S	5 Mar 2006 23:45:47 -0000
@@ -45,6 +45,7 @@ ENTRY(memset)
 	sllx		%o2, 32, %g1
 	ba,pt		%XCC, 1f
 	 or		%g1, %o2, %o2
+END(memset)
 
 ENTRY(__bzero)
 	clr		%o2
@@ -121,7 +122,6 @@ ENTRY(__bzero)
 	retl
 	 mov		%o3, %o0
 END(__bzero)
-END(memset)
 
 libc_hidden_builtin_def (memset)
 weak_alias (__bzero, bzero)
Index: sysdeps/unix/sysv/linux/sparc/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sysdeps/unix/sysv/linux/sparc/Makefile	16 Oct 2002 03:02:48 -0000	1.8
+++ sysdeps/unix/sysv/linux/sparc/Makefile	5 Mar 2006 23:45:48 -0000
@@ -1 +1,5 @@
 64bit-predefine = __sparc_v9__ __arch64__
+
+ifeq ($(subdir),rt)
+librt-routines += rt-sysdep
+endif
Index: sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S,v
retrieving revision 1.9
diff -u -p -r1.9 clone.S
--- sysdeps/unix/sysv/linux/sparc/sparc32/clone.S	26 May 2005 14:30:49 -0000	1.9
+++ sysdeps/unix/sysv/linux/sparc/sparc32/clone.S	5 Mar 2006 23:45:48 -0000
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <tcb-offsets.h>
+#include <sysdep.h>
 
 #define CLONE_VM	0x00000100
 #define CLONE_THREAD	0x00010000
@@ -32,12 +33,11 @@
 	     pid_t *ptid, void *tls, pid_t *ctid); */
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
-
-__clone:
+ENTRY (__clone)
 	save	%sp,-96,%sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
 	orcc	%i0,%g0,%g2
@@ -67,21 +67,21 @@ __clone:
 	 tst	%o1
 	bne	__thread_start
 	 nop
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %o0,%g0,%o0
 
 .Lerror:
 	call	__errno_location
 	 or	%g0,EINVAL,%i0
 	st	%i0,[%o0]
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-
-	.size	__clone, .-__clone
+END(__clone)
 
 	.type	__thread_start,@function
-
 __thread_start:
+	cfi_startproc
+
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
 	andcc	%g4, %l0, %g0
@@ -102,6 +102,8 @@ __thread_start:
 	call	_exit,0
 	 nop
 
+	cfi_endproc
+
 	.size	__thread_start, .-__thread_start
 
 weak_alias (__clone, clone)
Index: sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S,v
retrieving revision 1.4
diff -u -p -r1.4 pipe.S
--- sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S	28 Dec 2002 09:17:54 -0000	1.4
+++ sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S	5 Mar 2006 23:45:48 -0000
@@ -19,20 +19,22 @@
 
 #include <sysdep.h>
 
-	.globl __libc_pipe
-ENTRY (__libc_pipe)
-        mov %o0, %o2            /* Save PIPEDES. */
-	mov SYS_ify(pipe),%g1
-	ta 0x10
-	bcs __syscall_error_handler
-	 nop
-	st %o0, [%o2]           /* PIPEDES[0] = %o0; */
-        st %o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
+	.text
+	.globl		__syscall_error
+ENTRY(__libc_pipe)
+        mov	%o0, %o2            /* Save PIPEDES. */
+	mov	SYS_ify(pipe),%g1
+	ta	0x10
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]           /* PIPEDES[0] = %o0; */
+        st	%o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
 	retl
-	 clr %o0
-	SYSCALL_ERROR_HANDLER
+	 clr	%o0
+END(__libc_pipe)
 
-PSEUDO_END (__libc_pipe)
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
 weak_alias (__libc_pipe, pipe)
Index: sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S,v
retrieving revision 1.11
diff -u -p -r1.11 socket.S
--- sysdeps/unix/sysv/linux/sparc/sparc32/socket.S	20 Dec 2005 06:25:23 -0000	1.11
+++ sysdeps/unix/sysv/linux/sparc/sparc32/socket.S	5 Mar 2006 23:45:48 -0000
@@ -47,7 +47,7 @@
 # endif
 #endif
 
-.globl __socket
+	.globl		__syscall_error
 ENTRY (__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
@@ -76,18 +76,19 @@ ENTRY (__socket)
 	add %sp, 68, %o1		/* arg 2: parameter block */
 	LOADSYSCALL(socketcall)
 	t 0x10
-        bcs __syscall_error_handler
-	 nop
-	retl
+	bcc 1f
+	 mov %o7, %g1
+	call __syscall_error
+	 mov %g1, %o7
+1:	jmpl %o7 + 8, %g0
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save %sp, -96, %sp
-	cfi_def_cfa_register (%fp)
+	cfi_def_cfa_register(%fp)
 	cfi_window_save
-	cfi_register (%o7, %i7)
+	cfi_register(%o7, %i7)
 	CENABLE
 	 nop
 	mov %o0, %l0
@@ -95,18 +96,20 @@ ENTRY (__socket)
 	mov P(SOCKOP_,socket), %o0
 	LOADSYSCALL(socketcall)
 	t 0x10
-	bcs __syscall_error_handler2
+	bcc 1f
 	 mov %o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov %l0, %o0;
+	call __syscall_error;
+	 mov %l1, %o0;
+	b 1f
+	 mov -1, %l1;
+1:	CDISABLE
 	 mov %l0, %o0
-	jmpl %i7 + 8, %g0
+2:	jmpl %i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
 END (__socket)
 
 #ifndef NO_WEAK_ALIAS
Index: sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S,v
retrieving revision 1.3
diff -u -p -r1.3 syscall.S
--- sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S	28 Dec 2002 09:18:34 -0000	1.3
+++ sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S	5 Mar 2006 23:45:48 -0000
@@ -17,8 +17,10 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+
 	.text
-ENTRY (syscall)
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0, %g1
 	mov	%o1, %o0
 	mov	%o2, %o1
@@ -26,10 +28,10 @@ ENTRY (syscall)
 	mov	%o4, %o3
 	mov	%o5, %o4
 	ta	0x10
-	bcs	__syscall_error_handler
-	 nop
-	retl
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
Index: sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h,v
retrieving revision 1.16
diff -u -p -r1.16 sysdep.h
--- sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h	2 Jan 2006 20:48:07 -0000	1.16
+++ sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h	5 Mar 2006 23:45:48 -0000
@@ -38,131 +38,54 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
+#undef PSEUDO_END
 #undef ENTRY
 #undef END
 #undef LOC
 
-#define ENTRY(name) \
-	.global C_SYMBOL_NAME(name); \
-	.align 4;\
-	C_LABEL(name);\
-	.type name,@function;
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
 
-#define END(name) \
+#define END(name)			\
+	cfi_endproc;			\
 	.size name, . - name
 
 #define LOC(name)  .L##name
 
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	ld	[%l7 + rtld_errno], %l0;				\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#elif USE___THREAD
-# ifndef NOT_IN_libc
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-# ifdef SHARED
-#  define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %l1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	add	%l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1;		\
-	ld	[%l7 + %l1], %l1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-# else
-#  define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	add	%g2, %lo(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	ld	[%g2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%o7+8, %g0;						\
-	 mov	-1, %o0;						\
-	.previous;
-# endif
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-        .type   __errno_location,@function;				\
-	save   %sp, -96, %sp;						\
-	call   __errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;			\
+	bcc		1f;			\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_ERRVAL(name, syscall_name, args)	\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
 
-#define PSEUDO(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10;						\
-	bcs __syscall_error_handler;				\
-	 nop;							\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)		\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
+#define PSEUDO_END(name)			\
+	END(name)
 
 #else  /* __ASSEMBLER__ */
 
Index: sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S,v
retrieving revision 1.4
diff -u -p -r1.4 brk.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/brk.S	6 Jul 2001 04:56:21 -0000	1.4
+++ sysdeps/unix/sysv/linux/sparc/sparc64/brk.S	5 Mar 2006 23:45:48 -0000
@@ -37,8 +37,11 @@ __curbrk: .skip 8
 #endif
 
 	.text
-ENTRY(__brk)
+ENTRY (__brk)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 #ifdef PIC
 1:	call	2f
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
@@ -90,7 +93,6 @@ ENTRY(__brk)
 	sub	%g0, 1, %i0
 	jmpl	%i7+8, %g0
 	 restore
-
-	.size __brk, .-__brk
+END (__brk)
 
 weak_alias (__brk, brk)
Index: sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S,v
retrieving revision 1.9
diff -u -p -r1.9 clone.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/clone.S	26 May 2005 14:30:49 -0000	1.9
+++ sysdeps/unix/sysv/linux/sparc/sparc64/clone.S	5 Mar 2006 23:45:48 -0000
@@ -23,6 +23,7 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <tcb-offsets.h>
+#include <sysdep.h>
 
 #define CLONE_VM	0x00000100
 #define CLONE_THREAD	0x00010000
@@ -34,12 +35,12 @@
 	.register	%g3,#scratch
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
 
-__clone:
+ENTRY (__clone)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
 	brz,pn	%i0, 99f		/* fn non-NULL? */
@@ -65,7 +66,7 @@ __clone:
 	 nop
 	brnz,pn	%o1, __thread_start
 	 nop
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %o0, %g0, %o0
 99:
 #ifndef _LIBC_REENTRANT
@@ -88,12 +89,13 @@ __clone:
 	 nop
 	st	%i0, [%o0]
 #endif
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-	.size __clone, .-__clone
+END(__clone)
 
 	.type __thread_start,@function
 __thread_start:
+	cfi_startproc
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
 	andcc	%g4, %l0, %g0
@@ -112,6 +114,8 @@ __thread_start:
 	 mov	%g3,%o0
 	call	_exit,0
 	 nop
-	.size __thread_start, .-__thread_start
+	cfi_endproc
+
+	.size	__thread_start, .-__thread_start
 
 weak_alias (__clone, clone)
Index: sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S,v
retrieving revision 1.6
diff -u -p -r1.6 pipe.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S	28 Dec 2002 09:19:08 -0000	1.6
+++ sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S	5 Mar 2006 23:45:48 -0000
@@ -19,18 +19,22 @@
 
 #include <sysdep.h>
 
-ENTRY (__libc_pipe)
+	.text
+
+	.globl	__syscall_error
+ENTRY(__libc_pipe)
 	mov	%o0, %o2		/* Save PIPEDES. */
 	LOADSYSCALL(pipe)
 	ta	0x6d
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
 	st	%o1, [%o2 + 4]		/* PIPEDES[1] = %o1; */
 	retl
 	 clr	%o0
-	SYSCALL_ERROR_HANDLER
-PSEUDO_END (__libc_pipe)
+END(__libc_pipe)
 
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
Index: sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S,v
retrieving revision 1.3
diff -u -p -r1.3 setcontext.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S	6 Jul 2001 04:56:21 -0000	1.3
+++ sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S	5 Mar 2006 23:45:48 -0000
@@ -24,12 +24,15 @@
 .weak setcontext
 ENTRY(setcontext)
 
-	mov	1, %o1
+	ba,pt	%xcc, 1f
+	 mov	1, %o1
+
+END(setcontext)
 
 /* int __setcontext(ucontext_t *ctx, int restoremask); */
 ENTRY(__setcontext)
 
-	ldx	[%o0 + UC_SIGMASK], %o2
+1:	ldx	[%o0 + UC_SIGMASK], %o2
 	stx	%o2, [%o0 + __UC_SIGMASK]
 	ta	0x6f
 
Index: sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S,v
retrieving revision 1.6
diff -u -p -r1.6 setjmp.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S	31 Dec 2002 20:37:32 -0000	1.6
+++ sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S	5 Mar 2006 23:45:48 -0000
@@ -39,7 +39,8 @@ libc_hidden_def (_setjmp)
 /* int setjmp(jmp_buf) */
 
 ENTRY(setjmp)
-	set	1, %o1
+	ba,pt	%xcc, __sigsetjmp_local
+	 set	1, %o1
 END(setjmp)
 
 /* int __sigsetjmp(jmp_buf, savemask)  */
Index: sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S,v
retrieving revision 1.5
diff -u -p -r1.5 socket.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/socket.S	20 Dec 2005 06:25:24 -0000	1.5
+++ sysdeps/unix/sysv/linux/sparc/sparc64/socket.S	5 Mar 2006 23:45:48 -0000
@@ -47,8 +47,8 @@
 # endif
 #endif
 
-.globl __socket
-ENTRY (__socket)
+	.globl	__syscall_error
+ENTRY(__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
 	   the caller for varargs, since that's really what we have.  */
@@ -77,14 +77,15 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save	%sp, -160, %sp
 	cfi_def_cfa_register (%fp)
 	cfi_window_save
@@ -97,19 +98,21 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler2
+	bcc,pt	%xcc, 1f
 	 mov	%o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov	%l0, %o0;
+	call	__syscall_error;
+	 mov	%l1, %o0;
+	ba,pt	%xcc, 2f
+	 mov	-1, %l1;
+1:	CDISABLE
 	 mov	%l0, %o0
-	jmpl	%i7 + 8, %g0
+2:	jmpl	%i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
-END (__socket)
+END(__socket)
 
 #ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
Index: sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S,v
retrieving revision 1.5
diff -u -p -r1.5 syscall.S
--- sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S	28 Dec 2002 09:20:01 -0000	1.5
+++ sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S	5 Mar 2006 23:45:48 -0000
@@ -19,8 +19,8 @@
 #include <sysdep.h>
 	.text
 
-ENTRY (syscall)
-
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0,%g1
 	mov	%o1,%o0
 	mov	%o2,%o1
@@ -30,11 +30,10 @@ ENTRY (syscall)
 
 	ta	0x6d
 
-	bcs,pn %xcc,__syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
Index: sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h,v
retrieving revision 1.19
diff -u -p -r1.19 sysdep.h
--- sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h	6 Jan 2006 22:43:00 -0000	1.19
+++ sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h	5 Mar 2006 23:45:48 -0000
@@ -49,142 +49,52 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
+#undef PSEUDO_END
 #undef ENTRY
+#undef END
 
-#define ENTRY(name)							\
-	.global C_SYMBOL_NAME(name);					\
-	.align 2;							\
-	C_LABEL(name);							\
-	.type name,@function;
-
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits;	\
-	.globl __sparc64.get_pic.l7;					\
-	.hidden __sparc64.get_pic.l7;					\
-	.type __sparc64.get_pic.l7,@function;				\
-__sparc64.get_pic.l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp, -192, %sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc64.get_pic.l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	sethi	%hi(rtld_errno), %g1;					\
-	or	%g1, %lo(rtld_errno), %g1;				\
-	ldx	[%l7 + %g1], %l0;					\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#elif USE___THREAD
-# ifndef NOT_IN_libc
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-# ifdef SHARED
-#  define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits;	\
-	.globl __sparc64.get_pic.l7;					\
-	.hidden __sparc64.get_pic.l7;					\
-	.type __sparc64.get_pic.l7,@function;				\
-__sparc64.get_pic.l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-192,%sp;						\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %l1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc64.get_pic.l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	add	%l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1;		\
-	ldx	[%l7 + %l1], %l1, %tie_ldx(SYSCALL_ERROR_ERRNO);	\
-	st	%i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-# else
-#  define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g4;			\
-	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	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;						\
-	.previous;
-# endif
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-	.type   __errno_location,@function;				\
-	save	%sp, -192, %sp;						\
-	call	__errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d;							\
-	bcs,pn	%xcc, __syscall_error_handler;				\
-	 nop;								\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)			\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
-#undef PSEUDO_END
-#define PSEUDO_END(name)						\
-	.size name,.-name
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
+
+#define END(name)			\
+	cfi_endproc;			\
+	.size name, . - name
+
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;			\
+	bcc,pt		%xcc, 1f;		\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define	PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define	PSEUDO_ERRVAL(name, syscall_name, args) \
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
 
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name)					\
-	.size name,.-name
-
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name)						\
-	.size name,.-name
+#define PSEUDO_END(name)			\
+	END(name)
 
-#undef END
-#define END(name)							\
-	.size name,.-name
 
 /* Careful here!  This "ret" define can interfere; use jmpl if unsure.  */
 #define ret		retl; nop
--- /dev/null	2006-02-15 04:00:56.000000000 -0800
+++ sysdeps/unix/sysv/linux/sparc/rt-sysdep.c	2006-03-04 02:13:47.000000000 -0800
@@ -0,0 +1 @@
+#include <sysdep.c>
--- /dev/null	2006-02-15 04:00:56.000000000 -0800
+++ sysdeps/unix/sysv/linux/sparc/sysdep.c	2006-03-04 00:50:50.000000000 -0800
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/powerpc/sysdep.c>
--- sysdeps/unix/sysv/linux/sparc/sysdep.S.~1~	2006-03-05 16:10:45.000000000 -0800
+++ sysdeps/unix/sysv/linux/sparc/sysdep.S	2006-03-05 16:11:06.000000000 -0800
@@ -1 +1 @@
-/* Nothing to do here.  */
+sysdeps/unix/sysv/linux/sparc/sysdep.S
\ No newline at end of file


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