diff mbox series

[08/23] linux: Use generic __syscall_error for arc

Message ID 20201109201826.120534-9-adhemerval.zanella@linaro.org
State Superseded
Headers show
Series Simplify internal Linux syscall | expand

Commit Message

Adhemerval Zanella Nov. 9, 2020, 8:18 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 ---
 sysdeps/unix/sysv/linux/arc/sysdep.c | 33 ----------------------------
 sysdeps/unix/sysv/linux/arc/sysdep.h | 14 +++---------
 3 files changed, 3 insertions(+), 47 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/arc/sysdep.c
diff mbox series

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/sysdep.c
deleted file mode 100644
index fe904d723b..0000000000
--- a/sysdeps/unix/sysv/linux/arc/sysdep.c
+++ /dev/null
@@ -1,33 +0,0 @@ 
-/* ARC wrapper for setting errno.
-   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
-   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 <errno.h>
-
-extern long int __syscall_error (long int);
-libc_hidden_proto (__syscall_error)
-
-/* 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)
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index 4ab44f6925..9e43399f1e 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -19,6 +19,8 @@ 
 #ifndef _LINUX_ARC_SYSDEP_H
 #define _LINUX_ARC_SYSDEP_H 1
 
+#define SYSCALL_ERROR_FUNC
+
 #include <sysdeps/arc/sysdep.h>
 #include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
@@ -103,22 +105,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	\