about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/i686/sysdep.h')
-rw-r--r--sysdeps/unix/sysv/linux/i386/i686/sysdep.h52
1 files changed, 45 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/i686/sysdep.h b/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
index 8e7e5e0420..6b54a81d32 100644
--- a/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/i686/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@cygnus.com>, 1998.
 
@@ -32,11 +32,30 @@
 
 /* Store (- %eax) into errno through the GOT.  */
 # ifdef _LIBC_REENTRANT
-#  define SYSCALL_ERROR_HANDLER						      \
-1:movl (%esp),%ebx;							      \
+
+#  ifndef HAVE_HIDDEN
+#   define SETUP_PIC_REG \
+  call 1f;								      \
+  .subsection 1;							      \
+1:movl (%esp), %ebx;							      \
+  ret;									      \
+  .previous
+#  else
+#   define SETUP_PIC_REG \
+  .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits;	      \
+  .globl __i686.get_pc_thunk.bx;					      \
+  .hidden __i686.get_pc_thunk.bx;					      \
+  .type __i686.get_pc_thunk.bx,@function;				      \
+__i686.get_pc_thunk.bx:							      \
+  movl (%esp), %ebx;							      \
   ret;									      \
+  .previous;								      \
+  call __i686.get_pc_thunk.bx
+#  endif
+
+#  define SYSCALL_ERROR_HANDLER						      \
 0:pushl %ebx;								      \
-  call 1b;								      \
+  SETUP_PIC_REG;							      \
   addl $_GLOBAL_OFFSET_TABLE_, %ebx;					      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
@@ -52,10 +71,29 @@
 /* A quick note: it is assumed that the call to `__errno_location' does
    not modify the stack!  */
 # else
-#  define SYSCALL_ERROR_HANDLER						      \
-1:movl (%esp),%ecx;							      \
+
+#  ifndef HAVE_HIDDEN
+#   define SETUP_PIC_REG \
+  call 1f;								      \
+  .subsection 1;							      \
+1:movl (%esp), %ecx;							      \
+  ret;									      \
+  .previous
+#  else
+#   define SETUP_PIC_REG \
+  .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits;	      \
+  .globl __i686.get_pc_thunk.cx;					      \
+  .hidden __i686.get_pc_thunk.cx;					      \
+  .type __i686.get_pc_thunk.cx,@function;				      \
+__i686.get_pc_thunk.cx:							      \
+  movl (%esp), %ecx;							      \
   ret;									      \
-0:call 1b;								      \
+  .previous;								      \
+  call __i686.get_pc_thunk.cx
+#  endif
+
+#  define SYSCALL_ERROR_HANDLER						      \
+0:SETUP_PIC_REG;							      \
   addl $_GLOBAL_OFFSET_TABLE_, %ecx;					      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \