Create startup files from the GCC sources and drop our versions.
authorSimon Schubert <corecode@dragonflybsd.org>
Mon, 15 Jan 2007 18:01:44 +0000 (18:01 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Mon, 15 Jan 2007 18:01:44 +0000 (18:01 +0000)
This places the startup files into the GCC specific lib dir.  A short
overview is given in lib/csu/README.

This fixes issues with gcc41 and static binaries.

18 files changed:
Makefile.inc1
gnu/lib/csu/Makefile.csu [new file with mode: 0644]
gnu/lib/gcc34/csu/Makefile [new file with mode: 0644]
gnu/lib/gcc41/csu/Makefile [new file with mode: 0644]
gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h
gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h
lib/Makefile
lib/csu/README [new file with mode: 0644]
lib/csu/amd64/Makefile [deleted file]
lib/csu/amd64/Makefile.csu [new file with mode: 0644]
lib/csu/amd64/Makefile.inc [deleted file]
lib/csu/common/Makefile [deleted file]
lib/csu/common/crtbegin.c [deleted file]
lib/csu/common/crtbeginS.c [deleted file]
lib/csu/common/crtend.c [deleted file]
lib/csu/common/crtendS.c [deleted file]
lib/csu/i386/Makefile [deleted file]
lib/csu/i386/Makefile.csu [new file with mode: 0644]

index ef746aa..2a15c54 100644 (file)
@@ -1,6 +1,6 @@
 #
 # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
-# $DragonFly: src/Makefile.inc1,v 1.98 2007/01/04 14:19:03 y0netan1 Exp $
+# $DragonFly: src/Makefile.inc1,v 1.99 2007/01/15 18:01:44 corecode Exp $
 #
 # Build-time options are documented in make.conf(5).
 #
@@ -890,15 +890,14 @@ libraries:
 
 # These dependencies are not automatically generated:
 #
-# gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
+# gnu/lib/${CCVER}/libgcc and gnu/lib/${CCVER}/csu must be built before all
 # shared libraries for ELF.  The target for _startup_libs34 is
 # specifically built using gcc34.  Same goes for _startup_libs40.
 #
-_startup_libs34=       gnu/lib/gcc34/libgcc
-_startup_libs40=       gnu/lib/gcc40/libgcc
-_startup_libs41=       gnu/lib/gcc41/libgcc
-_startup_libs= lib/csu/${MACHINE_ARCH}
-_startup_libs+=        lib/csu/common lib/libc lib/libc_rtld
+_startup_libs34=       gnu/lib/gcc34/csu gnu/lib/gcc34/libgcc
+_startup_libs40=       gnu/lib/gcc40/csu gnu/lib/gcc40/libgcc
+_startup_libs41=       gnu/lib/gcc41/csu gnu/lib/gcc41/libgcc
+_startup_libs=         lib/libc lib/libc_rtld
 
 _prebuild_libs=        lib/libarchive
 _prebuild_libs+=       lib/libutil
diff --git a/gnu/lib/csu/Makefile.csu b/gnu/lib/csu/Makefile.csu
new file mode 100644 (file)
index 0000000..61c33fc
--- /dev/null
@@ -0,0 +1,67 @@
+# $FreeBSD: src/gnu/lib/csu/Makefile,v 1.24 2004/09/10 06:48:04 ru Exp $
+# $DragonFly: src/gnu/lib/csu/Makefile.csu,v 1.1 2007/01/15 18:01:44 corecode Exp $
+
+.include "${CSUDIR}/Makefile.csu"
+
+SRCS+=         crtstuff.c
+HDRS+=         tm.h
+
+NOBJS=         crtbegin.o crtend.o
+SOBJS=         crtbeginS.o crtendS.o
+
+OBJS+=         ${NOBJS} ${SOBJS}
+INSTALLOBJS+=  ${NOBJS} ${SOBJS}
+
+OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
+
+CFLAGS+=       -finhibit-size-directive -fno-inline-functions \
+               -fno-exceptions -fno-zero-initialized-in-bss \
+               -fno-omit-frame-pointer -fno-unit-at-a-time
+CFLAGS+=       -I.
+CFLAGS+=       -DUSED_FOR_TARGET
+
+CRTS_CFLAGS=   -DCRTSTUFFS_O -DSHARED ${PICFLAG}
+MKDEP=         -DCRT_BEGIN
+
+BEGINSRC?=     crtstuff.c
+ENDSRC?=       crtstuff.c
+
+${NOBJS} ${SOBJS}: ${HDRS}
+
+crtbegin.o:    ${BEGINSRC}
+       ${CC} ${CFLAGS} -g0 -DCRT_BEGIN \
+               -c -o ${.TARGET} ${.ALLSRC:N*.h}
+
+crtbeginS.o:   ${BEGINSRC}
+       ${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
+               -c -o ${.TARGET} ${.ALLSRC:N*.h}
+
+crtend.o:      ${ENDSRC}
+       ${CC} ${CFLAGS} -g0 -DCRT_END \
+               -c -o ${.TARGET} ${.ALLSRC:N*.h}
+
+crtendS.o:     ${ENDSRC}
+       ${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
+               -c -o ${.TARGET} ${.ALLSRC:N*.h}
+
+CLEANFILES+=   tm.h options.h auto-host.h
+beforedepend: tm.h options.h auto-host.h
+tm.h: ${CCDIR}/cc_prep/Makefile
+       ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
+
+options.h:
+       touch ${.TARGET}
+
+auto-host.h:
+       echo '#include "dragonfly-native.h"' > ${.TARGET}
+
+all: ${INSTALLOBJS}
+
+realinstall:
+       ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+           ${INSTALLOBJS} ${DESTDIR}${TARGET_LIBDIR}
+
+clean:
+       rm -f ${CLEANFILES} ${OBJS} ${OBJS:S/$/.tmp/}
+
+.include <bsd.lib.mk>
diff --git a/gnu/lib/gcc34/csu/Makefile b/gnu/lib/gcc34/csu/Makefile
new file mode 100644 (file)
index 0000000..dd825d9
--- /dev/null
@@ -0,0 +1,9 @@
+# $DragonFly: src/gnu/lib/gcc34/csu/Makefile,v 1.1 2007/01/15 18:01:44 corecode Exp $
+
+GCCDIR=        ${.CURDIR}/../../../../contrib/gcc-3.4
+CCDIR= ${.CURDIR}/../../../usr.bin/cc34
+
+CSUDIR=        ${.CURDIR}/../../../../lib/csu/${MACHINE_ARCH}
+
+.include "../Makefile.inc"
+.include "../../csu/Makefile.csu"
diff --git a/gnu/lib/gcc41/csu/Makefile b/gnu/lib/gcc41/csu/Makefile
new file mode 100644 (file)
index 0000000..598d963
--- /dev/null
@@ -0,0 +1,9 @@
+# $DragonFly: src/gnu/lib/gcc41/csu/Makefile,v 1.1 2007/01/15 18:01:44 corecode Exp $
+
+GCCDIR=        ${.CURDIR}/../../../../contrib/gcc-4.1
+CCDIR= ${.CURDIR}/../../../usr.bin/cc41
+
+CSUDIR=        ${.CURDIR}/../../../../lib/csu/${MACHINE_ARCH}
+
+.include "../Makefile.inc"
+.include "../../csu/Makefile.csu"
index 16dcfdf..02fde8b 100644 (file)
@@ -1,4 +1,4 @@
-/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.11 2006/07/27 00:29:57 corecode Exp $ */
+/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.12 2007/01/15 18:01:44 corecode Exp $ */
 
 /* Base configuration file for all DragonFly targets.
    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -164,7 +164,7 @@ is built with the --enable-threads configure-time option.}          \
 #define        DFBSD_DYNAMIC_LINKER            "/usr/libexec/ld-elf.so.2"
 #define        STANDARD_STARTFILE_PREFIX_1     PREFIX2"/lib/gcc34/"
 #define        STANDARD_EXEC_PREFIX            PREFIX2"/libexec/gcc34/"
-#define        STANDARD_STARTFILE_PREFIX       PREFIX2"/lib/"
+#define        STANDARD_STARTFILE_PREFIX       PREFIX2"/lib/gcc34/"
 #define TOOLDIR_BASE_PREFIX            PREFIX2"/libexec/gcc34"
 #define STANDARD_BINDIR_PREFIX         PREFIX2"/libexec/gcc34"
 #define STANDARD_LIBEXEC_PREFIX                PREFIX2"/libexec/gcc34"
index bccc18a..9a2590b 100644 (file)
@@ -1,4 +1,4 @@
-/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h,v 1.2 2006/10/04 13:18:57 corecode Exp $ */
+/* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h,v 1.3 2007/01/15 18:01:44 corecode Exp $ */
 
 /* Base configuration file for all DragonFly targets.
    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -172,7 +172,7 @@ is built with the --enable-threads configure-time option.}          \
 #define        STANDARD_EXEC_PREFIX            PREFIX2"/libexec/gcc41/"
 #endif
 #ifndef STANDARD_STARTFILE_PREFIX
-#define        STANDARD_STARTFILE_PREFIX       PREFIX2"/lib/"
+#define        STANDARD_STARTFILE_PREFIX       PREFIX2"/lib/gcc41/"
 #endif
 #ifndef TOOLDIR_BASE_PREFIX
 #define TOOLDIR_BASE_PREFIX            PREFIX2"/libexec/gcc41"
index 73c2f7f..78fb308 100644 (file)
@@ -1,6 +1,6 @@
 #      @(#)Makefile    8.1 (Berkeley) 6/4/93
 # $FreeBSD: src/lib/Makefile,v 1.107.2.16 2002/10/10 19:24:35 kbyanc Exp $
-# $DragonFly: src/lib/Makefile,v 1.27 2006/09/20 21:48:39 victor Exp $
+# $DragonFly: src/lib/Makefile,v 1.28 2007/01/15 18:01:44 corecode Exp $
 
 # To satisfy shared library or ELF linkage when only the libraries being
 # built are visible:
@@ -19,7 +19,7 @@
 #
 # Otherwise, the SUBDIR list should be in alphabetical order.
 
-SUBDIR=        ${_csu} csu/common libarchive libcom_err libcrypt libm libmd \
+SUBDIR=        libarchive libcom_err libcrypt libm libmd \
        libncurses libradius libskey libtacplus libutil libsbuf \
        libalias libatm ${_libbind} ${_libbind9} libbz2 libc ${_libc_r} \
        libcalendar libcam libcompat libdevstat libdisk libedit libfetch \
@@ -33,8 +33,6 @@ SUBDIR=       ${_csu} csu/common libarchive libcom_err libcrypt libm libmd \
 SUBDIR+= compat/${MACHINE_ARCH}
 .endif
 
-_csu=csu/${MACHINE_ARCH}
-
 .if !defined(NO_LIBC_R)
 _libc_r=       libc_r
 .endif
diff --git a/lib/csu/README b/lib/csu/README
new file mode 100644 (file)
index 0000000..a20dad6
--- /dev/null
@@ -0,0 +1,12 @@
+$DragonFly: src/lib/csu/README,v 1.1 2007/01/15 18:01:44 corecode Exp $
+
+How does CSU work in DragonFly?
+===============================
+
+Every GCC carries its own CSU sources which need to be used.  However, we
+also provide a part of the startup files.  Unfortunately, GCC does not
+support a search path for startup dirs, so we have to put all of them into
+the GCC specific library dir, namely /usr/lib/$GCCVER.
+
+This is realized by providing Makefile glue to gnu/lib/gcc*/csu, which
+includes lib/csu/${MACHINE_ARCH}/Makefile.csu.
diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile
deleted file mode 100644 (file)
index 1ae2b34..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD: src/lib/csu/amd64/Makefile,v 1.18 2003/06/30 12:53:39 ru Exp $
-# $DragonFly: src/lib/csu/amd64/Attic/Makefile,v 1.1 2004/02/02 05:43:13 dillon Exp $
-
-.PATH: ${.CURDIR}/../common
-
-SRCS=          crt1.c crti.S crtn.S
-OBJS=          ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+=         gcrt1.o
-CFLAGS+=       -I${.CURDIR}/../common \
-               -I${.CURDIR}/../../libc/include
-
-all: ${OBJS}
-
-CLEANFILES=    ${OBJS}
-
-gcrt1.o: crt1.c
-       ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
-
-realinstall:
-       ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-           ${OBJS} ${DESTDIR}${LIBDIR}
-
-.include <bsd.lib.mk>
diff --git a/lib/csu/amd64/Makefile.csu b/lib/csu/amd64/Makefile.csu
new file mode 100644 (file)
index 0000000..289f0fb
--- /dev/null
@@ -0,0 +1,16 @@
+# $FreeBSD: src/lib/csu/amd64/Makefile,v 1.18 2003/06/30 12:53:39 ru Exp $
+# $DragonFly: src/lib/csu/amd64/Makefile.csu,v 1.1 2007/01/15 18:01:44 corecode Exp $
+
+CSUDIR?=       ${.CURDIR}
+
+SRCS+=         crt1.c crti.S crtn.S
+OBJS+=         gcrt1.o
+INSTALLOBJS+=  crt1.o crti.o crtn.o gcrt1.o
+
+CFLAGS+=       -I${CSUDIR}/../common \
+               -I${CSUDIR}/../../libc/include
+
+.PATH:         ${CSUDIR} ${CSUDIR}/../common
+
+gcrt1.o: crt1.c
+       ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
diff --git a/lib/csu/amd64/Makefile.inc b/lib/csu/amd64/Makefile.inc
deleted file mode 100644 (file)
index 77a3c61..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# $DragonFly: src/lib/csu/amd64/Attic/Makefile.inc,v 1.2 2005/10/01 12:40:33 corecode Exp $
-
-CFLAGS+=       -D__EH_FRAME_CONST=const
-ELFSIZE=       64
diff --git a/lib/csu/common/Makefile b/lib/csu/common/Makefile
deleted file mode 100644 (file)
index 0b10d6a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# $DragonFly: src/lib/csu/common/Attic/Makefile,v 1.2 2005/10/19 16:54:25 joerg Exp $
-
-.if exists(${.CURDIR}/../${MACHINE_ARCH}/Makefile.inc)
-.include "${.CURDIR}/../${MACHINE_ARCH}/Makefile.inc"
-.endif
-
-.if !defined(ELFSIZE)
-ELFSIZE=       32
-.endif
-
-CFLAGS+=       -DPIC -DDYNAMIC -DELFSIZE=${ELFSIZE}
-CFLAGS+=       -I${.CURDIR}
-CFLAGS+=       -DDWARF2_EH
-CFLAGS+=       -DJCR
-CFLAGS+=       -DDSO_HANDLE
-CFLAGS+=       -fPIC
-
-# crtbrand.c is included by the architecture specific crt1.c
-SRCS+=         crtbegin.c crtend.c
-SRCS+=         crtbeginS.c crtendS.c
-OBJS=          ${SRCS:R:S/$/.o/g}
-
-CLEANFILES+=   ${OBJS}
-
-all: ${OBJS}
-
-crtbegin.o: crtbegin.c
-crtbeginS.o: crtbeginS.c
-crtend.o: crtend.c
-crtendS.o: crtendS.c
-
-realinstall:
-       ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-           ${OBJS} ${DESTDIR}${LIBDIR}
-
-.include <bsd.lib.mk>
diff --git a/lib/csu/common/crtbegin.c b/lib/csu/common/crtbegin.c
deleted file mode 100644 (file)
index 99b4b28..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*     $NetBSD: crtbegin.c,v 1.23 2003/12/02 03:01:19 lukem Exp $      */
-/* $DragonFly: src/lib/csu/common/Attic/crtbegin.c,v 1.3 2004/06/14 18:56:12 joerg Exp $ */
-
-/*-
- * Copyright (c) 1998, 2001, 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Paul Kranenburg, Ross Harvey, and Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Run-time module which handles constructors and destructors,
- * and NetBSD identification.
- *
- * The linker constructs the following arrays of pointers to global
- * constructors and destructors. The first element contains the
- * number of pointers in each or -1 to indicate that the run-time
- * code should figure out how many there are.  The tables are also
- * null-terminated.
- */
-
-#include <sys/param.h>         /* sysident.h requires `NetBSD' constant */
-#include <sys/exec.h>
-#include <sys/elf_common.h>
-#include <stdlib.h>
-
-#if __GNUC_PREREQ__(3, 0)
-#define        USED_NOINLINE __attribute__((__used__,__noinline__))
-#else
-#define        USED_NOINLINE __attribute__((__unused__))
-#endif
-
-#ifdef DWARF2_EH
-#include "dwarf2_eh.h"
-#endif
-#include "dot_init.h"
-
-static void (*__CTOR_LIST__[1])(void)
-    __attribute__((section(".ctors"))) = { (void *)-1 };       /* XXX */
-static void (*__DTOR_LIST__[1])(void)
-    __attribute__((section(".dtors"))) = { (void *)-1 };       /* XXX */
-
-#ifdef DWARF2_EH
-static __EH_FRAME_CONST char __EH_FRAME_BEGIN__[]
-    __attribute__((section(".eh_frame"), aligned(4))) = { };
-#endif
-
-#if defined(JCR) && defined(__GNUC__)
-extern void _Jv_RegisterClasses(void *) __attribute__((weak));
-
-static void *__JCR_LIST__[]
-    __attribute__((section(".jcr"))) = { };
-#endif
-
-#if defined(DSO_HANDLE) && defined(__GNUC__)
-/*
- * The __dso_handle variable is used to hang C++ local destructors off
- * of.  In the main program (i.e. using crtbegin.o), the value is 0.
- * In shared objects (i.e. using crtbeginS.o), the value must be unique.
- * The symbol is hidden, but the dynamic linker will still relocate it.
- */
-#ifdef SHARED
-void   *__dso_handle = &__dso_handle;
-#else
-void   *__dso_handle = NULL;
-#endif
-__asm(".hidden __dso_handle");
-
-#ifdef SHARED
-extern void __cxa_finalize(void *) __attribute__((weak));
-#endif
-#endif
-
-#ifndef MD_CALL_STATIC_FUNCTION
-#if defined(__GNUC__)
-#define        MD_CALL_STATIC_FUNCTION(section, func)                          \
-static void __attribute__((__unused__))                                        \
-__call_##func(void)                                                    \
-{                                                                      \
-       __asm __volatile (".section " #section);                        \
-       func();                                                         \
-       __asm __volatile (".previous");                                 \
-}
-#else
-#error Need MD_CALL_STATIC_FUNCTION
-#endif
-#endif /* ! MD_CALL_STATIC_FUNCTION */
-
-static void
-__ctors(void)
-{
-       unsigned long i = (unsigned long) __CTOR_LIST__[0];
-       void (**p)(void);
-
-       if (i == (unsigned long) -1)  {
-               for (i = 1; __CTOR_LIST__[i] != NULL; i++)
-                       ;
-               i--;
-       }
-       p = __CTOR_LIST__ + i;
-       while (i--)
-               (**p--)();
-}
-
-static void
-__dtors(void)
-{
-       void (**p)(void) = __DTOR_LIST__ + 1;
-
-       while (*p)
-               (**p++)();
-}
-
-static void USED_NOINLINE
-__do_global_ctors_aux(void)
-{
-       static int initialized;
-#ifdef DWARF2_EH
-#if defined(__GNUC__)
-       static struct dwarf2_eh_object object;
-#endif /* __GNUC__ */
-#endif /* DWARF2_EH */
-
-       if (!initialized) {
-               initialized = 1;
-
-#ifdef DWARF2_EH
-#if defined(__GNUC__)
-               if (__register_frame_info != NULL)
-                       __register_frame_info(__EH_FRAME_BEGIN__, &object);
-#endif /* __GNUC__ */
-#endif /* DWARF2_EH */
-
-#if defined(JCR) && defined(__GNUC__)
-               if (__JCR_LIST__[0] != NULL && _Jv_RegisterClasses != NULL)
-                       _Jv_RegisterClasses(__JCR_LIST__);
-#endif /* JCR && __GNUC__ */
-
-               /*
-                * Call global constructors.
-                */
-               __ctors();
-       }
-}
-MD_CALL_STATIC_FUNCTION(.init, __do_global_ctors_aux)
-
-static void USED_NOINLINE
-__do_global_dtors_aux(void)
-{
-       static int finished;
-
-       if (finished)
-               return;
-
-#if defined(DSO_HANDLE) && defined(__GNUC__) && defined(SHARED)
-       /*
-        * Call local destructors.
-        */
-       if (__cxa_finalize != NULL)
-               __cxa_finalize(__dso_handle);
-#endif /* DSO_HANDLE && __GNUC__ && SHARED */
-
-       /*
-        * Call global destructors.
-        */
-       __dtors();
-
-#ifdef DWARF2_EH
-#if defined(__GNUC__)
-       if (__deregister_frame_info != NULL)
-               __deregister_frame_info(__EH_FRAME_BEGIN__);
-#endif /* __GNUC__ */
-#endif /* DWARF2_EH */
-
-       finished = 1;
-}
-MD_CALL_STATIC_FUNCTION(.fini, __do_global_dtors_aux)
diff --git a/lib/csu/common/crtbeginS.c b/lib/csu/common/crtbeginS.c
deleted file mode 100644 (file)
index e4f642b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $DragonFly: src/lib/csu/common/Attic/crtbeginS.c,v 1.1 2004/06/14 18:56:12 joerg Exp $ */
-
-#define        SHARED
-#include "crtbegin.c"
diff --git a/lib/csu/common/crtend.c b/lib/csu/common/crtend.c
deleted file mode 100644 (file)
index f882525..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*     $NetBSD: crtend.c,v 1.9 2001/12/30 23:45:01 thorpej Exp $       */
-/* $DragonFly: src/lib/csu/common/Attic/crtend.c,v 1.3 2004/06/14 18:56:12 joerg Exp $ */
-
-#include <sys/cdefs.h>
-#include "dot_init.h"
-
-static void (*__CTOR_LIST__[1]) __P((void))
-    __attribute__((__unused__))
-    __attribute__((section(".ctors"))) = { (void *)0 };                /* XXX */
-static void (*__DTOR_LIST__[1]) __P((void))
-    __attribute__((__unused__))
-    __attribute__((section(".dtors"))) = { (void *)0 };                /* XXX */
-
-#ifdef DWARF2_EH
-static unsigned int __FRAME_END__[]
-    __attribute__((__unused__))
-    __attribute__((section(".eh_frame"))) = { 0 };
-#endif
-
-#if defined(JCR) && defined(__GNUC__)
-static void *__JCR_END__[1]
-    __attribute__((__unused__, section(".jcr"))) = { (void *) 0 };
-#endif
diff --git a/lib/csu/common/crtendS.c b/lib/csu/common/crtendS.c
deleted file mode 100644 (file)
index d160764..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $DragonFly: src/lib/csu/common/Attic/crtendS.c,v 1.1 2004/06/14 18:56:12 joerg Exp $ */
-
-#define        SHARED
-#include "crtend.c"
diff --git a/lib/csu/i386/Makefile b/lib/csu/i386/Makefile
deleted file mode 100644 (file)
index b61397d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# $FreeBSD: src/lib/csu/i386-elf/Makefile,v 1.6.2.5 2002/11/23 17:44:29 ru Exp $
-# $DragonFly: src/lib/csu/i386/Attic/Makefile,v 1.3 2004/06/15 08:53:09 joerg Exp $
-#
-
-SRCS=          crt1.c crti.S crtn.S
-OBJS=          ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+=         gcrt1.o
-CFLAGS+=       -elf -Wall -fkeep-inline-functions \
-               -I${.CURDIR}/../common
-LDFLAGS+=      -elf
-
-.PATH:         ${.CURDIR}/../common
-
-all: ${OBJS}
-
-CLEANFILES=    ${OBJS}
-
-gcrt1.o:       crt1.c
-       ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
-
-realinstall:
-       ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-           ${OBJS} ${DESTDIR}${LIBDIR}
-
-.include <bsd.lib.mk>
diff --git a/lib/csu/i386/Makefile.csu b/lib/csu/i386/Makefile.csu
new file mode 100644 (file)
index 0000000..519b567
--- /dev/null
@@ -0,0 +1,17 @@
+# $FreeBSD: src/lib/csu/i386-elf/Makefile,v 1.6.2.5 2002/11/23 17:44:29 ru Exp $
+# $DragonFly: src/lib/csu/i386/Makefile.csu,v 1.1 2007/01/15 18:01:44 corecode Exp $
+
+CSUDIR?=       ${.CURDIR}
+
+SRCS+=         crt1.c crti.S crtn.S
+OBJS+=         gcrt1.o
+INSTALLOBJS+=  crt1.o crti.o crtn.o gcrt1.o
+
+CFLAGS+=       -elf -Wall -fkeep-inline-functions \
+               -I${CSUDIR}/../common
+LDFLAGS+=      -elf
+
+.PATH:         ${CSUDIR} ${CSUDIR}/../common
+
+gcrt1.o:       crt1.c
+       ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${CSUDIR}/crt1.c