public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Allow compiling i386 with an x86-64 compiler
@ 2004-11-24 16:22 H. Peter Anvin
  2004-11-29 18:50 ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: H. Peter Anvin @ 2004-11-24 16:22 UTC (permalink / raw)
  To: Linus Torvalds, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

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@zytor.com>

[-- Attachment #2: build_on_x86_64.diff --]
[-- Type: text/x-patch, Size: 602 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow compiling i386 with an x86-64 compiler
  2004-11-24 16:22 [PATCH] Allow compiling i386 with an x86-64 compiler H. Peter Anvin
@ 2004-11-29 18:50 ` Tom Rini
  2004-11-29 19:25   ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2004-11-29 18:50 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Linus Torvalds, linux-kernel

On Wed, Nov 24, 2004 at 08:22:05AM -0800, H. Peter Anvin wrote:

> 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.

Just so 'bi-arch' arches look the same, I'd like to suggest (and stolen
from ppc32) something like:
HAS_BIARCH      := $(call cc-option-yn, -m32)
ifeq ($(HAS_BIARCH),y)
CC := $(CC) -m32
endif

Up near the top...

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow compiling i386 with an x86-64 compiler
  2004-11-29 18:50 ` Tom Rini
@ 2004-11-29 19:25   ` H. Peter Anvin
  0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2004-11-29 19:25 UTC (permalink / raw)
  To: Tom Rini; +Cc: Linus Torvalds, linux-kernel

Tom Rini wrote:
> On Wed, Nov 24, 2004 at 08:22:05AM -0800, H. Peter Anvin wrote:
> 
> 
>>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.
> 
> 
> Just so 'bi-arch' arches look the same, I'd like to suggest (and stolen
> from ppc32) something like:
> HAS_BIARCH      := $(call cc-option-yn, -m32)
> ifeq ($(HAS_BIARCH),y)
> CC := $(CC) -m32
> endif
> 
> Up near the top...
> 

I'm not really happy with it, because it's misleading; it implies it 
tests for a working x86-64 devel environment, which it doesn't.  It's 
not a strong opinion, though.

	-hpa


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-29 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-24 16:22 [PATCH] Allow compiling i386 with an x86-64 compiler H. Peter Anvin
2004-11-29 18:50 ` Tom Rini
2004-11-29 19:25   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox