diff options
author | peter <peter@FreeBSD.org> | 1996-05-05 07:56:21 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-05-05 07:56:21 +0000 |
commit | 4b7195c99191637bf59fd4ad626297296bf3610f (patch) | |
tree | bea8a07c70223c0e39939063c6dbbdf8eb9d0f17 /lib/libc/i386/sys/sbrk.S | |
parent | 93f1aa601a7bda9bd9b83bf5098c3f05f6edd744 (diff) | |
download | FreeBSD-src-4b7195c99191637bf59fd4ad626297296bf3610f.zip FreeBSD-src-4b7195c99191637bf59fd4ad626297296bf3610f.tar.gz |
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.
Diffstat (limited to 'lib/libc/i386/sys/sbrk.S')
-rw-r--r-- | lib/libc/i386/sys/sbrk.S | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/lib/libc/i386/sys/sbrk.S b/lib/libc/i386/sys/sbrk.S index 2d65b59..d5c48ddc 100644 --- a/lib/libc/i386/sys/sbrk.S +++ b/lib/libc/i386/sys/sbrk.S @@ -33,64 +33,63 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $ + * $Id: sbrk.S,v 1.3 1995/10/04 15:58:57 phk Exp $ */ #if defined(SYSLIBC_RCS) && !defined(lint) .text - .asciz "$Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $" + .asciz "$Id: sbrk.S,v 1.3 1995/10/04 15:58:57 phk Exp $" #endif /* SYSLIBC_RCS and not lint */ #include "SYS.h" -#define SYS_brk 17 - - .globl _end - .globl minbrk - .globl curbrk + .globl CNAME(end) + .globl HIDENAME(minbrk) + .globl HIDENAME(curbrk) .data -minbrk: .long _end -curbrk: .long _end +HIDENAME(minbrk): .long CNAME(end) +HIDENAME(curbrk): .long CNAME(end) .text ENTRY(sbrk) #ifdef PIC movl 4(%esp),%ecx PIC_PROLOGUE - movl PIC_GOT(curbrk),%edx + movl PIC_GOT(HIDENAME(curbrk)),%edx movl (%edx),%eax PIC_EPILOGUE testl %ecx,%ecx jz back addl %eax,4(%esp) - lea SYS_brk,%eax - LCALL(7,0) + lea SYS_break,%eax + KERNCALL jb err PIC_PROLOGUE - movl PIC_GOT(curbrk),%edx + movl PIC_GOT(HIDENAME(curbrk)),%edx movl (%edx),%eax addl %ecx,(%edx) PIC_EPILOGUE back: ret err: - jmp PIC_PLT(cerror) + PIC_PROLOGUE + jmp PIC_PLT(HIDENAME(cerror)) #else /* !PIC */ movl 4(%esp),%ecx - movl curbrk,%eax + movl HIDENAME(curbrk),%eax testl %ecx,%ecx jz back addl %eax,4(%esp) - lea SYS_brk,%eax - LCALL(7,0) + lea SYS_break,%eax + KERNCALL jb err - movl curbrk,%eax - addl %ecx,curbrk + movl HIDENAME(curbrk),%eax + addl %ecx,HIDENAME(curbrk) back: ret err: - jmp cerror + jmp HIDENAME(cerror) #endif /* PIC */ |