public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Lee Revell <rlrevell@joe-job.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: i386 -> x86_64 cross compile failure (binutils bug?)
Date: 10 Dec 2005 01:56:56 -0700	[thread overview]
Message-ID: <p73oe3ppbxj.fsf@verdi.suse.de> (raw)
In-Reply-To: <1134179410.18432.66.camel@mindpipe>

Lee Revell <rlrevell@joe-job.com> writes:
> > 
> > Yes, some commands NEED the -m64 and and WILL NOT work with -m64.
> > 
> 
> Aha!  I disabled CONFIG_IA32_EMULATION and it works perfectly.
> 
> So all that's needed to build an x86_64 kernel with the i386 Ubuntu 5.10
> toolchain:
> 
>  - edit Makefile: add -m64 to CFLAGS and AFLAGS

I guess I can add that.

I'm surprised someone does such a weird setup. Only the very early
x86-64 distributions set up the gccs like this until it was noticed
that a gcc compiled for 64bit targets run noticeable slower on 32bit
and needs more memory. That's because it does everything with long
long internally then and gcc's code generation for long long is not
exactly great. So it's normally better to use a separate cross 
compiler for 64bit to keep the 32bit compilations running faster.

Ubuntu seems didn't pay attention to history and just repated that
mistake. In addition they don't seem to be very fond of contributing
changes back - normally one would expect the distribution maintainer
to submit a patch like this if they set up their gcc in non
traditional this way. 

But you're the first to bring this problem to my attention.

>  - disable CONFIG_IA32_EMULATION

I just tried it here. Adding -m64 to CFLAGS/AFLAGS on a native
64bit biarch toolchain and it compiled without problems. It ends
up with -m64 -m32 for the 32bit vsyscall files, but that seems
to DTRT at least in gcc 4.

I'm not sure what's going wrong. If you use a freshly unmodified tree
and apply the appended patch does it work for you?

-Andi

Pass -m64 by default

This might help on distributions that use a 32bit biarch compiler.

Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux/arch/x86_64/Makefile
===================================================================
--- linux.orig/arch/x86_64/Makefile
+++ linux/arch/x86_64/Makefile
@@ -31,6 +31,7 @@ cflags-$(CONFIG_MK8) += $(call cc-option
 cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
 CFLAGS += $(cflags-y)
 
+CFLAGS += -m64
 CFLAGS += -mno-red-zone
 CFLAGS += -mcmodel=kernel
 CFLAGS += -pipe
@@ -52,6 +53,8 @@ CFLAGS += $(call cc-option,-funit-at-a-t
 # prevent gcc from generating any FP code by mistake
 CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
 
+AFLAGS += -m64
+
 head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
 
 libs-y 					+= arch/x86_64/lib/

  reply	other threads:[~2005-12-10  4:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-09 18:50 i386 -> x86_64 cross compile failure (binutils bug?) Lee Revell
2005-12-09 19:50 ` Ken Moffat
2005-12-09 19:59   ` Lee Revell
2005-12-09 21:30     ` Ken Moffat
2005-12-09 21:40       ` Lee Revell
2005-12-09 22:19         ` Ken Moffat
2005-12-09 19:58 ` Kyle McMartin
2005-12-09 20:21   ` Lee Revell
2005-12-09 20:41     ` Kyle McMartin
2005-12-09 20:58       ` Lee Revell
2005-12-09 21:25         ` Steven Rostedt
2005-12-09 21:35           ` Lee Revell
2005-12-09 21:10       ` Lee Revell
2005-12-09 21:19         ` Kyle McMartin
2005-12-09 22:37 ` Jeffrey Hundstad
2005-12-10  0:05   ` Lee Revell
2005-12-10  0:23     ` Jeffrey Hundstad
2005-12-10  1:28       ` Lee Revell
2005-12-10  1:50       ` Lee Revell
2005-12-10  8:56         ` Andi Kleen [this message]
2005-12-10  5:12           ` Lee Revell
2005-12-10  7:19             ` Andi Kleen
2005-12-10  7:43               ` Lee Revell
2005-12-10 19:34               ` Lee Revell
2005-12-11  0:00                 ` Andi Kleen
2005-12-11  0:26                   ` Lee Revell
2005-12-16 23:40                   ` Lee Revell
2005-12-23  5:59                   ` Lee Revell
2006-01-11 16:48                   ` Lee Revell
2006-01-11 16:54                     ` Andi Kleen
2005-12-09 22:43 ` Xavier Bestel
2005-12-10  1:31   ` Lee Revell
2005-12-10 20:34     ` Xavier Bestel
2005-12-10 20:48       ` Lee Revell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=p73oe3ppbxj.fsf@verdi.suse.de \
    --to=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlrevell@joe-job.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox