了解一些cc1参数

Dav*_*542 0 c assembly gcc

运行的$ gcc -v结果是第一个命令是一个cc1命令。首先,我在哪里可以找到所有参数的含义?我试着键入man cc1help cc1等,找不到任何东西。

在 linux 上,gcc -v file.c导致第一个命令是(稍微重新组织):

/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1 \
    file.c \
    -o ccN7P5D111.s
    -quiet \
    -v \
    -imultiarch x86_64-linux-gnu \
    -quiet \
    -dumpbase file.c \
    -mtune=generic \
    -march=x86-64 \
    -auxbase file \
    -version \
    -fstack-protector \
    -Wformat \
    -Wformat-security \
Run Code Online (Sandbox Code Playgroud)
  • file.c 是要编译的文件。
  • -o ccN7P5D111.s 是输出文件(几乎是随机的 tmpfile)

而其他人,嗯,不太确定。对它们的基本描述是什么?其中哪些很重要?

Pet*_*des 5

它不在 中$PATH,这就是为什么gcc -v通过完整路径运行它。它没有手册页,因为它不打算手动调用,只是通过gcc前端调用。

它们都不重要,如果您不是(试图成为)GCC 开发人员,请不要手动运行它。 如果是,请阅读源代码。

在我的系统上,/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/cc1 --help打印一堆帮助信息,就像大多数程序一样。

The following options are specific to just the language Ada:
  -fdump-scos                           [available in Ada]

The following options are specific to just the language AdaSCIL:
 None found.  Use --help=AdaSCIL to show *all* the options supported by the AdaSCIL front-end.

The following options are specific to just the language AdaWhy:
 None found.  Use --help=AdaWhy to show *all* the options supported by the AdaWhy front-end.

The following options are specific to just the language BRIG:
  -fassume-phsa                         [available in BRIG]

The following options are specific to just the language C:
  -fgimple                              [disabled]

The following options are specific to just the language C++:
  -Wplacement-new                       -Wplacement-new=1
  -Wplacement-new=<0,2>                 [available in C++]

The following options are specific to just the language D:
  -Hd <dir>                             
  -Hf <file>                            
  -Wcast-result                         [available in D]
  -Wspeculative                         [disabled]
  -X                                    [disabled]
  -Xf <file>                            
  -fall-instantiations                  [disabled]
  -fassert                              [available in D]
  -fbounds-check                        [available in D]
  -fbounds-check=[on|safeonly|off]      [available in D]
  -fdebug                               [disabled]
...

The following options control parameters:
  --param=align-loop-iterations=        4
  --param=align-threshold=<1,65536>             100
  --param=analyzer-bb-explosion-factor=         5
  --param=analyzer-max-enodes-per-program-point=        8
  --param=analyzer-max-recursion-depth=         2
  --param=analyzer-min-snodes-for-call-summary=         10
  --param=asan-globals=<0,1>            1
...

The following options control compiler warning messages:
  -W                                    -Wextra
  -Waggregate-return                    [disabled]
  -Waggressive-loop-optimizations       [enabled]
  -Wanalyzer-double-fclose              [enabled]
  -Wanalyzer-double-free                [enabled]
  -Wanalyzer-exposure-through-output-file       [enabled]
Run Code Online (Sandbox Code Playgroud)

GCC 确实有一个 gcc-internals 手册,其中包含collect2您在之前的问题中询问过的文档。

该gccint手册是不是只是如何使用的部分,虽然。它还记录了机器描述文件和类似告诉 GCC ISA 指令的内容。如果您想修改 GCC 自己的源代码的 C 代码,例如添加新的优化器通道,或了解 GIMPLE 和 RTL,您需要知道的东西。

我实际上并没有cc1在 gccint 手册中找到对选项的描述。在常规(针对最终用户)GCC 手册中,有一个Invoking GCC条目,但当然这是针对前端的,而不是针对cc1.

info本地页面中进行全文搜索没有找到相关文档,因此--help输出可能是您得到的最好的结果。