In handwritten asm use -fPIC code instead of -fpic, our libc has grown

large enough for GOT to be larger than 8k.

While here kill redundant PIC ifdefs in setjmp.S - sparc "call"
instruction is piccy by itself.

Tested by martin@
This commit is contained in:
uwe 2007-10-08 13:06:00 +00:00
parent 3833b1d829
commit a34b3f871d
8 changed files with 93 additions and 75 deletions

View File

@ -33,7 +33,7 @@
* @(#)SYS.h 8.1 (Berkeley) 6/4/93
*
* from: Header: SYS.h,v 1.2 92/07/03 18:57:00 torek Exp
* $NetBSD: SYS.h,v 1.16 2005/05/20 23:56:15 uwe Exp $
* $NetBSD: SYS.h,v 1.17 2007/10/08 13:06:00 uwe Exp $
*/
#include <machine/asm.h>
@ -60,7 +60,8 @@
#ifdef PIC
#define CALL(name) \
PIC_PROLOGUE(%g1, %g2); \
ld [%g1 + name], %g2; \
set name, %g2; \
ld [%g1 + %g2], %g2; \
jmp %g2; \
nop
#else

View File

@ -1,4 +1,4 @@
/* $NetBSD: setjmp.S,v 1.10 2006/12/28 10:02:43 martin Exp $ */
/* $NetBSD: setjmp.S,v 1.11 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
.asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: setjmp.S,v 1.10 2006/12/28 10:02:43 martin Exp $")
RCSID("$NetBSD: setjmp.S,v 1.11 2007/10/08 13:06:00 uwe Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@ -59,34 +59,17 @@
ENTRY(__setjmp14)
save %sp, -CCFSZ, %sp
#ifdef PIC
PIC_PROLOGUE(%l0,%o0) ! %l0 = _GLOBAL_OFFSET_TABLE
#endif
/*
* local vars on stack: struct sigstack foo @ offset 0x48
* Note: sc_g1 is not used; sc_o0 is set in longjmp()
*/
#ifdef PIC
ld [%l0 + _C_LABEL(__sigprocmask14)], %g2
#endif
mov 1, %o0 /* SIG_BLOCK */
add %i0, 32, %o2 /* build sigcontext sc.sc_mask */
#ifdef PIC
call %g2
#else
call _C_LABEL(__sigprocmask14)
#endif
clr %o1 /* sigprocmask(SIG_BLOCK, NULL, &sc.sc_mask) */
#ifdef PIC
ld [%l0 + _C_LABEL(__sigaltstack14)], %g2
#endif
add %sp, 0x48, %o1 /* (foo being in arg dump area) */
#ifdef PIC
call %g2
#else
call _C_LABEL(__sigaltstack14)
#endif
clr %o0 /* sigstack(NULL, &foo) */
ld [%sp + 0x48 + 8], %o0 /* foo.ss_flags */

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigsetjmp.S,v 1.5 2005/10/15 22:11:22 uwe Exp $ */
/* $NetBSD: sigsetjmp.S,v 1.6 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1995 Paul Kranenburg
* All rights reserved.
@ -35,29 +35,44 @@
#ifdef PIC
ENTRY(__sigsetjmp14)
PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
cmp %o1,0
st %o1,[%o0+56] ! jmpbuf[JBLEN]
bne,a 1f
ld [%g1+_C_LABEL(__setjmp14)], %g1 ! if (%o1 != 0) goto __setjmp14;
ld [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
1:
PIC_PROLOGUE(%g1, %g2) ! %g1 = _GLOBAL_OFFSET_TABLE
tst %o1
bnz 1f
st %o1, [%o0 + 56] ! jmpbuf[JBLEN] = savemask
!! if (savemask == 0) goto _setjmp
set _C_LABEL(_setjmp), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
nop
!! if (savemask != 0) goto setjmp
1: set _C_LABEL(__setjmp14), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
ENTRY(__siglongjmp14)
PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
ld [%o0+56],%g2 ! jmpbuf[JBLEN]
cmp %g2,0
bne,a 1f
ld [%g1+_C_LABEL(__longjmp14)], %g1 ! if (%g2 != 0) goto __longjmp14;
ld [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
1:
jmp %g1
nop
unimp 0
PIC_PROLOGUE(%g1, %g2) ! %g1 = _GLOBAL_OFFSET_TABLE
ld [%o0 + 56], %g2 ! restoremask = jmpbuf[JBLEN]
tst %g2
bnz 1f
nop
#else /* PIC */
!! if (restoremask == 0) goto _longjmp
set _C_LABEL(_longjmp), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
!! if (restoremask != 0) goto longjmp
1: set _C_LABEL(__longjmp14), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
#else /* !PIC */
ENTRY(__sigsetjmp14)
cmp %o1,0
@ -75,4 +90,4 @@ ENTRY(__siglongjmp14)
ba,a _C_LABEL(__longjmp14)
unimp 0
#endif /* PIC */
#endif /* !PIC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: brk.S,v 1.11 2003/12/26 11:21:48 martin Exp $ */
/* $NetBSD: brk.S,v 1.12 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
.asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: brk.S,v 1.11 2003/12/26 11:21:48 martin Exp $")
RCSID("$NetBSD: brk.S,v 1.12 2007/10/08 13:06:00 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
@ -62,7 +62,8 @@ _C_LABEL(__minbrk):
ENTRY(_brk)
#ifdef PIC
PIC_PROLOGUE(%o5,%o4)
ld [%o5 + _C_LABEL(__minbrk)], %o4
set _C_LABEL(__minbrk), %o4
ld [%o5 + %o4], %o4
ld [%o4], %o1 ! %o1 = minbrk
cmp %o1, %o0 ! if (minbrk > %o0)
bgu,a 0f

View File

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.9 2006/12/28 10:02:43 martin Exp $ */
/* $NetBSD: cerror.S,v 1.10 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
.asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: cerror.S,v 1.9 2006/12/28 10:02:43 martin Exp $")
RCSID("$NetBSD: cerror.S,v 1.10 2007/10/08 13:06:00 uwe Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
@ -59,7 +59,8 @@ FUNC(CERROR)
.globl _C_LABEL(errno)
#ifdef PIC
FUNC(CERROR)
ld [%g1 + _C_LABEL(errno)], %g1
set _C_LABEL(errno), %g2
ld [%g1 + %g2], %g1
st %o0, [%g1]
mov -1, %o0
retl

View File

@ -1,4 +1,4 @@
/* $NetBSD: ptrace.S,v 1.7 2006/01/08 20:03:19 martin Exp $ */
/* $NetBSD: ptrace.S,v 1.8 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
.asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: ptrace.S,v 1.7 2006/01/08 20:03:19 martin Exp $")
RCSID("$NetBSD: ptrace.S,v 1.8 2007/10/08 13:06:00 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
@ -56,7 +56,8 @@ ENTRY(ptrace)
#else
#ifdef PIC
PIC_PROLOGUE(%g1,%g2)
ld [%g1 + _C_LABEL(errno)], %g1
set _C_LABEL(errno), %g2
ld [%g1 + %g2], %g1
st %g0, [%g1]
#else
sethi %hi(_C_LABEL(errno)), %g1

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbrk.S,v 1.9 2003/08/07 16:42:26 agc Exp $ */
/* $NetBSD: sbrk.S,v 1.10 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
.asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: sbrk.S,v 1.9 2003/08/07 16:42:26 agc Exp $")
RCSID("$NetBSD: sbrk.S,v 1.10 2007/10/08 13:06:00 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
@ -60,7 +60,8 @@ CURBRK: .long _end
ENTRY(_sbrk)
#ifdef PIC
PIC_PROLOGUE(%o5,%o4)
ld [%o5 + CURBRK], %o2
set CURBRK, %o2
ld [%o5 + %o2], %o2
ld [%o2], %o3 ! %o3 = old break
add %o3, %o0, %o4 ! %o4 = new break
mov %o4, %o0 ! copy for syscall

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_sigsetjmp.S,v 1.1 2005/10/15 22:11:22 uwe Exp $ */
/* $NetBSD: compat_sigsetjmp.S,v 1.2 2007/10/08 13:06:00 uwe Exp $ */
/*
* Copyright (c) 1995 Paul Kranenburg
* All rights reserved.
@ -35,29 +35,44 @@
#ifdef PIC
ENTRY(sigsetjmp)
PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
cmp %o1,0
st %o1,[%o0+40] ! jmpbuf[JBLEN]
bne,a 1f
ld [%g1+_C_LABEL(setjmp)], %g1 ! if (%o1 != 0) goto _setjmp;
ld [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp;
1:
PIC_PROLOGUE(%g1, %g2) ! %g1 = _GLOBAL_OFFSET_TABLE
tst %o1
bnz 1f
st %o1, [%o0 + 56] ! jmpbuf[JBLEN] = savemask
!! if (savemask == 0) goto _setjmp
set _C_LABEL(_setjmp), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
nop
!! if (savemask != 0) goto setjmp
1: set _C_LABEL(setjmp), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
ENTRY(siglongjmp)
PIC_PROLOGUE(%g1,%g2) ! %g1 = _GLOBAL_OFFSET_TABLE
ld [%o0+40],%g2 ! jmpbuf[JBLEN]
cmp %g2,0
bne,a 1f
ld [%g1+_C_LABEL(longjmp)], %g1 ! if (%g2 != 0) goto _longjmp;
ld [%g1+_C_LABEL(_longjmp)], %g1 ! else goto __longjmp;
1:
jmp %g1
nop
unimp 0
PIC_PROLOGUE(%g1, %g2) ! %g1 = _GLOBAL_OFFSET_TABLE
ld [%o0 + 56], %g2 ! restoremask = jmpbuf[JBLEN]
tst %g2
bnz 1f
nop
#else /* PIC */
!! if (restoremask == 0) goto _longjmp
set _C_LABEL(_longjmp), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
!! if (restoremask != 0) goto longjmp
1: set _C_LABEL(longjmp), %g2
ld [%g1 + %g2], %g1
jmp %g1
nop
#else /* !PIC */
ENTRY(sigsetjmp)
cmp %o1,0
@ -75,4 +90,4 @@ ENTRY(siglongjmp)
ba,a _C_LABEL(longjmp)
unimp 0
#endif /* PIC */
#endif /* !PIC */