diff --git a/lib/libc/i386/gen/fixunsdfsi.s b/lib/libc/i386/gen/fixunsdfsi.s index 312edadaaac4..6914931aaba4 100644 --- a/lib/libc/i386/gen/fixunsdfsi.s +++ b/lib/libc/i386/gen/fixunsdfsi.s @@ -34,17 +34,26 @@ * SUCH DAMAGE. */ +#include "SYS.h" + #if defined(LIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)fixunsdfsi.s 5.1 12/17/90"*/ - .asciz "$Id: fixunsdfsi.s,v 1.3 1993/08/26 02:13:27 mycroft Exp $" + .asciz "$Id: fixunsdfsi.s,v 1.4 1993/09/28 21:04:38 pk Exp $" #endif /* LIBC_SCCS and not lint */ .globl ___fixunsdfsi ___fixunsdfsi: fldl 4(%esp) /* argument double to accum stack */ frndint /* create integer */ - fcoml fbiggestsigned /* bigger than biggest signed? */ +#ifdef PIC + PIC_PROLOGUE + leal PIC_GOTOFF(fbiggestsigned),%eax + PIC_EPILOGUE + fcoml (%eax) +#else + fcoml PIC_GOTOFF(fbiggestsigned) /* bigger than biggest signed? */ +#endif fstsw %ax sahf jnb 1f @@ -53,10 +62,19 @@ ___fixunsdfsi: movl 4(%esp),%eax ret -1: fsubl fbiggestsigned /* reduce for proper conversion */ +1: +#ifdef PIC + PIC_PROLOGUE + leal PIC_GOTOFF(fbiggestsigned),%eax + PIC_EPILOGUE + fsubl (%eax) +#else + fsubl PIC_GOTOFF(fbiggestsigned) /* reduce for proper conversion */ +#endif fistpl 4(%esp) /* convert */ movl 4(%esp),%eax orl $0x80000000,%eax /* restore bias */ + PIC_EPILOGUE ret fbiggestsigned: .double 0r2147483648.0 diff --git a/lib/libc/i386/gen/setjmp.s b/lib/libc/i386/gen/setjmp.s index c117474b1444..33d06a3e0b6c 100644 --- a/lib/libc/i386/gen/setjmp.s +++ b/lib/libc/i386/gen/setjmp.s @@ -37,7 +37,7 @@ #if defined(LIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90"*/ - .asciz "$Id: setjmp.s,v 1.3 1993/08/26 02:13:28 mycroft Exp $" + .asciz "$Id: setjmp.s,v 1.4 1993/09/28 21:04:39 pk Exp $" #endif /* LIBC_SCCS and not lint */ /* @@ -51,10 +51,11 @@ */ #include "DEFS.h" +#include "SYS.h" ENTRY(setjmp) pushl $0 - call _sigblock + call PIC_PLT(_sigblock) popl %edx movl 4(%esp),%ecx movl 0(%esp),%edx @@ -71,7 +72,7 @@ ENTRY(setjmp) ENTRY(longjmp) movl 4(%esp),%edx pushl 24(%edx) - call _sigsetmask + call PIC_PLT(_sigsetmask) popl %eax movl 4(%esp),%edx movl 8(%esp),%eax diff --git a/lib/libc/i386/sys/Ovfork.s b/lib/libc/i386/sys/Ovfork.s index b670455776dc..53e4889fc881 100644 --- a/lib/libc/i386/sys/Ovfork.s +++ b/lib/libc/i386/sys/Ovfork.s @@ -37,7 +37,7 @@ #if defined(SYSLIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90"*/ - .asciz "$Id: Ovfork.s,v 1.4 1993/08/26 02:14:11 mycroft Exp $" + .asciz "$Id: Ovfork.s,v 1.5 1993/09/28 21:04:52 pk Exp $" #endif /* SYSLIBC_SCCS and not lint */ #include "SYS.h" @@ -61,7 +61,14 @@ vforkok: jmp parent .globl _errno verror: +#ifdef PIC + PIC_PROLOGUE + movl PIC_GOT(_errno), %edx + movl %eax,(%edx) + PIC_EPILOGUE +#else movl %eax,_errno +#endif movl $-1,%eax jmp %ecx child: diff --git a/lib/libc/i386/sys/brk.s b/lib/libc/i386/sys/brk.s index c71ffd046058..5883ad44a9bf 100644 --- a/lib/libc/i386/sys/brk.s +++ b/lib/libc/i386/sys/brk.s @@ -37,7 +37,7 @@ #if defined(SYSLIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)brk.s 5.2 (Berkeley) 12/17/90"*/ - .asciz "$Id: brk.s,v 1.3 1993/08/26 02:14:12 mycroft Exp $" + .asciz "$Id: brk.s,v 1.4 1993/09/28 21:04:53 pk Exp $" #endif /* SYSLIBC_SCCS and not lint */ #include "SYS.h" @@ -50,6 +50,29 @@ ENTRY(_brk) jmp ok ENTRY(brk) +#ifdef PIC + movl 4(%esp),%eax + PIC_PROLOGUE + movl %edx,PIC_GOT(curbrk) # set up GOT addressing + movl %ecx,PIC_GOT(minbrk) # + cmpl %eax,(%ecx) + PIC_EPILOGUE + jl ok + movl (%ecx),%eax + movl %eax,4(%esp) +ok: + lea SYS_brk,%eax + LCALL(7,0) + jb err + movl 4(%esp),%eax + movl %eax,(%edx) + movl $0,%eax + ret +err: + jmp PIC_PLT(cerror) + +#else + movl 4(%esp),%eax cmpl %eax,minbrk jl ok @@ -65,3 +88,4 @@ ok: ret err: jmp cerror +#endif diff --git a/lib/libc/i386/sys/cerror.s b/lib/libc/i386/sys/cerror.s index b973c5595328..1c8246caee8a 100644 --- a/lib/libc/i386/sys/cerror.s +++ b/lib/libc/i386/sys/cerror.s @@ -37,13 +37,20 @@ #if defined(SYSLIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)cerror.s 5.1 (Berkeley) 4/23/90"*/ - .asciz "$Id: cerror.s,v 1.3 1993/08/26 02:14:12 mycroft Exp $" + .asciz "$Id: cerror.s,v 1.4 1993/09/28 21:04:54 pk Exp $" #endif /* SYSLIBC_SCCS and not lint */ #include "SYS.h" .globl _errno cerror: +#ifdef PIC + PIC_PROLOGUE + movl PIC_GOT(_errno),%ecx + movl %eax,(%ecx) + PIC_EPILOGUE +#else movl %eax,_errno +#endif movl $-1,%eax ret diff --git a/lib/libc/i386/sys/ptrace.s b/lib/libc/i386/sys/ptrace.s index cd9326eb59e1..5081ef138f04 100644 --- a/lib/libc/i386/sys/ptrace.s +++ b/lib/libc/i386/sys/ptrace.s @@ -37,14 +37,21 @@ #if defined(SYSLIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)ptrace.s 5.1 (Berkeley) 4/23/90"*/ - .asciz "$Id: ptrace.s,v 1.3 1993/08/26 02:14:16 mycroft Exp $" + .asciz "$Id: ptrace.s,v 1.4 1993/09/28 21:04:55 pk Exp $" #endif /* SYSLIBC_SCCS and not lint */ #include "SYS.h" ENTRY(ptrace) xorl %eax,%eax +#ifdef PIC + PIC_PROLOGUE + movl PIC_GOT(_errno),%edx + movl %eax,(%edx) + PIC_EPILOGUE +#else movl %eax,_errno +#endif lea SYS_ptrace,%eax LCALL(7,0) jb err diff --git a/lib/libc/i386/sys/sbrk.s b/lib/libc/i386/sys/sbrk.s index 65702464d6cd..dbd6c72abe14 100644 --- a/lib/libc/i386/sys/sbrk.s +++ b/lib/libc/i386/sys/sbrk.s @@ -37,7 +37,7 @@ #if defined(SYSLIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)sbrk.s 5.1 (Berkeley) 4/23/90"*/ - .asciz "$Id: sbrk.s,v 1.3 1993/08/26 02:14:18 mycroft Exp $" + .asciz "$Id: sbrk.s,v 1.4 1993/09/28 21:04:56 pk Exp $" #endif /* SYSLIBC_SCCS and not lint */ #include "SYS.h" @@ -54,6 +54,27 @@ curbrk: .long _end .text ENTRY(sbrk) +#ifdef PIC + movl 4(%esp),%ecx + PIC_PROLOGUE + movl PIC_GOT(curbrk),%edx + movl (%edx),%eax + PIC_EPILOGUE + addl %eax,4(%esp) + lea SYS_brk,%eax + LCALL(7,0) + jb err + PIC_PROLOGUE + movl PIC_GOT(curbrk),%edx + movl (%edx),%eax + addl %ecx,(%edx) + PIC_EPILOGUE + ret +err: + jmp PIC_PLT(cerror) + +#else + movl 4(%esp),%ecx movl curbrk,%eax addl %eax,4(%esp) @@ -65,3 +86,4 @@ ENTRY(sbrk) ret err: jmp cerror +#endif diff --git a/lib/libc/i386/sys/setlogin.s b/lib/libc/i386/sys/setlogin.s index 769fc822cf0f..2839c1eb9989 100644 --- a/lib/libc/i386/sys/setlogin.s +++ b/lib/libc/i386/sys/setlogin.s @@ -37,7 +37,7 @@ #if defined(LIBC_SCCS) && !defined(lint) .text /*.asciz "from: @(#)setlogin.s 5.2 (Berkeley) 4/12/91"*/ - .asciz "$Id: setlogin.s,v 1.3 1993/08/26 02:14:19 mycroft Exp $" + .asciz "$Id: setlogin.s,v 1.4 1993/09/28 21:04:57 pk Exp $" #endif /* LIBC_SCCS and not lint */ #include "SYS.h" @@ -45,5 +45,14 @@ .globl __logname_valid /* in getlogin() */ SYSCALL(setlogin) +#ifdef PIC + PIC_PROLOGUE + pushl %eax + movl PIC_GOT(__logname_valid),%eax + movl $0,(%eax) + popl %eax + PIC_EPILOGUE +#else movl $0,__logname_valid +#endif ret /* setlogin(name) */