[PATCH] Allow compiling i386 with an x86-64 compiler
From: H. Peter Anvin
Date: Wed Nov 24 2004 - 17:53:39 EST
This patch adds -m32 if gcc supports it, thus making it easier to
compile the i386 architecture with an x86-64 compiler.
Note that it adds the option to CC, since it also affects assembly code
and linking. The extra level of indirection is because $(call
cc-option) itself uses $(CC), so just doing CC += ... would cause $(CC)
to be recursively defined.
-hpa
Signed-Off-By: H. Peter Anvin <hpa@xxxxxxxxx>
Index: linux-2.5/arch/i386/Makefile
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/arch/i386/Makefile,v
retrieving revision 1.72
diff -u -r1.72 Makefile
--- linux-2.5/arch/i386/Makefile 27 Oct 2004 17:27:13 -0000 1.72
+++ linux-2.5/arch/i386/Makefile 23 Nov 2004 02:04:09 -0000
@@ -20,6 +20,10 @@
LDFLAGS_vmlinux :=
CHECKFLAGS += -D__i386__
+# This allows compilation with an x86-64 compiler
+CC_M32 := $(call cc-option,-m32)
+CC += $(CC_M32)
+
CFLAGS += -pipe -msoft-float
# prevent gcc from keeping the stack 16 byte aligned