问题描述
我正在寻找编译期间使用的默认编译器标志.因此,我使用了命令gcc -Q -v <example.c>
感兴趣的输出看起来像这样:
I am looking for the default compiler flags used during compilation. Therefore I used the command gcc -Q -v <example.c>
the output of interest looks like this:
GGC启发式:--param ggc-min-expand = 100 --param ggc-min-heapsize = 131072
GGC heuristics: --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
options passed: -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-inline-消除未使用的调试类型-ffunction-cse -fgcse-lm -fgnu运行时-fgnu-唯一-fident -finline-atomics -fira-hoist-pressure -fira-share-save-slots -fira-share-spill-slots -fivopts -fkeep-static-consts -flead -下划线-fmath-errno -fmerge-调试字符串-fmove-loop-不变式-fpeephole -fprefetch-loop-arrays -freg-struct-return -fsched-critical-path-heuristic -fsched-dep-count-heuristic -fsched -组启发式-fsched-interblock -fsched-last-insn-启发式-fsched-rank-启发式-fsched-spec -fsched-spec-insn-启发式-fsched-stalled-insns-dep -fshow-column -fsigned-zeros -fsplit-ivs-in-roller -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-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
options enabled: -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-underscore -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= -ftree-phiprop -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-slp-vectorize -ftree-vect-loop-version -funit-at-a-time -funwind-tables -fvar-tracking -fvar-tracking-assignments -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
我现在想知道:启用的选项和通过的选项之间有什么区别?
I am now wondering: what is the difference between options enabled and options passed?
推荐答案
传递的选项是添加到命令行的选项,是通过配置(例如-march=x86-64 -fstack-protector
)或通过命令调用(例如-v
.这意味着这些选项默认情况下未启用,必须由gcc命令指定.
Options passed are options added to the command line, added by configuration, like -march=x86-64 -fstack-protector
, or by command invocation, like -v
. That means those options are not enabled by default and must be specified by gcc command.
启用的选项是已启用的选项,它们始终用于与特定系统上的特定gcc
进行编译,直到传递给 option 为止.禁用其中一些.
Options enebled are options that are enabled and are always used to compile with that specific gcc
on the specific system, as far as into option passed you are not disabling some of them.
例如在晴朗的环境中,调用gcc example.c
将为您提供example.c
作为唯一通过的选项,但启用的所有选项仍然相同.
E.g. On a clear environment calling gcc example.c
will give you example.c
as only passed option, but all options enabled still the same.
这篇关于“启用选项"与“启用选项"之间有什么区别?和“通过的选项"使用gcc -Q -v的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!