* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):

Store 4 bytes into errno, not 8 bytes.
	* sysdeps/unix/x86_64/sysdep.S: Store 32 bits at errno, not 64 bits.
	AFAICT, it was just blind luck that the word following errno in .bss
	was just alignment padding and not some other variable to be clobbered.
This commit is contained in:
Andreas Jaeger 2002-09-30 07:09:42 +00:00
parent 6ebd24ad98
commit f6c1008561
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -73,7 +73,7 @@
#ifndef PIC
#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
#else
/* Store (- %rax) into errno through the GOT. */
/* Store (- %rax) into errno through the GOT. Note that errno occupies 4 bytes. */
#ifdef _LIBC_REENTRANT
#define SYSCALL_ERROR_HANDLER \
0: \
@ -84,7 +84,7 @@
call BP_SYM (__errno_location)@PLT; \
POP_ERRNO_LOCATION_RETURN; \
popq %rdx; \
movq %rdx, (%rax); \
movl %edx, (%rax); \
orq $-1, %rax; \
jmp L(pseudo_end);
@ -95,7 +95,7 @@
0:movq errno@GOTPCREL(%RIP), %rcx; \
xorq %rdx, %rdx; \
subq %rax, %rdx; \
movq %rdx, (%rcx); \
movl %edx, (%rcx); \
orq $-1, %rax; \
jmp L(pseudo_end);
#endif /* _LIBC_REENTRANT */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -49,19 +49,19 @@ notb:
call BP_SYM (__errno_location)
POP_ERRNO_LOCATION_RETURN
popq %rcx
movq %rcx, (%rax)
movl %ecx, (%rax)
# endif
#else
# ifndef _LIBC_REENTRANT
movq C_SYMBOL_NAME(errno)@GOTPCREL(%rip), %rcx
movq %rax, (%rcx)
movl %eax, (%rcx)
# else
pushq %rax
PUSH_ERRNO_LOCATION_RETURN
call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
POP_ERRNO_LOCATION_RETURN
popq %rcx
movq %rcx, (%rax)
movl %ecx, (%rax)
# endif
#endif
movq $-1, %rax