Difference gcc options "-m32" and "-arch i386"

tom fogal tfogal@alumni.unh.edu
Fri Oct 23 02:55:00 GMT 2009


Ian Lance Taylor <iant@google.com> writes:
> 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
[snip]
>   -march=cpu-type
[snip]

I think the OP was asking about m?? and *arch* (arch != march). `arch'
is an apple-specific flag.

I'm not sure that -m?? can be used to produce so-called `universal' or
`fat' binaries, whereas it is completely valid (and somewhat common) to
specify:

  gcc -arch i386 -arch x86_64 test.c

to generate a binary which runs as x86_64 code on that architecture,
but still runs correctly on x86.

If you're always building for a single architecture anyway, I would bet
(but do not know) that it doesn't really matter which you use.

Cheers,

-tom



More information about the Gcc-help mailing list