]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
authorAndreas Jaeger <aj@suse.de>
Mon, 30 Sep 2002 07:09:42 +0000 (07:09 +0000)
committerAndreas Jaeger <aj@suse.de>
Mon, 30 Sep 2002 07:09:42 +0000 (07:09 +0000)
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.

sysdeps/unix/sysv/linux/x86_64/sysdep.h
sysdeps/unix/x86_64/sysdep.S

index 972fa20442f83cfac4ea292a1982521c04893ed1..2b11d37ee353589f14714568956c32389a4063ab 100644 (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 */
index b26b1db9347ef7023ea5c3ecf70669087148167d..e7865914e1e8f692586d7feebd260d0dca0a2501 100644 (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