【编译工具】之gcc中-march与-arch的使用

gcc online doc :https://gcc.gnu.org/onlinedocs/gcc

1、-march

不同架构的平台对应的-march不同,具体参考:https://gcc.gnu.org/onlinedocs/gcc 中“3.18 Machine-Dependent Options“”小节。查看机器对应的-march的方法:

  gcc -c -Q -march=native --help=target 

or

  gcc -march=native -Q --help=target 

具体参考网址:
  https://stackoverflow.com/questions/5470257/how-to-see-which-flags-march-native-will-activate
  https://wiki.gentoo.org/wiki/GCC_optimization/zh-cn

2、-arch

-arch选项只在Darwin平台有效,,即mac电脑上有用。
  -arch is darwin-only option(来源:https://stackoverflow.com/questions/13944340/llvm-clang-cant-compile-for-a-supported-arch

附:-arch的其他介绍
-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) 具体参考网址:https://stackoverflow.com/questions/1754460/apples-gcc-whats-the-difference-between-arch-i386-and-m32

其他参考网址:
https://abseil.io/docs/cpp/platforms/macros
https://stackoverflow.com/questions/12224314/support-for-arch-arch-only-flags-in-different-macports-gcc-versions?rq=1

http://houh-1984.blog.163.com/blog/static/31127834201382694010808/
https://blog.csdn.net/longintchar/article/details/51204545

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值