本文介绍了苹果的gcc,-arch i386和-m32有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据:

那么这两个调用有什么区别:

 gcc -arch i386 program.c 

 gcc -m32 program.c 

只是 -arch 更强大,因为它更灵活,可以产生通用二进制文件,当指定多个arch?

解决方案

我不确定,但从阅读手册页我得到类似的结论, 。

我想唯一真正的区别是可以使用 -arch 创建通用二进制文件。



因为这可以创建通用二进制文件

  gcc -arch i386 -arch x86_64 foo.c 

但是您实际上无法确定以下的语义应该是什么(他们可能甚至是无效的语法)。特别是第三个应该是无效的,因为手册页说为32或64位环境生成。

  gcc -m32 -arch i386 -arch x86_64 foo.c 
gcc -m64 -arch i386 -arch x86_64 foo.c
gcc -m32 -m64 -arch i386 -arch x86_64 foo.c




According to Apple's gcc 4.2.1 doc:

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 -arch can be used to create universal binaries.

As this works to create universal binaries

gcc -arch i386 -arch x86_64 foo.c

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.

gcc -m32 -arch i386 -arch x86_64 foo.c
gcc -m64 -arch i386 -arch x86_64 foo.c
gcc -m32 -m64 -arch i386 -arch x86_64 foo.c

这篇关于苹果的gcc,-arch i386和-m32有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 12:03