From 0a3e7b0f16865e89a8ee8dc1761e2658338559f8 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 15 Jan 2001 13:28:58 +0000 Subject: USe the name crt0.o, and cp it to $(TOPDIR)/libcrt0.o --- libc/sysdeps/linux/arm/Makefile | 12 ++++++-- libc/sysdeps/linux/arm/crt0.S | 66 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 libc/sysdeps/linux/arm/crt0.S (limited to 'libc/sysdeps/linux/arm') 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 + + -- cgit v1.2.3