Browse Source

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().

Eric Andersen 21 years ago
parent
commit
a3560dc47b

+ 1 - 6
libc/sysdeps/Makefile

@@ -1,7 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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
 

+ 1 - 6
libc/sysdeps/linux/Makefile

@@ -1,7 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 1 - 1
libc/sysdeps/linux/alpha/Makefile

@@ -1,6 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 1 - 6
libc/sysdeps/linux/arm/Makefile

@@ -1,7 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 1 - 6
libc/sysdeps/linux/common/Makefile

@@ -1,7 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 5 - 1
libc/sysdeps/linux/cris/Makefile

@@ -1,3 +1,7 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
+#
 # 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

+ 7 - 13
libc/sysdeps/linux/h8300/Makefile

@@ -1,6 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 1 - 8
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
-
-

+ 0 - 1
libc/sysdeps/linux/i386/Makefile

@@ -1,6 +1,5 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
 # Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # This program is free software; you can redistribute it and/or modify it under

+ 2 - 2
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

+ 6 - 22
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 <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 7 - 17
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 <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 1 - 7
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
-

+ 1 - 6
libc/sysdeps/linux/mips/Makefile

@@ -1,7 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2001 by Lineo, inc.
-# Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 13 - 8
libc/sysdeps/linux/mips/crt0.S

@@ -12,8 +12,19 @@
 #include <sys/regdef.h>
 
 .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
-

+ 1 - 5
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 <andersen@uclibc.org>
 #
 # 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

+ 1 - 6
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
-

+ 1 - 6
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 <andersen@uclibc.org>
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
 #
 # 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

+ 5 - 10
libc/sysdeps/linux/v850/Makefile

@@ -2,7 +2,6 @@
 #
 # Copyright (C) 2001,2002  NEC Corporation
 # Copyright (C) 2001,2002  Miles Bader <miles@gnu.org>
-# 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