'gcc 11: "options enabled" disappeared
gcc (x86-64) up to version 10.x produced a list of "options enabled" with -v or as comment in the .s assembly file with -fverbose-asm, see e.g What is the difference between "options enabled" and "options passed" using gcc -Q -v. With gcc version 11.x this list has disappeared.
Why? Is there a way to get this list back with some compiler flag?
Solution 1:[1]
Use -Q together with one of the --help= options:
optimizersDisplay all of the optimization options supported by the compiler.
warningsDisplay all of the options controlling warning messages produced by the compiler.
targetDisplay target-specific options. Unlike the --target-help option however, target-specific options of the linker and assembler are not displayed. This is because those tools do not currently support the extended --help= syntax.
paramsDisplay the values recognized by the --param option.
languageDisplay the options supported for language, where language is the name of one of the languages supported in this version of GCC. If an option is supported by all languages, one needs to select ‘common’ class.
commonDisplay the options that are common to all languages.
For instance, gcc -Q --help=optimizers shows output like:
...
-fauto-inc-dec [enabled]
-fbit-tests [enabled]
-fbranch-count-reg [disabled]
-fbranch-probabilities [disabled]
-fcaller-saves [disabled]
-fcode-hoisting [disabled]
-fcombine-stack-adjustments [disabled]
...
If you run gcc -O2 -Q --help=optimizers instead, you will see many of them change to [enabled].
Solution 2:[2]
If you have a GCC 10 version that emits the compiler flags by default, that must be a downstream addition, I think. Upstream only does this with gcc -g (which makes the -grecord-gcc-switches default observable) or -frecord-gcc-switches.
So the difference you see is likely not due to compiler versions, but who built and packaged the compiler.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nate Eldredge |
| Solution 2 | Florian Weimer |
