summaryrefslogtreecommitdiff
path: root/gnu/lib
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2004-08-24 20:52:17 +0000
committerthorpej <thorpej@NetBSD.org>2004-08-24 20:52:17 +0000
commit1f4e63b33e13485aabfa9bbc80fdd9e82b431754 (patch)
tree199e7c38097aca1012444db9a51e5ff247c05abc /gnu/lib
parentc1c65fe4a12d6df5cea9cdbed732f2c431136b64 (diff)
Build infrastructure for GCC's "crtstuff".
Diffstat (limited to 'gnu/lib')
-rw-r--r--gnu/lib/crtstuff3/Makefile64
-rw-r--r--gnu/lib/crtstuff3/crtbegin.c9
-rw-r--r--gnu/lib/crtstuff3/crtbeginS.c10
-rw-r--r--gnu/lib/crtstuff3/crtbeginT.c10
-rw-r--r--gnu/lib/crtstuff3/crtend.c9
-rw-r--r--gnu/lib/crtstuff3/crtendS.c10
6 files changed, 112 insertions, 0 deletions
diff --git a/gnu/lib/crtstuff3/Makefile b/gnu/lib/crtstuff3/Makefile
new file mode 100644
index 00000000000..2c8680e1109
--- /dev/null
+++ b/gnu/lib/crtstuff3/Makefile
@@ -0,0 +1,64 @@
+# $NetBSD: Makefile,v 1.1 2004/08/24 20:52:17 thorpej Exp $
+
+REQUIRETOOLS= yes
+NOLINT= # defined
+
+.include <bsd.own.mk>
+
+# If using an external toolchain, we expect crtbegin/crtend to be
+# supplied by that toolchain's run-time support.
+.if !defined(EXTERNAL_TOOLCHAIN) && ${MKGCC} != "no"
+
+DIST= ${NETBSDSRCDIR}/gnu/dist/gcc
+GNUHOSTDIST= ${DIST}
+GCCARCH= ${NETBSDSRCDIR}/gnu/usr.bin/gcc3/arch/${MACHINE_ARCH}
+
+GALLCFLAGS= ${G_CRTSTUFF_CFLAGS} ${G_CRTSTUFF_T_CFLAGS}
+
+CPPFLAGS+= -I${GCCARCH} ${GALLCFLAGS:M-D*} ${GALLCFLAGS:M-I*:N-I.*}
+CPPFLAGS+= -I.
+
+GCFLAGS= ${GALLCFLAGS:N-D*:N-I*:N-i*:N./*}
+
+DPSRCS+= ${.CURDIR}/arch/${MACHINE_ARCH}.mk tconfig.h
+CLEANFILES+= cs-tconfig.h tconfig.h
+
+.if exists(${.CURDIR}/arch/${MACHINE_ARCH}.mk)
+.include "${.CURDIR}/arch/${MACHINE_ARCH}.mk"
+.endif
+
+SRCS+= crtbegin.c crtend.c
+OBJS+= crtbegin.o crtend.o
+.if ${MKPIC} != "no"
+SRCS+= crtbeginS.c crtendS.c
+OBJS+= crtbeginS.o crtendS.o # for shared libraries
+SRCS+= crtbeginT.c
+OBJS+= crtbeginT.o # for -static links
+.endif
+
+realall: ${OBJS}
+
+FILES=${OBJS}
+FILESDIR=${LIBDIR}
+
+.PATH: ${DIST}/gcc ${DIST}/gcc/config ${G_CONFIGDIR}
+
+tconfig.h:
+ ${_MKTARGET_CREATE}
+ TM_DEFINES="$(G_tm_defines)" \
+ HEADERS="$(G_xm_file)" XM_DEFINES="$(G_xm_defines)" \
+ TARGET_CPU_DEFAULT="" \
+ ${HOST_SH} $(GNUHOSTDIST)/gcc/mkconfig.sh tconfig.h
+
+.include <bsd.prog.mk>
+
+# Override the default .c -> .o rule.
+.c.o:
+ ${CC} ${CPPFLAGS} ${GCFLAGS} -c ${.IMPSRC} -o ${.TARGET}.o
+ mv ${.TARGET}.o ${.TARGET}
+
+.else
+
+.include <bsd.prog.mk> # do nothing
+
+.endif # ! EXTERNAL_TOOLCHAIN && MKGCC != no
diff --git a/gnu/lib/crtstuff3/crtbegin.c b/gnu/lib/crtstuff3/crtbegin.c
new file mode 100644
index 00000000000..184aa0c05c6
--- /dev/null
+++ b/gnu/lib/crtstuff3/crtbegin.c
@@ -0,0 +1,9 @@
+/* $NetBSD: crtbegin.c,v 1.1 2004/08/24 20:52:17 thorpej Exp $ */
+
+/*
+ * Written by Jason R. Thorpe, August 24, 2004.
+ * Public domain.
+ */
+
+#define CRT_BEGIN
+#include "crtstuff.c"
diff --git a/gnu/lib/crtstuff3/crtbeginS.c b/gnu/lib/crtstuff3/crtbeginS.c
new file mode 100644
index 00000000000..3165970e0c3
--- /dev/null
+++ b/gnu/lib/crtstuff3/crtbeginS.c
@@ -0,0 +1,10 @@
+/* $NetBSD: crtbeginS.c,v 1.1 2004/08/24 20:52:17 thorpej Exp $ */
+
+/*
+ * Written by Jason R. Thorpe, August 24, 2004.
+ * Public domain.
+ */
+
+#define CRT_BEGIN
+#define CRTSTUFFS_O
+#include "crtstuff.c"
diff --git a/gnu/lib/crtstuff3/crtbeginT.c b/gnu/lib/crtstuff3/crtbeginT.c
new file mode 100644
index 00000000000..727a829d4c3
--- /dev/null
+++ b/gnu/lib/crtstuff3/crtbeginT.c
@@ -0,0 +1,10 @@
+/* $NetBSD: crtbeginT.c,v 1.1 2004/08/24 20:52:17 thorpej Exp $ */
+
+/*
+ * Written by Jason R. Thorpe, August 24, 2004.
+ * Public domain.
+ */
+
+#define CRT_BEGIN
+#define CRTSTUFFT_O
+#include "crtstuff.c"
diff --git a/gnu/lib/crtstuff3/crtend.c b/gnu/lib/crtstuff3/crtend.c
new file mode 100644
index 00000000000..0301c62e5d7
--- /dev/null
+++ b/gnu/lib/crtstuff3/crtend.c
@@ -0,0 +1,9 @@
+/* $NetBSD: crtend.c,v 1.1 2004/08/24 20:52:17 thorpej Exp $ */
+
+/*
+ * Written by Jason R. Thorpe, August 24, 2004.
+ * Public domain.
+ */
+
+#define CRT_END
+#include "crtstuff.c"
diff --git a/gnu/lib/crtstuff3/crtendS.c b/gnu/lib/crtstuff3/crtendS.c
new file mode 100644
index 00000000000..c4b569cb643
--- /dev/null
+++ b/gnu/lib/crtstuff3/crtendS.c
@@ -0,0 +1,10 @@
+/* $NetBSD: crtendS.c,v 1.1 2004/08/24 20:52:17 thorpej Exp $ */
+
+/*
+ * Written by Jason R. Thorpe, August 24, 2004.
+ * Public domain.
+ */
+
+#define CRT_END
+#define CRTSTUFFS_O
+#include "crtstuff.c"