@@ -1,2 +1,2 @@
text data bss dec hex filename
- 100 0 0 100 64 io/fstatat64.o
+ 94 0 0 94 5e io/fstatat64.o
For shared objects the inline __syscall_error does generate more
compact code:
@@ -1,5 +1,5 @@
text data bss dec hex filename
-1774028 20520 15896 1810444 1ba00c libc.so
- 167499 7280 392 175171 2ac43 elf/ld.so
- 99261 1640 16728 117629 1cb7d nptl/libpthread.so
- 24751 1188 2400 28339 6eb3 rt/librt.so
+1776260 20520 15896 1812676 1ba8c4 libc.so
+ 167758 7280 392 175430 2ad46 elf/ld.so
+ 100221 1640 16728 118589 1cf3d nptl/libpthread.so
+ 24927 1188 2400 28515 6f63 rt/librt.so
A possible option might be to use the same strategy for both static
and PIC code, which allow to remove the arch-specific syscall_error.c
with a slight increase of code size in static library.
Checked on x86_64-linux-gnu.
---
.../unix/sysv/linux/x86_64/syscall_error.c | 7 +++
sysdeps/unix/sysv/linux/x86_64/sysdep.S | 40 ---------------
sysdeps/unix/x86_64/sysdep.S | 49 -------------------
3 files changed, 7 insertions(+), 89 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/x86_64/syscall_error.c
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/sysdep.S
delete mode 100644 sysdeps/unix/x86_64/sysdep.S
new file mode 100644
@@ -0,0 +1,7 @@
+/* The auto-generated syscalls calls __syscall_error for static objects. */
+#include <syscall_error.h>
+#ifndef SHARED
+# undef SYSCALL_ERROR_FUNC
+# define SYSCALL_ERROR_FUNC 1
+#endif
+#include <sysdeps/unix/sysv/linux/syscall_error.c>
deleted file mode 100644
@@ -1,40 +0,0 @@
-/* Copyright (C) 2001-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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-/* The following code is only used in the shared library when we
- compile the reentrant version. Otherwise each system call defines
- each own version. */
-
-#ifndef PIC
-
-/* The syscall stubs jump here when they detect an error.
- The code for Linux is almost identical to the canonical Unix
- code, except that the error number in %rax is negated. */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %rax. */
-
- .text
-ENTRY (__syscall_error)
- neg %RAX_LP
-
-#define __syscall_error __syscall_error_1
-#include <sysdeps/unix/x86_64/sysdep.S>
-
-#endif /* !PIC */
deleted file mode 100644
@@ -1,49 +0,0 @@
-/* Copyright (C) 2001-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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <errno.h>
-#include <tls.h>
-
-#if IS_IN (rtld)
-# include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
-#endif
-
-.globl C_SYMBOL_NAME(errno)
-.globl syscall_error
-
-__syscall_error:
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
- /* We translate the system's EWOULDBLOCK error into EAGAIN.
- The GNU C library always defines EWOULDBLOCK==EAGAIN.
- EWOULDBLOCK_sys is the original number. */
- cmp $EWOULDBLOCK_sys, %RAX_LP /* Is it the old EWOULDBLOCK? */
- jne notb /* Branch if not. */
- movl $EAGAIN, %eax /* Yes; translate it to EAGAIN. */
-notb:
-#endif
-#ifdef PIC
- movq C_SYMBOL_NAME(errno@GOTTPOFF)(%rip), %rcx
- movl %eax, %fs:0(%rcx)
-#else
- movl %eax, %fs:C_SYMBOL_NAME(errno@TPOFF)
-#endif
- or $-1, %RAX_LP
- ret
-
-#undef __syscall_error
-END (__syscall_error)