Summary: What do the -f
and -m
in gcc
and clang
compiler options stand for?
Details:
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:
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.
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.
GCC is a mature compiler with support for many languages. As can be seen from the name Clang supports mostly C, C++, and Objective-C. But the framework underlying Clang called LLVM is extensible enough to support newer languages like Julia and Swift.
GCC stands for “GNU Compiler Collection”. GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Fortran, Ada, D, and Go.
gcc and g++ are the traditional GNU compilers for C and C++ code. Recently, clang (and clang++) using LLVM has been gaining popularity as an alternative compiler.
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' stands for 'flag'.
Flags are on if specified via '-fFLAG
' and off via '-fno-FLAG
'
ex:
-fpic # flag to set position independent code
-fno-builtin # don't recognize build in functions ...
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 (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 (e.g ... when this mode...)
According to gcc onlinedocs, options of the form -ffoo
and -fno-foo
stand for machine independent code generation conventions.
Examples: fpic
, -fno-pic
-m
options stand for machine dependent options.
eg: -mcpu
, -march
, -matomic
https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
https://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html#Submodel-Options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With