diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/sysdeps/linux/arm/Makefile | 12 | ||||
-rw-r--r-- | libc/sysdeps/linux/arm/crt0.S | 66 |
2 files changed, 76 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile index 7d901b769..a75e47715 100644 --- a/libc/sysdeps/linux/arm/Makefile +++ b/libc/sysdeps/linux/arm/Makefile @@ -25,7 +25,10 @@ include $(TOPDIR)Rules.mak LIBC=$(TOPDIR)libc.a ASFLAGS=$(CFLAGS) -SSRC=_start.S longjmp.S setjmp.S +CRT0=_start.S +CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) + +SSRC=longjmp.S setjmp.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) CSRC=fork.c vfork.c @@ -34,13 +37,18 @@ COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(SOBJS) $(MOBJ) $(COBJS) -all: $(OBJS) $(LIBC) +all: $(OBJS) $(CRT0_OBJ) $(LIBC) $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) +$(CRT0_OBJ): %.o : %.S + $(CC) $(CFLAGS) -c $< -o $@ + $(STRIPTOOL) -x -R .note -R .comment $*.o + cp $*.o $(TOPDIR)/libcrt0.o + $(SOBJS): %.o : %.S $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o diff --git a/libc/sysdeps/linux/arm/crt0.S b/libc/sysdeps/linux/arm/crt0.S new file mode 100644 index 000000000..3944bd34c --- /dev/null +++ b/libc/sysdeps/linux/arm/crt0.S @@ -0,0 +1,66 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + + +#define BASEREG r9 + +@ r0 = argc +@ r1 = argv +@ r2 = envp +@ sl = data segment + + + + .text + .align 2 + .global _start, exit, main + .type _start,%function + +.text +_start: + @ adjust the data sgement base pointer + ldr r3,=__data_start + sub sl,sl,r3 + mov BASEREG,sl + + ldr r3, .L3 + str r2,[BASEREG,r3] + ldr r0,[sp, #0] + ldr r1,[sp, #4] + ldr r2,[sp, #8] + bl main + ldr r0,=0 + bl exit + + +.L3: .word environ + + + .data + .align 2 + .global __errno, __environ + +__environ: .long 0 +.weak environ +environ = __environ + +__errno: .long 0 +.weak errno +errno = __errno + + |