about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-02-21 15:42:42 -0800
committerDavid S. Miller <davem@davemloft.net>2012-02-20 17:51:53 -0800
commit3d2b3019e0efa9735370498122ac80298deff8c7 (patch)
tree693771bb0b1fba08098558d99613ce80bc36a923 /sysdeps/unix/sysv/linux/sparc
parentc80098a9a05b7d5f8ad1488135f2cee613998c50 (diff)
downloadglibc-3d2b3019e0efa9735370498122ac80298deff8c7.tar.gz
glibc-3d2b3019e0efa9735370498122ac80298deff8c7.tar.xz
glibc-3d2b3019e0efa9735370498122ac80298deff8c7.zip
Use sparc GOTDATA relocations whenever possible.
	* sysdeps/sparc/crti.S: Try to use GOTDATA relocs.
	* sysdeps/sparc/sparc32/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/sparc/sparc32/elf/start.S: Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/sparc/sparc64/elf/start.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memset.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
	(SYSCALL_ERROR_HANDLER): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
	(SYSCALL_ERROR_HANDLER): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/sparc')
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S18
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h26
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S18
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/brk.S34
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h26
5 files changed, 95 insertions, 27 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S b/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S
index 8b5ac7fceb..dfbf76165a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S
@@ -63,17 +63,21 @@ ENTRY (____longjmp_chk)
 	 nop
 
 .Lfail:
-#ifdef PIC
-1:	call	2f
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
-2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
-	add	%l7, %o7, %l7
-#endif
+#ifndef PIC
+	sethi	%hi(longjmp_msg), %o0
+	or	%o0, %lo(longjmp_msg), %o0
+#else
+	SETUP_PIC_REG(l7)
+#ifdef HAVE_BINUTILS_GOTDATA
+	sethi	%gdop_hix22(longjmp_msg), %o0
+	xor	%o0, %gdop_lox10(longjmp_msg), %o0
+	ld	[%l7 + %o0], %o0, %gdop(longjmp_msg)
+#else
 	sethi	%hi(longjmp_msg), %o0
 	or	%o0, %lo(longjmp_msg), %o0
-#ifdef PIC
 	ld	[%l7 + %o0], %o0
 #endif
+#endif
 	call	HIDDEN_JUMPTARGET(__fortify_fail)
 	 nop
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index fd7ded5af9..3d6042e9ec 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -88,7 +88,17 @@ ENTRY(name);					\
 	 mov	%g1, %o7;
 #else
 # if RTLD_PRIVATE_ERRNO
-#  define SYSCALL_ERROR_HANDLER			\
+#  ifdef HAVE_BINUTILS_GOTDATA
+#   define SYSCALL_ERROR_HANDLER		\
+0:	SETUP_PIC_REG_LEAF(o2,g1)		\
+	sethi	%gdop_hix22(rtld_errno), %g1;	\
+	xor	%g1, %gdop_lox10(rtld_errno), %g1;\
+	ld	[%o2 + %g1], %g1, %gdop(rtld_errno); \
+	st	%o0, [%g1];			\
+	jmp	%o7 + 8;			\
+	 mov	-1, %o0;
+#  else
+#   define SYSCALL_ERROR_HANDLER		\
 0:	SETUP_PIC_REG_LEAF(o2,g1)		\
 	sethi	%hi(rtld_errno), %g1;		\
 	or	%g1, %lo(rtld_errno), %g1;	\
@@ -96,6 +106,7 @@ ENTRY(name);					\
 	st	%o0, [%g1];			\
 	jmp	%o7 + 8;			\
 	 mov	-1, %o0;
+#  endif
 # elif defined _LIBC_REENTRANT
 
 #  ifndef NOT_IN_libc
@@ -112,7 +123,17 @@ ENTRY(name);					\
 	jmp	%o7 + 8;					\
 	 mov	-1, %o0;
 # else
-#  define SYSCALL_ERROR_HANDLER		\
+#  ifdef HAVE_BINUTILS_GOTDATA
+#   define SYSCALL_ERROR_HANDLER	\
+0:	SETUP_PIC_REG_LEAF(o2,g1)	\
+	sethi	%gdop_hix22(errno), %g1;\
+	xor	%g1, %gdop_lox10(errno), %g1;\
+	ld	[%o2 + %g1], %g1, %gdop(errno);\
+	st	%o0, [%g1];		\
+	jmp	%o7 + 8;		\
+	 mov	-1, %o0;
+#  else
+#   define SYSCALL_ERROR_HANDLER	\
 0:	SETUP_PIC_REG_LEAF(o2,g1)	\
 	sethi	%hi(errno), %g1;	\
 	or	%g1, %lo(errno), %g1;	\
@@ -120,6 +141,7 @@ ENTRY(name);					\
 	st	%o0, [%g1];		\
 	jmp	%o7 + 8;		\
 	 mov	-1, %o0;
+#  endif
 # endif	/* _LIBC_REENTRANT */
 #endif	/* PIC */
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S
index c6587d5965..69cf5acb38 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S
@@ -62,17 +62,21 @@ ENTRY (____longjmp_chk)
 	 nop
 
 .Lfail:
