【问题标题】:What is the difference between "options enabled" and "options passed" using gcc -Q -v使用 gcc -Q -v “启用选项”和“通过选项”有什么区别
【发布时间】:2016-11-09 16:53:04
【问题描述】:

我正在寻找编译期间使用的默认编译器标志。因此我使用了命令gcc -Q -v <example.c> 感兴趣的输出如下所示:

GNU C (Ubuntu 4.8.4-2ubuntu1~14.04.3) 版本 4.8.4 (x86_64-linux-gnu) 由 GNU C 版本 4.8.4、GMP 版本 5.1.3、MPFR 版本 3.1.2-p3、MPC 版本 1.0.1 编译

GGC 启发式:--param ggc-min-expand=100 --param ggc-min-heapsize=131072

通过的选项:-v -imultiarch x86_64-linux-gnu example.c -mtune=generic -march=x86-64 -fstack-protector -Wformat -Wformat-security

启用选项:-faggressive-loop-optimizations -fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg -fcommon -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fgnu-runtime -fgnu-unique -fident -finline-atomics -fira-hoist-pressure -fira-share-save-slots -fira-share-spill-slots -fivopts -fkeep-static-consts -fleading -下划线 -fmath-errno -fmerge-debug-strings -fmove-loop-invariants -fpeephole -fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic -fsched-dep-count-heuristic -fsched -group-heuristic -fsched-interblock -fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fstack-protector -fstrict-volatile-bitfields -fsync-libcalls -ftrapping-math -ftree-coalesce-vars -ftree-cselim -ftree-forwprop -ftree-loop-if-convert -ftree -loop-im -ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops= -ft ree-phiprop -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version -funit-at-a-time -funwind-tables -fvar-tracking -fvar-跟踪分配-fzero-initialized-in-bss -m128bit-long-double -m64 -m80387 -maccumulate-outgoing-args -malign-stringops -mfancy-math-387 -mfp-ret-in-387 -mfxsr -mglibc - mieee-fp -mlong-double-80 -mmmx -mno-sse4 -mpush-args -mred-zone -msse -msse2 -mtls-direct-seg-refs

我现在想知道:启用的选项通过的选项有什么区别?

【问题讨论】:

    标签: c linux gcc options


    【解决方案1】:

    传递的选项是添加到命令行的选项,由配置添加,如-march=x86-64 -fstack-protector,或通过命令调用,如-v。这意味着这些选项默认不启用,必须由 gcc 命令指定。

    Options enebled 是启用的选项,并且始终用于在特定系统上使用特定的gcc 进行编译,就 optionspassed 你没有禁用其中一些。

    例如在一个清晰的环境中调用gcc example.c 会给你example.c 作为唯一通过的选项,但所有启用的选项仍然相同。

    【讨论】:

    • 因为默认情况下不启用传递的选项,必须传递给命令才能启用它们。
    • 是的,最后所有选项都被使用。但是在没有任何配置的清晰系统中,使用命令gcc example.c 将使用启用的选项,并且传递的唯一选项将是example.c。我没有任何官方参考。
    • 如果你想禁用 option enabled 选项也是一样:使用 passed option 你可以禁用它。
    • @amn 例如,使用 -v 选项可以看到 COLLECT_GCC_OPTIONS 是由 gcc 驱动程序本身创建的。查看the manual 了解其他环境变量。
    • @amn 它是由gcc 创建来完成这项工作的,并在进程结束时销毁。
    猜你喜欢
    • 2017-09-22
    • 1970-01-01
    • 2013-07-24
    • 1970-01-01
    • 1970-01-01
    • 2014-09-20
    • 2017-09-07
    • 2017-06-24
    • 2011-07-05
    相关资源
    最近更新 更多