Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc Mark __cerror as hidden to avoid using the PLT. Th...



details:   https://anonhg.NetBSD.org/src/rev/cf8934b680ca
branches:  trunk
changeset: 971831:cf8934b680ca
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue May 05 20:43:47 2020 +0000

description:
Mark __cerror as hidden to avoid using the PLT.  This is required for new
binutils where the PLT stubs now use %t1 (%r22) which is used to pass
the errno to __cerror.

diffstat:

 lib/libc/arch/hppa/SYS.h                           |  16 ++++++++++++----
 lib/libc/arch/hppa/sys/__clone.S                   |  13 +++++++------
 lib/libc/arch/hppa/sys/__vfork14.S                 |  10 ++++++----
 lib/libc/compat/arch/hppa/sys/compat_sigpending.S  |   4 +---
 lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S |   4 +---
 lib/libc/compat/arch/hppa/sys/compat_sigreturn.S   |   4 +---
 lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S  |   4 +---
 7 files changed, 29 insertions(+), 26 deletions(-)

diffs (176 lines):

diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/arch/hppa/SYS.h
--- a/lib/libc/arch/hppa/SYS.h  Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/arch/hppa/SYS.h  Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: SYS.h,v 1.11 2020/05/05 20:39:18 skrll Exp $   */
+/*     $NetBSD: SYS.h,v 1.12 2020/05/05 20:43:47 skrll Exp $   */
 
 /*     $OpenBSD: SYS.h,v 1.9 2001/09/20 20:52:09 millert Exp $ */
 
@@ -35,13 +35,17 @@
 #define        SYSENTRY(x)     LEAF_ENTRY(x)
 #define        SYSEXIT(x)      EXIT(x)
 
+/*
+ * The restore of rp in the branch to __cerror delay slot is required
+ */
 #define        SYSCALL(x)                              !\
        stw     %rp, HPPA_FRAME_ERP(%sr0,%sp)   !\
        ldil    L%SYSCALLGATE, %r1              !\
        ble     4(%sr2, %r1)                    !\
-       ldi     __CONCAT(SYS_,x), %t1           !\
-       .import __cerror, code                  !\
-       comb,<> %r0, %t1, __cerror              !\
+        ldi    __CONCAT(SYS_,x), %t1           !\
+       comb,=,n %r0, %t1, 1f                   !\
+       b       __cerror                        !\
+1:                                             !\
         ldw    HPPA_FRAME_ERP(%sr0,%sp), %rp
 
 #define        PSEUDO(x,y)                             !\
@@ -73,3 +77,7 @@
 #define WSYSCALL(weak,strong)          !\
        PSEUDO(weak,weak)
 #endif
+
+       .global __cerror
+       .hidden __cerror
+       .import __cerror, code
diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/arch/hppa/sys/__clone.S
--- a/lib/libc/arch/hppa/sys/__clone.S  Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/arch/hppa/sys/__clone.S  Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: __clone.S,v 1.7 2020/05/05 06:20:55 skrll Exp $        */
+/*     $NetBSD: __clone.S,v 1.8 2020/05/05 20:43:47 skrll Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,8 +36,6 @@
        WEAK_ALIAS(clone, __clone)
 #endif
 
-       .import __cerror, code
-
 /*
  * int clone(int (*fn)(void *), void *stack, int flags, void *arg);
  */
@@ -46,10 +44,9 @@
        /*
         * Sanity checks: func and stack may not be NULL.
         */
-       ldi     EINVAL, %t1
-       comb,=  %r0, %arg0, __cerror
+       comb,=  %r0, %arg0, 8f
         nop
-       comb,=  %r0, %arg1, __cerror
+       comb,=  %r0, %arg1, 8f
         nop
 
        /*
@@ -67,6 +64,10 @@
        comb,<>,n %r0, %ret1, 9f
        bv,n    %r0(%rp)
 
+8:
+       b       __cerror
+        ldi    EINVAL, %t1
+
 9:     /*
         * Child: Reload the function and argument from the new stack.
         */
diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/arch/hppa/sys/__vfork14.S
--- a/lib/libc/arch/hppa/sys/__vfork14.S        Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/arch/hppa/sys/__vfork14.S        Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: __vfork14.S,v 1.8 2020/05/05 06:20:55 skrll Exp $      */
+/*     $NetBSD: __vfork14.S,v 1.9 2020/05/05 20:43:47 skrll Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -57,9 +57,11 @@
        copy    %rp, %t4
        ldil    L%SYSCALLGATE, %r1
        ble     4(%sr2, %r1)
-       ldi     SYS___vfork14, %t1
-       comb,<> %r0, %t1, __cerror
-        copy   %t4, %rp
+        ldi    SYS___vfork14, %t1
+       comb,=,n %r0, %t1, 1f
+       b       __cerror
+1:
+        copy   %t4, %rp                // delay slot of branch to __cerror
        addi    -1, %ret1, %ret1
        bv      %r0(%rp)
         and    %ret0, %ret1, %ret0
diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/compat/arch/hppa/sys/compat_sigpending.S
--- a/lib/libc/compat/arch/hppa/sys/compat_sigpending.S Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/compat/arch/hppa/sys/compat_sigpending.S Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_sigpending.S,v 1.4 2020/05/05 06:11:06 skrll Exp $      */
+/*     $NetBSD: compat_sigpending.S,v 1.5 2020/05/05 20:43:47 skrll Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
 #include <sys/errno.h>
 #include "SYS.h"
 
-       .import __cerror, code
-
 WARN_REFERENCES(sigpending, \
     "warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
 
diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S
--- a/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S        Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S        Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_sigprocmask.S,v 1.4 2020/05/05 06:11:06 skrll Exp $     */
+/*     $NetBSD: compat_sigprocmask.S,v 1.5 2020/05/05 20:43:47 skrll Exp $     */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
 #include <sys/errno.h>
 #include "SYS.h"
 
-       .import __cerror, code
-
 WARN_REFERENCES(sigprocmask, \
     "warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
 
diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/compat/arch/hppa/sys/compat_sigreturn.S
--- a/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S  Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S  Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_sigreturn.S,v 1.4 2020/05/05 06:11:06 skrll Exp $       */
+/*     $NetBSD: compat_sigreturn.S,v 1.5 2020/05/05 20:43:47 skrll Exp $       */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
 #include <sys/errno.h>
 #include "SYS.h"
 
-       .import __cerror, code
-
 WARN_REFERENCES(sigreturn, \
     "warning: reference to compatibility sigreturn(); include <signal.h> for correct reference")
 
diff -r 70d05c64cd02 -r cf8934b680ca lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S
--- a/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S Tue May 05 20:39:18 2020 +0000
+++ b/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S Tue May 05 20:43:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_sigsuspend.S,v 1.4 2020/05/05 06:11:06 skrll Exp $      */
+/*     $NetBSD: compat_sigsuspend.S,v 1.5 2020/05/05 20:43:47 skrll Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
 #include <sys/errno.h>
 #include "SYS.h"
 
-       .import __cerror, code
-
 WARN_REFERENCES(sigsuspend, \
     "warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
 



Home | Main Index | Thread Index | Old Index