-#ifdef PIC
-1:	call	2f
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
-2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
-	add	%l7, %o7, %l7
-#endif
+#ifndef PIC
+	sethi	%hi(longjmp_msg), %o0
+	or	%o0, %lo(longjmp_msg), %o0
+#else
+	SETUP_PIC_REG(l7)
+#ifdef HAVE_BINUTILS_GOTDATA
+	sethi	%gdop_hix22(longjmp_msg), %o0
+	xor	%o0, %gdop_lox10(longjmp_msg), %o0
+	ldx	[%l7 + %o0], %o0, %gdop(longjmp_msg)
+#else
 	sethi	%hi(longjmp_msg), %o0
 	or	%o0, %lo(longjmp_msg), %o0
-#ifdef PIC
 	ldx	[%l7 + %o0], %o0
 #endif
+#endif
 	call	HIDDEN_JUMPTARGET(__fortify_fail)
 	 nop
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
index 74500eb486..a89d8775e1 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
@@ -42,10 +42,7 @@ ENTRY (__brk)
 	cfi_window_save
 	cfi_register(%o7, %i7)
 #ifdef PIC
-1:	call	2f
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
-2:	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
-	add	%l7, %o7, %l7
+	SETUP_PIC_REG(l7)
 #endif
 
 	LOADSYSCALL(brk)
@@ -62,10 +59,20 @@ ENTRY (__brk)
 	 nop
 
 	/* Update __curbrk and return cleanly.  */
-.Lok:	sethi	%hi(__curbrk), %g1
+.Lok:
+#ifndef PIC
+	sethi	%hi(__curbrk), %g1
 	or	%g1, %lo(__curbrk), %g1
-#ifdef PIC
-	ldx	[%l7+%g1], %g1
+#else
+#ifdef HAVE_BINUTILS_GOTDATA
+	sethi	%gdop_hix22(__curbrk), %g1
+	xor	%g1, %gdop_lox10(__curbrk), %g1
+	ldx	[%l7 + %g1], %g1, %gdop(__curbrk)
+#else
+	sethi	%hi(__curbrk), %g1
+	or	%g1, %lo(__curbrk), %g1
+	ldx	[%l7 + %g1], %g1
+#endif
 #endif
 	stx	%o0, [%g1]
 	mov	%g0, %i0
@@ -78,10 +85,19 @@ ENTRY (__brk)
 .Lerr0:	set	ENOMEM, %o0
 .Lerr1:
 #ifndef _LIBC_REENTRANT
+#ifndef PIC
 	sethi	%hi(errno), %g1
 	or	%g1, %lo(errno), %g1
-#ifdef PIC
-	ldx	[%l7+%g1], %g1
+#else
+#ifdef HAVE_BINUTILS_GOTDATA
+	sethi	%gdop_hix22(errno), %g1
+	xor	%g1, %gdop_lox10(errno), %g1
+	ldx	[%l7 + %g1], %g1, %gdop(errno)
+#else
+	sethi	%hi(errno), %g1
+	or	%g1, %lo(errno), %g1
+	ldx	[%l7 + %g1], %g1
+#endif
 #endif
 	st	%o0, [%g1]
 #else
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index 67ead22b50..33e1a41165 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -95,7 +95,17 @@ ENTRY(name);					\
 	 mov	%g1, %o7;
 #else
 # if RTLD_PRIVATE_ERRNO
-#  define SYSCALL_ERROR_HANDLER			\
+#  ifdef HAVE_BINUTILS_GOTDATA
+#   define SYSCALL_ERROR_HANDLER		\
+0:	SETUP_PIC_REG_LEAF(o2,g1)		\
+	sethi	%gdop_hix22(rtld_errno), %g1;	\
+	xor	%g1, %gdop_lox10(rtld_errno), %g1;\
+	ldx	[%o2 + %g1], %g1, %gdop(rtld_errno); \
+	st	%o0, [%g1];			\
+	jmp	%o7 + 8;			\
+	 mov	-1, %o0;
+#  else
+#   define SYSCALL_ERROR_HANDLER		\
 0:	SETUP_PIC_REG_LEAF(o2,g1)		\
 	sethi	%hi(rtld_errno), %g1;		\
 	or	%g1, %lo(rtld_errno), %g1;	\
@@ -103,6 +113,7 @@ ENTRY(name);					\
 	st	%o0, [%g1];			\
 	jmp	%o7 + 8;			\
 	 mov	-1, %o0;
+#  endif
 # elif defined _LIBC_REENTRANT
 
 #  ifndef NOT_IN_libc
@@ -119,7 +130,17 @@ ENTRY(name);					\
 	jmp	%o7 + 8;					\
 	 mov	-1, %o0;
 # else
-#  define SYSCALL_ERROR_HANDLER		\
+#  ifdef HAVE_BINUTILS_GOTDATA
+#   define SYSCALL_ERROR_HANDLER	\
+0:	SETUP_PIC_REG_LEAF(o2,g1)	\
+	sethi	%gdop_hix22(errno), %g1;\
+	xor	%g1, %gdop_lox10(errno), %g1;\
+	ldx	[%o2 + %g1], %g1, %gdop(errno);\
+	st	%o0, [%g1];		\
+	jmp	%o7 + 8;		\
+	 mov	-1, %o0;
+#  else
+#   define SYSCALL_ERROR_HANDLER	\
 0:	SETUP_PIC_REG_LEAF(o2,g1)	\
 	sethi	%hi(errno), %g1;	\
 	or	%g1, %lo(errno), %g1;	\
@@ -127,6 +148,7 @@ ENTRY(name);					\
 	st	%o0, [%g1];		\
 	jmp	%o7 + 8;		\
 	 mov	-1, %o0;
+#  endif
 # endif	/* _LIBC_REENTRANT */
 #endif	/* PIC */