gcc/clang编译器选项中的-f和-m代表什么 [英] What do the -f and -m in gcc/clang compiler options stand for
问题描述
摘要:gcc
和clang
编译器选项中的-f
和-m
代表什么?
Summary: What do the -f
and -m
in gcc
and clang
compiler options stand for?
详细信息:
使用clang
时,我注意到许多编译器选项均以-f
开头,而另一些则以-m
开头.我认为这是有历史原因的,我很好奇,因此我查看了gcc
帮助并看到了以下内容:
When using clang
I've noticed that many compiler options start with -f
and others start with -m
. I assume that there is some historical reason for this and I was curious so I looked at the gcc
help and saw the following:
以-g,-f,-m,-O,-W或--param开头的选项是自动的 传递给gcc调用的各个子流程.为了 将其他选项传递给这些进程-W选项必须 被使用.
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调用的其他子流程.
If I had to guess I think that -f
might stand for frontend and -m
for machine. But I'd be interested to hear a more comprehensive answer, possibly including the other sub-processes that gcc invokes.
推荐答案
我没有具体的资料说明'f'和'm'的含义,但是我们可以根据文档中的使用模式进行推断.
I don't have specific sources that state what 'f' and 'm' mean, but we can infer based on usage patterns found in documentation.
'f'代表标志".
如果通过'-fFLAG
'指定,则打开标记,而通过'-fno-FLAG
'
Flags are on if specified via '-fFLAG
' and off via '-fno-FLAG
'
例如:
-fpic # flag to set position independent code
-fno-builtin # don't recognize build in functions ...
技术定义是"f"定义控制代码生成中使用的接口约定".
The technical definition is that 'f' defines "Control the interface conventions used in code generation".
Src: https://gcc.gnu.org/onlinedocs/gcc/Code- Gen-Options.html (例如-fpci,当设置了 flag 时)
Src: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html (e.g -fpci, when this flag is set)
-mabi=name #abi mode = name
-mcpu=cpu
Src: https://gcc.gnu.org/onlinedocs/gccint/Standard-Names. html (例如...当此模式 ...时)
Src: https://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html (e.g ... when this mode...)
这篇关于gcc/clang编译器选项中的-f和-m代表什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!