mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Rework sparc PIC macros so crt{i,n}.S can use them too.
* 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.
This commit is contained in:
13
ChangeLog
13
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>
|
2012-02-17 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
* aout/Makefile: Remove.
|
* aout/Makefile: Remove.
|
||||||
|
@ -70,9 +70,7 @@
|
|||||||
_init:
|
_init:
|
||||||
save %sp, -STACKFRAME_SIZE, %sp
|
save %sp, -STACKFRAME_SIZE, %sp
|
||||||
#if PREINIT_FUNCTION_WEAK
|
#if PREINIT_FUNCTION_WEAK
|
||||||
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
|
SETUP_PIC_REG(l7)
|
||||||
call __sparc_get_pc_thunk.l7
|
|
||||||
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
|
|
||||||
sethi %hi(PREINIT_FUNCTION), %g1
|
sethi %hi(PREINIT_FUNCTION), %g1
|
||||||
or %g1, %lo(PREINIT_FUNCTION), %g1
|
or %g1, %lo(PREINIT_FUNCTION), %g1
|
||||||
GOT_LOAD [%l7 + %g1], %g1
|
GOT_LOAD [%l7 + %g1], %g1
|
||||||
@ -93,12 +91,3 @@ _init:
|
|||||||
.type _fini, @function
|
.type _fini, @function
|
||||||
_fini:
|
_fini:
|
||||||
save %sp, -STACKFRAME_SIZE, %sp
|
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
|
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
C name space. Make sure we use an innocuous name. */
|
C name space. Make sure we use an innocuous name. */
|
||||||
#define syscall_error C_SYMBOL_NAME(__syscall_error)
|
#define syscall_error C_SYMBOL_NAME(__syscall_error)
|
||||||
|
|
||||||
#ifdef PIC
|
#define SPARC_PIC_THUNK(reg) \
|
||||||
#define SETUP_PIC_REG(reg, tmp) \
|
|
||||||
.ifndef __sparc_get_pc_thunk.reg; \
|
.ifndef __sparc_get_pc_thunk.reg; \
|
||||||
.section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
|
.section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
|
||||||
.align 32; \
|
.align 32; \
|
||||||
@ -38,13 +37,21 @@ __sparc_get_pc_thunk.reg: \
|
|||||||
jmp %o7 + 8; \
|
jmp %o7 + 8; \
|
||||||
add %o7, %reg, %##reg; \
|
add %o7, %reg, %##reg; \
|
||||||
.previous; \
|
.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; \
|
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %##reg; \
|
||||||
mov %o7, %##tmp; \
|
mov %o7, %##tmp; \
|
||||||
call __sparc_get_pc_thunk.reg; \
|
call __sparc_get_pc_thunk.reg; \
|
||||||
or %##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg; \
|
or %##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg; \
|
||||||
mov %##tmp, %o7;
|
mov %##tmp, %o7;
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ENTRY(name) \
|
#define ENTRY(name) \
|
||||||
.global C_SYMBOL_NAME(name); \
|
.global C_SYMBOL_NAME(name); \
|
||||||
|
@ -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.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
|
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
|
||||||
@ -89,7 +89,7 @@ ENTRY(name); \
|
|||||||
#else
|
#else
|
||||||
# if RTLD_PRIVATE_ERRNO
|
# if RTLD_PRIVATE_ERRNO
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
0: SETUP_PIC_REG(o2,g1) \
|
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
||||||
sethi %hi(rtld_errno), %g1; \
|
sethi %hi(rtld_errno), %g1; \
|
||||||
or %g1, %lo(rtld_errno), %g1; \
|
or %g1, %lo(rtld_errno), %g1; \
|
||||||
ld [%o2 + %g1], %g1; \
|
ld [%o2 + %g1], %g1; \
|
||||||
@ -104,7 +104,7 @@ ENTRY(name); \
|
|||||||
# define SYSCALL_ERROR_ERRNO errno
|
# define SYSCALL_ERROR_ERRNO errno
|
||||||
# endif
|
# endif
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
0: SETUP_PIC_REG(o2,g1) \
|
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
||||||
sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
|
sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
|
||||||
add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
|
add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
|
||||||
ld [%o2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO); \
|
ld [%o2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO); \
|
||||||
@ -113,7 +113,7 @@ ENTRY(name); \
|
|||||||
mov -1, %o0;
|
mov -1, %o0;
|
||||||
# else
|
# else
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
0: SETUP_PIC_REG(o2,g1) \
|
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
||||||
sethi %hi(errno), %g1; \
|
sethi %hi(errno), %g1; \
|
||||||
or %g1, %lo(errno), %g1; \
|
or %g1, %lo(errno), %g1; \
|
||||||
ld [%o2 + %g1], %g1; \
|
ld [%o2 + %g1], %g1; \
|
||||||
|
@ -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.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
|
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
|
||||||
@ -96,7 +96,7 @@ ENTRY(name); \
|
|||||||
#else
|
#else
|
||||||
# if RTLD_PRIVATE_ERRNO
|
# if RTLD_PRIVATE_ERRNO
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
0: SETUP_PIC_REG(o2,g1) \
|
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
||||||
sethi %hi(rtld_errno), %g1; \
|
sethi %hi(rtld_errno), %g1; \
|
||||||
or %g1, %lo(rtld_errno), %g1; \
|
or %g1, %lo(rtld_errno), %g1; \
|
||||||
ldx [%o2 + %g1], %g1; \
|
ldx [%o2 + %g1], %g1; \
|
||||||
@ -111,7 +111,7 @@ ENTRY(name); \
|
|||||||
# define SYSCALL_ERROR_ERRNO errno
|
# define SYSCALL_ERROR_ERRNO errno
|
||||||
# endif
|
# endif
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
0: SETUP_PIC_REG(o2,g1) \
|
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
||||||
sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
|
sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
|
||||||
add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
|
add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
|
||||||
ldx [%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\
|
ldx [%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\
|
||||||
@ -120,7 +120,7 @@ ENTRY(name); \
|
|||||||
mov -1, %o0;
|
mov -1, %o0;
|
||||||
# else
|
# else
|
||||||
# define SYSCALL_ERROR_HANDLER \
|
# define SYSCALL_ERROR_HANDLER \
|
||||||
0: SETUP_PIC_REG(o2,g1) \
|
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
||||||
sethi %hi(errno), %g1; \
|
sethi %hi(errno), %g1; \
|
||||||
or %g1, %lo(errno), %g1; \
|
or %g1, %lo(errno), %g1; \
|
||||||
ldx [%o2 + %g1], %g1; \
|
ldx [%o2 + %g1], %g1; \
|
||||||
|
Reference in New Issue
Block a user