gcc - gcc/clang 编译器选项中的 -f 和 -m 代表什么

标签 gcc

总结 : -f 做什么和 -mgccclang编译器选项代表什么?

详情 :

使用 clang 时我注意到许多编译器选项以 -f 开头和其他以 -m 开头.我认为这有一些历史原因,我很好奇,所以我查看了 gcc帮助并看到以下内容:

Options starting with -g, -f, -m, -O, -W, or --param are automatically passed on to the various sub-processes invoked by gcc. In order to pass other options on to these processes the -W options must be used.



如果我不得不猜测,我认为 -f可能代表前端和 -m为机器。但我很想听听更全面的答案,可能包括 gcc 调用的其他子流程。

最佳答案

我没有具体的资料来说明“f”和“m”的含义,但我们可以根据文档中的使用模式进行推断。
“f”代表“标志”。
如果通过 ' -fFLAG 指定,标志将打开' 并通过 ' -fno-FLAG 关闭'
前任:

  -fpic         # flag to set position independent code 
  -fno-builtin  # don't recognize build in functions ... 
技术定义是“f”定义“控制代码生成中使用的接口(interface)约定”。
源:
https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html
(例如 -fpci,设置此标志时)

'm' 代表模式。一个普遍的特征是它有时具有参数。例如
 -mabi=name   #abi mode = name
 -mcpu=cpu
源:
https://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html (例如......当这种模式......)

关于gcc - gcc/clang 编译器选项中的 -f 和 -m 代表什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16227501/

相关文章:

ubuntu - 我们可以将 WSL 升级到最新的 Ubuntu 内核版本和 GCC、CLang 编译器版本吗?

python - 安装 pymix 时出现错误 : command 'gcc' failed with exit status 1,

c++ - 如何确定可以传递给编译器选项的最小值和最大值?

gcc - 为什么 GCC 4.3 出现 "Redefinition of typedef"错误而不是 GCC 4.6?

c++ - 在 Eclipse IDE 中设置 gcc ( gcc-arm-embedded ) for C/C++ Developers Mars in OS X

c++ - 为什么 64 位 ubuntu 中的 gcc 没有检测到以下数组溢出?

gcc - 加速GNU make构建过程-并行性?

c - GCC 编译错误 : "error: expected specifier-qualifier-list before..." from variadic macro

c - GCC 和 Borland Turbo C 中 printf() 语句的不同输出

c++ - O2 和 O3 优化的 FP 代码之间的行为截然不同