[v2,07/23] linux: Use generic __syscall_error for arc

Message ID 20201113165837.121629-8-adhemerval.zanella@linaro.org
State Superseded
Headers
Series Simplify internal Linux syscall |

Commit Message

Adhemerval Zanella Netto Nov. 13, 2020, 4:58 p.m. UTC
  Moving to intra DSO calls generates slight better code and avoid
a GLIBC_PRIVATE symbol (only librt increases because it issues
syscalls only in specific places).

--- sizes-arc-linux-gnuhf.before
+++ sizes-arc-linux-gnuhf.after
    text           data     bss     dec     hex filename
- 962196           9400    8116  979712   ef300 libc.so
- 110145           3724     192  114061   1bd8d elf/ld.so
-  75099            796    8348   84243   14913 nptl/libpthread.so
-  18882            600     156   19638    4cb6 rt/librt.so
+ 961186           9400    8116  978702   eef0e libc.so
+ 109745           3724     192  113661   1bbfd elf/ld.so
+  75463            796    8348   84607   14a7f nptl/libpthread.so
+  18704            596     156   19456    4c00 rt/librt.so

Checked with build for arc-linux-gnuabihf.
---
 sysdeps/arc/Versions                          |  3 ---
 .../linux/arc/{sysdep.c => syscall_error.h}   | 20 ++++++-------------
 sysdeps/unix/sysv/linux/arc/sysdep.h          | 12 +----------
 3 files changed, 7 insertions(+), 28 deletions(-)
 rename sysdeps/unix/sysv/linux/arc/{sysdep.c => syscall_error.h} (67%)
  

Patch

diff --git a/sysdeps/arc/Versions b/sysdeps/arc/Versions
index 6ac7b8e495..ff157421a5 100644
--- a/sysdeps/arc/Versions
+++ b/sysdeps/arc/Versions
@@ -2,7 +2,4 @@  libc {
   GLIBC_2.32 {
     __mcount;
   }
-  GLIBC_PRIVATE {
-    __syscall_error;
-  }
 }
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.c b/sysdeps/unix/sysv/linux/arc/syscall_error.h
similarity index 67%
rename from sysdeps/unix/sysv/linux/arc/sysdep.c
rename to sysdeps/unix/sysv/linux/arc/syscall_error.h
index fe904d723b..a45e02dbe4 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.c
+++ b/sysdeps/unix/sysv/linux/arc/syscall_error.h
@@ -1,4 +1,4 @@ 
-/* ARC wrapper for setting errno.
+/* Linux wrappers for setting errno.  AArch64 version.
    Copyright (C) 2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,18 +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
 
-extern long int __syscall_error (long int);
-libc_hidden_proto (__syscall_error)
+#define SYSCALL_ERROR_FUNC        1
+#define SYSCALL_ERROR_FUNC_ATTR
 
-/* All syscall handlers land here to avoid generated code bloat due to
-   GOT reference  to errno_location or it's equivalent.  */
-long int
-__syscall_error (long int err_no)
-{
-  __set_errno (-err_no);
-  return -1;
-}
-
-libc_hidden_def (__syscall_error)
+#endif
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index 4ab44f6925..7b36b72963 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -103,22 +103,12 @@ 
 # define PSEUDO_END_ERRVAL(name)				\
   END (name)
 
-
-/* To reduce the code footprint, we confine the actual errno access
-   to single place in __syscall_error().
-   This takes raw kernel error value, sets errno and returns -1.  */
-# if IS_IN (libc)
-#  define CALL_ERRNO_SETTER_C	bl     PLTJMP(HIDDEN_JUMPTARGET(__syscall_error))
-# else
-#  define CALL_ERRNO_SETTER_C	bl     PLTJMP(__syscall_error)
-# endif
-
 # define SYSCALL_ERROR_HANDLER				\
 L (call_syscall_err):			ASM_LINE_SEP	\
     push_s   blink			ASM_LINE_SEP	\
     cfi_adjust_cfa_offset (4)		ASM_LINE_SEP	\
     cfi_rel_offset (blink, 0)		ASM_LINE_SEP	\
-    CALL_ERRNO_SETTER_C			ASM_LINE_SEP	\
+    bl __syscall_error			ASM_LINE_SEP	\
     pop_s  blink			ASM_LINE_SEP	\
     cfi_adjust_cfa_offset (-4)		ASM_LINE_SEP	\
     cfi_restore (blink)			ASM_LINE_SEP	\