From 4b7195c99191637bf59fd4ad626297296bf3610f Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 5 May 1996 07:56:21 +0000 Subject: Add support to enable libc to be compiled in ELF format. (#ifdef __ELF__) In a nutshell, this macroizes the local/global symbol scoping rules that are different in a.out and ELF. It also makes the i386 assembler stubs conform to i386 PIC calling conventions - the a.out ld.so didn't object, but the ELF one needs it as it implements PIC jumps via PLT's as well as calls. The a.out rtld only worked because it was accidently snooping the grandparent calling function's return address off the stack.. This also affects the libc_r code a little, because of cpp macro nesting. --- lib/libc/i386/gen/modf.S | 12 ++++++------ lib/libc/i386/gen/setjmp.S | 16 ++++++++++------ lib/libc/i386/gen/sigsetjmp.S | 16 ++++++++++------ 3 files changed, 26 insertions(+), 18 deletions(-) (limited to 'lib/libc/i386/gen') diff --git a/lib/libc/i386/gen/modf.S b/lib/libc/i386/gen/modf.S index 35b993a..34a89ed 100644 --- a/lib/libc/i386/gen/modf.S +++ b/lib/libc/i386/gen/modf.S @@ -33,12 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: modf.S,v 1.2 1995/01/23 01:27:05 davidg Exp $ */ #if defined(LIBC_RCS) && !defined(lint) .text - .asciz "$Id$" + .asciz "$Id: modf.S,v 1.2 1995/01/23 01:27:05 davidg Exp $" #endif /* LIBC_RCS and not lint */ /* @@ -50,10 +50,10 @@ */ /* With CHOP mode on, frndint behaves as TRUNC does. Useful. */ -.text -.globl _modf -.type _modf,@function -_modf: + +#include "DEFS.h" + +ENTRY(modf) pushl %ebp movl %esp,%ebp subl $16,%esp diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S index 89efa92..078b2eb 100644 --- a/lib/libc/i386/gen/setjmp.S +++ b/lib/libc/i386/gen/setjmp.S @@ -33,12 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $ + * $Id: setjmp.S,v 1.4 1996/01/22 00:00:53 julian Exp $ */ #if defined(LIBC_RCS) && !defined(lint) .text - .asciz "$Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $" + .asciz "$Id: setjmp.S,v 1.4 1996/01/22 00:00:53 julian Exp $" #endif /* LIBC_RCS and not lint */ /* @@ -59,13 +59,15 @@ ENTRY(_thread_sys_setjmp) #else ENTRY(setjmp) #endif + PIC_PROLOGUE pushl $0 #ifdef _THREAD_SAFE - call PIC_PLT(__thread_sys_sigblock) + call PIC_PLT(CNAME(_thread_sys_sigblock)) #else - call PIC_PLT(_sigblock) + call PIC_PLT(CNAME(sigblock)) #endif popl %edx + PIC_EPILOGUE movl 4(%esp),%ecx movl 0(%esp),%edx movl %edx, 0(%ecx) @@ -85,13 +87,15 @@ ENTRY(_thread_sys_longjmp) ENTRY(longjmp) #endif movl 4(%esp),%edx + PIC_PROLOGUE pushl 24(%edx) #ifdef _THREAD_SAFE - call PIC_PLT(__thread_sys_sigsetmask) + call PIC_PLT(CNAME(_thread_sys_sigsetmask)) #else - call PIC_PLT(_sigsetmask) /* XXX this is not reentrant */ + call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */ #endif popl %eax + PIC_EPILOGUE movl 4(%esp),%edx movl 8(%esp),%eax movl 0(%edx),%ecx diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S index 5cc00f0..1d56f29 100644 --- a/lib/libc/i386/gen/sigsetjmp.S +++ b/lib/libc/i386/gen/sigsetjmp.S @@ -33,12 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sigsetjmp.S,v 1.5 1996/01/22 00:00:54 julian Exp $ + * $Id: sigsetjmp.S,v 1.6 1996/02/17 12:25:21 peter Exp $ */ #if defined(LIBC_RCS) && !defined(lint) .text - .asciz "$Id: sigsetjmp.S,v 1.5 1996/01/22 00:00:54 julian Exp $" + .asciz "$Id: sigsetjmp.S,v 1.6 1996/02/17 12:25:21 peter Exp $" #endif /* LIBC_RCS and not lint */ #include "DEFS.h" @@ -69,13 +69,15 @@ ENTRY(sigsetjmp) movl %eax,32(%ecx) testl %eax,%eax jz 1f + PIC_PROLOGUE pushl $0 #ifdef _THREAD_SAFE - call PIC_PLT(__thread_sys_sigblock) + call PIC_PLT(CNAME(_thread_sys_sigblock)) #else - call PIC_PLT(_sigblock) + call PIC_PLT(CNAME(sigblock)) #endif addl $4,%esp + PIC_EPILOGUE movl 4(%esp),%ecx movl %eax,24(%ecx) 1: movl 0(%esp),%edx @@ -97,13 +99,15 @@ ENTRY(siglongjmp) movl 4(%esp),%edx cmpl $0,32(%edx) jz 1f + PIC_PROLOGUE pushl 24(%edx) #ifdef _THREAD_SAFE - call PIC_PLT(__thread_sys_sigsetmask) + call PIC_PLT(CNAME(_thread_sys_sigsetmask)) #else - call PIC_PLT(_sigsetmask) + call PIC_PLT(CNAME(sigsetmask)) #endif addl $4,%esp + PIC_EPILOGUE 1: movl 4(%esp),%edx movl 8(%esp),%eax movl 0(%edx),%ecx -- cgit v1.1