[v2,06/23] linux: Use generic __syscall_error for i386
Commit Message
The auto-generated syscalls calls the __syscall_error, and for i686
it results in much less compat code:
--- sizes-i686-linux-gnu.outline
+++ sizes-i686-linux-gnu.inline
text data bss dec hex filename
-1933727 11324 10172 1955223 1dd597 libc.so
- 175366 4768 184 180318 2c05e elf/ld.so
- 109851 832 8408 119091 1d133 nptl/libpthread.so
- 27983 628 184 28795 707b rt/librt.so
+1937875 11324 10172 1959371 1de5cb libc.so
+ 175790 4768 184 180742 2c206 elf/ld.so
+ 110179 832 8408 119419 1d27b nptl/libpthread.so
+ 28139 628 184 28951 7117 rt/librt.so
This patch enabled SYSCALL_ERROR_FUNC with the expected abi by also
defining SYSCALL_ERROR_FUNC_ATTR.
Checked on i686-linux-gnu.
---
sysdeps/unix/sysv/linux/i386/Makefile | 13 ------------
.../linux/i386/{sysdep.c => syscall_error.h} | 20 ++++++++-----------
2 files changed, 8 insertions(+), 25 deletions(-)
rename sysdeps/unix/sysv/linux/i386/{sysdep.c => syscall_error.h} (67%)
@@ -28,22 +28,9 @@ gen-as-const-headers += ucontext_i.sym
endif
ifeq ($(subdir),csu)
-sysdep-dl-routines += sysdep
ifeq (yes,$(build-shared))
sysdep_routines += divdi3
shared-only-routines += divdi3
CPPFLAGS-divdi3.c = -Din_divdi3_c
endif
endif
-
-ifeq ($(subdir),nptl)
-# pull in __syscall_error routine
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
-
-ifeq ($(subdir),rt)
-# pull in __syscall_error routine
-librt-routines += sysdep
-librt-shared-only-routines += sysdep
-endif
similarity index 67%
rename from sysdeps/unix/sysv/linux/i386/sysdep.c
rename to sysdeps/unix/sysv/linux/i386/syscall_error.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2015-2020 Free Software Foundation, Inc.
+/* Linux wrappers for setting errno. i386 version.
+ Copyright (C) 2020 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
@@ -15,15 +16,10 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <errno.h>
+#ifndef _SYSCALL_ERROR_H
+#define _SYSCALL_ERROR_H
-/* This routine is jumped to by all the syscall handlers, to stash
- an error number into errno. ERROR is the negative error number
- returned from the x86 kernel. */
-int
-__attribute__ ((__regparm__ (1)))
-__syscall_error (int error)
-{
- __set_errno (-error);
- return -1;
-}
+#define SYSCALL_ERROR_FUNC 1
+#define SYSCALL_ERROR_FUNC_ATTR __attribute__ ((__regparm__ (1)))
+
+#endif