Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch/sh3/gen Use PLT for PIC calls. Makes the call...



details:   https://anonhg.NetBSD.org/src/rev/e4e15321fe58
branches:  trunk
changeset: 586899:e4e15321fe58
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Jan 04 22:32:06 2006 +0000

description:
Use PLT for PIC calls.  Makes the called functions overridable and
avoids text reloc in the shared library.
Same non-PIC code generated.

diffstat:

 lib/libc/arch/sh3/gen/swapcontext.S |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 52a9ac2085af -r e4e15321fe58 lib/libc/arch/sh3/gen/swapcontext.S
--- a/lib/libc/arch/sh3/gen/swapcontext.S       Wed Jan 04 22:10:10 2006 +0000
+++ b/lib/libc/arch/sh3/gen/swapcontext.S       Wed Jan 04 22:32:06 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: swapcontext.S,v 1.5 2006/01/04 20:47:24 uwe Exp $      */
+/*     $NetBSD: swapcontext.S,v 1.6 2006/01/04 22:32:06 uwe Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <machine/asm.h>
 #if defined(SYSLIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: swapcontext.S,v 1.5 2006/01/04 20:47:24 uwe Exp $")
+       RCSID("$NetBSD: swapcontext.S,v 1.6 2006/01/04 22:32:06 uwe Exp $")
 #endif /* SYSLIBC_SCCS and not lint */
 
 /*
@@ -46,8 +46,10 @@
  * swapcontext(ucontext_t * restrict oucp, ucontext_t * restrict ucp);
  */
 ENTRY(swapcontext)
+       PIC_PROLOGUE(.L_got, r0)
        mov.l   r5, @-sp
        sts.l   pr, @-sp
+
        mov.l   .L__getcontext, r0
 1:     CALL    r0                      /* _getcontext(oucp) */
         mov.l  r4, @-sp
@@ -64,9 +66,16 @@
        /* if we get here, return error from setcontext */
 3:
        lds.l   @sp+, pr
+#ifdef PIC
+       add     #4, sp
+       rts
+        PIC_EPILOGUE
+#else
        rts
         add    #4, sp
+#endif
 
        .align  2
-.L__getcontext:                CALL_DATUM_LOCAL(_C_LABEL(_getcontext), 1b)
-.L_setcontext:         CALL_DATUM_LOCAL(_C_LABEL(setcontext), 2b)
+.L_got:                        PIC_GOT_DATUM
+.L__getcontext:                CALL_DATUM(_C_LABEL(_getcontext), 1b)
+.L_setcontext:         CALL_DATUM(_C_LABEL(setcontext), 2b)



Home | Main Index | Thread Index | Old Index