about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sparc/sysdep.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h10
3 files changed, 21 insertions, 14 deletions
diff --git a/sysdeps/unix/sparc/sysdep.h b/sysdeps/unix/sparc/sysdep.h
index fe8b75a0e7..10d561e789 100644
--- a/sysdeps/unix/sparc/sysdep.h
+++ b/sysdeps/unix/sparc/sysdep.h
@@ -26,8 +26,7 @@
    C name space.  Make sure we use an innocuous name.  */
 #define	syscall_error	C_SYMBOL_NAME(__syscall_error)
 
-#ifdef PIC
-#define SETUP_PIC_REG(reg, tmp)						\
+#define SPARC_PIC_THUNK(reg)						\
 	.ifndef __sparc_get_pc_thunk.reg;				\
 	.section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
 	.align	 32;							\
@@ -38,13 +37,21 @@ __sparc_get_pc_thunk.reg:		   				\
 	jmp	%o7 + 8;						\
 	 add	%o7, %reg, %##reg;					\
 	.previous;							\
-	.endif;								\
+	.endif;
+
+#define SETUP_PIC_REG(reg)						\
+	SPARC_PIC_THUNK(reg)						\
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %##reg;			\
+	call	__sparc_get_pc_thunk.reg;				\
+	 or	%##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg;
+
+#define SETUP_PIC_REG_LEAF(reg, tmp)					\
+	SPARC_PIC_THUNK(reg)						\
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %##reg;			\
 	mov	%o7, %##tmp;		      				\
 	call	__sparc_get_pc_thunk.reg;				\
 	 or	%##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg;		\
 	mov	%##tmp, %o7;
-#endif
 
 #define	ENTRY(name)		\
   .global C_SYMBOL_NAME(name);	\
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index 01ee307abe..fd7ded5af9 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2002, 2003, 2004, 2006, 2008, 2011
+/* Copyright (C) 1997, 2002, 2003, 2004, 2006, 2008, 2011, 2012
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
@@ -89,7 +89,7 @@ ENTRY(name);					\
 #else
 # if RTLD_PRIVATE_ERRNO
 #  define SYSCALL_ERROR_HANDLER			\
-0:	SETUP_PIC_REG(o2,g1)			\
+0:	SETUP_PIC_REG_LEAF(o2,g1)		\
 	sethi	%hi(rtld_errno), %g1;		\
 	or	%g1, %lo(rtld_errno), %g1;	\
 	ld	[%o2 + %g1], %g1;		\
@@ -103,8 +103,8 @@ ENTRY(name);					\
 #  else
 #   define SYSCALL_ERROR_ERRNO errno
 #  endif
-#  define SYSCALL_ERROR_HANDLER				\
-0:	SETUP_PIC_REG(o2,g1)					\
+#  define SYSCALL_ERROR_HANDLER					\
+0:	SETUP_PIC_REG_LEAF(o2,g1)				\
 	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;		\
 	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;	\
 	ld	[%o2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO);	\
@@ -113,7 +113,7 @@ ENTRY(name);					\
 	 mov	-1, %o0;
 # else
 #  define SYSCALL_ERROR_HANDLER		\
-0:	SETUP_PIC_REG(o2,g1)		\
+0:	SETUP_PIC_REG_LEAF(o2,g1)	\
 	sethi	%hi(errno), %g1;	\
 	or	%g1, %lo(errno), %g1;	\
 	ld	[%o2 + %g1], %g1;	\
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index c5fa866421..67ead22b50 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006, 2008, 2011
+/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006, 2008, 2011, 2012
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -96,7 +96,7 @@ ENTRY(name);					\
 #else
 # if RTLD_PRIVATE_ERRNO
 #  define SYSCALL_ERROR_HANDLER			\
-0:	SETUP_PIC_REG(o2,g1)			\
+0:	SETUP_PIC_REG_LEAF(o2,g1)		\
 	sethi	%hi(rtld_errno), %g1;		\
 	or	%g1, %lo(rtld_errno), %g1;	\
 	ldx	[%o2 + %g1], %g1;		\
@@ -110,8 +110,8 @@ ENTRY(name);					\
 #  else
 #   define SYSCALL_ERROR_ERRNO errno
 #  endif
-#  define SYSCALL_ERROR_HANDLER				\
-0:	SETUP_PIC_REG(o2,g1)					\
+#  define SYSCALL_ERROR_HANDLER					\
+0:	SETUP_PIC_REG_LEAF(o2,g1)				\
 	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;		\
 	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;	\
 	ldx	[%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\
@@ -120,7 +120,7 @@ ENTRY(name);					\
 	 mov	-1, %o0;
 # else
 #  define SYSCALL_ERROR_HANDLER		\
-0:	SETUP_PIC_REG(o2,g1)		\
+0:	SETUP_PIC_REG_LEAF(o2,g1)	\
 	sethi	%hi(errno), %g1;	\
 	or	%g1, %lo(errno), %g1;	\
 	ldx	[%o2 + %g1], %g1;	\