This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Building a cross compiler for x86_64


I should have been more specific.  I'm migrating an existing 32-bit OS
kernel to be 64-bit, ia32e mode, i.e. x86_64.  I have my own libs but the
result is a kernel that is a standalone executable.

I probably want to build the binutils too, its not that much extra work and
I'll know for sure what I've got if I do that.

The development machine is an ia32 pc running fc8.  The target will be a
standalone kernel running in ia32e mode.  It sounds like x86_64-pc-linux
will probably work for me.

What I really want is for the resulting cross tools, gcc, gas, ld, etc. to
be 64-bit only.  Will that be the case with this build or will I still need
to use -m64 in my compile steps?

Thanks,
FM

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Brian Dessent
Sent: Thursday, February 14, 2008 6:32 PM
To: Frank W. Miller
Cc: gcc-help@gcc.gnu.org
Subject: Re: Building a cross compiler for x86_64

"Frank W. Miller" wrote:

> I've determined that my gcc build does not support the -w64 compile
> option.  (I'm running FC8 and its not compiled in by default apparently)

I'm assuming you mean -m64 here.

> So, I need to build a cross compiler.  I have binutils-2.18 and

Not necessarily.  The gcc i386 backend is bi-arch, meaning that it
targets both ia32 and x86_64 from a single backend.  So you can simply
build a 32 bit gcc that also supports 64 bit.  This would not
necessarily be a cross compiler, but you of course wouldn't be able to
run the resulting binary on the host.

To make this work, you first need to install a 64 bit libc however. 
This means headers, libs, crt*.o, etc.  You should be able to do this
through your distro.  Once you have that you can configure with
--enable-targets=all and you should get a 32 bit gcc with -m64.

You can still go the cross route but it's more work, you'd need to first
create a sysroot containing full 32 and 64 bit libc-devel's, then
configure with --target=x86_64-pc-linux --with-sysroot=whatever.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]