Building a cross compiler for x86_64
Brian Dessent
brian@dessent.net
Fri Feb 15 01:32:00 GMT 2008
"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
More information about the Gcc-help
mailing list