This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: configure gcc to build 32-bit binaries on x86_64
- From: Andrew Haley <aph at redhat dot com>
- To: natasha at fnal dot gov
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 18 Jan 2007 11:56:48 +0000
- Subject: Re: configure gcc to build 32-bit binaries on x86_64
- References: <Pine.LNX.4.58.0701171633120.32458@cmstv.fnal.gov>
natasha@fnal.gov writes:
>
> We plan to use x86_64 linux machine to build binary code that can
> eventually run on i386 machine. I know it's possible with -m32.
>
> I wonder if there is an easy way to configure/build GCC so that it would
> produce 32-bit binaries by default?
>
> The reason I want this is because we build many products, and it may be
> more difficult to implant -m32 option in every build system.
You can do this by building a custom version of gcc, with special
option processing. Also, you can edit gcc's specs.
But I wouldn't do that: it's too much trouble to solve a trivial
problem. Instead I'd write a script, like this:
exec /path/to/gcc -m32 $*
You can override -m32 with -m64 if you need it.
Andrew.