Help building a 32bit GCC that can generate 32/64bit (x86)
Ian Lance Taylor
iant@google.com
Wed Apr 27 19:11:00 GMT 2011
Paul Smith <paul@mad-scientist.net> writes:
>> 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 tried to build on a 64bit system setting CC="gcc -m32" and CXX="g++
> -m32" when running configure. But this failed. I'll look up
> BOOT_CFLAGS and see what I can find out.
Setting CC and CXX won't help, because that won't affect the later
bootstrap stages. Setting BOOT_CFLAGS should affect the way the later
bootstrap stages are built, and should cause them to build 32-bit
binaries. I haven't actually tried it.
> One, build on a 32bit host and use --target=x86_64-pc-linux-gnu (or
> something) to get a 64bit cross compiler (I assume(?) the resulting
> compiler will also be able to build 32bit targets).
That should work.
> Two, build on a 64bit host and figure out a way to force the resulting
> compiler to be a 32bit application. Would the best way of doing that be
> using configure with CC="gcc -m32"? Or setting --host=i686-pc-linux-gnu
> (or similar)? Or...?
That should work, but use BOOT_CFLAGS as I suggested.
>> > I am using --enable-targets=all to configure.
>>
>> That only affects the binutils.
>
> It's listed in the GCC install.info file... is it relevant only for
> binutils?
I'm sorry, you're quite right. I did not know about that. You're
right, using --enable-targets=all when bootstrapping on a 32-bit ought
to give you a compiler which supports the -m64 option. What failed when
you tried that?
Ian
More information about the Gcc-help
mailing list