Difference gcc options "-m32" and "-arch i386"
Ian Lance Taylor
iant@google.com
Fri Oct 23 00:54:00 GMT 2009
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
More information about the Gcc-help
mailing list