[16/23] linux: Use generic __syscall_error for microblaze

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

Commit Message

Adhemerval Zanella Nov. 9, 2020, 8:18 p.m. UTC
  Although the auto-generated syscall sets errno directly for dynamic
case, using a function call generates more compact code:

--- sizes-microblaze-linux-gnu.inline
+++ sizes-microblaze-linux-gnu.outline
    text           data     bss     dec     hex filename
-1835305          52738    9216 1897259  1cf32b libc.so
- 188644           7236     176  196056   2fdd8 elf/ld.so
- 121772           5872    8356  136000   21340 nptl/libpthread.so
-  30836           1724     160   32720    7fd0 rt/librt.so
+1831025          52714    9216 1892955  1ce25b libc.so
+ 188904           7240     176  196320   2fee0 elf/ld.so
+ 121540           5864    8356  135760   21250 nptl/libpthread.so
+  30640           1720     160   32520    7f08 rt/librt.so

Checked with a cross make check for microblaze-linux-gnu.
---
 sysdeps/unix/sysv/linux/microblaze/Makefile |  6 ----
 sysdeps/unix/sysv/linux/microblaze/sysdep.S | 39 ---------------------
 sysdeps/unix/sysv/linux/microblaze/sysdep.h |  2 ++
 3 files changed, 2 insertions(+), 45 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/microblaze/sysdep.S
  

Patch

diff --git a/sysdeps/unix/sysv/linux/microblaze/Makefile b/sysdeps/unix/sysv/linux/microblaze/Makefile
index d178bc6f34..614553204f 100644
--- a/sysdeps/unix/sysv/linux/microblaze/Makefile
+++ b/sysdeps/unix/sysv/linux/microblaze/Makefile
@@ -1,9 +1,3 @@ 
 ifeq ($(subdir),resource)
 sysdep_routines += backtrace_linux
 endif
-
-ifeq ($(subdir),nptl)
-# pull in __syscall_error routine
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.S b/sysdeps/unix/sysv/linux/microblaze/sysdep.S
deleted file mode 100644
index c3157880d8..0000000000
--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.S
+++ /dev/null
@@ -1,39 +0,0 @@ 
-/* Copyright (C) 2009-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 <sysdep.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.  */
-
-#ifndef	PIC
-
-/* The syscall stubs jump here when they detect an error.  */
-
-# undef CALL_MCOUNT
-# define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %d0.  */
-
-	.text
-ENTRY (__syscall_error)
-	rsubk	r3,r3,r0
-	rtsd	r15,8
-	addik	r3,r0,-1	/* delay slot.  */
-END (__syscall_error)
-#endif /* PIC.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
index 6fd96adbf0..2beaba9247 100644
--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
+++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
@@ -19,6 +19,8 @@ 
 #ifndef _LINUX_MICROBLAZE_SYSDEP_H
 #define _LINUX_MICROBLAZE_SYSDEP_H 1
 
+#define SYSCALL_ERROR_FUNC
+
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/microblaze/sysdep.h>