Reputation: 10063
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.
Upvotes: 23
Views: 12026
Reputation: 1361
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 or https://home.cs.colorado.edu/~main/cs1300/doc/gnu/gcc_2.html#SEC43
https://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html#Submodel-Options or https://home.cs.colorado.edu/~main/cs1300/doc/gnu/gcc_2.html#SEC16
Upvotes: 10
Reputation: 6492
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...)
Upvotes: 24