aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--sysdeps/sparc/crti.S13
-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
5 files changed, 35 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index da9a167..fee48a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-02-18 David S. Miller <davem@davemloft.net>
+
+ * sysdeps/unix/sparc/sysdep.h (SPARC_PIC_THUNK): New macro.
+ (SETUP_PIC_REG): Use SPARC_PIC_THUNK and don't save and restore
+ %o7 across the call.
+ (SETUP_PIC_REG_LEAF): Do %o7 save/restore in this new macro
+ instead.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Use
+ SETUP_PIC_REG_LEAF.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.
+ * sysdeps/sparc/crti.S: Use SETUP_PIC_REG.
+ * sysdeps/sparc/crtn.S: Likewise.
+
2012-02-17 Ulrich Drepper <drepper@gmail.com>
* aout/Makefile: Remove.
diff --git a/sysdeps/sparc/crti.S b/sysdeps/sparc/crti.S
index adb1b29..6ec4e9a 100644
--- a/sysdeps/sparc/crti.S
+++ b/sysdeps/sparc/crti.S
@@ -70,9 +70,7 @@
_init:
save %sp, -STACKFRAME_SIZE, %sp
#if PREINIT_FUNCTION_WEAK
- sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
- call __sparc_get_pc_thunk.l7
- add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+ SETUP_PIC_REG(l7)
sethi %hi(PREINIT_FUNCTION), %g1
or %g1, %lo(PREINIT_FUNCTION), %g1
GOT_LOAD [%l7 + %g1], %g1
@@ -93,12 +91,3 @@ _init:
.type _fini, @function
_fini:
save %sp, -STACKFRAME_SIZE, %sp
-
- .section .text.__sparc_get_pc_thunk.l7,"axG",@progbits,__sparc_get_pc_thunk.l7,comdat
- .p2align 2
- .weak __sparc_get_pc_thunk.l7
- .hidden __sparc_get_pc_thunk.l7
- .type __sparc_get_pc_thunk.l7, #function
-__sparc_get_pc_thunk.l7:
- jmp %o7 + 8
- add %o7, %l7, %l7
diff --git a/sysdeps/unix/sparc/sysdep.h b/sysdeps/unix/sparc/sysdep.h
index fe8b75a..10d561e 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 01ee307..fd7ded5 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 c5fa866..67ead22 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; \