Use large (-fPIC) relocations.

This commit is contained in:
eeh 2002-05-07 01:34:21 +00:00
parent b92211c580
commit 22abdf821b
7 changed files with 143 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: __sigsetjmp14.S,v 1.4 2000/08/28 00:45:59 eeh Exp $ */ /* $NetBSD: __sigsetjmp14.S,v 1.5 2002/05/07 01:34:21 eeh Exp $ */
/* /*
* Copyright (c) 1995 Paul Kranenburg * Copyright (c) 1995 Paul Kranenburg
* All rights reserved. * All rights reserved.
@ -33,45 +33,76 @@
#include "SYS.h" #include "SYS.h"
#ifdef PIC #ifdef PIC
#ifdef BIGPIC
ENTRY(__sigsetjmp14)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
st %o1,[%o0+0x48] ! jmpbuf[JBLEN]
sethi %hi(_C_LABEL(__setjmp14)), %o2
sethi %hi(_C_LABEL(_setjmp)), %o3
or %o2, %lo(_C_LABEL(__setjmp14)), %o2
or %o3, %lo(_C_LABEL(_setjmp)), %o3
brnz %o1, 1f
ldx [%g1+%o3], %o3 ! if (%o1 != 0) goto _setjmp;
ldx [%g1+%o2], %o3 ! else goto __setjmp;
1:
jmp %o3
nop
ENTRY(__siglongjmp14)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
ld [%o0+0x48], %o2 ! jmpbuf[JBLEN]
sethi %hi(_C_LABEL(__longjmp14)), %o3
sethi %hi(_C_LABEL(_longjmp)), %o4
or %o3, %lo(_C_LABEL(__longjmp14)), %o3
or %o4, %lo(_C_LABEL(_longjmp)), %o4
brnz,a %o2, 1f
ldx [%g1+%o4], %o4 ! if (%o2 != 0) goto _longjmp;
ldx [%g1+%o3], %o4 ! else goto __longjmp;
1:
jmp %o4
nop
unimp 0
#else
ENTRY(__sigsetjmp14) ENTRY(__sigsetjmp14)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
cmp %o1,0 cmp %o1,0
st %o1,[%o0+0x48] ! jmpbuf[JBLEN] st %o1,[%o0+0x48] ! jmpbuf[JBLEN]
bne,a 1f bne,a 1f
ldx [%g1+_C_LABEL(__setjmp14)], %g1 ! if (%o1 != 0) goto _setjmp; ldx [%g1+_C_LABEL(__setjmp14)], %g1 ! if (%o1 != 0) goto _setjmp;
ldx [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp; ldx [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
1: 1:
jmp %g1 jmp %g1
nop nop
ENTRY(__siglongjmp14) ENTRY(__siglongjmp14)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
ld [%o0+0x48],%o2 ! jmpbuf[JBLEN] ld [%o0+0x48],%o2 ! jmpbuf[JBLEN]
cmp %o2,0 cmp %o2,0
bne,a 1f bne,a 1f
ldx [%g1+_C_LABEL(__longjmp14)], %g1 ! if (%g2 != 0) goto _longjmp; ldx [%g1+_C_LABEL(__longjmp14)], %g1 ! if (%g1 != 0) goto _longjmp;
ldx [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp; ldx [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
1: 1:
jmp %g1 jmp %g1
nop nop
unimp 0 unimp 0
#endif /* BIGPIC */
#else /* PIC */ #else /* PIC */
ENTRY(__sigsetjmp14) ENTRY(__sigsetjmp14)
cmp %o1,0 cmp %o1,0
be _C_LABEL(_setjmp) be _C_LABEL(_setjmp)
st %o1,[%o0+0x48] ! jmpbuf[JBLEN] st %o1,[%o0+0x48] ! jmpbuf[JBLEN]
ba,a _C_LABEL(__setjmp14) ba,a _C_LABEL(__setjmp14)
unimp 0 unimp 0
ENTRY(__siglongjmp14) ENTRY(__siglongjmp14)
ld [%o0+0x48],%g1 ld [%o0+0x48],%g1
cmp %g1,0 cmp %g1,0
be _C_LABEL(_longjmp) be _C_LABEL(_longjmp)
nop nop
ba,a _C_LABEL(__longjmp14) ba,a _C_LABEL(__longjmp14)
unimp 0 unimp 0
#endif /* PIC */ #endif /* PIC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigsetjmp.S,v 1.5 2000/08/28 00:45:59 eeh Exp $ */ /* $NetBSD: sigsetjmp.S,v 1.6 2002/05/07 01:34:21 eeh Exp $ */
/* /*
* Copyright (c) 1995 Paul Kranenburg * Copyright (c) 1995 Paul Kranenburg
* All rights reserved. * All rights reserved.
@ -33,7 +33,8 @@
#include "SYS.h" #include "SYS.h"
#ifdef PIC #ifdef PIC
#ifdef BIGPIC
ENTRY(sigsetjmp) ENTRY(sigsetjmp)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
set _C_LABEL(setjmp), %o2 ! if (%o1 != 0) goto _setjmp; set _C_LABEL(setjmp), %o2 ! if (%o1 != 0) goto _setjmp;
@ -55,6 +56,32 @@ ENTRY(siglongjmp)
nop nop
unimp 0 unimp 0
#else
ENTRY(sigsetjmp)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
cmp %o1, 0
bne,a 1f
ldx [%g1 + _C_LABEL(setjmp)], %g1 ! if (%o1 != 0) goto _setjmp;
ldx [%g1 + _C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
1:
jmp %g1
st %o1,[%o0+0x48] ! jmpbuf[JBLEN]
ENTRY(siglongjmp)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
cmp %o2, 0
ld [%o0 + 0x48],%o2 ! jmpbuf[JBLEN]
bne,a 1f
ldx [%g1 + _C_LABEL(longjmp)], %g1 ! if (%o2 != 0) goto _longjmp;
ldx [%g1 + _C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
1:
jmp %g1
nop
unimp 0
#endif /* BIGPIC */
#else /* PIC */ #else /* PIC */
ENTRY(sigsetjmp) ENTRY(sigsetjmp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: __clone.S,v 1.1 2001/07/23 07:35:44 thorpej Exp $ */ /* $NetBSD: __clone.S,v 1.2 2002/05/07 01:34:22 eeh Exp $ */
/*- /*-
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -81,7 +81,7 @@ ENTRY(__clone)
call %l0 ! Call the clone's entry point. call %l0 ! Call the clone's entry point.
nop nop
CALL(_C_LABEL(_exit)) JUMP(_exit)
/* NOTREACHED */ /* NOTREACHED */
2: ret 2: ret

View File

@ -1,4 +1,4 @@
/* $NetBSD: brk.S,v 1.9 2000/07/25 20:15:40 mycroft Exp $ */ /* $NetBSD: brk.S,v 1.10 2002/05/07 01:34:22 eeh Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -44,7 +44,7 @@
#if 0 #if 0
.asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93" .asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
#else #else
RCSID("$NetBSD: brk.S,v 1.9 2000/07/25 20:15:40 mycroft Exp $") RCSID("$NetBSD: brk.S,v 1.10 2002/05/07 01:34:22 eeh Exp $")
#endif #endif
#endif /* SYSLIBC_SCCS and not lint */ #endif /* SYSLIBC_SCCS and not lint */
@ -66,6 +66,7 @@ _C_LABEL(__minbrk):
ENTRY(_brk) ENTRY(_brk)
#ifdef PIC #ifdef PIC
#ifdef BIGPIC
PIC_PROLOGUE(%o5,%o4) PIC_PROLOGUE(%o5,%o4)
set _C_LABEL(__minbrk), %o4 set _C_LABEL(__minbrk), %o4
ldx [%o5 + %o4], %o4 ldx [%o5 + %o4], %o4
@ -82,6 +83,22 @@ ENTRY(_brk)
1: 1:
retl /* success, return 0 & record new break */ retl /* success, return 0 & record new break */
stx %o2, [%o4] stx %o2, [%o4]
#else
PIC_PROLOGUE(%o5,%o4)
ldx [%o5 + _C_LABEL(__minbrk)], %o4
ldx [%o4], %o1 /* %o1 = minbrk */
cmp %o1, %o0 /* if (minbrk > %o0) */
movg %xcc, %o1, %o0 /* %o0 = minbrk */
mov %o0, %o2 /* save argument to syscall */
mov SYS_break, %g1
t ST_SYSCALL
bcc,a,pt %icc, 1f
ldx [%o5 + _C_LABEL(__curbrk)], %o4
ERROR()
1:
retl /* success, return 0 & record new break */
stx %o2, [%o4]
#endif
#else #else
sethi %hi(_C_LABEL(__minbrk)), %o1 /* %o1 = minbrk */ sethi %hi(_C_LABEL(__minbrk)), %o1 /* %o1 = minbrk */
ldx [%o1 + %lo(_C_LABEL(__minbrk))], %o1 ldx [%o1 + %lo(_C_LABEL(__minbrk))], %o1

View File

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.4 2000/07/26 00:53:50 eeh Exp $ */ /* $NetBSD: cerror.S,v 1.5 2002/05/07 01:34:22 eeh Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -44,7 +44,7 @@
#if 0 #if 0
.asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93" .asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
#else #else
RCSID("$NetBSD: cerror.S,v 1.4 2000/07/26 00:53:50 eeh Exp $") RCSID("$NetBSD: cerror.S,v 1.5 2002/05/07 01:34:22 eeh Exp $")
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -62,6 +62,16 @@ FUNC(__cerror)
#else #else
.globl _C_LABEL(errno) .globl _C_LABEL(errno)
#ifdef PIC #ifdef PIC
#ifdef BIGPIC
FUNC(__cerror)
PIC_PROLOGUE(%g1, %o3)
set _C_LABEL(errno),%o1
ldx [%g1 + %o1], %g1
st %o0, [%g1]
mov -1, %o0
retl
mov -1, %o1
#else
FUNC(__cerror) FUNC(__cerror)
PIC_PROLOGUE(%g1, %o3) PIC_PROLOGUE(%g1, %o3)
ldx [%g1 + _C_LABEL(errno)], %g1 ldx [%g1 + _C_LABEL(errno)], %g1
@ -69,6 +79,7 @@ FUNC(__cerror)
mov -1, %o0 mov -1, %o0
retl retl
mov -1, %o1 mov -1, %o1
#endif
#else #else
FUNC(__cerror) FUNC(__cerror)
sethi %hi(_C_LABEL(errno)), %g1 sethi %hi(_C_LABEL(errno)), %g1

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbrk.S,v 1.7 2000/07/25 15:14:46 mycroft Exp $ */ /* $NetBSD: sbrk.S,v 1.8 2002/05/07 01:34:22 eeh Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -44,7 +44,7 @@
#if 0 #if 0
.asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93" .asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93"
#else #else
RCSID("$NetBSD: sbrk.S,v 1.7 2000/07/25 15:14:46 mycroft Exp $") RCSID("$NetBSD: sbrk.S,v 1.8 2002/05/07 01:34:22 eeh Exp $")
#endif #endif
#endif /* SYSLIBC_SCCS and not lint */ #endif /* SYSLIBC_SCCS and not lint */
@ -65,6 +65,7 @@ _C_LABEL(__curbrk):
ENTRY(_sbrk) ENTRY(_sbrk)
#ifdef PIC #ifdef PIC
#ifdef BIGPIC
PIC_PROLOGUE(%o5,%o4) PIC_PROLOGUE(%o5,%o4)
set _C_LABEL(__curbrk), %o3 set _C_LABEL(__curbrk), %o3
ldx [%o5 + %o3], %o2 ldx [%o5 + %o3], %o2
@ -79,6 +80,21 @@ ENTRY(_sbrk)
1: 1:
retl /* and update curbrk */ retl /* and update curbrk */
stx %o4, [%o2] stx %o4, [%o2]
#else
PIC_PROLOGUE(%o5,%o4)
ldx [%o5 + _C_LABEL(__curbrk)], %o2
ldx [%o2], %o3 /* %o3 = old break */
add %o3, %o0, %o4 /* %o4 = new break */
mov %o4, %o0 /* copy for syscall */
mov SYS_break, %g1
t ST_SYSCALL /* break(new_break) */
bcc,a 1f /* if success, */
mov %o3, %o0 /* set return value */
ERROR()
1:
retl /* and update curbrk */
stx %o4, [%o2]
#endif
#else #else
sethi %hi(_C_LABEL(__curbrk)), %o2 sethi %hi(_C_LABEL(__curbrk)), %o2
ldx [%o2 + %lo(_C_LABEL(__curbrk))], %o3 /* %o3 = old break */ ldx [%o2 + %lo(_C_LABEL(__curbrk))], %o3 /* %o3 = old break */

View File

@ -1,4 +1,4 @@
/* $NetBSD: setlogin.S,v 1.3 2000/07/21 03:14:15 eeh Exp $ */ /* $NetBSD: setlogin.S,v 1.4 2002/05/07 01:34:22 eeh Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -44,7 +44,7 @@
#if 0 #if 0
.asciz "@(#)setlogin.s 8.1 (Berkeley) 6/4/93" .asciz "@(#)setlogin.s 8.1 (Berkeley) 6/4/93"
#else #else
RCSID("$NetBSD: setlogin.S,v 1.3 2000/07/21 03:14:15 eeh Exp $") RCSID("$NetBSD: setlogin.S,v 1.4 2002/05/07 01:34:22 eeh Exp $")
#endif #endif
#endif /* SYSLIBC_SCCS and not lint */ #endif /* SYSLIBC_SCCS and not lint */
@ -54,11 +54,18 @@
SYSCALL(setlogin) SYSCALL(setlogin)
#ifdef PIC #ifdef PIC
#ifdef BIGPIC
PIC_PROLOGUE(%o1,%o2) PIC_PROLOGUE(%o1,%o2)
set _C_LABEL(__logname_valid), %o2 set _C_LABEL(__logname_valid), %o2
ldx [%o1 + %o2], %o1 ldx [%o1 + %o2], %o1
retl retl
st %g0, [%o1] st %g0, [%o1]
#else
PIC_PROLOGUE(%o1,%o2)
ldx [%o1 + _C_LABEL(__logname_valid)], %o1
retl
st %g0, [%o1]
#endif
#else #else
/* Dunno what model we're using so we need to use full addresses */ /* Dunno what model we're using so we need to use full addresses */
sethi %hh(_C_LABEL(__logname_valid)), %o1 sethi %hh(_C_LABEL(__logname_valid)), %o1