Is it possible to expand GCC/Clang compile and link options that start with "-f"?
I write C/C++ with GCC/Clang, but know little about compiler options that starts with "-f".
For example, to turn on Address Sanitizer, I pass "-fno-omit-frame-pointer -fsanitize=address" to the compiler. This should both affect compile and link stages.
Another example, to turn on OpenMP, I pass "-fopenmp" to the compiler, which gives support of compile and link to shared openmp library.
If I use static openmp library, I should pass "-fopenmp" to the compiler, and pass "-fopenmp -static" to the linker. And this StackOverFlow answer says it means "-lgomp -lrt".
My question: is there any method to expand the "-f" started compile/options, thus I can know what exactly libraries this "-f" flag links to?
Let's check the docs of clang at https://clang.llvm.org/docs/ClangCommandLineReference.html --verbose
or -v
looks very promising.
A quick check at compiler-explorer.com gives promising results.
GCC has a similar page with all options: https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
Here we have -v
as well, though as it prints stuff to stderr, I can't verify the output at compiler-explorer.