diff mbox series

[v2,13/23] linux: Use generic __syscall_error for s390

Message ID 20201113165837.121629-14-adhemerval.zanella@linaro.org
State New
Headers show
Series Simplify internal Linux syscall | expand

Commit Message

Adhemerval Zanella Nov. 13, 2020, 4:58 p.m. UTC
The auto-generated syscalls issue the __syscall_error only for
static objects, so an arch specific syscall_error is added.  However
the size of using inline __syscall_error is slight better even for
static case:
diff mbox series

Patch

--- size-fstatat64.inline
+++ size-fstatat64.outline
@@ -1,2 +1,2 @@ 
    text           data     bss     dec     hex filename
-    120              0       0     120      78 io/fstatat64.o
+    128              0       0     128      80 io/fstatat64.o

For shared objects the inline syscall generates slight large code
(specially for libc.so).

--- sizes-s390x-linux-gnu.outline
+++ sizes-s390x-linux-gnu.inline
    text           data     bss     dec     hex filename
-1755806          20232   14544 1790582  1b5276 libc.so
- 169705           6696     336  176737   2b261 elf/ld.so
- 111982           1664   16680  130326   1fd16 nptl/libpthread.so
-  29703           1132    2296   33131    816b rt/librt.so
+1756334          20232   14544 1791110  1b5486 libc.so
+ 169385           6696     336  176417   2b121 elf/ld.so
+ 112198           1664   16680  130542   1fdee nptl/libpthread.so
+  29719           1132    2296   33147    817b rt/librt.so

Checked on s390x-linux-gnu and s390-linux-gnu.
---
 sysdeps/s390/nptl/Makefile                    |  5 --
 sysdeps/unix/sysv/linux/s390/Makefile         |  5 --
 sysdeps/unix/sysv/linux/s390/rt-sysdep.S      |  1 -
 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S | 74 ------------------
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S | 75 -------------------
 sysdeps/unix/sysv/linux/s390/syscall_error.c  |  7 ++
 6 files changed, 7 insertions(+), 160 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/s390/rt-sysdep.S
 delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
 delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
 create mode 100644 sysdeps/unix/sysv/linux/s390/syscall_error.c

diff --git a/sysdeps/s390/nptl/Makefile b/sysdeps/s390/nptl/Makefile
index d34cb27699..7869dd571c 100644
--- a/sysdeps/s390/nptl/Makefile
+++ b/sysdeps/s390/nptl/Makefile
@@ -18,8 +18,3 @@ 
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
-
-ifeq ($(subdir),nptl)
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile
index d9db1b5422..0d88f8d7ff 100644
--- a/sysdeps/unix/sysv/linux/s390/Makefile
+++ b/sysdeps/unix/sysv/linux/s390/Makefile
@@ -2,11 +2,6 @@  abi-variants := 32 64
 abi-32-condition := __WORDSIZE == 32
 abi-64-condition := __WORDSIZE == 64
 
-ifeq ($(subdir),rt)
-librt-routines += rt-sysdep
-librt-shared-only-routines += rt-sysdep
-endif
-
 ifeq ($(subdir),stdlib)
 gen-as-const-headers += ucontext_i.sym
 endif
diff --git a/sysdeps/unix/sysv/linux/s390/rt-sysdep.S b/sysdeps/unix/sysv/linux/s390/rt-sysdep.S
deleted file mode 100644
index f966bf1e59..0000000000
--- a/sysdeps/unix/sysv/linux/s390/rt-sysdep.S
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
deleted file mode 100644
index f8a6b7901d..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
+++ /dev/null
@@ -1,74 +0,0 @@ 
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
-   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 <tls.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.  */
-
-/* The syscall stubs jump here when they detect an error.  */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT
-
-	.text
-ENTRY(__syscall_error)
-#ifndef PIC
-# if IS_IN (libc)
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-	basr	%r1,0
-0:	l	%r1,1f-0b(%r1)
-	ear	%r3,%a0
-	lcr	%r2,%r2
-	st	%r2,0(%r1,%r3)
-	lhi	%r2,-1
-	br	%r14
-1:	.long	SYSCALL_ERROR_ERRNO@ntpoff
-#else
-# if RTLD_PRIVATE_ERRNO
-	basr	%r1,0
-0:	al	%r1,1f-0b(%r1)
-	lcr	%r2,%r2
-	st	%r2,0(%r1)
-	lhi	%r2,-1
-	br	%r14
-1:	.long	rtld_errno - 0b
-# else
-#  if IS_IN (libc)
-#   define SYSCALL_ERROR_ERRNO __libc_errno
-#  else
-#   define SYSCALL_ERROR_ERRNO errno
-#  endif
-	basr	%r1,0
-0:	al	%r1,1f-0b(%r1)
-	ear	%r3,%a0
-	l	%r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1)
-	lcr	%r2,%r2
-	st	%r2,0(%r1,%r3)
-	lhi	%r2,-1
-	br	%r14
-1:	.long	_GLOBAL_OFFSET_TABLE_-0b
-# endif
-#endif
-
-END (__syscall_error)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
deleted file mode 100644
index 98c8dd3913..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
+++ /dev/null
@@ -1,75 +0,0 @@ 
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
-   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 <tls.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.  */
-
-/* The syscall stubs jump here when they detect an error.  */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT
-
-.text
-ENTRY(__syscall_error)
-#ifndef PIC
-# if IS_IN (libc)
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-	basr	%r1,0
-0:	lg	%r1,1f-0b(%r1)
-	ear	%r3,%a0
-	sllg	%r3,%r3,32
-	ear	%r3,%a1
-	lcr	%r2,%r2
-	st	%r2,0(%r1,%r3)
-	lghi	%r2,-1
-	br	%r14
-1:	.quad	SYSCALL_ERROR_ERRNO@ntpoff
-#else
-# if RTLD_PRIVATE_ERRNO
-	larl	%r1,rtld_errno
-	lcr	%r2,%r2
-	st	%r2,0(%r1)
-	lghi	%r2,-1
-	br	%r14
-# else
-#  if IS_IN (libc)
-#   define SYSCALL_ERROR_ERRNO __libc_errno
-#  else
-#   define SYSCALL_ERROR_ERRNO errno
-#  endif
-	larl	%r1,_GLOBAL_OFFSET_TABLE_
-	lg	%r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1)
-	ear	%r3,%a0
-	sllg	%r3,%r3,32
-	ear	%r3,%a1
-	lcr	%r2,%r2
-	st	%r2,0(%r1,%r3)
-	lghi	%r2,-1
-	br	%r14
-# endif
-#endif
-
-END (__syscall_error)
diff --git a/sysdeps/unix/sysv/linux/s390/syscall_error.c b/sysdeps/unix/sysv/linux/s390/syscall_error.c
new file mode 100644
index 0000000000..de5491dc50
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/syscall_error.c
@@ -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>