diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-04-17 03:47:43 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-04-17 03:47:43 +0000 |
commit | 7389599b98e0ba87da878a8fed32d63073e545d9 (patch) | |
tree | d95af9136363c0f8405773d1172adaf7ca2559dd /lib/libc/arch | |
parent | 5310346d0e6069022eace1f0ae09c2f2710f3ffc (diff) |
ELF fixups, ELF PIC syscall support, asm changes as requested by assembler.
Diffstat (limited to 'lib/libc/arch')
-rw-r--r-- | lib/libc/arch/i386/SYS.h | 21 | ||||
-rw-r--r-- | lib/libc/arch/i386/gen/alloca.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/i386/gen/setjmp.S | 8 | ||||
-rw-r--r-- | lib/libc/arch/i386/gen/sigsetjmp.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/Ovfork.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/brk.S | 9 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/cerror.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/exect.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/sbrk.S | 9 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/sigprocmask.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/sigsuspend.S | 9 | ||||
-rw-r--r-- | lib/libc/arch/i386/sys/syscall.S | 9 |
12 files changed, 84 insertions, 35 deletions
diff --git a/lib/libc/arch/i386/SYS.h b/lib/libc/arch/i386/SYS.h index db822ba7963..23080c07e11 100644 --- a/lib/libc/arch/i386/SYS.h +++ b/lib/libc/arch/i386/SYS.h @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.13 2002/10/06 23:24:13 art Exp $ + * $OpenBSD: SYS.h,v 1.14 2003/04/17 03:47:38 drahn Exp $ */ #include <machine/asm.h> @@ -71,6 +71,9 @@ int $0x80 #endif /* ! __STDC__ */ +#define CERROR _C_LABEL(__cerror) +#define CURBRK _C_LABEL(__curbrk) + /* perform a syscall */ #define _SYSCALL_NOERROR(x,y) \ SYSENTRY(x); \ @@ -80,13 +83,25 @@ _SYSCALL_NOERROR(x,x) /* perform a syscall, set errno */ +#ifdef PIC +#define _SYSCALL(x,y) \ + .text; \ + .align 2; \ + 2: PIC_PROLOGUE; \ + movl PIC_GOT(CERROR), %ecx; \ + PIC_EPILOGUE; \ + jmp *%ecx; \ + _SYSCALL_NOERROR(x,y) \ + jc 2b +#else #define _SYSCALL(x,y) \ .text; \ .align 2; \ 2: \ - jmp PIC_PLT(__cerror); \ + jmp PIC_PLT(CERROR); \ _SYSCALL_NOERROR(x,y) \ jc 2b +#endif #define SYSCALL(x) \ _SYSCALL(x,x) @@ -105,4 +120,4 @@ #define RSYSCALL(x) \ PSEUDO(x,x); - .globl __cerror + .globl CERROR diff --git a/lib/libc/arch/i386/gen/alloca.S b/lib/libc/arch/i386/gen/alloca.S index 256d5135416..6f9738fe371 100644 --- a/lib/libc/arch/i386/gen/alloca.S +++ b/lib/libc/arch/i386/gen/alloca.S @@ -38,7 +38,7 @@ #if defined(LIBC_SCCS) .text - .asciz "$OpenBSD: alloca.S,v 1.3 1996/08/19 08:12:15 tholo Exp $" + .asciz "$OpenBSD: alloca.S,v 1.4 2003/04/17 03:47:42 drahn Exp $" #endif /* like alloc, but automatic automatic free in return */ @@ -55,4 +55,4 @@ ENTRY(alloca) pushl 4(%ecx) pushl 0(%ecx) pushl %eax /* dummy to pop at callsite */ - jmp %edx /* "return" */ + jmp *%edx /* "return" */ diff --git a/lib/libc/arch/i386/gen/setjmp.S b/lib/libc/arch/i386/gen/setjmp.S index 466dd480689..645cb127968 100644 --- a/lib/libc/arch/i386/gen/setjmp.S +++ b/lib/libc/arch/i386/gen/setjmp.S @@ -38,7 +38,7 @@ #if defined(LIBC_SCCS) .text - .asciz "$OpenBSD: setjmp.S,v 1.4 2001/11/01 07:02:13 mickey Exp $" + .asciz "$OpenBSD: setjmp.S,v 1.5 2003/04/17 03:47:42 drahn Exp $" #endif /* @@ -52,6 +52,7 @@ */ ENTRY(setjmp) + PIC_PROLOGUE pushl $0 #ifdef PIC call PIC_PLT(_C_LABEL(sigblock)) @@ -59,6 +60,8 @@ ENTRY(setjmp) call _C_LABEL(sigblock) #endif addl $4,%esp + PIC_EPILOGUE + movl 4(%esp),%ecx movl 0(%esp),%edx movl %edx, 0(%ecx) @@ -73,6 +76,7 @@ ENTRY(setjmp) ENTRY(longjmp) movl 4(%esp),%edx + PIC_PROLOGUE pushl 24(%edx) #ifdef PIC call PIC_PLT(_C_LABEL(sigsetmask)) @@ -80,6 +84,8 @@ ENTRY(longjmp) call _C_LABEL(sigsetmask) #endif addl $4,%esp + PIC_EPILOGUE + movl 4(%esp),%edx movl 8(%esp),%eax movl 0(%edx),%ecx diff --git a/lib/libc/arch/i386/gen/sigsetjmp.S b/lib/libc/arch/i386/gen/sigsetjmp.S index ac8adff03f9..02b122dd90e 100644 --- a/lib/libc/arch/i386/gen/sigsetjmp.S +++ b/lib/libc/arch/i386/gen/sigsetjmp.S @@ -38,7 +38,7 @@ #if defined(LIBC_SCCS) .text - .asciz "$OpenBSD: sigsetjmp.S,v 1.4 2001/11/01 07:02:13 mickey Exp $" + .asciz "$OpenBSD: sigsetjmp.S,v 1.5 2003/04/17 03:47:42 drahn Exp $" #endif ENTRY(sigsetjmp) @@ -47,6 +47,8 @@ ENTRY(sigsetjmp) movl %eax,28(%ecx) testl %eax,%eax jz 1f + + PIC_PROLOGUE pushl $0 #ifdef PIC call PIC_PLT(_C_LABEL(sigblock)) @@ -54,6 +56,8 @@ ENTRY(sigsetjmp) call _C_LABEL(sigblock) #endif addl $4,%esp + PIC_EPILOGUE + movl 4(%esp),%ecx movl %eax,24(%ecx) 1: movl 0(%esp),%edx @@ -70,6 +74,8 @@ ENTRY(siglongjmp) movl 4(%esp),%edx cmpl $0,28(%edx) jz 1f + + PIC_PROLOGUE pushl 24(%edx) #ifdef PIC call PIC_PLT(_C_LABEL(sigsetmask)) @@ -77,6 +83,8 @@ ENTRY(siglongjmp) call _C_LABEL(sigsetmask) #endif addl $4,%esp + PIC_EPILOGUE + 1: movl 4(%esp),%edx movl 8(%esp),%eax movl 0(%edx),%ecx diff --git a/lib/libc/arch/i386/sys/Ovfork.S b/lib/libc/arch/i386/sys/Ovfork.S index 264e09e302f..1c80b1cd109 100644 --- a/lib/libc/arch/i386/sys/Ovfork.S +++ b/lib/libc/arch/i386/sys/Ovfork.S @@ -38,7 +38,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: Ovfork.S,v 1.3 1998/11/20 11:18:29 d Exp $" + .asciz "$OpenBSD: Ovfork.S,v 1.4 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIB_SCCS */ /* @@ -55,15 +55,15 @@ SYSENTRY(vfork) jc err decl %edx andl %edx,%eax - jmp %ecx + jmp *%ecx err: #ifdef PIC PIC_PROLOGUE - movl PIC_GOT(_errno),%edx + movl PIC_GOT(_C_LABEL(errno)),%edx PIC_EPILOGUE movl %eax,(%edx) #else - movl %eax,_errno + movl %eax,_C_LABEL(errno) #endif movl $-1,%eax - jmp %ecx + jmp *%ecx diff --git a/lib/libc/arch/i386/sys/brk.S b/lib/libc/arch/i386/sys/brk.S index 2692ca01949..fbb24062d0f 100644 --- a/lib/libc/arch/i386/sys/brk.S +++ b/lib/libc/arch/i386/sys/brk.S @@ -38,7 +38,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: brk.S,v 1.5 2002/10/06 23:31:41 art Exp $" + .asciz "$OpenBSD: brk.S,v 1.6 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIB_SCCS */ .globl _end @@ -70,7 +70,10 @@ ENTRY(brk) movl %ecx,(%edx) ret err: - jmp PIC_PLT(__cerror) + PIC_PROLOGUE + movl PIC_GOT(CERROR),%ecx # set up GOT addressing + PIC_EPILOGUE + jmp *%ecx #else @@ -87,5 +90,5 @@ err: movl %ecx,__curbrk ret err: - jmp __cerror + jmp CERROR #endif diff --git a/lib/libc/arch/i386/sys/cerror.S b/lib/libc/arch/i386/sys/cerror.S index 11512c86b50..35cb35d62f4 100644 --- a/lib/libc/arch/i386/sys/cerror.S +++ b/lib/libc/arch/i386/sys/cerror.S @@ -38,18 +38,18 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: cerror.S,v 1.3 2002/10/06 23:24:13 art Exp $" + .asciz "$OpenBSD: cerror.S,v 1.4 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIB_SCCS */ - .globl _errno -__cerror: + .globl _C_LABEL(errno) +CERROR: #ifdef PIC PIC_PROLOGUE - movl PIC_GOT(_errno),%ecx + movl PIC_GOT(_C_LABEL(errno)),%ecx PIC_EPILOGUE movl %eax,(%ecx) #else - movl %eax,_errno + movl %eax,_C_LABEL(errno) #endif movl $-1,%eax movl $-1,%edx diff --git a/lib/libc/arch/i386/sys/exect.S b/lib/libc/arch/i386/sys/exect.S index 99ed7bfe48c..c4a9a946032 100644 --- a/lib/libc/arch/i386/sys/exect.S +++ b/lib/libc/arch/i386/sys/exect.S @@ -39,7 +39,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: exect.S,v 1.3 2002/10/06 23:24:13 art Exp $" + .asciz "$OpenBSD: exect.S,v 1.4 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIB_SCCS */ ENTRY(exect) @@ -51,7 +51,11 @@ ENTRY(exect) popf int $0x80 #ifdef PIC - jmp PIC_PLT(__cerror) /* exect(file, argv, env); */ + PIC_PROLOGUE + movl PIC_GOT(CERROR), %ecx + PIC_EPILOGUE + jmp *%ecx + #else - jmp __cerror + jmp CERROR #endif diff --git a/lib/libc/arch/i386/sys/sbrk.S b/lib/libc/arch/i386/sys/sbrk.S index f5000be04c4..193fe74a6a4 100644 --- a/lib/libc/arch/i386/sys/sbrk.S +++ b/lib/libc/arch/i386/sys/sbrk.S @@ -38,7 +38,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: sbrk.S,v 1.5 2002/10/06 23:31:41 art Exp $" + .asciz "$OpenBSD: sbrk.S,v 1.6 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIBC_SCCS */ .globl _end @@ -66,7 +66,10 @@ ENTRY(sbrk) addl %ecx,(%edx) ret err: - jmp PIC_PLT(__cerror) + PIC_PROLOGUE + movl PIC_GOT(CERROR), %ecx + PIC_EPILOGUE + jmp *%ecx #else @@ -80,5 +83,5 @@ err: addl %ecx,__curbrk ret err: - jmp __cerror + jmp CERROR #endif diff --git a/lib/libc/arch/i386/sys/sigprocmask.S b/lib/libc/arch/i386/sys/sigprocmask.S index 1a473e252eb..51b1ab7adc5 100644 --- a/lib/libc/arch/i386/sys/sigprocmask.S +++ b/lib/libc/arch/i386/sys/sigprocmask.S @@ -38,7 +38,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: sigprocmask.S,v 1.5 2002/10/06 23:24:13 art Exp $" + .asciz "$OpenBSD: sigprocmask.S,v 1.6 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIBC_SCCS */ SYSENTRY(sigprocmask) @@ -62,7 +62,11 @@ out: ret err: #ifdef PIC - jmp PIC_PLT(__cerror) + PIC_PROLOGUE + movl PIC_GOT(CERROR), %ecx + PIC_EPILOGUE + jmp *%ecx + #else - jmp __cerror + jmp CERROR #endif diff --git a/lib/libc/arch/i386/sys/sigsuspend.S b/lib/libc/arch/i386/sys/sigsuspend.S index d31b954cf0f..319b46c3d53 100644 --- a/lib/libc/arch/i386/sys/sigsuspend.S +++ b/lib/libc/arch/i386/sys/sigsuspend.S @@ -38,7 +38,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: sigsuspend.S,v 1.4 2002/10/06 23:24:13 art Exp $" + .asciz "$OpenBSD: sigsuspend.S,v 1.5 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIBC_SCCS */ SYSENTRY(sigsuspend) @@ -52,7 +52,10 @@ SYSENTRY(sigsuspend) ret err: #ifdef PIC - jmp PIC_PLT(__cerror) + PIC_PROLOGUE + movl PIC_GOT(CERROR), %ecx + PIC_EPILOGUE + jmp *%ecx #else - jmp __cerror + jmp CERROR #endif diff --git a/lib/libc/arch/i386/sys/syscall.S b/lib/libc/arch/i386/sys/syscall.S index cd2e5e09b12..a9f9966cd93 100644 --- a/lib/libc/arch/i386/sys/syscall.S +++ b/lib/libc/arch/i386/sys/syscall.S @@ -38,7 +38,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: syscall.S,v 1.4 2002/10/06 23:24:13 art Exp $" + .asciz "$OpenBSD: syscall.S,v 1.5 2003/04/17 03:47:42 drahn Exp $" #endif /* SYSLIBC_SCCS */ SYSENTRY(syscall) @@ -51,7 +51,10 @@ SYSENTRY(syscall) ret err: #ifdef PIC - jmp PIC_PLT(__cerror) + PIC_PROLOGUE + movl PIC_GOT(CERROR), %ecx + PIC_EPILOGUE + jmp *%ecx #else - jmp __cerror + jmp CERROR #endif |