This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Difference gcc options "-m32" and "-arch i386"
- From: Ian Lance Taylor <iant at google dot com>
- To: info4jpk <info4jpk at googlemail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 22 Oct 2009 14:35:38 -0700
- Subject: Re: Difference gcc options "-m32" and "-arch i386"
- References: <26017391.post@talk.nabble.com>
info4jpk <info4jpk@googlemail.com> writes:
> Could someone please explain me the difference between the two gcc/g++
> options "-m32" and "-arch i386"? Is there any difference when used as a
> compiler or linker flag?
I quote the friendly manual:
-m32
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit
environment sets int, long and pointer to 32 bits and generates
code that runs on any i386 system. The 64-bit environment sets
int to 32 bits and long and pointer to 64 bits and generates code
for AMD's x86-64 architecture. For darwin only the -m64 option
turns off the -fno-pic and -mdynamic-no-pic options.
-march=cpu-type
Generate instructions for the machine type cpu-type. The choices
for cpu-type are the same as for -mtune. Moreover, specifying
-march=cpu-type implies -mtune=cpu-type.
In other words, selecting -m32 does not necessarily restrict the
compiler to using only instructions which are available on the i386.
Selecting -march=i386 does restrict the compiler. The default -march
option is determined by how the compiler was configured when it was
built.
Ian