[17/23] linux: Use generic __syscall_error for ia64

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

Commit Message

Adhemerval Zanella Netto Nov. 9, 2020, 8:18 p.m. UTC
  Although the auto-generated syscall issues __syscall_errno, using
an inline function generates much more compact code:

--- sizes-ia64-linux-gnu.inline
+++ sizes-ia64-linux-gnu.outline
    text           data     bss     dec     hex filename
-2940053          20776   14424 2975253  2d6615 libc.so
- 301887          23190    1968  327045   4fd85 elf/ld.so
- 203203           2472   16640  222315   3646b nptl/libpthread.so
-  47153           1764    2272   51189    c7f5 rt/librt.so
+2947445          20776   14424 2982645  2d82f5 libc.so
+ 302591          23190    1968  327749   50045 elf/ld.so
+ 204987           2472   16640  224099   36b63 nptl/libpthread.so
+  47609           1764    2272   51645    c9bd rt/librt.so

Checked with a cross make check for ia64-linux-gnu.
---
 sysdeps/ia64/nptl/Makefile                   |  5 --
 sysdeps/unix/sysv/linux/ia64/Makefile        |  5 --
 sysdeps/unix/sysv/linux/ia64/rt-sysdep.S     |  1 -
 sysdeps/unix/sysv/linux/ia64/syscall_error.c |  3 +
 sysdeps/unix/sysv/linux/ia64/sysdep.S        | 58 --------------------
 5 files changed, 3 insertions(+), 69 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/rt-sysdep.S
 create mode 100644 sysdeps/unix/sysv/linux/ia64/syscall_error.c
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/sysdep.S
  

Patch

diff --git a/sysdeps/ia64/nptl/Makefile b/sysdeps/ia64/nptl/Makefile
index d34cb27699..7869dd571c 100644
--- a/sysdeps/ia64/nptl/Makefile
+++ b/sysdeps/ia64/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/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile
index 97fc7df0b1..57917e78db 100644
--- a/sysdeps/unix/sysv/linux/ia64/Makefile
+++ b/sysdeps/unix/sysv/linux/ia64/Makefile
@@ -17,11 +17,6 @@  ifeq ($(subdir),elf)
 sysdep-dl-routines += dl-static
 endif
 
-ifeq ($(subdir),rt)
-librt-routines += rt-sysdep
-librt-shared-only-routines += rt-sysdep
-endif
-
 ifeq ($(subdir),nptl)
 libpthread-sysdep_routines += __ia64_longjmp unwind_longjmp __sigstack_longjmp
 endif
diff --git a/sysdeps/unix/sysv/linux/ia64/rt-sysdep.S b/sysdeps/unix/sysv/linux/ia64/rt-sysdep.S
deleted file mode 100644
index f966bf1e59..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/rt-sysdep.S
+++ /dev/null
@@ -1 +0,0 @@ 
-#include <sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/ia64/syscall_error.c b/sysdeps/unix/sysv/linux/ia64/syscall_error.c
new file mode 100644
index 0000000000..60fa99a158
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/syscall_error.c
@@ -0,0 +1,3 @@ 
+/* The auto-generated syscalls calls __syscall_error.  */
+#define SYSCALL_ERROR_FUNC
+#include <sysdeps/unix/sysv/linux/syscall_error.c>
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.S b/sysdeps/unix/sysv/linux/ia64/sysdep.S
deleted file mode 100644
index 75fc3d6456..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.S
+++ /dev/null
@@ -1,58 +0,0 @@ 
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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 <features.h>
-#include <tls.h>
-
-ENTRY(__syscall_error)
-#if RTLD_PRIVATE_ERRNO
-	/*
-	 * Note that the gp has to be set properly for this to work.
-	 * As long as all syscalls are in the same load unit
-	 * (executable or shared library) as this routine, we should
-	 * be fine.  Otherwise, we would have to first load the global
-	 * pointer register from __gp.
-	 */
-	addl	r2=@gprel(rtld_errno),gp
-	;;
-	st4	[r2]=r8
-	mov	r8=-1
-#else
-# if IS_IN (libc)
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-	addl	r2=@ltoff(@tprel(SYSCALL_ERROR_ERRNO)), gp;;
-	ld8	r2=[r2]
-	mov	r3=r8;;
-	mov	r8=-1
-	add	r2=r2,r13;;
-	st4	[r2]=r3
-#endif
-	ret			// ret is #define'd in syscall.h!
-END(__syscall_error)
-
-ENTRY(__ia64_syscall)
-	mov r15=r37		/* syscall number */
-	break __IA64_BREAK_SYSCALL
-	cmp.eq p6,p0=-1,r10	/* r10 = -1 on error */
-(p6)	br.cond.spnt.few __syscall_error
-	ret
-PSEUDO_END(__ia64_syscall)