diff mbox series

[11/23] linux: Use generic __syscall_error for hppa

Message ID 20201109201826.120534-12-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
HPPA issues inline error handling for auto-generated syscall,
the __syscall_error is used solely on clone implementation and
it differs from generic implementation by passing positive errno
numbers.

Also, inline error handling does not really produce the most
compat code.

--- sizes-hppa-linux-gnu.outline
+++ sizes-hppa-linux-gnu.inline
    text           data     bss     dec     hex filename
-1576515          22028    9424 1607967  18891f libc.so
- 174755          15524     448  190727   2e907 elf/ld.so
- 132799           1296    8364  142459   22c7b nptl/libpthread.so
-  30993            788     236   32017    7d11 rt/librt.so
+1579367          22028    9424 1610819  189443 libc.so
+ 174835          15524     448  190807   2e957 elf/ld.so
+ 133055           1296    8364  142715   22d7b nptl/libpthread.so
+  31297            788     236   32321    7e41 rt/librt.so

Checked on hppa-linux-gnu.
---
 sysdeps/unix/sysv/linux/hppa/clone.S  |  6 ++++--
 sysdeps/unix/sysv/linux/hppa/sysdep.c | 27 ---------------------------
 sysdeps/unix/sysv/linux/hppa/sysdep.h |  2 ++
 3 files changed, 6 insertions(+), 29 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/hppa/sysdep.c
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S
index 4eda812dd0..fcfafe1d2b 100644
--- a/sysdeps/unix/sysv/linux/hppa/clone.S
+++ b/sysdeps/unix/sysv/linux/hppa/clone.S
@@ -124,7 +124,8 @@  ENTRY(__clone)
 .LerrorRest:
 	/* Something bad happened -- no child created */
 	bl	__syscall_error, %rp
-	sub     %r0, %ret0, %arg0
+	 copy    %ret0, %arg0
+
 	ldw	-84(%sp), %rp
 	/* Return after setting errno, ret0 is set to -1 by __syscall_error. */
 	bv	%r0(%rp)
@@ -133,7 +134,8 @@  ENTRY(__clone)
 .LerrorSanity:
 	/* Sanity checks failed, return -1, and set errno to EINVAL. */
 	bl	__syscall_error, %rp
-	ldi     EINVAL, %arg0
+	 ldi     -EINVAL, %arg0
+
 	ldw	-84(%sp), %rp
 	bv	%r0(%rp)
 	ldwm	-64(%sp), %r4
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.c b/sysdeps/unix/sysv/linux/hppa/sysdep.c
deleted file mode 100644
index 8c06b6fc80..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.c
+++ /dev/null
@@ -1,27 +0,0 @@ 
-/* Copyright (C) 1997-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>
-
-/* This routine is jumped to by all the syscall handlers, to stash
-   an error number into errno.  */
-int
-__syscall_error (int err_no)
-{
-  __set_errno (err_no);
-  return -1;
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h
index 531fe2beed..a1165da81e 100644
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.h
+++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h
@@ -21,6 +21,8 @@ 
 #ifndef _LINUX_HPPA_SYSDEP_H
 #define _LINUX_HPPA_SYSDEP_H 1
 
+#define SYSCALL_ERROR_FUNC
+
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/hppa/sysdep.h>