According to Apple’s gcc 4.2.1 doc:
-arch arch
Compile for the specified target
architecture arch. The allowable
values are ‘i386’, ‘x86_64’, ‘ppc’ and
‘ppc64’. Multiple options work, and
direct the compiler to produce
“universal” binaries including object
code for each architecture specified
with -arch. This option only works if
assembler and libraries are available
for each architecture specified.
(APPLE ONLY)
So what’s the difference between these two calls:
gcc -arch i386 program.c
and
gcc -m32 program.c
Is it just that -arch is more powerful as it’s more flexible and can produce universal binaries when specifiying multiple archs?
I’m not sure but from reading the man page I get to similar conclusions as you do.
I guess the only real difference is that
-archcan be used to create universal binaries.As this works to create universal binaries
but you actually can’t be sure what the semantics of the following should be (they probably are even invalid syntax). Especially the third should be invalid as the man pages says to generate for for 32- or 64-bit environments.