gcc 11: "options enabled" 消失了

gcc 11: "options enabled" disappeared

gcc (x86-64) 至版本 10.x 生成了一个“启用选项”列表 -v 或作为 .s 汇编文件中的注释 -fverbose-asm,例如 。对于 gcc 版本 11.x,此列表已消失。

为什么?有没有办法用一些编译器标志恢复这个列表?

-Q--help= options之一一起使用:

optimizers

Display all of the optimization options supported by the compiler.

warnings

Display all of the options controlling warning messages produced by the compiler.

target

Display 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.

params

Display the values recognized by the --param option.

language

Display 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.

common

Display the options that are common to all languages.

例如,gcc -Q --help=optimizers 显示如下输出:

  ...
  -fauto-inc-dec                    [enabled]
  -fbit-tests                       [enabled]
  -fbranch-count-reg                [disabled]
  -fbranch-probabilities            [disabled]
  -fcaller-saves                    [disabled]
  -fcode-hoisting                   [disabled]
  -fcombine-stack-adjustments       [disabled]
  ...

如果您改为 运行 gcc -O2 -Q --help=optimizers,您会看到其中许多更改为 [enabled]

如果您的 GCC 10 版本默认发出编译器标志,我认为那一定是下游添加的。上游仅使用 gcc -g 执行此操作(这使得 -grecord-gcc-switches default observable) or -frecord-gcc-switches.

所以您看到的差异可能不是由于编译器版本,而是编译器的构建和打包者。