diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-09-23 08:09:21 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-09-23 08:09:21 +0000 |
commit | fc9a8e8fa99cf0c3eb966ae93229a5d47e76f108 (patch) | |
tree | 4e2c952e0577c3556bdc5a61dc63a31aec1af4c3 /Makefile.cross | |
parent | f1b8f8141af617d4556a047743774317a54d6acc (diff) |
Detect word-size mismatches between host and target, which result in
the cross compiler generating bad code, and abort
ok deraadt@
Diffstat (limited to 'Makefile.cross')
-rw-r--r-- | Makefile.cross | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Makefile.cross b/Makefile.cross index f2dbed0fa96..f0ea1f9b94b 100644 --- a/Makefile.cross +++ b/Makefile.cross @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.cross,v 1.47 2011/09/18 09:02:18 kettenis Exp $ +# $OpenBSD: Makefile.cross,v 1.48 2011/09/23 08:09:20 guenther Exp $ cross-tools: cross-includes cross-binutils cross-gcc cross-lib cross-distrib: cross-tools cross-bin cross-share cross-sys cross-etc-root-var @@ -32,6 +32,21 @@ TARGET_ARCH= ${TARGET} .endif TARGET_CPU?= ${TARGET_ARCH} +# List of LP64 archs +# XXX move to bsd.*.mk? +LP64_ARCH = amd64 alpha hppa64 ia64 mips64 sparc64 vax64 + +TARGET_IS_LP64 = +MACHINE_IS_LP64 = +.for _ in ${LP64_ARCH} +. if !empty(TARGET_ARCH:M$_) + TARGET_IS_LP64 = yes +. endif +. if !empty(MACHINE_ARCH:M$_) + MACHINE_IS_LP64 = yes +. endif +.endfor + #CROSSCPPFLAGS?= -nostdinc -I${CROSSDIR}/usr/include #CROSSLDFLAGS?= -nostdlib -L${CROSSDIR}/usr/lib -static CROSSCFLAGS?= ${CROSSCPPFLAGS} -O2 ${PIPE} ${DEBUG} @@ -134,6 +149,10 @@ cross-env: BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${CROSSDIRS}: +.if ${TARGET_IS_LP64} != ${MACHINE_IS_LP64} + @echo "host and target have different size longs" + @echo "cross compiler generates bad code; aborting"; exit 1 +.endif @-mkdir -p ${CROSSDIR} @echo ${TARGET_ARCH} > ${CROSSDIR}/TARGET_ARCH @echo TARGET_ARCH is `cat ${CROSSDIR}/TARGET_ARCH` |