summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/solaris2/kopensolaris-gnu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/solaris2/kopensolaris-gnu')
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/sysdep.h94
1 files changed, 23 insertions, 71 deletions
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/sysdep.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/sysdep.h
index 68733b7d78..8bbb05ddd1 100644
--- a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/sysdep.h
@@ -220,80 +220,32 @@
int $T_FASTTRAP; \
L(pseudo_end):
-
-#ifndef PIC
-# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
-#else
-
-# if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER \
-0: SETUP_PIC_REG(cx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
- movl %eax, rtld_errno@GOTOFF(%ecx); \
- orl $-1, %eax; \
- SYSCALL_64BIT_RETURN_ASM \
- jmp L(pseudo_end);
-
-# elif defined _LIBC_REENTRANT
-
-# if USE___THREAD
-# ifndef NOT_IN_libc
-# define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-# define SYSCALL_ERROR_ERRNO errno
-# endif
-# define SYSCALL_ERROR_HANDLER \
-0: SETUP_PIC_REG (cx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
- movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx; \
- SYSCALL_ERROR_HANDLER_TLS_STORE (%eax, %ecx); \
- orl $-1, %eax; \
- SYSCALL_64BIT_RETURN_ASM \
- jmp L(pseudo_end);
-# ifndef NO_TLS_DIRECT_SEG_REFS
-# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
- movl src, %gs:(destoff)
-# else
-# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
- addl %gs:0, destoff; \
- movl src, (destoff)
-# endif
+# if defined PIC && defined RTLD_PRIVATE_ERRNO
+# define SYSCALL_SET_ERRNO \
+ lea rtld_errno(%rip), %RCX_LP; \
+ neg %eax; \
+ movl %eax, (%rcx)
+# else
+# ifndef NOT_IN_libc
+# define SYSCALL_ERROR_ERRNO __libc_errno
# else
-# define SYSCALL_ERROR_HANDLER \
-0:pushl %ebx; \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (ebx, 0); \
- SETUP_PIC_REG (bx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ebx; \
- pushl %eax; \
- cfi_adjust_cfa_offset (4); \
- PUSH_ERRNO_LOCATION_RETURN; \
- call BP_SYM (__errno_location)@PLT; \
- POP_ERRNO_LOCATION_RETURN; \
- popl %ecx; \
- cfi_adjust_cfa_offset (-4); \
- popl %ebx; \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (ebx); \
- movl %ecx, (%eax); \
- orl $-1, %eax; \
- SYSCALL_64BIT_RETURN_ASM \
- jmp L(pseudo_end);
-/* A quick note: it is assumed that the call to `__errno_location' does
- not modify the stack! */
+# define SYSCALL_ERROR_ERRNO errno
# endif
+# define SYSCALL_SET_ERRNO \
+ movq SYSCALL_ERROR_ERRNO@GOTTPOFF(%rip), %rcx;\
+ neg %eax; \
+ movl %eax, %fs:(%rcx);
+# endif
+
+# ifndef PIC
+# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
# else
-/* Store (%eax) into errno through the GOT. */
-# define SYSCALL_ERROR_HANDLER \
-0:SETUP_PIC_REG(cx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
- movl errno@GOT(%ecx), %ecx; \
- movl %eax, (%ecx); \
- orl $-1, %eax; \
- SYSCALL_64BIT_RETURN_ASM \
- jmp L(pseudo_end);
-# endif /* _LIBC_REENTRANT */
-#endif /* PIC */
+# define SYSCALL_ERROR_HANDLER \
+0: \
+ SYSCALL_SET_ERRNO; \
+ or $-1, %RAX_LP; \
+ ret;
+# endif /* PIC */