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