Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread/arch A couple of fixes to make libpthread rea...



details:   https://anonhg.NetBSD.org/src/rev/a801aaf02d49
branches:  trunk
changeset: 586856:a801aaf02d49
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Jan 04 12:43:43 2006 +0000

description:
A couple of fixes to make libpthread really shared, i.e. not have text re-
locations:

        - Don't declare pthread__switch_away global
        - Do the PIC dance for pthread__switch_return_point and
          pthread__locked_switch. Ideally these (and other) symbols would
          be hidden.

Thanks to uwe@, dyoung@ and elad@ for help.

XXX sh3 is still to be done.
XXX vax does strange things.

diffstat:

 lib/libpthread/arch/i386/pthread_switch.S    |   3 +--
 lib/libpthread/arch/sparc/pthread_switch.S   |   4 ++--
 lib/libpthread/arch/sparc64/pthread_switch.S |   4 ++--
 lib/libpthread/arch/x86_64/pthread_switch.S  |  11 +++++++++--
 4 files changed, 14 insertions(+), 8 deletions(-)

diffs (94 lines):

diff -r 9f2bbaac6311 -r a801aaf02d49 lib/libpthread/arch/i386/pthread_switch.S
--- a/lib/libpthread/arch/i386/pthread_switch.S Wed Jan 04 12:29:21 2006 +0000
+++ b/lib/libpthread/arch/i386/pthread_switch.S Wed Jan 04 12:43:43 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.8 2004/04/23 02:58:27 simonb Exp $        */
+/*     $NetBSD: pthread_switch.S,v 1.9 2006/01/04 12:43:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -168,7 +168,6 @@
  * Helper switch code used by pthread__locked_switch() and 
  * pthread__upcall_switch() when they discover spinlock preemption.
  */
-.globl pthread__switch_away
 pthread__switch_away:
        STACK_SWITCH
 
diff -r 9f2bbaac6311 -r a801aaf02d49 lib/libpthread/arch/sparc/pthread_switch.S
--- a/lib/libpthread/arch/sparc/pthread_switch.S        Wed Jan 04 12:29:21 2006 +0000
+++ b/lib/libpthread/arch/sparc/pthread_switch.S        Wed Jan 04 12:43:43 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.7 2003/09/07 14:47:54 cl Exp $ */
+/*     $NetBSD: pthread_switch.S,v 1.8 2006/01/04 12:43:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -122,7 +122,7 @@
  * %i2 flag to clear lock
  */
 
-ENTRY(pthread__switch_away)
+pthread__switch_away:
 
        STACK_SWITCH(%i1, %l2)
 
diff -r 9f2bbaac6311 -r a801aaf02d49 lib/libpthread/arch/sparc64/pthread_switch.S
--- a/lib/libpthread/arch/sparc64/pthread_switch.S      Wed Jan 04 12:29:21 2006 +0000
+++ b/lib/libpthread/arch/sparc64/pthread_switch.S      Wed Jan 04 12:43:43 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.8 2003/09/07 14:47:55 cl Exp $ */
+/*     $NetBSD: pthread_switch.S,v 1.9 2006/01/04 12:43:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  * %i2 flag to clear lock
  */
 
-ENTRY(pthread__switch_away)
+pthread__switch_away:
 
        STACK_SWITCH(%i1,%l2)
 
diff -r 9f2bbaac6311 -r a801aaf02d49 lib/libpthread/arch/x86_64/pthread_switch.S
--- a/lib/libpthread/arch/x86_64/pthread_switch.S       Wed Jan 04 12:29:21 2006 +0000
+++ b/lib/libpthread/arch/x86_64/pthread_switch.S       Wed Jan 04 12:43:43 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.10 2004/04/23 02:58:27 simonb Exp $       */
+/*     $NetBSD: pthread_switch.S,v 1.11 2006/01/04 12:43:43 skrll Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -136,7 +136,11 @@
         * Edit the context so that it continues as if returning from
         * the _setcontext_u below.  
         */
+#ifdef PIC
+       movq    PIC_GOT(pthread__switch_return_point), %r15
+#else
        leaq    pthread__switch_return_point(%rip), %r15
+#endif
        movq    %r15, UC_RIP(%r14)
        movq    %r14, PT_UC(%r12)
        
@@ -157,7 +161,6 @@
  * Helper switch code used by pthread__locked_switch() and 
  * pthread__upcall_switch() when they discover spinlock preemption.
  */
-.globl pthread__switch_away
 pthread__switch_away:
        STACK_SWITCH
 
@@ -204,7 +207,11 @@
         * Edit the context so that it continues as if returning from
         * the _setcontext_u below.  
         */
+#ifdef PIC
+       movq    PIC_GOT(locked_return_point), %r15
+#else
        leaq    locked_return_point(%rip), %r15
+#endif
        movq    %r15, UC_RIP(%r14)
        movq    %r14, PT_UC(%r12)
        



Home | Main Index | Thread Index | Old Index