Help building a 32bit GCC that can generate 32/64bit (x86)
Ian Lance Taylor
iant@google.com
Wed Apr 27 16:26:00 GMT 2011
Paul Smith <paul@mad-scientist.net> writes:
> I'd like to create a 32bit version of GCC (+ binutils) that can compile
> for both 32bit and 64bit output.
Do you mean that you want a gcc which is itself a 32-bit binary? Or do
you mean that you want the default to be -m32?
I think the simplest way to do this would be to configure as usual on a
64-bit system, and build it using something like
make BOOT_CFLAGS="-m32 -g -O2"
> I am using --enable-targets=all to configure.
That only affects the binutils.
> Can I build a 32/64bit compiler on a 32bit version of Linux? Do I need
> to make a cross-compiler (set --build and --host)? Do I need to set
> --target? Or does the --enable-targets=all take care of this?
To build an x86_64 compiler on a 32-bit GNU/Linux system, you would need
to build a cross-compiler, since the default compiler output won't run
on the host system. So you would need to set --target.
Ian
More information about the Gcc-help
mailing list