From fd8b66cd017f88e1baffc6426ca74ea7f57dbadd Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Mon, 15 Jan 2007 18:01:44 +0000 Subject: [PATCH] Create startup files from the GCC sources and drop our versions. 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. --- Makefile.inc1 | 13 +- gnu/lib/csu/Makefile.csu | 67 ++++++ gnu/lib/gcc34/csu/Makefile | 9 + gnu/lib/gcc41/csu/Makefile | 9 + .../cc34/cc_prep/config/dragonfly-spec.h | 4 +- .../cc41/cc_prep/config/dragonfly-spec.h | 4 +- lib/Makefile | 6 +- lib/csu/README | 12 + lib/csu/amd64/Makefile | 23 -- lib/csu/amd64/Makefile.csu | 16 ++ lib/csu/amd64/Makefile.inc | 4 - lib/csu/common/Makefile | 36 --- lib/csu/common/crtbegin.c | 206 ------------------ lib/csu/common/crtbeginS.c | 4 - lib/csu/common/crtend.c | 23 -- lib/csu/common/crtendS.c | 4 - lib/csu/i386/Makefile | 26 --- lib/csu/i386/Makefile.csu | 17 ++ 18 files changed, 142 insertions(+), 341 deletions(-) create mode 100644 gnu/lib/csu/Makefile.csu create mode 100644 gnu/lib/gcc34/csu/Makefile create mode 100644 gnu/lib/gcc41/csu/Makefile create mode 100644 lib/csu/README delete mode 100644 lib/csu/amd64/Makefile create mode 100644 lib/csu/amd64/Makefile.csu delete mode 100644 lib/csu/amd64/Makefile.inc delete mode 100644 lib/csu/common/Makefile delete mode 100644 lib/csu/common/crtbegin.c delete mode 100644 lib/csu/common/crtbeginS.c delete mode 100644 lib/csu/common/crtend.c delete mode 100644 lib/csu/common/crtendS.c delete mode 100644 lib/csu/i386/Makefile create mode 100644 lib/csu/i386/Makefile.csu diff --git a/Makefile.inc1 b/Makefile.inc1 index ef746aae88..2a15c546ac 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -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 index 0000000000..61c33fc8d2 --- /dev/null +++ b/gnu/lib/csu/Makefile.csu @@ -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 diff --git a/gnu/lib/gcc34/csu/Makefile b/gnu/lib/gcc34/csu/Makefile new file mode 100644 index 0000000000..dd825d9c92 --- /dev/null +++ b/gnu/lib/gcc34/csu/Makefile @@ -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 index 0000000000..598d9632fe --- /dev/null +++ b/gnu/lib/gcc41/csu/Makefile @@ -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" diff --git a/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h b/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h index 16dcfdf2fd..02fde8befe 100644 --- a/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h +++ b/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h @@ -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" diff --git a/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h b/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h index bccc18aa73..9a2590b32b 100644 --- a/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h +++ b/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h @@ -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" diff --git a/lib/Makefile b/lib/Makefile index 73c2f7f696..78fb30803e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 index 0000000000..a20dad63e2 --- /dev/null +++ b/lib/csu/README @@ -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 index 1ae2b34687..0000000000 --- a/lib/csu/amd64/Makefile +++ /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 diff --git a/lib/csu/amd64/Makefile.csu b/lib/csu/amd64/Makefile.csu new file mode 100644 index 0000000000..289f0fb98e --- /dev/null +++ b/lib/csu/amd64/Makefile.csu @@ -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 index 77a3c616b5..0000000000 --- a/lib/csu/amd64/Makefile.inc +++ /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 index 0b10d6ae73..0000000000 --- a/lib/csu/common/Makefile +++ /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 diff --git a/lib/csu/common/crtbegin.c b/lib/csu/common/crtbegin.c deleted file mode 100644 index 99b4b28ca5..0000000000 --- a/lib/csu/common/crtbegin.c +++ /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 /* sysident.h requires `NetBSD' constant */ -#include -#include -#include - -#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 index e4f642b4f7..0000000000 --- a/lib/csu/common/crtbeginS.c +++ /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 index f882525068..0000000000 --- a/lib/csu/common/crtend.c +++ /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 -#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 index d160764330..0000000000 --- a/lib/csu/common/crtendS.c +++ /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 index b61397d948..0000000000 --- a/lib/csu/i386/Makefile +++ /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 diff --git a/lib/csu/i386/Makefile.csu b/lib/csu/i386/Makefile.csu new file mode 100644 index 0000000000..519b567ad2 --- /dev/null +++ b/lib/csu/i386/Makefile.csu @@ -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 -- 2.41.0