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: configure gcc to build 32-bit binaries on x86_64


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.


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