From a3560dc47b3cf2eef3ebf0e0c9765e11bdf66b6a Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 23 Jan 2003 17:55:27 +0000 Subject: Update architecture specific support to consistantly generate a crt0 and crt1 file. Most arches still need to be updated to call __uClibc_start_main() rather than __uClibc_main(). --- libc/sysdeps/Makefile | 7 +------ libc/sysdeps/linux/Makefile | 7 +------ libc/sysdeps/linux/alpha/Makefile | 2 +- libc/sysdeps/linux/arm/Makefile | 7 +------ libc/sysdeps/linux/common/Makefile | 7 +------ libc/sysdeps/linux/cris/Makefile | 6 +++++- libc/sysdeps/linux/h8300/Makefile | 20 +++++++------------- libc/sysdeps/linux/h8300/crt0.S | 9 +-------- libc/sysdeps/linux/i386/Makefile | 1 - libc/sysdeps/linux/i386/crt0.S | 4 ++-- libc/sysdeps/linux/i960/Makefile | 28 ++++++---------------------- libc/sysdeps/linux/m68k/Makefile | 24 +++++++----------------- libc/sysdeps/linux/m68k/crt0.S | 8 +------- libc/sysdeps/linux/mips/Makefile | 7 +------ libc/sysdeps/linux/mips/crt0.S | 21 +++++++++++++-------- libc/sysdeps/linux/sh/Makefile | 6 +----- libc/sysdeps/linux/sh/crt0.S | 7 +------ libc/sysdeps/linux/sparc/Makefile | 7 +------ libc/sysdeps/linux/v850/Makefile | 15 +++++---------- 19 files changed, 56 insertions(+), 137 deletions(-) diff --git a/libc/sysdeps/Makefile b/libc/sysdeps/Makefile index 302041711..e1e304873 100644 --- a/libc/sysdeps/Makefile +++ b/libc/sysdeps/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. DIRS = linux diff --git a/libc/sysdeps/linux/Makefile b/libc/sysdeps/linux/Makefile index 757576efc..59e460709 100644 --- a/libc/sysdeps/linux/Makefile +++ b/libc/sysdeps/linux/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../ include $(TOPDIR)Rules.mak diff --git a/libc/sysdeps/linux/alpha/Makefile b/libc/sysdeps/linux/alpha/Makefile index 097b320df..c94c9751f 100644 --- a/libc/sysdeps/linux/alpha/Makefile +++ b/libc/sysdeps/linux/alpha/Makefile @@ -1,6 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2002-2003 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile index 540d2b30c..efb9139e9 100644 --- a/libc/sysdeps/linux/arm/Makefile +++ b/libc/sysdeps/linux/arm/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2002 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index c4e63766e..225371b3f 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000-2002 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak diff --git a/libc/sysdeps/linux/cris/Makefile b/libc/sysdeps/linux/cris/Makefile index b3d7d16c5..8a860f188 100644 --- a/libc/sysdeps/linux/cris/Makefile +++ b/libc/sysdeps/linux/cris/Makefile @@ -1,3 +1,7 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2003 Erik Andersen +# # This program 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 @@ -37,7 +41,7 @@ $(LIBC): ar-target ar-target: $(OBJS) $(CRT0_OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) - cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ) + cp $(CRT0_OBJ) $(TOPDIR)lib/ $(CRT0_OBJ): $(CRT0_SRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o diff --git a/libc/sysdeps/linux/h8300/Makefile b/libc/sysdeps/linux/h8300/Makefile index d63500a54..605278f23 100644 --- a/libc/sysdeps/linux/h8300/Makefile +++ b/libc/sysdeps/linux/h8300/Makefile @@ -1,6 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -15,19 +15,13 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak ASFLAGS=$(CFLAGS) -# If you're looking for vfork(), it is defined in include/unistd.h - -CRT0=crt0.S -CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) +CRT0_SRC = crt0.S +CRT0_OBJ = crt0.o crt1.o SSRC=setjmp.S vfork.S # longjmp.S _start.S clone.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) @@ -35,7 +29,7 @@ SOBJS=$(patsubst %.S,%.o, $(SSRC)) CSRC=ptrace.c COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(SOBJS) $(MOBJ) $(COBJS) +OBJS=$(SOBJS) $(COBJS) @@ -45,10 +39,10 @@ $(LIBC): ar-target ar-target: $(OBJS) $(CRT0_OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) - cp $(CRT0_OBJ) $(TOPDIR)lib/$(CRT0_OBJ) + cp $(CRT0_OBJ) $(TOPDIR)lib/ -$(CRT0_OBJ): %.o : %.S - $(CC) $(CFLAGS) -c $< -o $@ +$(CRT0_OBJ): $(CRT0_SRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): %.o : %.S diff --git a/libc/sysdeps/linux/h8300/crt0.S b/libc/sysdeps/linux/h8300/crt0.S index 2fe9d0d53..a4f862797 100644 --- a/libc/sysdeps/linux/h8300/crt0.S +++ b/libc/sysdeps/linux/h8300/crt0.S @@ -22,6 +22,7 @@ Cambridge, MA 02139, USA. */ .global _start .global __exit .global atexit + .global main .h8300h .text @@ -53,11 +54,3 @@ empty_func: .set atexit,empty_func #endif - -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ -L_dummy_main_reference: - .long _main - - diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile index acbdfc9bf..9ca790cff 100644 --- a/libc/sysdeps/linux/i386/Makefile +++ b/libc/sysdeps/linux/i386/Makefile @@ -1,6 +1,5 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. # Copyright (C) 2000-2003 Erik Andersen # # This program is free software; you can redistribute it and/or modify it under diff --git a/libc/sysdeps/linux/i386/crt0.S b/libc/sysdeps/linux/i386/crt0.S index 71b7f6c70..e871c0876 100644 --- a/libc/sysdeps/linux/i386/crt0.S +++ b/libc/sysdeps/linux/i386/crt0.S @@ -35,8 +35,8 @@ Cambridge, MA 02139, USA. */ .text .align 4 - .globl _start - .type _start,@function + .global _start + .type _start,%function #if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__ .type __uClibc_main,%function #else diff --git a/libc/sysdeps/linux/i960/Makefile b/libc/sysdeps/linux/i960/Makefile index 00a23b896..9fd8a837d 100644 --- a/libc/sysdeps/linux/i960/Makefile +++ b/libc/sysdeps/linux/i960/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001,2002 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,24 +15,13 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. - -USE_CRT0_C=false TOPDIR=../../../../ include $(TOPDIR)Rules.mak ASFLAGS=$(CFLAGS) -ifeq ($(USE_CRT0_C),true) -CRT0=crt0.c -CRT0_OBJ=$(patsubst %.c,%.o, $(CRT0)) -else -CRT0=crt0.S -CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) -endif +CRT0_SRC = crt0.S +CRT0_OBJ = crt0.o crt1.o SSRC=clone.S _mmap.S setjmp.S vfork.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) @@ -50,14 +38,10 @@ $(LIBC): ar-target ar-target: $(OBJS) $(CRT0_OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) - cp $(CRT0_OBJ) $(TOPDIR)lib/$(CRT0_OBJ) + cp $(CRT0_OBJ) $(TOPDIR)lib/ -ifeq ($(USE_CRT0_C),true) -$(CRT0_OBJ): %.o : %.c -else -$(CRT0_OBJ): %.o : %.S -endif - $(CC) $(CFLAGS) -c $< -o $@ +$(CRT0_OBJ): $(CRT0_SRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): %.o : %.S diff --git a/libc/sysdeps/linux/m68k/Makefile b/libc/sysdeps/linux/m68k/Makefile index 78f1c3f19..36970c6df 100644 --- a/libc/sysdeps/linux/m68k/Makefile +++ b/libc/sysdeps/linux/m68k/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001,2002 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak @@ -29,12 +24,11 @@ ASFLAGS=$(CFLAGS) ifeq ($(UCLIBC_HAS_MMU),y) -CRT0=crt0.c -CRT0_OBJ=$(patsubst %.c,%.o, $(CRT0)) +CRT0_SRC = crt0.c else -CRT0=crt0.S -CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) +CRT0_SRC = crt0.S endif +CRT0_OBJ = crt0.o crt1.o SSRC= __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) @@ -52,14 +46,10 @@ $(LIBC): ar-target ar-target: $(OBJS) $(CRT0_OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) - cp $(CRT0_OBJ) $(TOPDIR)lib/$(CRT0_OBJ) + cp $(CRT0_OBJ) $(TOPDIR)lib/ -ifeq ($(UCLIBC_HAS_MMU),y) -$(CRT0_OBJ): %.o : %.c -else -$(CRT0_OBJ): %.o : %.S -endif - $(CC) $(CFLAGS) -c $< -o $@ +$(CRT0_OBJ): $(CRT0_SRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): %.o : %.S diff --git a/libc/sysdeps/linux/m68k/crt0.S b/libc/sysdeps/linux/m68k/crt0.S index 8d7f6802d..36546835c 100644 --- a/libc/sysdeps/linux/m68k/crt0.S +++ b/libc/sysdeps/linux/m68k/crt0.S @@ -27,6 +27,7 @@ Cambridge, MA 02139, USA. */ .global _start .global __exit .global atexit + .global main .text @@ -60,10 +61,3 @@ empty_func: .set atexit,empty_func #endif - -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ -L_dummy_main_reference: - .long main - diff --git a/libc/sysdeps/linux/mips/Makefile b/libc/sysdeps/linux/mips/Makefile index 1fba4ef74..53b3031b8 100644 --- a/libc/sysdeps/linux/mips/Makefile +++ b/libc/sysdeps/linux/mips/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2001 by Lineo, inc. -# Copyright (C) 2000-2002 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak diff --git a/libc/sysdeps/linux/mips/crt0.S b/libc/sysdeps/linux/mips/crt0.S index fdb997b73..b24fe1d84 100644 --- a/libc/sysdeps/linux/mips/crt0.S +++ b/libc/sysdeps/linux/mips/crt0.S @@ -12,8 +12,19 @@ #include .text -.global __start -.type __start,@function + .global __start + .type __start,%function +#if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__ + .type __uClibc_main,%function +#else + .weak _init + .weak _fini + .type __uClibc_start_main,%function +#endif +/* Stick in a dummy reference to main(), so that if an application + * is linking when the main() function is in a static library (.a) + * we can be sure that main() actually gets linked in */ + .type main,%function __start: #ifdef __PIC__ @@ -49,9 +60,3 @@ __start: hlt: b hlt -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ -L_dummy_main_reference: - .long main - diff --git a/libc/sysdeps/linux/sh/Makefile b/libc/sysdeps/linux/sh/Makefile index f43c83096..425335f7b 100644 --- a/libc/sysdeps/linux/sh/Makefile +++ b/libc/sysdeps/linux/sh/Makefile @@ -1,7 +1,7 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. # Copyright (C) 2001 by Hewlett-Packard Australia +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +16,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak diff --git a/libc/sysdeps/linux/sh/crt0.S b/libc/sysdeps/linux/sh/crt0.S index 90fba8d34..b6a7e117d 100644 --- a/libc/sysdeps/linux/sh/crt0.S +++ b/libc/sysdeps/linux/sh/crt0.S @@ -40,6 +40,7 @@ .text .globl _start .type _start,@function + .type main,@function .size _start,_start_end - _start _start: /* Clear the frame pointer since this is the outermost frame. */ @@ -127,9 +128,3 @@ L_fini: L_abort: .long abort -/* Stick in a dummy reference to main(), so that if an application - * is linking when the main() function is in a static library (.a) - * we can be sure that main() actually gets linked in */ -L_dummy_main_reference: - .long main - diff --git a/libc/sysdeps/linux/sparc/Makefile b/libc/sysdeps/linux/sparc/Makefile index aecb3bd16..1491cf343 100644 --- a/libc/sysdeps/linux/sparc/Makefile +++ b/libc/sysdeps/linux/sparc/Makefile @@ -1,7 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. -# Copyright (C) 2000,2001,2002 Erik Andersen +# Copyright (C) 2000-2003 Erik Andersen # # This program 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 @@ -16,10 +15,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak diff --git a/libc/sysdeps/linux/v850/Makefile b/libc/sysdeps/linux/v850/Makefile index 199c7c550..cc098014e 100644 --- a/libc/sysdeps/linux/v850/Makefile +++ b/libc/sysdeps/linux/v850/Makefile @@ -2,7 +2,6 @@ # # Copyright (C) 2001,2002 NEC Corporation # Copyright (C) 2001,2002 Miles Bader -# Copyright (C) 2000 Lineo, inc. # # This program 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 @@ -17,10 +16,6 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived in part from the Linux-8086 C library, the GNU C Library, and several -# other sundry sources. Files within this library are copyright by their -# respective copyright holders. TOPDIR=../../../../ include $(TOPDIR)Rules.mak @@ -30,8 +25,8 @@ SFLAGS = $(CFLAGS) -D__ASSEMBLER -DASM_GLOBAL_DIRECTIVE=.globl TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine) -CRT0 = crt0.S -CRT0_OBJ = $(patsubst %.S,%.o, $(CRT0)) +CRT0_SRC = crt0.S +CRT0_OBJ = crt0.o crt1.o SSRC = setjmp.S __longjmp.S vfork.S SOBJS = $(patsubst %.S,%.o, $(SSRC)) @@ -48,10 +43,10 @@ $(LIBC): ar-target ar-target: $(OBJS) $(CRT0_OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) - cp $(CRT0_OBJ) $(TOPDIR)lib/$(CRT0_OBJ) + cp $(CRT0_OBJ) $(TOPDIR)lib/ -$(CRT0_OBJ): %.o : %.S - $(CC) $(SFLAGS) -c $< -o $@ +$(CRT0_OBJ): $(CRT0_SRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): %.o : %.S -- cgit v1.2.3