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
* All rights reserved.
@ -33,6 +33,37 @@
#include "SYS.h"
#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)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
@ -50,13 +81,13 @@ ENTRY(__siglongjmp14)
ld [%o0+0x48],%o2 ! jmpbuf[JBLEN]
cmp %o2,0
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;
1:
jmp %g1
nop
unimp 0
#endif /* BIGPIC */
#else /* PIC */
ENTRY(__sigsetjmp14)

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
* All rights reserved.
@ -33,6 +33,7 @@
#include "SYS.h"
#ifdef PIC
#ifdef BIGPIC
ENTRY(sigsetjmp)
PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE
@ -55,6 +56,32 @@ ENTRY(siglongjmp)
nop
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 */
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.
@ -81,7 +81,7 @@ ENTRY(__clone)
call %l0 ! Call the clone's entry point.
nop
CALL(_C_LABEL(_exit))
JUMP(_exit)
/* NOTREACHED */
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
@ -44,7 +44,7 @@
#if 0
.asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
#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 /* SYSLIBC_SCCS and not lint */
@ -66,6 +66,7 @@ _C_LABEL(__minbrk):
ENTRY(_brk)
#ifdef PIC
#ifdef BIGPIC
PIC_PROLOGUE(%o5,%o4)
set _C_LABEL(__minbrk), %o4
ldx [%o5 + %o4], %o4
@ -82,6 +83,22 @@ ENTRY(_brk)
1:
retl /* success, return 0 & record new break */
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
sethi %hi(_C_LABEL(__minbrk)), %o1 /* %o1 = minbrk */
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
@ -44,7 +44,7 @@
#if 0
.asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
#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 /* LIBC_SCCS and not lint */
@ -62,6 +62,16 @@ FUNC(__cerror)
#else
.globl _C_LABEL(errno)
#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)
PIC_PROLOGUE(%g1, %o3)
ldx [%g1 + _C_LABEL(errno)], %g1
@ -69,6 +79,7 @@ FUNC(__cerror)
mov -1, %o0
retl
mov -1, %o1
#endif
#else
FUNC(__cerror)
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
@ -44,7 +44,7 @@
#if 0
.asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93"
#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 /* SYSLIBC_SCCS and not lint */
@ -65,6 +65,7 @@ _C_LABEL(__curbrk):
ENTRY(_sbrk)
#ifdef PIC
#ifdef BIGPIC
PIC_PROLOGUE(%o5,%o4)
set _C_LABEL(__curbrk), %o3
ldx [%o5 + %o3], %o2
@ -79,6 +80,21 @@ ENTRY(_sbrk)
1:
retl /* and update curbrk */
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
sethi %hi(_C_LABEL(__curbrk)), %o2
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
@ -44,7 +44,7 @@
#if 0
.asciz "@(#)setlogin.s 8.1 (Berkeley) 6/4/93"
#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 /* SYSLIBC_SCCS and not lint */
@ -54,11 +54,18 @@
SYSCALL(setlogin)
#ifdef PIC
#ifdef BIGPIC
PIC_PROLOGUE(%o1,%o2)
set _C_LABEL(__logname_valid), %o2
ldx [%o1 + %o2], %o1
retl
st %g0, [%o1]
#else
PIC_PROLOGUE(%o1,%o2)
ldx [%o1 + _C_LABEL(__logname_valid)], %o1
retl
st %g0, [%o1]
#endif
#else
/* Dunno what model we're using so we need to use full addresses */
sethi %hh(_C_LABEL(__logname_valid)), %o1