* sysdeps/unix/sysv/linux/i386/sysdep.h (PSEUDO): Use

SYSCALL_PIC_SETUP before jumping to syscall_error.
	* sysdeps/unix/i386/sysdep.h (SYSCALL_PIC_SETUP): New macro.
	(PSEUDO): Use it before jumping to syscall_error.
	* sysdeps/unix/i386/sysdep.S [! PIC]: Don't find GOT address;
	expect it in %ebx on entry.  Pop old %ebx value off stack after
	using it.
This commit is contained in:
Roland McGrath 1995-10-19 02:20:22 +00:00
parent 580c1888be
commit 1d234146c0
4 changed files with 27 additions and 9 deletions

View file

@ -1,5 +1,13 @@
Wed Oct 18 03:33:22 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> Wed Oct 18 03:33:22 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/i386/sysdep.h (PSEUDO): Use
SYSCALL_PIC_SETUP before jumping to syscall_error.
* sysdeps/unix/i386/sysdep.h (SYSCALL_PIC_SETUP): New macro.
(PSEUDO): Use it before jumping to syscall_error.
* sysdeps/unix/i386/sysdep.S [! PIC]: Don't find GOT address;
expect it in %ebx on entry. Pop old %ebx value off stack after
using it.
* signal/signal.h [__USE_BSD] (_sys_siglist, sys_siglist): Declare * signal/signal.h [__USE_BSD] (_sys_siglist, sys_siglist): Declare
them. them.

View file

@ -41,11 +41,11 @@ notb:
#ifndef PIC #ifndef PIC
movl %eax, C_SYMBOL_NAME(errno) movl %eax, C_SYMBOL_NAME(errno)
#else #else
/* Standard PIC nonsense to store into `errno' through the GOT. */ /* The caller has pushed %ebx and then set it up to
call here point to the GOT before calling us through the PLT. */
here: popl %ecx movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx /* Pop %ebx value saved before jumping here. */
movl C_SYMBOL_NAME(errno@GOT)(%ecx), %ecx popl %ebx
movl %eax, (%ecx) movl %eax, (%ecx)
#endif #endif
movl $-1, %eax movl $-1, %eax

View file

@ -42,15 +42,23 @@ Cambridge, MA 02139, USA. */
#endif #endif
#define PSEUDO(name, syscall_name, args) \ #define PSEUDO(name, syscall_name, args) \
lose: SYSCALL_PIC_SETUP \
jmp JUMPTARGET(syscall_error) \
.globl syscall_error; \ .globl syscall_error; \
ENTRY (name) \ ENTRY (name) \
DO_CALL (syscall_name, args); \ DO_CALL (syscall_name, args); \
jb JUMPTARGET(syscall_error) jb lose
#ifdef PIC #ifdef PIC
#define JUMPTARGET(name) name##@PLT #define JUMPTARGET(name) name##@PLT
#define SYSCALL_PIC_SETUP \
pushl %ebx; \
call 0f; \
0: popl %ebx; \
addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx;
#else #else
#define JUMPTARGET(name) name #define JUMPTARGET(name) name
#define SYSCALL_PIC_SETUP /* Nothing. */
#endif #endif
/* This is defined as a separate macro so that other sysdep.h files /* This is defined as a separate macro so that other sysdep.h files

View file

@ -42,12 +42,14 @@ Cambridge, MA 02139, USA. */
#undef PSEUDO #undef PSEUDO
#define PSEUDO(name, syscall_name, args) \ #define PSEUDO(name, syscall_name, args) \
.text; \ .text; \
lose: SYSCALL_PIC_SETUP \
jmp JUMPTARGET (syscall_error) \
.globl syscall_error; \ .globl syscall_error; \
ENTRY (name) \ ENTRY (name) \
movl $SYS_ify (syscall_name), %eax; \ movl $SYS_ify (syscall_name), %eax; \
DO_CALL (args); \ DO_CALL (args); \
testl %eax, %eax; \ testl %eax, %eax; \
jl JUMPTARGET (syscall_error) jl lose
/* We define our own ENTRY macro because the alignment should be 16 for ELF. */ /* We define our own ENTRY macro because the alignment should be 16 for ELF. */
#undef ENTRY #undef ENTRY