summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-11-22 19:18:50 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-11-22 19:18:50 +0000
commitf11b2023729bf4e59e9c1ddefc17af4529a40dbf (patch)
tree62a8f132b05392ae3f5cb7023df07d17f11f68b9 /gnu
parent4ad0ea8bb2ffdca446b54762a396a2112d66795d (diff)
Improved cross build support for gcc on OpenBSD. allows the cross built
compiler to have the same default options as native. The changes to cross build a native compiler is not quite complete. "Get this in" miod@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gcc/Makefile.bsd-wrapper17
-rw-r--r--gnu/usr.bin/gcc/gcc/Makefile.in3
-rw-r--r--gnu/usr.bin/gcc/gcc/config/openbsd.h16
-rw-r--r--gnu/usr.bin/gcc/gcc/toplev.c6
4 files changed, 35 insertions, 7 deletions
diff --git a/gnu/usr.bin/gcc/Makefile.bsd-wrapper b/gnu/usr.bin/gcc/Makefile.bsd-wrapper
index e8c9abea7e8..c7b16e5261c 100644
--- a/gnu/usr.bin/gcc/Makefile.bsd-wrapper
+++ b/gnu/usr.bin/gcc/Makefile.bsd-wrapper
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.54 2006/07/12 23:00:07 espie Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.55 2006/11/22 19:18:48 drahn Exp $
MAN= gcc.1 cpp.1 gcov.1 protoize.1
MLINKS+= protoize.1 unprotoize.1
@@ -51,13 +51,24 @@ GCCARCH= ${MACHINE_ARCH}-unknown-openbsd${OSREV}
GCCINC= /usr/lib/gcc-lib/${GCCARCH}/$V/include
# cross-compilation
-.if defined(TARGET_ARCH) && defined(CROSSDIR)
+.if defined(CROSS_HOST) && defined(TARGET_ARCH) && defined(CROSSDIR)
+CONFIGTARGET= --build=${CROSS_HOST}-unknown-openbsd${OSREV} \
+ --target=${TARGET_ARCH}-unknown-openbsd${OSREV}
+
+CONFIGPREFIX= ${CROSSDIR}/usr
+PATH= /bin:/usr/bin:/sbin:/usr/sbin:${CROSSDIR}/usr/bin
+GXX_INCDIR= ${CROSSDIR}/usr/include/g++
+GNUCFLAGS= ${CFLAGS} ${COPTS} -DOPENBSD_CROSS -I${LIBIBERTY_INCLUDES}
+HOSTCFLAGS= ${CFLAGS} ${COPTS} -DOPENBSD_CROSS -I${LIBIBERTY_INCLUDES}
+HOST_CC=cc
+MAKE_FLAGS+= CFLAGS_FOR_BUILD="${HOSTCFLAGS}" HOST_CC=cc
+.elif defined(TARGET_ARCH) && defined(CROSSDIR)
CONFIGTARGET= --target=${TARGET_ARCH}-unknown-openbsd${OSREV}
CONFIGPREFIX= ${CROSSDIR}/usr
MAKE_FLAGS+= GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include"
PATH= /bin:/usr/bin:/sbin:/usr/sbin:${CROSSDIR}/usr/bin
GXX_INCDIR= ${CROSSDIR}/usr/include/g++
-GNUCFLAGS= ${CFLAGS} ${COPTS} -I${LIBIBERTY_INCLUDES}
+GNUCFLAGS= ${CFLAGS} ${COPTS} -DOPENBSD_CROSS -I${LIBIBERTY_INCLUDES}
VAXHOST_CFLAGS= -DIN_GCC -DHAVE_CONFIG_H -O0
.else
CONFIGTARGET=
diff --git a/gnu/usr.bin/gcc/gcc/Makefile.in b/gnu/usr.bin/gcc/gcc/Makefile.in
index f5f126303eb..a356e5e9ccb 100644
--- a/gnu/usr.bin/gcc/gcc/Makefile.in
+++ b/gnu/usr.bin/gcc/gcc/Makefile.in
@@ -935,6 +935,9 @@ auto-host.h: cstamp-h ; @true
cstamp-h: config.in config.status
CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
+auto-build.h: config.in config.status
+ CONFIG_HEADERS=auto-build.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
+
# Really, really stupid make features, such as SUN's KEEP_STATE, may force
# a target to build even if it is up-to-date. So we must verify that
# config.status does not exist before failing.
diff --git a/gnu/usr.bin/gcc/gcc/config/openbsd.h b/gnu/usr.bin/gcc/gcc/config/openbsd.h
index 96f6ee1c8ef..f3ef4f92f5e 100644
--- a/gnu/usr.bin/gcc/gcc/config/openbsd.h
+++ b/gnu/usr.bin/gcc/gcc/config/openbsd.h
@@ -50,10 +50,23 @@ Boston, MA 02111-1307, USA. */
/* This configuration method, namely Makefile.bsd-wrapper and
OPENBSD_NATIVE is NOT recommended for building cross-compilers. */
-#ifdef OPENBSD_NATIVE
+/* OPENBSD_CROSS is only recommended for building cross-compilers which
+ target a OpenBSD system (kernel/userland) */
+
+#if defined(OPENBSD_NATIVE) || defined(OPENBSD_CROSS)
/* The compiler is configured with ONLY the gcc/g++ standard headers. */
#undef INCLUDE_DEFAULTS
+#ifdef CROSS_COMPILE
+#define INCLUDE_DEFAULTS \
+ { \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 },\
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \
+ { GPLUSPLUS_INCLUDE_DIR "/..", STANDARD_INCLUDE_COMPONENT, 0, 0 }, \
+ { 0, 0, 0, 0 } \
+ }
+#else
#define INCLUDE_DEFAULTS \
{ \
{ GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
@@ -62,6 +75,7 @@ Boston, MA 02111-1307, USA. */
{ STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 }, \
{ 0, 0, 0, 0 } \
}
+#endif
/* Under OpenBSD, the normal location of the various *crt*.o files is the
/usr/lib directory. */
diff --git a/gnu/usr.bin/gcc/gcc/toplev.c b/gnu/usr.bin/gcc/gcc/toplev.c
index 8105a718d9f..c9327da33bd 100644
--- a/gnu/usr.bin/gcc/gcc/toplev.c
+++ b/gnu/usr.bin/gcc/gcc/toplev.c
@@ -804,7 +804,7 @@ int flag_gnu_linker = 1;
#endif
/* Nonzero means put zero initialized data in the bss section. */
-#ifdef OPENBSD_NATIVE
+#if defined(OPENBSD_NATIVE) || defined(OPENBSD_CROSS)
int flag_zero_initialized_in_bss = 0;
#else
int flag_zero_initialized_in_bss = 1;
@@ -856,7 +856,7 @@ int flag_instrument_function_entry_exit = 0;
On SVR4 targets, it also controls whether or not to emit a
string identifying the compiler. */
-#ifdef OPENBSD_NATIVE
+#if defined(OPENBSD_NATIVE) || defined(OPENBSD_CROSS)
int flag_no_ident = 1;
#else
int flag_no_ident = 0;
@@ -4957,7 +4957,7 @@ parse_options_and_default_flags (argc, argv)
flag_schedule_insns_after_reload = 1;
#endif
flag_regmove = 1;
-#ifndef OPENBSD_NATIVE
+#if !defined(OPENBSD_NATIVE) && !defined(OPENBSD_CROSS)
flag_delete_null_pointer_checks = 1;
#endif
flag_reorder_blocks = 1;