gcc编译部分编译选项
我只寫出一些我沒有在文檔中查到的,網(wǎng)上也搜索不出來什么明確的資料。正確性實在不敢保證。
https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/Option-Summary.html#Option-Summary 這是文檔。
使用gcc命令顯示的幫助信息
用法:gcc [選項] 文件... 選項: -pass-exit-codes 在某一階段退出時返回最高的錯誤碼 --help 顯示此幫助說明 --target-help 顯示目標機器特定的命令行選項 --help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...] 顯示特定類型的命令行選項 --version 顯示編譯器版本信息 -dumpspecs 顯示所有內(nèi)建 spec 字符串 -dumpversion 顯示編譯器的版本號 -dumpmachine 顯示編譯器的目標處理器 -print-search-dirs 顯示編譯器的搜索路徑 -print-libgcc-file-name 顯示編譯器伴隨庫的名稱 -print-file-name=<庫> 顯示 <庫> 的完整路徑 -print-prog-name=<程序> 顯示編譯器組件 <程序> 的完整路徑 -print-multiarch Display the target's normalized GNU triplet, used as a component in the library path -print-multi-directory 顯示不同版本 libgcc 的根目錄 -print-multi-lib 顯示命令行選項和多個版本庫搜索路徑間的映射 -print-multi-os-directory 顯示操作系統(tǒng)庫的相對路徑 -print-sysroot 顯示目標庫目錄 -print-sysroot-headers-suffix 顯示用于尋找頭文件的 sysroot 后綴 -Wa,<選項> 將逗號分隔的 <選項> 傳遞給匯編器 -Wp,<選項> 將逗號分隔的 <選項> 傳遞給預處理器 -Wl,<選項> 將逗號分隔的 <選項> 傳遞給鏈接器 -Xassembler <參數(shù)> 將 <參數(shù)> 傳遞給匯編器 -Xpreprocessor <參數(shù)> 將 <參數(shù)> 傳遞給預處理器 -Xlinker <參數(shù)> 將 <參數(shù)> 傳遞給鏈接器 -save-temps 不刪除中間文件 -save-temps=<arg> 不刪除中間文件 -no-canonical-prefixes 生成其他 gcc 組件的相對路徑時不生成規(guī)范化的 前綴 -pipe 使用管道代替臨時文件 -time 為每個子進程計時 -specs=<文件> 用 <文件> 的內(nèi)容覆蓋內(nèi)建的 specs 文件 -std=<標準> 指定輸入源文件遵循的標準 --sysroot=<目錄> 將 <目錄> 作為頭文件和庫文件的根目錄 -B <目錄> 將 <目錄> 添加到編譯器的搜索路徑中 -v 顯示編譯器調(diào)用的程序 -### 與 -v 類似,但選項被引號括住,并且不執(zhí)行命令 -E 僅作預處理,不進行編譯、匯編和鏈接 -S 編譯到匯編語言,不進行匯編和鏈接 -c 編譯、匯編到目標代碼,不進行鏈接 -o <文件> 輸出到 <文件> -pie Create a position independent executable -shared Create a shared library -x <語言> 指定其后輸入文件的語言 允許的語言包括:c c++ assembler none ‘none’意味著恢復默認行為,即根據(jù)文件的擴展名猜測 源文件的語言 以 -g、-f、-m、-O、-W 或 --param 開頭的選項將由 gcc 自動傳遞給其調(diào)用的 不同子進程。若要向這些進程傳遞其他選項,必須使用 -W<字母> 選項。 下列選項只與特定語言相關 Ada: 找不到對應的選項。使用 --help=Ada 顯示 Ada 前端所支持的所有選項 下列選項只與特定語言相關 AdaSCIL: 找不到對應的選項。使用 --help=AdaSCIL 顯示 AdaSCIL 前端所支持的所有選項 下列選項只與特定語言相關 AdaWhy: 找不到對應的選項。使用 --help=AdaWhy 顯示 AdaWhy 前端所支持的所有選項 下列選項只與特定語言相關 C: -lang-asm 此開關缺少可用文檔 下列選項只與特定語言相關 C++: 找不到對應的選項。使用 --help=C++ 顯示 C++ 前端所支持的所有選項 下列選項只與特定語言相關 Fortran: -J<目錄> 將 MODULE 文件放入目錄 -Waliasing 為可能的虛參重疊給出警告 -Walign-commons 對 COMMON 塊對齊的警告 -Wampersand 若延續(xù)字符常量中缺少 & 則給出警告 -Warray-temporaries 創(chuàng)建臨時數(shù)組時給出警告 -Wc-binding-type Warn if the type of a variable might be not interoperable with C -Wcharacter-truncation 對被截斷的字符表達式給出警告 -Wcompare-reals Warn about equality comparisons involving REAL or COMPLEX expressions -Wconversion-extra 對大多數(shù)隱式類型轉換給出警告 -Wextra 打印額外(可能您并不想要)的警告信息 -Wfunction-elimination Warn about function call elimination -Wimplicit-interface 對帶有隱式接口的調(diào)用給出警告 -Wimplicit-procedure 對沒有隱式聲明的過程調(diào)用給出警告 -Wintrinsic-shadow 如果用戶過程有與內(nèi)建過程相同的名字則警告 -Wintrinsics-std 當內(nèi)建函數(shù)不是所選標準的一部分時給出警告 -Wline-truncation 對被截斷的源文件行給出警告 -Wreal-q-constant Warn about real-literal-constants with 'q' exponent-letter -Wrealloc-lhs Warn when a left-hand-side array variable is reallocated -Wrealloc-lhs-all Warn when a left-hand-side variable is reallocated -Wsurprising 對“可疑”的構造給出警告 -Wtabs 允許使用不符合規(guī)范的制表符 -Wtarget-lifetime Warn if the pointer in a pointer assignment might outlive its target -Wunderflow 數(shù)字常量表達式下溢時警告 -Wunused-dummy-argument 對未使用的啞元給出警告。 -cpp 啟用預處理 -cpp= 此開關缺少可用文檔 -faggressive-function-elimination Eliminate multiple function invokations also for impure functions -falign-commons 對齊 COMMON 塊 -fall-intrinsics 無論選擇何種標準,所有內(nèi)建過程均可用 -fallow-leading-underscore 此開關缺少可用文檔 -fautomatic 不把局部變量 和 COMMON 塊如它們在 SAVE 語句中被命名那樣來處理 -fbackslash 指定字符串中的反斜杠引入一個轉義字符 -fbacktrace 遇到運行時錯誤時打印函數(shù)調(diào)用回溯 -fblas-matmul-limit=<n> 使用 BLAS 進行矩陣乘法的矩陣大小下限 -fcheck-array-temporaries 對為過程參數(shù)而臨時創(chuàng)建的數(shù)組產(chǎn)生一個運行時警告 -fcheck=[...] 指定要進行哪種運行時檢查 -fcoarray=[...] 指定要使用的集合數(shù)組并行化 -fconvert=big-endian 為未格式化的文件使用大端在前的格式 -fconvert=little-endian 為未格式化的文件使用小端在前的格式 -fconvert=native 對未格式化的文件,使用本地格式 -fconvert=swap 對未格式化的文件,交換字節(jié)次序 -fcray-pointer 使用 Cray 指針擴展 -fd-lines-as-code 在固定格式中忽略第一列的‘D’ -fd-lines-as-comments 將第一列為‘D’的行視作注釋 -fdefault-double-8 將默認雙精度種別設為 8 字節(jié)寬 -fdefault-integer-8 將默認整數(shù)種別設為 8 字節(jié)寬 -fdefault-real-8 將默認實型種別設為 8 字節(jié)寬 -fdollar-ok 允許在實體名中使用美元符號 -fdump-core 不起作用。為向前兼容保留的選項。 -fdump-fortran-optimized Display the code tree after front end optimization -fdump-fortran-original 解析后顯示代碼樹 -fdump-parse-tree Display the code tree after parsing; deprecated option -fexternal-blas 為大尺寸數(shù)組調(diào)用 matmul 時應當使用一個外部 BLAS 庫 -ff2c 使用 f2c 調(diào)用約定 -ffixed-form 假定源文件是固定格式的 -ffixed-line-length-<n> 在固定模式下以 n 作為字符行寬 -ffixed-line-length-none 在固定模式下允許任意的字符行寬 -ffpe-trap=[...] 在以下浮點異常的情況下停止 -ffree-form 假定源文件是自由格式 -ffree-line-length-<n> 在自由模式下以 n 作為字符行寬 -ffree-line-length-none 在自由模式下允許任意的字符行寬 -ffrontend-optimize Enable front end optimization -fimplicit-none 不允許使用隱式類型,除非顯式地使用了 IMPLICIT 語句 -finit-character=<n> 將局部字符變量初始化 ASCII 值 n -finit-integer=<n> 將局部整數(shù)變量初始化為 n -finit-local-zero 局部變量初始化為零(與 g77 相同) -finit-logical=<true|false> 初始化局部邏輯變量 -finit-real=<zero|nan|inf|-inf> 初始化局部實變量 -finteger-4-integer-8 Interpret any INTEGER(4) as an INTEGER(8) -fintrinsic-modules-path 指定編譯好的內(nèi)建模塊的位置 -fintrinsic-modules-path= 指定編譯好的內(nèi)建模塊的位置 -fmax-array-constructor=<n> 一個數(shù)組構造函數(shù)中對象的最大數(shù)目 -fmax-identifier-length=<n> 標識符的最大長度 -fmax-stack-var-size=<n> 以字節(jié)大小表示的可以被放入堆棧的數(shù)組的最大大小 -fmax-subrecord-length=<n> 子記錄的最大長度 -fmodule-private 將模塊實體的默認訪問權限設置為 PRIVATE。 -fpack-derived 為派生類型使用盡可能緊實的布局 -fprotect-parens 尊重表達式中的括號 -frange-check 啟用編譯時范圍檢查 -freal-4-real-10 Interpret any REAL(4) as a REAL(10) -freal-4-real-16 Interpret any REAL(4) as a REAL(16) -freal-4-real-8 Interpret any REAL(4) as a REAL(8) -freal-8-real-10 Interpret any REAL(8) as a REAL(10) -freal-8-real-16 Interpret any REAL(8) as a REAL(16) -freal-8-real-4 Interpret any REAL(8) as a REAL(4) -frealloc-lhs 在賦值中重分配左值 -frecord-marker=4 對未格式化的文件,使用一個 4 字節(jié)的記錄標記 -frecord-marker=8 對未格式化的文件,使用一個 8 字節(jié)的記錄格式 -frecursive 在堆棧上分配局部變量以允許間接遞歸 -frepack-arrays 在過程入口處將數(shù)組段復制到一個連續(xù)的塊中 -fsecond-underscore 當名字已經(jīng)包含一個下劃線時添加第二個下劃線 -fsign-zero 在零值前使用負號 -fstack-arrays Put all local arrays on stack. -funderscoring 為外部可見的名字添加下劃線 -fwhole-file 立即編譯所有程序單元并檢查接口 -nocpp 禁用預處理 -static-libgfortran 靜態(tài)鏈接 GNU Fortran 助手庫(libgfortran) -std=f2003 遵循 ISO Fortran 2003 標準 -std=f2008 遵循 ISO Fortran 2008 標準 -std=f2008ts Conform to the ISO Fortran 2008 standard including TS 29113 -std=f95 遵循 ISO Fortran 95 標準 -std=gnu 不特別遵循任何標準 -std=legacy 接受一定的擴展以支持傳統(tǒng)的代碼 下列選項只與特定語言相關 Go: -L 此開關缺少可用文檔 -fgo-check-divide-overflow Add explicit checks for division overflow in INT_MIN / -1 -fgo-check-divide-zero Add explicit checks for division by zero -fgo-dump-<type> Dump Go frontend internal information -fgo-optimize-<type> Turn on optimization passes in the frontend -fgo-pkgpath=<string> Set Go package path -fgo-prefix=<string> Set package-specific prefix for exported Go names -fgo-relative-import-path= -fgo-relative-import-path=<path> Treat a relative import as relative to path -frequire-return-statement Functions which return values must end with return statements 下列選項只與特定語言相關 Java: --CLASSPATH 此開關缺少可用文檔 --bootclasspath 此開關缺少可用文檔 --classpath 此開關缺少可用文檔 --encoding 此開關缺少可用文檔 --extdirs 此開關缺少可用文檔 --output-class-directory 此開關缺少可用文檔 --output-class-directory= 此開關缺少可用文檔 --resource 此開關缺少可用文檔 --resource= 此開關缺少可用文檔 -CLASSPATH 此開關缺少可用文檔 -MD_ 此開關缺少可用文檔 -MMD_ 此開關缺少可用文檔 -Wall-deprecation 此開關缺少可用文檔 -Wall-javadoc 此開關缺少可用文檔 -Wassert-identifier 此開關缺少可用文檔 -Wboxing 此開關缺少可用文檔 -Wchar-concat 此開關缺少可用文檔 -Wcondition-assign 此開關缺少可用文檔 -Wconstructor-name 此開關缺少可用文檔 -Wdep-ann 此開關缺少可用文檔 -Wdiscouraged 此開關缺少可用文檔 -Wempty-block 此開關缺少可用文檔 -Wenum-identifier 此開關缺少可用文檔 -Wenum-switch 此開關缺少可用文檔 -Wextraneous-semicolon 發(fā)現(xiàn)不建議使用的空語句時給出警告 -Wfallthrough 此開關缺少可用文檔 -Wfield-hiding 此開關缺少可用文檔 -Wfinal-bound 此開關缺少可用文檔 -Wfinally 此開關缺少可用文檔 -Wforbidden 此開關缺少可用文檔 -Whiding 此開關缺少可用文檔 -Windirect-static 此開關缺少可用文檔 -Wintf-annotation 此開關缺少可用文檔 -Wintf-non-inherited 此開關缺少可用文檔 -Wjavadoc 此開關缺少可用文檔 -Wlocal-hiding 此開關缺少可用文檔 -Wmasked-catch-block 此開關缺少可用文檔 -Wnls 此開關缺少可用文檔 -Wno-effect-assign 此開關缺少可用文檔 -Wnull 此開關缺少可用文檔 -Wout-of-date 當 .class 文件已過時時給出警告 -Wover-ann 此開關缺少可用文檔 -Wparam-assign 此開關缺少可用文檔 -Wpkg-default-method 此開關缺少可用文檔 -Wraw 此開關缺少可用文檔 -Wredundant-modifiers 當指定了不必須的修飾符時給出警告 -Wserial 此開關缺少可用文檔 -Wspecial-param-hiding 此開關缺少可用文檔 -Wstatic-access 此開關缺少可用文檔 -Wstatic-receiver 此開關缺少可用文檔 -Wsuppress 此開關缺少可用文檔 -Wsynthetic-access 此開關缺少可用文檔 -Wtasks 此開關缺少可用文檔 -Wtype-hiding 此開關缺少可用文檔 -Wuncheck 此開關缺少可用文檔 -Wunnecessary-else 此開關缺少可用文檔 -Wunqualified-field 此開關缺少可用文檔 -Wunused-argument 此開關缺少可用文檔 -Wunused-import 此開關缺少可用文檔 -Wunused-label 有未使用的標號時警告 -Wunused-local 此開關缺少可用文檔 -Wunused-private 此開關缺少可用文檔 -Wunused-thrown 此開關缺少可用文檔 -Wuseless-type-check 此開關缺少可用文檔 -Wvarargs-cast 此開關缺少可用文檔 -Wwarning-token 此開關缺少可用文檔 -bootclasspath 此開關缺少可用文檔 -classpath 此開關缺少可用文檔 -encoding 此開關缺少可用文檔 --CLASSPATH 不建議使用;請改用 --classpath -fassert 允許使用 assert 關鍵字 -fassume-compiled 此開關缺少可用文檔 -fassume-compiled= 此開關缺少可用文檔 -faux-classpath 此開關缺少可用文檔 --bootclasspath=<路徑> 替換系統(tǒng)路徑 -fbootstrap-classes 生成的類可被自舉加載 -fcheck-references 檢查指向 NULL 的引用 --classpath=<路徑> 設置類路徑 -fcompile-resource= 此開關缺少可用文檔 -fdisable-assertions 此開關缺少可用文檔 -fdisable-assertions= 此開關缺少可用文檔 -femit-class-file 輸出一個 class 文件 -femit-class-files -fmit-class-file 的別名 -fenable-assertions 此開關缺少可用文檔 -fenable-assertions= 此開關缺少可用文檔 --encoding=<編碼> 選擇輸入編碼(默認來自您的區(qū)域選項) --extdirs=<路徑> 設定擴展目錄 -ffilelist-file 輸入文件是一個文件名列表,指定了需要編譯的文件 -fforce-classes-archive-check 總是檢查非 gcj 生成的類文檔 -fhash-synchronization 假定運行時使用一張散列表完成從對象到其同步結構的映射 -findirect-classes 在運行時生成類的實例 -findirect-dispatch 為虛方法調(diào)用使用偏移表 -finline-functions Integrate functions not declared "inline" into their callers when profitable -fjni 假定本地函數(shù)使用 JNI 實現(xiàn) -foptimize-static-class-initialization 啟用靜態(tài)類初始代碼優(yōu)化 -foutput-class-dir= 此開關缺少可用文檔 -freduced-reflection 減少生成的反射元數(shù)據(jù) -fsaw-java-file 此開關缺少可用文檔 -fsource-filename= 此開關缺少可用文檔 -fsource= 設定源語言版本 -fstore-check 存儲到對象數(shù)組時進行可賦值性檢查 -ftarget= 指定目標虛擬機的版本 -fuse-atomic-builtins 為內(nèi)建原子操作生成代碼 -fuse-boehm-gc 為 Boehm 生成代碼 -fuse-divide-subroutine 調(diào)用一個庫子程序來完成整數(shù)除法 -version 顯示編譯器版本 下列選項只與特定語言相關 LTO: -fltrans 在局部轉化(LTRANS)模式下運行鏈接時優(yōu)化器。 -fltrans-output-list= 指定存放 LTRANS 輸出的文件列表的文件。 -fresolution= 符號解析文件 -fwpa 在全程序分析(WPA)模式下運行鏈接時優(yōu)化器。 下列選項只與特定語言相關 ObjC: 找不到對應的選項。使用 --help=ObjC 顯示 ObjC 前端所支持的所有選項 下列選項只與特定語言相關 ObjC++: -fobjc-call-cxx-cdtors 如果需要,生成特殊的 Objective-C 方法來初始化/析構非簡單舊數(shù)據(jù) C++ 變量 下列選項與語言相關: --all-warnings 此開關缺少可用文檔 --ansi 此開關缺少可用文檔 --assert 此開關缺少可用文檔 --assert= 此開關缺少可用文檔 --comments 此開關缺少可用文檔 --comments-in-macros 此開關缺少可用文檔 --define-macro 此開關缺少可用文檔 --define-macro= 此開關缺少可用文檔 --dependencies 此開關缺少可用文檔 --dump 此開關缺少可用文檔 --dump= 此開關缺少可用文檔 --imacros 此開關缺少可用文檔 --imacros= 此開關缺少可用文檔 --include 此開關缺少可用文檔 --include-barrier 此開關缺少可用文檔 --include-directory 此開關缺少可用文檔 --include-directory-after 此開關缺少可用文檔 --include-directory-after= 此開關缺少可用文檔 --include-directory= 此開關缺少可用文檔 --include-prefix 此開關缺少可用文檔 --include-prefix= 此開關缺少可用文檔 --include-with-prefix 此開關缺少可用文檔 --include-with-prefix-after 此開關缺少可用文檔 --include-with-prefix-after= 此開關缺少可用文檔 --include-with-prefix-before 此開關缺少可用文檔 --include-with-prefix-before= 此開關缺少可用文檔 --include-with-prefix= 此開關缺少可用文檔 --include= 此開關缺少可用文檔 --no-line-commands 此開關缺少可用文檔 --no-standard-includes 此開關缺少可用文檔 --no-standard-libraries 此開關缺少可用文檔 --no-warnings 此開關缺少可用文檔 --output 此開關缺少可用文檔 --output-pch= 此開關缺少可用文檔 --output= 此開關缺少可用文檔 --pedantic 此開關缺少可用文檔 --preprocess 此開關缺少可用文檔 --print-missing-file-dependencies 此開關缺少可用文檔 --trace-includes 此開關缺少可用文檔 --traditional-cpp 此開關缺少可用文檔 --trigraphs 此開關缺少可用文檔 --undefine-macro 此開關缺少可用文檔 --undefine-macro= 此開關缺少可用文檔 --user-dependencies 此開關缺少可用文檔 --verbose 此開關缺少可用文檔 --write-dependencies 此開關缺少可用文檔 --write-user-dependencies 此開關缺少可用文檔 -A<問題>=<答案> 給出問題的答案。在問題前加一個‘-’將禁用其答案 -C 不丟棄注釋 -CC 展開宏時不丟棄注釋 -D<宏>[=<值>] 將宏定義為值。如果只給出了宏,值將被定為 1 -E 此開關缺少可用文檔 -F <目錄> 將目錄添加至主框架包含路徑的末尾 -H 打印使用到的頭文件名 -I <目錄> 將目錄添加至主包含路徑末尾 -M 生成 make 依賴項 -MD 生成 make 依賴規(guī)則并編譯 -MF <文件> 將依賴項輸出到給定文件 -MG 將缺失的頭文件看作生成的文件 -MM 與 -M 類似但是忽略系統(tǒng)頭文件 -MMD 與 -MD 類似但是忽略系統(tǒng)頭文件 -MP 為所有頭文件生成偽目標 -MQ <目標> 添加一個 MAKE 括起的目標 -MT <目標> 添加一個不被括起的目標 -P 不生成 #line 指令 -U<宏> 取消定義宏 -Wabi 當結果與 ABI 相容的編譯器的編譯結果不同時給出警告 -Wabi-tag Warn if a subobject has an abi_tag attribute that the complete object type does not have -Waddress 使用可疑的內(nèi)存地址時給出警告 -Wall 啟用大部分警告信息 -Wassign-intercept 當 Objective-C 賦值可能為垃圾回收所介入時給出警告 -Wbad-function-cast 當把函數(shù)轉換為不兼容類型時給出警告 -Wbuiltin-macro-redefined 當內(nèi)建預處理宏未定義或重定義時給出警告 -Wc++-compat 當在 C 語言中使用了 C 與 C++ 交集以外的構造時給出警告 -Wc++0x-compat Deprecated in favor of -Wc++11-compat -Wc++11-compat Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011 -Wcast-qual 當類型轉換丟失限定信息時給出警告 -Wchar-subscripts 當下標類型為“char”時給出警告 -Wclobbered 對能為"longjmp"或"vfork"所篡改的變量給出警告 -Wcomment 對可能嵌套的注釋和長度超過一個物理行長的 C++ 注釋給出警告 -Wcomments -Wcomment 的同義詞 -Wconversion 當隱式類型轉換可能改變值時給出警告 -Wconversion-null 將 NULL 轉換為非指針類型時給出警告 -Wctor-dtor-privacy 當所有構造函數(shù)和析構函數(shù)都是私有時給出警告 -Wdeclaration-after-statement 當聲明出現(xiàn)在語句后時給出警告 -Wdelete-non-virtual-dtor Warn about deleting polymorphic objects with non- virtual destructors -Wdeprecated 使用不建議的編譯器特性、類、方法或字段時給出警告 -Wdiv-by-zero 對編譯時發(fā)現(xiàn)的零除給出警告 -Wdouble-promotion 對從“float”到“double”的隱式轉換給出警告 -Weffc++ 對不遵循《Effetive C++》的風格給出警告 -Wempty-body 當 if 或 else 語句體為空時給出警告 -Wendif-labels 當 #elif 和 #endif 后面跟有其他標識符時給出警告 -Wenum-compare 對不同枚舉類型之間的比較給出警告 -Werror 所有的警告都當作是錯誤 -Werror-implicit-function-declaration 不建議使用此開關;請改用 -Werror=implicit-function-declaration -Wfloat-equal 當比較浮點數(shù)是否相等時給出警告 -Wformat 對 printf/scanf/strftime/strfmon 中的格式字符串異常給出警告 -Wformat-contains-nul 當格式字符串包含 NUL 字節(jié)時給出警告 -Wformat-extra-args 當傳遞給格式字符串的參數(shù)太多時給出警告 -Wformat-nonliteral 當格式字符串不是字面值時給出警告 -Wformat-security 當使用格式字符串的函數(shù)可能導致安全問題時給出警告 -Wformat-y2k 當 strftime 格式給出 2 位記年時給出警告 -Wformat-zero-length 對長度為 0 的格式字符串給出警告 -Wformat= 對 printf/scanf/strftime/strfmon 中的格式字符串異常給出警告 -Wignored-qualifiers 當類型限定符被忽略時給出警告。 -Wimplicit 對隱式函數(shù)聲明給出警告 -Wimplicit-function-declaration 對隱式函數(shù)聲明給出警告 -Wimplicit-int 當聲明未指定類型時給出警告 -Wimport 此開關缺少可用文檔 -Winherited-variadic-ctor Warn about C++11 inheriting constructors when the base has a variadic constructor -Winit-self 對初始化為自身的變量給出警告。 -Wint-to-pointer-cast 當將一個大小不同的整數(shù)轉換為指針時給出警告 -Winvalid-offsetof 對“offsetof”宏無效的使用給出警告 -Winvalid-pch 在找到了 PCH 文件但未使用的情況給出警告 -Wjump-misses-init 當跳轉略過變量初始化時給出警告 -Wliteral-suffix Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore. -Wlogical-op 當邏輯操作結果似乎總為真或假時給出警告 -Wlong-long 當使用 -pedantic 時不對“l(fā)ong long”給出警告 -Wmain 對可疑的“main”聲明給出警告 -Wmaybe-uninitialized Warn about maybe uninitialized automatic variables -Wmissing-braces 若初始值設定項中可能缺少花括號則給出警告 -Wmissing-declarations 當全局函數(shù)沒有前向聲明時給出警告 -Wmissing-field-initializers 若結構初始值設定項中缺少字段則給出警告 -Wmissing-format-attribute 此開關缺少可用文檔 -Wmissing-include-dirs 當用戶給定的包含目錄不存在時給出警告 -Wmissing-parameter-type K&R 風格函數(shù)參數(shù)聲明中未指定類型限定符時給出警告 -Wmissing-prototypes 全局函數(shù)沒有原型時給出警告 -Wmudflap 當構造未被 -fmudflap 處理時給出警告 -Wmultichar 使用多字節(jié)字符集的字符常量時給出警告 -Wnarrowing Warn about narrowing conversions within { } that are ill-formed in C++11 -Wnested-externs 當“extern”聲明不在文件作用域時給出警告 -Wnoexcept Warn when a noexcept expression evaluates to false even though the expression can't actually throw -Wnon-template-friend 在模板內(nèi)聲明未模板化的友元函數(shù)時給出警告 -Wnon-virtual-dtor 當析構函數(shù)不是虛函數(shù)時給出警告 -Wnonnull 當將 NULL 傳遞給需要非 NULL 的參數(shù)的函數(shù)時給出警告 -Wnormalized=<id|nfc|nfkc> 對未歸一化的 Unicode 字符串給出警告 -Wold-style-cast 程序使用 C 風格的類型轉換時給出警告 -Wold-style-declaration 對聲明中的過時用法給出警告 -Wold-style-definition 使用舊式形參定義時給出警告 -Woverlength-strings 當字符串長度超過標準規(guī)定的可移植的最大長度時給出警告 -Woverloaded-virtual 重載虛函數(shù)名時給出警告 -Woverride-init 覆蓋無副作用的初始值設定時給出警告 -Wpacked-bitfield-compat 當緊實位段的偏移量因 GCC 4.4 而改變時給出警告 -Wparentheses 可能缺少括號的情況下給出警告 -Wpedantic 給出標準指定的所有警告信息 -Wpmf-conversions 當改變成員函數(shù)指針的類型時給出警告 -Wpointer-arith 當在算術表達式中使用函數(shù)指針時給出警告 -Wpointer-sign 賦值時如指針符號不一致則給出警告 -Wpointer-to-int-cast 將一個指針轉換為大小不同的整數(shù)時給出警告 -Wpragmas 對錯誤使用的 pragma 加以警告 -Wproperty-assign-default Warn if a property for an Objective-C object has no assign semantics specified -Wprotocol 當繼承來的方法未被實現(xiàn)時給出警告 -Wpsabi 此開關缺少可用文檔 -Wredundant-decls 對同一個對象多次聲明時給出警告 -Wreorder 編譯器將代碼重新排序時給出警告 -Wreturn-local-addr Warn about returning a pointer/reference to a local or temporary variable. -Wreturn-type 當 C 函數(shù)的返回值默認為“int”,或者 C++ 函數(shù)的返回類型不一致時給出警告 -Wselector 當選擇子有多個方法時給出警告 -Wsequence-point 當可能違反定序點規(guī)則時給出警告 -Wsign-compare 在有符號和無符號數(shù)間進行比較時給出警告 -Wsign-conversion 為有符號和無符號整數(shù)間的隱式類型轉換給出警告 -Wsign-promo 當重載將無符號數(shù)提升為有符號數(shù)時給出警告 -Wsizeof-pointer-memaccess 此開關缺少可用文檔 -Wstrict-aliasing= 當代碼可能破壞強重疊規(guī)則時給出警告 -Wstrict-null-sentinel 將未作轉換的 NULL 用作哨兵時給出警告 -Wstrict-overflow= 禁用假定有符號數(shù)溢出行為未被定義的優(yōu)化 -Wstrict-prototypes 使用了非原型的函數(shù)聲明時給出警告 -Wstrict-selector-match 當備選方法的類型簽字不完全匹配時給出警告 -Wsuggest-attribute=format 當函數(shù)可能是 format 屬性的備選時給出警告 -Wswitch 當使用枚舉類型作為開關變量,沒有提供 default 分支,但又缺少某個 case 時給出警告 -Wswitch-default 當使用枚舉類型作為開關變量,但沒有提供“default”分支時給出警告 -Wswitch-enum 當使用枚舉類型作為開關變量但又缺少某個 case 時給出警告 -Wsync-nand 當 __sync_fetch_and_nand 和 __sync_nand_and_fetch 內(nèi)建函數(shù)被使用時給出警告 -Wsynth 不建議使用。此開關不起作用。 -Wsystem-headers 不抑制系統(tǒng)頭文件中的警告 -Wtraditional 使用了傳統(tǒng) C 不支持的特性時給出警告 -Wtraditional-conversion 原型導致的類型轉換與無原型時的類型轉換不同時給出警告 -Wtrigraphs 當三字母序列可能影響程序意義時給出警告 -Wundeclared-selector 當使用 @selector() 卻不作事先聲明時給出警告 -Wundef 當 #if 指令中用到未定義的宏時給出警告 -Wuninitialized 自動變量未初始化時警告 -Wunknown-pragmas 對無法識別的 pragma 加以警告 -Wunsuffixed-float-constants 對不帶后綴的浮點常量給出警告 -Wunused 啟用所有關于“XX未使用”的警告 -Wunused-local-typedefs Warn when typedefs locally defined in a function are not used -Wunused-macros 當定義在主文件中的宏未被使用時給出警告 -Wunused-result 當一個帶有 warn_unused_result 屬性的函數(shù)的調(diào)用者未使用前者的返回值時給出警告 -Wuseless-cast Warn about useless casts -Wvarargs Warn about questionable usage of the macros used to retrieve variable arguments -Wvariadic-macros Warn about using variadic macros -Wvirtual-move-assign Warn if a virtual base has a non-trivial move assignment operator -Wvla 使用變長數(shù)組時警告 -Wvolatile-register-var 當一個寄存器變量被聲明為 volatile 時給出警告 -Wwrite-strings 在 C++ 中,非零值表示將字面字符串轉換為‘char *’時給出警告。在 C 中,給出相似的警告,但這種類型轉換是符合 ISO C 標準的。 -Wzero-as-null-pointer-constant Warn when a literal '0' is used as null pointer -ansi -std=c89 (對 C 來說) 或 -std=c++98 (對 C++ 來說)的同義詞 -d<字母> 為指定的某趟匯譯啟用內(nèi)存轉儲 -fRTS= Select the runtime -faccess-control 執(zhí)行類成員訪問控制語義 -fada-spec-parent= -fada-spec-parent=unit Dump Ada specs as child units of given parent -fall-virtual 此開關缺少可用文檔 -fallow-parameterless-variadic-functions Allow variadic functions without named parameter -falt-external-templates 不再受支持 -fasm 識別“asm”關鍵字 -fbuilding-libgcc 此開關缺少可用文檔 -fbuiltin 識別內(nèi)建函數(shù) -fbuiltin- 此開關缺少可用文檔 -fcanonical-system-headers Where shorter, use canonicalized paths to systems headers. -fcheck-new 檢查 new 的返回值 -fcond-mismatch 允許‘?’運算符的參數(shù)有不同的類型 -fconserve-space 不起作用。為向前兼容保留的選項。 -fconst-string-class=<名字> 使用名字作為常量字符串類的名稱 -fconstexpr-depth=<number> Specify maximum constexpr recursion depth -fdebug-cpp Emit debug annotations during preprocessing -fdeduce-init-list enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list -fdefault-inline 不起作用。為向前兼容保留的選項。 -fdirectives-only 僅預處理指示。 -fdollars-in-identifiers 允許‘$’作為標識符的一部分 -fdump-ada-spec Write all declarations as Ada code transitively -fdump-ada-spec-slim Write all declarations as Ada code for the given file only -felide-constructors 此開關缺少可用文檔 -femit-struct-debug-baseonly 積極地縮減結構體的調(diào)試信息 -femit-struct-debug-detailed=<規(guī)格列表> 詳細指定如何縮減結構體的調(diào)試信息 -femit-struct-debug-reduced 保守地縮減結構體的調(diào)試信息 -fenforce-eh-specs 生成檢查異常規(guī)范的代碼 -fenum-int-equiv 此開關缺少可用文檔 -fexec-charset=<字符集> 將所有字符串和字符常量轉換到字符集 -fext-numeric-literals Interpret imaginary, fixed-point, or other gnu number suffix as the corresponding number literal rather than a user-defined number literal. -fextended-identifiers 允許標識符中出現(xiàn) Unicode 字符名(\u 和 \U) -fextern-tls-init Support dynamic initialization of thread-local variables in a different translation unit -fexternal-templates 此開關缺少可用文檔 -ffor-scope for 循環(huán)初始化中定義的變量作用域局限于循環(huán)內(nèi) -ffreestanding 不假定標準 C 庫和“main”存在 -ffriend-injection 將友元函數(shù)聲明視作包含它的命名空間中的有效聲明 -fgnu-keywords 識別 GNU 定義的關鍵字 -fgnu-runtime 為 GNU 運行時環(huán)境生成代碼 -fgnu89-inline 為內(nèi)聯(lián)函數(shù)使用傳統(tǒng)的 GNU 語義 -fguiding-decls 此開關缺少可用文檔 -fhandle-exceptions 此開關缺少可用文檔 -fhonor-std 此開關缺少可用文檔 -fhosted 假定一般的 C 執(zhí)行環(huán)境 -fhuge-objects 不再受支持 -fimplement-inlines 導出被內(nèi)聯(lián)的函數(shù) -fimplicit-inline-templates 允許內(nèi)聯(lián)模板隱式實例化 -fimplicit-templates 允許模板隱式實例化 -finput-charset=<字符集> 指定源代碼的默認字符集 -fkeep-inline-dllexport 除非必需,不生成 DLL 導出的內(nèi)聯(lián)函數(shù) -flabels-ok 此開關缺少可用文檔 -flax-vector-conversions 允許具有不同元素數(shù)量和/或元素類型的向量間的轉換 -fms-extensions 使用微軟擴展時不給出警告 -fmudflap 為單線程程序添加 mudflap 邊界檢查 -fmudflapir 插入 mudflag 時忽略讀操作 -fmudflapth 為多線程程序添加 mudflap 邊界檢查 -fname-mangling-version- 此開關缺少可用文檔 -fnew-abi 此開關缺少可用文檔 -fnext-runtime 為 NeXT (蘋果 Mac OS X) 運行時環(huán)境生成代碼 -fnil-receivers 假定 Objective-C 消息的接受者可能是 nil -fnonansi-builtins 此開關缺少可用文檔 -fnonnull-objects 此開關缺少可用文檔 -fnothrow-opt Treat a throw() exception specification as noexcept to improve code size -fobjc-abi-version= Specify which ABI to use for Objective-C family code and meta-data generation. -fobjc-direct-dispatch 允許快速跳轉至消息分發(fā)者 -fobjc-exceptions 啟用 Objective-C 異常和同步語法 -fobjc-gc 在 Objective-C/Objective-C++ 程序中啟用垃圾收集 -fobjc-nilcheck Enable inline checks for nil receivers with the NeXT runtime and ABI version 2. -fobjc-sjlj-exceptions 啟用 Objective-C setjmp 異常處理運行時 -fobjc-std=objc1 Conform to the Objective-C 1.0 language as implemented in GCC 4.0 -fopenmp 啟用 OpenMP(對 Fortran 而言也同時設定 -frecursive) -foperator-names 識別“compl”、“xor”等 C++ 關鍵詞 -foptional-diags 不起作用。為向前兼容保留的選項。 -fpch-deps 此開關缺少可用文檔 -fpch-preprocess 即使在預處理時也搜索并使用 PCH 文件 -fpermissive 將兼容性錯誤降格為警告 -fplan9-extensions 啟用九號計劃語言擴展 -fpreprocessed 將輸入文件當作已經(jīng)預處理過的 -fpretty-templates -fno-pretty-templates 不使用模板簽名加實參的方式美化模板特例化的打印 -freplace-objc-classes 指定對象文件可能在運行時被換入以允許“修復并繼續(xù)”調(diào)試模式 -frepo 啟用模板自動實例化 -frtti 生成運行時類型描述信息 -fshort-double 令 double 使用 float 的大小 -fshort-enums 為枚舉類型使用盡可能窄的整數(shù)類型 -fshort-wchar 強制指定“wchar_t”的內(nèi)在類型為“unsigned short” -fsigned-bitfields 沒有給定“signed”或“unsigned”時將位段視作有符號的 -fsigned-char 使“char”類型默認為有符號 -fsquangle 此開關缺少可用文檔 -fstats 顯示編譯過程中累計的統(tǒng)計數(shù)字 -fstrict-enums Assume that values of enumeration type are always within the minimum range of that type -fstrict-prototype 此開關缺少可用文檔 -ftabstop=<N> 指定報告列號時制表位間的距離 -ftemplate-backtrace-limit= Set the maximum number of template instantiation notes for a single warning or error -ftemplate-depth- 此開關缺少可用文檔 -ftemplate-depth=<N> 指定模板實例化的最大深度 -fthis-is-variable 此開關缺少可用文檔 -fno-threadsafe-statics 不為局部靜態(tài)變量生成線程安全的初始化代碼 -ftrack-macro-expansion 此開關缺少可用文檔 -ftrack-macro-expansion= -ftrack-macro-expansion=<0|1|2> Track locations of tokens coming from macro expansion and display them in error messages -funsigned-bitfields 未指定“signed”或“unsigned”時默認位段為無符號的 -funsigned-char 使“char”類型默認為無符號 -fuse-cxa-atexit 將 __cxa_atexit 而非 atexit 登記為析構函數(shù) -fuse-cxa-get-exception-ptr 在異常處理中使用 __cxa_get_exception_ptr -fvisibility-inlines-hidden Marks all inlined functions and methods as having hidden visibility -fvisibility-ms-compat 默認使用與 Microsoft Visual Studio 匹配的可見性 -fvtable-gc 不再受支持 -fvtable-thunks 不再受支持 -fweak 將公共符號視作弱符號 -finput-charset=<字符集> 將所有寬字符串和字符常量都轉換為字符集 -fworking-directory 生成一個指向當前工作目錄的 #line 預處理指令 -fxref 不再受支持 -fzero-link 為 Zero-Link 模式生成后期類查找(通過 objc_getClass()) -gant Catch typos -gen-decls 將聲明轉儲到一個 .decl 文件中 -gnat<選項> 指定給 GNAT 的選項 -gnatO Set name of output ALI file (internal switch) -idirafter <目錄> 將目錄添加至系統(tǒng)包含路徑末尾 -imacros <文件> 接受文件中定義的宏 -imultilib <目錄> 將目錄設定為 multilib 的包含子目錄 -include <文件> 在包含其它文件之前先包含該文件的內(nèi)容 -iprefix <路徑> 將路徑指定為下兩個選項的前綴 -iquote <目錄> 將目錄添加至括起的包含路徑末尾 -isysroot <目錄> 將目錄設為系統(tǒng)根目錄 -isystem <目錄> 將目錄添加至系統(tǒng)包含路徑開頭 -iwithprefix <目錄> 將目錄添加至系統(tǒng)包含路徑末尾 -iwithprefixbefore <目錄> 將目錄添加至主包含路徑末尾 -nostdinc 不搜索標準系統(tǒng)頭文件目錄(但仍將使用由 -isystem 指定的目錄) -nostdinc++ 不搜索 C++ 標準系統(tǒng)頭文件目錄 -nostdlib Do not look for object files in standard path -o <文件> 將輸出寫入文件 -pedantic 此開關缺少可用文檔 -print-objc-runtime-info 生成有平臺相關特性的 C 頭文件 -remap 包含文件時映射短文件名 -std=c++03 Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum -std=c++0x Deprecated in favor of -std=c++11 -std=c++11 Conform to the ISO 2011 C++ standard (experimental and incomplete support) -std=c++1y Conform to the ISO 201y(7?) C++ draft standard (experimental and incomplete support) -std=c++98 Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum -std=c11 Conform to the ISO 2011 C standard (experimental and incomplete support) -std=c1x Deprecated in favor of -std=c11 -std=c89 遵循 ISO 1990 C 標準 -std=c90 遵循 ISO 1990 C 標準 -std=c99 遵循 ISO 1999 C 標準 -std=c9x 不建議使用,請改用 -std=c99 -std=gnu++03 Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum with GNU extensions -std=gnu++0x Deprecated in favor of -std=gnu++11 -std=gnu++11 Conform to the ISO 2011 C++ standard with GNU extensions (experimental and incomplete support) -std=gnu++1y Conform to the ISO 201y(7?) C++ draft standard with GNU extensions (experimental and incomplete support) -std=gnu++98 Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum with GNU extensions -std=gnu11 Conform to the ISO 2011 C standard with GNU extensions (experimental and incomplete support) -std=gnu1x Deprecated in favor of -std=gnu11 -std=gnu89 遵循 ISO 1990 C 標準,也支持 GNU 擴展 -std=gnu90 遵循 ISO 1990 C 標準,也支持 GNU 擴展 -std=gnu99 遵循 ISO 1999 C 標準,也支持 GNU 擴展 -std=gnu9x 不建議使用,請改用 -std=gnu99 -std=iso9899:1990 遵循 ISO 1990 C 標準 -std=iso9899:199409 遵循 ISO 1990 C 標準于 1994 年修訂的版本 -std=iso9899:1999 遵循 ISO 1999 C 標準 -std=iso9899:199x 不建議使用,為 -std=iso9899:1999 所取代 -std=iso9899:2011 Conform to the ISO 2011 C standard (experimental and incomplete support) -traditional-cpp 啟用傳統(tǒng)預處理 -trigraphs 支持 ISO C 三元符 -undef 不預定義系統(tǒng)或 GCC 特定的宏 -v 啟用詳細輸出 -w 不顯示警告 --param 選項可接受以下參數(shù): predictable-branch-outcome 被認為可以預測的分支的最大估算結果 inline-min-speedup The minimal estimated speedup allowing inliner to ignore inline-insns-single and inline-isnsns-auto max-inline-insns-single 單個可內(nèi)聯(lián)的函數(shù)體最多能包含的指令數(shù) max-inline-insns-auto 自動內(nèi)聯(lián)時指令的最大數(shù)量 max-inline-insns-recursive 由于嵌套內(nèi)聯(lián)造成的內(nèi)聯(lián)函數(shù)代碼膨脹的上限值(指令數(shù)) max-inline-insns-recursive-auto 由于嵌套內(nèi)聯(lián)造成的非內(nèi)聯(lián)函數(shù)代碼膨脹的上限值(指令數(shù)) max-inline-recursive-depth 內(nèi)聯(lián)函數(shù)中嵌套內(nèi)聯(lián)的最大深度 max-inline-recursive-depth-auto 非內(nèi)聯(lián)函數(shù)中嵌套內(nèi)聯(lián)的最大深度 min-inline-recursive-probability 僅當被執(zhí)行的調(diào)用的概率超過此參數(shù)時方進行遞歸地內(nèi)聯(lián) max-early-inliner-iterations 早期內(nèi)聯(lián)器可以進行的嵌套間接內(nèi)聯(lián)的最大數(shù)量 comdat-sharing-probability Probability that COMDAT function will be shared with different compilation unit partial-inlining-entry-probability 進行部分內(nèi)聯(lián)時分離區(qū)域入口基本塊占函數(shù)入口基本塊的百分比概率的上限 max-variable-expansions-in-unroller 如果使用了 -fvariable-expansion-in- unroller,即指單個變量在循環(huán)展開時可以同時被展開的次數(shù) min-vect-loop-bound 使用 -ftree-vectorize 時考慮進行向量化的循環(huán)次數(shù)下限 max-delay-slot-insn-search 考慮填充入延遲槽中的最大指令數(shù) max-delay-slot-live-search 用以發(fā)現(xiàn)準確的活動寄存器信息的最大指令數(shù)量 max-pending-list-length 調(diào)度候選操作列表的最大長度 max-modulo-backtrack-attempts The maximum number of backtrack attempts the scheduler should make when modulo scheduling a loop large-function-insns 超過這個大小的函數(shù)體被認為是大的 large-function-growth 內(nèi)聯(lián)大函數(shù)造成的代碼膨脹的上限(以百分數(shù)的形式給出) large-unit-insns 超過這個大小的翻譯單元被認為是大的 inline-unit-growth 給定的編譯單元因內(nèi)聯(lián)造成的體積膨脹上限(以百分數(shù)表示) ipcp-unit-growth 給定的編譯單元因跨進程常量傳遞造成的編譯單元體積膨脹上限(以百分數(shù)表示) early-inlining-insns 對單個調(diào)用進行的早期內(nèi)聯(lián)所導致的函數(shù)體代碼膨脹的最大估計值 large-stack-frame 超過這個大小的棧幀被認為是大的 large-stack-frame-growth 內(nèi)聯(lián)造成的棧幀膨脹的上限(以百分數(shù)的形式給出) max-gcse-memory GCSE 可分配的最大內(nèi)存量 max-gcse-insertion-ratio The maximum ratio of insertions to deletions of expressions in GCSE gcse-after-reload-partial-fraction 重新載入后進行部分冗余消除的比例閾值 gcse-after-reload-critical-fraction 重新載入后允許進行冗余消除的關鍵邊執(zhí)行次數(shù)的比例閾值 gcse-cost-distance-ratio 計算一個表達式被 GCSE 優(yōu)化移動的最大距離時的比例因子 gcse-unrestricted-cost 指定 GCSE 優(yōu)化不約束一個表達式能被移動的距離時的代價 max-hoist-depth Maximum depth of search in the dominator tree for expressions to hoist max-unrolled-insns 單個循環(huán)中考慮展開的最大指令數(shù) max-average-unrolled-insns 單個循環(huán)中考慮展開的平均最大指令數(shù) max-unroll-times 單個循環(huán)最多可以被展開的次數(shù) max-peeled-insns 剝離后的循環(huán)所能有的最大指令數(shù) max-peel-times 單個循環(huán)最大的剝離數(shù) max-peel-branches The maximum number of branches on the path through the peeled sequence max-completely-peeled-insns 一個完全剝離的循環(huán)所能有的最大指令數(shù) max-completely-peel-times 一個完全剝離的單個循環(huán)最大的剝離數(shù) max-once-peeled-insns 被剝離后只卷繞一次的循環(huán)包含的最多指令數(shù) max-completely-peel-loop-nest-depth 一個完全剝離的循環(huán)嵌套所能有的最大深度 max-unswitch-insns 去開關后的循環(huán)所能有的最大指令數(shù) max-unswitch-level 單個循環(huán)中考慮去開關的最大指令數(shù) max-iterations-to-track 暴力迭代次數(shù)分析算法評估迭代次數(shù)的上限 max-iterations-computation-cost 用于計算迭代次數(shù)的表達式的開銷的上限值 sms-max-ii-factor 調(diào)整擺動模調(diào)度器調(diào)度循環(huán)時使用的上限的一個因素 sms-min-sc The minimum value of stage count that swing modulo scheduler will generate. sms-dfa-history 使用 DFA 檢查沖突時擺動模調(diào)度器考慮的周期數(shù) sms-loop-average-count-threshold 由擺動模調(diào)度程序考慮的關于平均循環(huán)計數(shù)的閾值 hot-bb-count-ws-permille A basic block profile count is considered hot if it contributes to the given permillage of the entire profiled execution hot-bb-frequency-fraction 當某基本塊執(zhí)行頻率超過函數(shù)中基本塊執(zhí)行的最大頻率的指定百分比時,該基本塊可被考慮為熱點代碼 align-threshold 當某基本塊執(zhí)行頻率超過函數(shù)中基本塊執(zhí)行的最大頻率的指定百分比時,該基本塊將被對齊 align-loop-iterations 對齊循環(huán)次數(shù)大于或等于設定值的循環(huán) max-predicted-iterations 靜態(tài)預測時的最多循環(huán)次數(shù) tracer-dynamic-coverage-feedback 必須被蹤跡形成所覆蓋的函數(shù)百分比,以執(zhí)行頻率加權。當取樣反饋可用時使用 tracer-dynamic-coverage 必須被蹤跡形成所覆蓋的函數(shù)百分比,以執(zhí)行頻率加權。當取樣反饋不可用時使用 tracer-max-code-growth 以百分比表示的尾復制所引起的最大代碼膨脹 tracer-min-branch-ratio 當最優(yōu)邊的反向概率小于此閾值(以百分數(shù)表示)時停止反向增長 tracer-min-branch-probability-feedback 當最優(yōu)邊的概率小于此限值(以百分數(shù)表示)時,停止前向增長。當取樣反饋可用時使用。 tracer-min-branch-probability 當最優(yōu)邊的概率小于此限值(以百分數(shù)表示)時,停止前向增長。當取樣反饋不可用時使用。 max-crossjump-edges 考慮進行交叉跳轉的最大入邊數(shù)量 min-crossjump-insns 考慮進行交叉跳轉的最小匹配指令數(shù)量 max-grow-copy-bb-insns 復制基本塊時最大的展開因子 max-goto-duplication-insns 分解計算轉移時復制指令的數(shù)量上限 max-cse-path-length 公因式消去時考慮的最大路徑長度 max-cse-insns 清空前公因式消去處理的最大指令數(shù) lim-expensive 循環(huán)不變量轉移時一條昂貴的表達式的最小開銷 iv-consider-all-candidates-bound 當備選少于此設定值時所有備選都將為歸納變量優(yōu)化所考慮 iv-max-considered-uses 對歸納變量數(shù)少于設定值的循環(huán)進行歸納變量優(yōu)化 iv-always-prune-cand-set-bound 當備選歸納變量少于設定值時總是設法在優(yōu)化過程中消除未使用的歸納變量 scev-max-expr-size 用在標量演化分析器中的表達式的大小上限 scev-max-expr-complexity Bound on the complexity of the expressions in the scalar evolutions analyzer omega-max-vars Omega 約束系統(tǒng)中變量數(shù)的上限 omega-max-geqs Omega 約束系統(tǒng)中不等式數(shù)量的上限 omega-max-eqs Omega 約束系統(tǒng)中等式數(shù)量的上限 omega-max-wild-cards Omega 約束系統(tǒng)中通配符數(shù)量的上限 omega-hash-table-size Omega 約束系統(tǒng)中散列表大小的上限 omega-max-keys Omega 約束系統(tǒng)中 omega-eliminate-redundant-constraints 設為 1 時,使用昂貴的方法來消除所有冗余的約束 vect-max-version-for-alignment-checks 向量循環(huán)版本化插入的運行時對齊檢查次數(shù)的上限 vect-max-version-for-alias-checks 向量循環(huán)版本化插入的運行時別名檢查次數(shù)的上限 max-cselib-memory-locations cselib 最多記錄的內(nèi)存位置 ggc-min-expand 引發(fā)垃圾收集的堆展開的最小值,以占堆總大小的百分比給出 ggc-min-heapsize 開始垃圾回收時最小的堆大小,以千字節(jié)表示 max-reload-search-insns 后向搜索以尋找等價重載入時要搜索的最大指令數(shù)量 sink-frequency-threshold Target block's relative execution frequency (as a percentage) required to sink a statement max-sched-region-blocks 一個區(qū)域中考慮進行塊間調(diào)度的最大塊數(shù) max-sched-region-insns 一個區(qū)域中考慮進行塊間調(diào)度的最大指令數(shù) max-pipeline-region-blocks 一個區(qū)域中考慮進行塊間調(diào)度的最大塊數(shù) max-pipeline-region-insns 一個區(qū)域中考慮進行塊間調(diào)度的最大指令數(shù) min-spec-prob 塊間投機調(diào)度時到達一個源塊的最小概率 max-sched-extend-regions-iters 通過 CFG 以擴展區(qū)域的最大循環(huán)次數(shù) max-sched-insn-conflict-delay 考慮進行投機移動的指令的最大沖突延遲數(shù) sched-spec-prob-cutoff 以百分比表示的投機成功的最小概率,影響對投機指令的調(diào)度 sched-state-edge-prob-cutoff The minimum probability an edge must have for the scheduler to save its state across it. selsched-max-lookahead 進行選擇調(diào)度時前瞻窗口的最大尺寸 selsched-max-sched-times 指定一條指令最多能被調(diào)度幾次 selsched-insns-to-rename 在適合行重命名的就緒列表中最多的指令數(shù) sched-mem-true-dep-cost 可能沖突的存儲和裝載之間的最小距離 max-last-value-rtl 可以被記作組合器的最終值的最大 RTL 節(jié)點數(shù) integer-share-limit 共享整型常量的上界 ssp-buffer-size 考慮預防堆棧溢出的緩沖區(qū)的下限值 max-jump-thread-duplication-stmts 線索化跳轉時一個以被復制的塊中所能包含的最大語句數(shù) max-fields-for-field-sensitive 在指針分析將該結構視為單一變量前結構包含的最大字段數(shù) max-sched-ready-insns 首趟調(diào)度考慮準備生成的指令的最大數(shù)量 max-dse-active-local-stores Maximum number of active local stores in RTL dead store elimination prefetch-latency 預取操作完成前執(zhí)行指令的數(shù)目 simultaneous-prefetches 可以同時運行的預取操作數(shù)目 l1-cache-size 一級緩存大小 l1-cache-line-size 一級緩存列長度 l2-cache-size 二級緩存大小 use-canonical-types 是否使用合乎規(guī)范的類型 max-partial-antic-length 進行樹上部分冗余消除時部分可預期集的最大長度 sccvn-max-scc-size 在 SCCVN 停止處理一個函數(shù)以前 SCC 的最大尺寸 sccvn-max-alias-queries-per-access Maximum number of disambiguations to perform per memory access ira-max-loops-num 用作區(qū)域寄存器分配的最大循環(huán)數(shù) ira-max-conflict-table-size 以 MB 表示的沖突表大小上限 ira-loop-reserved-regs 保留不為循環(huán)不變量轉移使用的各種寄存器的數(shù)量 switch-conversion-max-branch-ratio 當數(shù)組大小與開關分支的比率大于此值時開關轉換不會發(fā)生 loop-block-tile-size 循環(huán)分塊中每小塊的大小 graphite-max-nb-scop-params 一個靜態(tài)控制部分(ScoP)中參數(shù)的最大數(shù)量 graphite-max-bbs-per-function Graphite 可分析的每函數(shù)所包含的基本塊數(shù)量上限 loop-max-datarefs-for-datadeps Maximum number of datarefs in loop for building loop data dependencies loop-invariant-max-bbs-in-loop 用作循環(huán)不變量轉移的循環(huán)中基本塊的最大數(shù)量 slp-max-insns-in-bb 考慮進行基本塊向量化的基本塊能包含的指令數(shù)上限 min-insn-to-prefetch-ratio 為有未知路程計數(shù)的循環(huán)啟用預取時最小的指令/預取比 prefetch-min-insn-to-mem-ratio 為循環(huán)啟用預取時最小的指令/內(nèi)存操作比 max-vartrack-size 變量跟蹤散列表的最大尺寸 max-vartrack-expr-depth Max. recursion depth for expanding var tracking expressions max-vartrack-reverse-op-size Max. size of loc list for which reverse ops should be added min-nondebug-insn-uid 非調(diào)試指令所使用的最小 UID ipa-sra-ptr-growth-factor IPA-SRA 考慮將指向的聚合的指針替換為參數(shù)時這些參數(shù)總和大小相對原指針參數(shù)大小倍數(shù)的最大值 tm-max-aggregate-size Size in bytes after which thread-local aggregates should be instrumented with the logging functions instead of save/restore pairs ipa-cp-value-list-size Maximum size of a list of values associated with each parameter for interprocedural constant propagation ipa-cp-eval-threshold Threshold ipa-cp opportunity evaluation that is still considered beneficial to clone. ipa-max-agg-items Maximum number of aggregate content items for a parameter in jump functions and lattices ipa-cp-loop-hint-bonus Compile-time bonus IPA-CP assigns to candidates which make loop bounds or strides known. lto-partitions Number of partitions the program should be split to lto-min-partition Minimal size of a partition for LTO (in estimated instructions) cxx-max-namespaces-for-diagnostic-help Maximum number of namespaces to search for alternatives when name lookup fails max-stores-to-sink Maximum number of conditional store pairs that can be sunk case-values-threshold The smallest number of different values for which it is best to use a jump-table instead of a tree of conditional branches, if 0, use the default for the machine allow-load-data-races Allow new data races on loads to be introduced allow-store-data-races Allow new data races on stores to be introduced allow-packed-load-data-races Allow new data races on packed data loads to be introduced allow-packed-store-data-races Allow new data races on packed data stores to be introduced tree-reassoc-width Set the maximum number of instructions executed in parallel in reassociated tree. If 0, use the target dependent heuristic. max-tail-merge-comparisons Maximum amount of similar bbs to compare a bb with max-tail-merge-iterations Maximum amount of iterations of the pass over a function max-tracked-strlens Maximum number of strings for which strlen optimization pass will track string lengths sched-pressure-algorithm Which -fsched-pressure algorithm to apply max-slsr-cand-scan Maximum length of candidate scans for straight- line strength reduction 下列選項控制編譯器警告信息: --extra-warnings 此開關缺少可用文檔 -W 不建議使用此開關;請改用 -Wextra -Waggregate-return 當返回結構、聯(lián)合或數(shù)組時給出警告 -Waggressive-loop-optimizations Warn if a loop with constant number of iterations triggers undefined behavior -Warray-bounds 當數(shù)組訪問越界時給出警告 -Wattributes 當對屬性的使用不合適時給出警告 -Wcast-align 當轉換指針類型導致對齊邊界增長時給出警告 -Wcoverage-mismatch Warn in case profiles in -fprofile-use do not match -Wcpp Warn when a #warning directive is encountered -Wdeprecated-declarations 對 __attribute__((deprecated)) 聲明給出警告 -Wdisabled-optimization 當某趟優(yōu)化被禁用時給出警告 -Wfree-nonheap-object Warn when attempting to free a non-heap object -Winline 當內(nèi)聯(lián)函數(shù)無法被內(nèi)聯(lián)時給出警告 -Winvalid-memory-model Warn when an atomic memory model parameter is known to be outside the valid range. -Wlarger-than- 此開關缺少可用文檔 -Wlarger-than=<N> 當目標文件大于 N 字節(jié)時給出警告 -Woverflow 算術表示式溢出時給出警告 -Wpacked 當 packed 屬性對結構布局不起作用時給出警告 -Wpadded 當需要填補才能對齊結構成員時給出警告 -Wshadow 當一個局部變量掩蓋了另一個局部變量時給出警告 -Wstack-protector 當因為某種原因堆棧保護失效時給出警告 -Wstack-usage= Warn if stack usage might be larger than specified amount -Wstrict-aliasing 當代碼可能破壞強重疊規(guī)則時給出警告 -Wstrict-overflow 禁用假定有符號數(shù)溢出行為未被定義的優(yōu)化 -Wsuggest-attribute=const Warn about functions which might be candidates for __attribute__((const)) -Wsuggest-attribute=noreturn 當函數(shù)可能是 __attribute__((noreturn)) 的備選時給出警告 -Wsuggest-attribute=pure Warn about functions which might be candidates for __attribute__((pure)) -Wtrampolines Warn whenever a trampoline is generated -Wtype-limits 當由于數(shù)據(jù)類型范圍限制比較結果永遠為真或假時給出警告 -Wunsafe-loop-optimizations 當循環(huán)因為不平凡的假定而不能被優(yōu)化時給出警告 -Wunused-but-set-parameter Warn when a function parameter is only set, otherwise unused -Wunused-but-set-variable Warn when a variable is only set, otherwise unused -Wunused-function 有未使用的函數(shù)時警告 -Wunused-parameter 發(fā)現(xiàn)未使用的函數(shù)指針時給出警告 -Wunused-value 當一個表達式的值未被使用時給出警告 -Wunused-variable 有未使用的變量時警告 -Wvector-operation-performance Warn when a vector operation is compiled outside the SIMD 下列選項控制優(yōu)化: -O<N> 將優(yōu)化等級設為 N -Ofast 為速度優(yōu)化,不嚴格遵守標準 -Og Optimize for debugging experience rather than speed or size -Os 為最小空間而不是最大速度優(yōu)化 -faggressive-loop-optimizations Aggressively optimize loops using language constraints -falign-functions 對齊函數(shù)入口 -falign-jumps 對齊只能為跳轉所到達的標號 -falign-labels 對齊所有的標號 -falign-loops 對齊循環(huán)入口 -fasynchronous-unwind-tables 生成精確到每條指令邊界的堆棧展開表 -fbranch-count-reg 將加/減法、比較、跳轉指令序列替換為根據(jù)計數(shù)寄存器跳轉指令 -fbranch-probabilities 為分支概率使用取樣信息 -fbranch-target-load-optimize 在開始/結末線程前進行分支目標載入優(yōu)化 -fbranch-target-load-optimize2 在開始/結末線程后進行分支目標載入優(yōu)化 -fbtr-bb-exclusive 限制目標載入融合不重用任何基本塊中的寄存器 -fcaller-saves 函數(shù)調(diào)用前后保存/恢復寄存器值 -fcombine-stack-adjustments Looks for opportunities to reduce stack adjustments and stack references. -fcommon 不將未初始化的全局數(shù)據(jù)放在公共節(jié)中 -fcompare-elim Perform comparison elimination after register allocation has finished -fconserve-stack 不進行可能導致堆棧使用明顯增長的優(yōu)化 -fcprop-registers 進行一趟寄存器副本傳遞優(yōu)化 -fcrossjumping 進行跨跳轉優(yōu)化 -fcse-follow-jumps 進行 CSE 時,跟隨跳轉至目標 -fcx-fortran-rules 復數(shù)乘除遵循 Fortran 規(guī)則 -fcx-limited-range 當進行復數(shù)除法時省略縮減范圍的步驟 -fdata-sections 將每個數(shù)據(jù)項分別放在它們各自的節(jié)中 -fdce 使用 RTL 死代碼清除 -fdefer-pop 延遲將函數(shù)實參彈棧 -fdelayed-branch 嘗試填充分支指令的延遲槽 -fdelete-null-pointer-checks 刪除無用的空指針檢查 -fdevirtualize Try to convert virtual calls to direct ones. -fdse 使用 RTL 死存儲清除 -fearly-inlining 進行早內(nèi)聯(lián) -fexceptions 啟用異常處理 -fexpensive-optimizations 進行一些細微的、代價高昂的優(yōu)化 -ffinite-math-only 假定結果不會是 NaN 或無窮大浮點數(shù) -ffloat-store 不將單精度和雙精度浮點數(shù)分配到擴展精度的寄存器中 -fforward-propagate 進行 RTL 上的前向傳遞 -fgcse 進行全局公共子表達式消除 -fgcse-after-reload Perform global common subexpression elimination after register allocation has finished -fgcse-las Perform redundant load after store elimination in global common subexpression elimination -fgcse-lm 在全局公共子表達式消除中進行增強的讀轉移優(yōu)化 -fgcse-sm 在全局公共子表達式消除后進行存儲轉移 -fgraphite-identity 啟用 Graphite 身份轉換 -fguess-branch-probability 啟用分支概率猜測 -fhoist-adjacent-loads Enable hoisting adjacent loads to encourage generating conditional move instructions -fif-conversion 將條件跳轉替換為沒有跳轉的等值表示 -fif-conversion2 將條件跳轉替換為條件執(zhí)行 -finline Enable inlining of function declared "inline", disabling disables all inlining -finline-atomics Inline __atomic operations when a lock free instruction sequence is available. -finline-functions-called-once Integrate functions only required by their single caller -finline-small-functions Integrate functions into their callers when code size is known not to grow -fipa-cp 進行進程間的復寫傳遞 -fipa-cp-clone 進行復制以使跨進程常量傳遞更有效 -fipa-profile Perform interprocedural profile propagation -fipa-pta 進行進程間的指向分析 -fipa-pure-const 發(fā)現(xiàn)純函數(shù)和常函數(shù) -fipa-reference 發(fā)現(xiàn)只讀和不可尋址靜態(tài)變量 -fipa-sra 為聚合類型進行跨進程標量替換 -fira-hoist-pressure Use IRA based register pressure calculation in RTL hoist optimizations. -fivopts 在樹上優(yōu)化歸納變量 -fjump-tables 為足夠大的 switch 語句使用跳轉表 -floop-block 啟用循環(huán)分塊轉換 -floop-interchange 啟用循環(huán)交換轉換 -floop-nest-optimize Enable the ISL based loop nest optimizer -floop-parallelize-all 將所有循環(huán)標記為并行 -floop-strip-mine 啟用循環(huán)條帶開采轉換 -fmath-errno 執(zhí)行內(nèi)建數(shù)學函數(shù)后設置 errno -fmerge-all-constants 試圖合并相同的常量和常變量 -fmerge-constants 試圖合并不同編譯單元中的相同常量 -fmodulo-sched 在首趟調(diào)度前進行基于 SMS 的模調(diào)度 -fmove-loop-invariants 將每次循環(huán)中不變的計算外提 -fnon-call-exceptions 支持同步非調(diào)用異常 -fomit-frame-pointer 盡可能不生成棧幀 -fopt-info Enable all optimization info dumps on stderr -foptimize-register-move 進行全寄存器傳送優(yōu)化 -foptimize-sibling-calls 優(yōu)化同級遞歸和尾遞歸 -foptimize-strlen Enable string length optimizations on trees -fpack-struct 將結構成員不帶間隔地緊實存放 -fpack-struct=<N> 設定結構成員最大對齊邊界的初始值 -fpeel-loops 進行循環(huán)剝離 -fpeephole 啟用機器相關的窺孔優(yōu)化 -fpeephole2 在 sched2 前進行一趟 RTL 窺孔優(yōu)化 -fpredictive-commoning 啟用預測公因子優(yōu)化。 -fprefetch-loop-arrays 如果可用,為循環(huán)中的數(shù)組生成預取指令 -freg-struct-return 在寄存器中返回小聚合 -fregmove 啟用寄存器傳送優(yōu)化 -frename-registers 進行寄存器重命名優(yōu)化 -freorder-blocks 基本塊重新排序以改善代碼布局 -freorder-blocks-and-partition 對基本塊重新排序并劃分為熱區(qū)和冷區(qū) -freorder-functions 函數(shù)重新排序以改善代碼布局 -frerun-cse-after-loop 在循環(huán)優(yōu)化結束后增加一趟公共子表達式消除 -freschedule-modulo-scheduled-loops 啟用/禁用已經(jīng)通過模調(diào)度的循環(huán)中的傳統(tǒng)調(diào)度 -frounding-math 禁用假定默認浮點舍入行為的優(yōu)化 -fsched-critical-path-heuristic 為調(diào)度器啟用關鍵路徑啟發(fā)式發(fā)現(xiàn) -fsched-dep-count-heuristic 為調(diào)度器啟用依賴計數(shù)啟發(fā)式發(fā)現(xiàn) -fsched-group-heuristic 在調(diào)度器中啟用組啟發(fā) -fsched-interblock 啟用基本塊間的調(diào)度 -fsched-last-insn-heuristic 為調(diào)度器啟用最近指令啟發(fā)式發(fā)現(xiàn) -fsched-pressure 啟用對寄存器壓力敏感的指令調(diào)度 -fsched-rank-heuristic 在調(diào)度器中啟用秩啟發(fā) -fsched-spec 允許非載入的投機移動 -fsched-spec-insn-heuristic 為調(diào)度器啟用投機指令啟發(fā)式發(fā)現(xiàn) -fsched-spec-load 允許一些載入的投機移動 -fsched-spec-load-dangerous 允許更多載入的投機移動 -fsched-stalled-insns 允許對隊列中的指令進行早調(diào)度 -fsched-stalled-insns-dep 設置排隊中指令的進行早調(diào)度的依賴距離檢查 -fsched2-use-superblocks 在重載后調(diào)度中使用跨基本塊調(diào)度 -fschedule-insns 分配寄存器前重新調(diào)度指令 -fschedule-insns2 分配寄存器后重新調(diào)度指令 -fsection-anchors 從共享的錨點訪問在同樣的節(jié)中的數(shù)據(jù) -fsel-sched-pipelining 在選擇性調(diào)度中對內(nèi)層循環(huán)進行軟件流水化 -fsel-sched-pipelining-outer-loops 在選擇性調(diào)度中對外層循環(huán)進行軟件流水化 -fsel-sched-reschedule-pipelined 重新調(diào)度沒有被流水線化的流水線區(qū)域 -fselective-scheduling 用選擇性調(diào)度算法調(diào)度指令 -fselective-scheduling2 在重加載后使用選擇性調(diào)度 -fset-stack-executable 為嵌套函數(shù)設定可執(zhí)行堆棧權限。 -fshrink-wrap Emit function prologues only before parts of the function that need it, rather than at the top of the function. -fsignaling-nans 禁用為 IEEE NaN 可見的優(yōu)化 -fsigned-zeros 禁用忽略 IEEE 中零的符號的浮點優(yōu)化 -fsingle-precision-constant 將浮點常量轉換為單精度常量 -fsplit-ivs-in-unroller 展開循環(huán)時分離歸納變量的生存期 -fsplit-wide-types 將寬類型分割到獨立的寄存器中 -fstrict-aliasing 假定應用強重疊規(guī)則 -fthread-jumps 進行跳轉線程優(yōu)化 -ftoplevel-reorder 重新排序文件作用域的函數(shù)、變量和匯編 -ftrapping-math 假定浮點運算可能引發(fā)陷阱 -ftrapv 加法、減法或乘法溢出時激活陷阱 -ftree-bit-ccp Enable SSA-BIT-CCP optimization on trees -ftree-builtin-call-dce 為內(nèi)建函數(shù)啟用有條件的死代碼消除優(yōu)化 -ftree-ccp 啟用樹上的 SSA-CCP 優(yōu)化 -ftree-ch 啟用樹上的循環(huán)不變量轉移 -ftree-coalesce-inlined-vars Enable coalescing of copy-related user variables that are inlined -ftree-coalesce-vars Enable coalescing of all copy-related user variables -ftree-copy-prop 在樹級別進行復寫傳遞 -ftree-copyrename 將 SSA 臨時變量重命名為更易理解的名稱 -ftree-cselim 將條件存儲轉換為非條件存儲 -ftree-dce 啟用樹上的 SSA 死代碼消除優(yōu)化 -ftree-dominator-opts 啟用主導優(yōu)化 -ftree-dse 刪除死存儲 -ftree-forwprop 在樹級別進行前向復寫傳遞 -ftree-fre 啟用樹上的完全冗余消除(FRE) -ftree-loop-distribute-patterns Enable loop distribution for patterns transformed into a library call -ftree-loop-distribution 在樹上進行循環(huán)分配 -ftree-loop-if-convert Convert conditional jumps in innermost loops to branchless equivalents -ftree-loop-if-convert-stores 將包含內(nèi)存寫入的條件跳轉轉換為不帶分支的等效形式 -ftree-loop-im 啟用樹上的循環(huán)不變量轉移 -ftree-loop-ivcanon 在循環(huán)中生成正規(guī)的歸納變量 -ftree-loop-optimize 在樹級別進行循環(huán)優(yōu)化 -ftree-lrs 在 SSA->normal 過程中分離活動范圍 -ftree-partial-pre In SSA-PRE optimization on trees, enable partial- partial redundancy elimination -ftree-phiprop 為條件指針外提內(nèi)存讀取操作。 -ftree-pre 啟用樹上的 SSA-PRE 優(yōu)化 -ftree-pta 在樹上進行函數(shù)內(nèi)的指向分析。 -ftree-reassoc 在樹級別進行重結合 -ftree-scev-cprop 為標量演化信息進行復寫傳遞。 -ftree-sink 啟用樹上的 SSA 代碼下沉優(yōu)化 -ftree-slp-vectorize 在樹上進行基本塊向量化(SLP) -ftree-slsr Perform straight-line strength reduction -ftree-sra 為聚合類型進行標量替換 -ftree-switch-conversion 轉換開關初始化 -ftree-tail-merge Enable tail merging on trees -ftree-ter 在 SSA->normal 過程中替換臨時表達式 -ftree-vect-loop-version 在樹上進行循環(huán)向量化時啟用多版本循環(huán) -ftree-vectorize 在樹上進行循環(huán)向量化 -ftree-vrp 進行樹上的值域傳遞 -funit-at-a-time 一次編譯一整個編譯單元 -funroll-all-loops 展開所有循環(huán) -funroll-loops 展開所有迭代次數(shù)已知的循環(huán) -funsafe-loop-optimizations 允許假定循環(huán)以“正常”方式動作的循環(huán)優(yōu)化 -funsafe-math-optimizations 允許可能違反 IEEE 或 ISO 標準的優(yōu)化 -funswitch-loops 外提循環(huán)內(nèi)的測試語句 -funwind-tables 僅為異常處理生成堆棧展開表 -fvar-tracking 進行變量跟蹤 -fvar-tracking-assignments 評注賦值以進行變量跟蹤 -fvar-tracking-assignments-toggle 切換 -fvar-tracking-assignments -fvar-tracking-uninit 進行變量追蹤并且標記未被初始化的變量 -fvariable-expansion-in-unroller 展開循環(huán)時也展開變量 -fvect-cost-model 啟用向量化開銷模型 -fvpt 在優(yōu)化中使用表達式值樣本提供的信息 -fweb 建立關系網(wǎng)并且分離對同一變量的無關應用 -fwhole-program 進行全程序優(yōu)化 -fwrapv 假定有符號運算溢出時回繞 下列選項與特定目標機相關: -m128bit-long-double sizeof(long double) 等于 16 -m32 生成 32 位 i386 代碼 -m3dnow 支持 3DNow! 內(nèi)建函數(shù) -m3dnowa 支持擴展 3DNow! 內(nèi)建函數(shù) -m64 生成 64 位 x86-64 代碼 -m80387 使用硬件浮點單元 -m8bit-idiv 將 32/64 位整數(shù)除法擴展為帶運行時檢查的 8 位無符號整數(shù)除法 -m96bit-long-double sizeof(long double) 等于 12 -mabi= 生成遵循給定 ABI 的代碼 -mabm 支持生成高級位操作(ABM)指令。 -maccumulate-outgoing-args 在函數(shù)序言中為輸出參數(shù)預留空間 -maddress-mode= Use given address mode -madx Support flag-preserving add-carry instructions -maes 支持 AES 內(nèi)建函數(shù)及代碼生成 -malign-double 一些雙精度浮點數(shù)在雙字邊界上對齊 -malign-functions= 函數(shù)入口對齊在 2 的此次方上 -malign-jumps= 跳轉目標對齊在 2 的此次方上 -malign-loops= 循環(huán)代碼對齊到 2 的此次方上 -malign-stringops 對齊字符串操作的目標 -march= 為給定的 CPU 生成代碼 -masm= 使用給定的匯編風格 -mavx 支持 MMX、SSE、SSE2、SSE3、SSSE3、SSE4.1、SSE4.2 和 AVX 內(nèi)建函數(shù)及代碼生成 -mavx2 Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation -mavx256-split-unaligned-load Split 32-byte AVX unaligned load -mavx256-split-unaligned-store Split 32-byte AVX unaligned store -mbmi 支持 BMI 內(nèi)建函數(shù)及代碼生成 -mbmi2 Support BMI2 built-in functions and code generation -mbranch-cost= 指定分支的代價(1-5,任意單位) -mcld 在函數(shù)序言中生成 cld 指令 -mcmodel= 使用給定的 x86-64 代碼模式 -mconsole 創(chuàng)建命令行程序 -mcpu= 此開關缺少可用文檔 -mcrc32 支持生成 crc32 指令。 -mcx16 支持生成 cmpxchg16b 指令。 -mdispatch-scheduler Do dispatch scheduling if processor is bdver1 or bdver2 or bdver3 and Haifa scheduling is selected. -mdll 生成動態(tài)鏈接庫的代碼 -mf16c 支持 F16C 內(nèi)建函數(shù)及代碼生成 -mfancy-math-387 為 FPU 生成 sin、cos 和 sqrt 指令 -mfentry Emit profiling counter call at function entry before prologue. -mfma 支持 MMX、SSE、SSE2、SSE3、SSSE3、SSE4.1、SSE4.2、AVX 和 FMA 內(nèi)建函數(shù)及代碼生成 -mfma4 支持 FMA4 內(nèi)建函數(shù)及代碼生成 -mforce-drap 總是使用動態(tài)對齊參數(shù)指針(DRAP)來重新對齊堆棧 -mfp-ret-in-387 在 FPU 寄存器中存放函數(shù)返回值 -mfpmath= 為指定的指令集生成浮點數(shù)學代碼 -mfsgsbase 支持 FSGSBASE 內(nèi)建函數(shù)及代碼生成 -mfused-madd 此開關缺少可用文檔 -mfxsr Support FXSAVE and FXRSTOR instructions -mhard-float 使用硬件浮點單元 -mhle Support Hardware Lock Elision prefixes -mieee-fp 浮點數(shù)間的比較嚴格遵循 IEEE 標準 -mincoming-stack-boundary= 假定棧對齊到 2 的此次方上 -minline-all-stringops 內(nèi)聯(lián)所有已知的字符串操作 -minline-stringops-dynamically 內(nèi)聯(lián) memset/memcpy 字符串操作,但僅為較小的塊使用內(nèi)聯(lián)版本 -mintel-syntax 此開關缺少可用文檔 -mlarge-data-threshold= 在 x86-64 中等模式下大于指定閾值的數(shù)據(jù)將被存放在 .ldata 節(jié)中 -mlong-double-64 使用 64 位 long double -mlong-double-80 Use 80-bit long double -mlwp 支持 LWP 內(nèi)建函數(shù)及代碼生成 -mlzcnt Support LZCNT built-in function and code generation -mmmx 支持 MMX 內(nèi)建函數(shù) -mmovbe 支持生成 movbe 指令。 -mms-bitfields 使用本地 (MS) 位段存儲方式 -mno-align-stringops 此開關缺少可用文檔 -mno-fancy-math-387 此開關缺少可用文檔 -mno-push-args 此開關缺少可用文檔 -mno-red-zone 此開關缺少可用文檔 -mno-sse4 不支持 SSE4.1 和 SSE4.2 內(nèi)建函數(shù)及代碼生成 -mnop-fun-dllimport 忽略函數(shù)的 dllimport 屬性 -momit-leaf-frame-pointer 為葉函數(shù)(不調(diào)用其他函數(shù)的函數(shù))忽略框架指針 -mpc32 Set 80387 floating-point precision to 32-bit -mpc64 Set 80387 floating-point precision to 64-bit -mpc80 Set 80387 floating-point precision to 80-bit -mpclmul 支持 PCLMUL 內(nèi)建函數(shù)及代碼生成 -mpe-aligned-commons 使用 PE 格式的 GNU 擴展來對齊 common 數(shù)據(jù) -mpopcnt 支持生成 popcnt 指令。 -mprefer-avx128 自動向量化時使用 128 位 AVX 指令而不是 256 位 AVX 指令 -mpreferred-stack-boundary= 試圖讓棧保持對齊到 2 的此次方上 -mprfchw Support PREFETCHW instruction -mpush-args 使用 push 指令保存輸出參數(shù) -mrdrnd 支持 RDRND 內(nèi)建函數(shù)及代碼生成 -mrdseed Support RDSEED instruction -mrecip 生成倒數(shù)指令而不是 divss 和 sqrtss。 -mrecip= Control generation of reciprocal estimates. -mred-zone 在 x86-64 代碼中使用紅區(qū) -mregparm= 用以傳遞整數(shù)參數(shù)的寄存器個數(shù) -mrtd 更改調(diào)用約定 -mrtm Support RTM built-in functions and code generation -msahf 支持在 x86-64 模式下生成 sahf 指令。 -msoft-float 不使用硬件浮點單元 -msse 支持 MMX 和 SSE 內(nèi)建函數(shù)及代碼生成 -msse2 支持 MMX、SSE 和 SSE2 內(nèi)建函數(shù)及代碼生成 -msse2avx 支持帶 VEX 前綴的 SSE 指令 -msse3 支持 MMX、SSE、SSE2 和 SSE3 內(nèi)建函數(shù)及代碼生成 -msse4 支持 MMX、SSE、SSE2、SSE3、SSSE3、SSE4.1 和 SSE4.2 內(nèi)建函數(shù)及代碼生成 -msse4.1 支持 MMX、SSE、SSE2、SSE3、SSSE3 和 SSE4.1 內(nèi)建函數(shù)及代碼生成 -msse4.2 支持 MMX、SSE、SSE2、SSE3、SSSE3、SSE4.1 和 SSE4.2 內(nèi)建函數(shù)及代碼生成 -msse4a 支持 MMX、SSE、SSE2、SSE3 和 SSE4A 內(nèi)建函數(shù)及代碼生成 -msse5 此開關缺少可用文檔 -msseregparm 在 SF 和 DF 模式下使用 SSE 寄存器調(diào)用約定 -mssse3 支持 MMX、SSE、SSE2、SSE3 和 SSSE3 內(nèi)建函數(shù)及代碼生成 -mstack-arg-probe 啟用堆棧探測 -mstackrealign 在前言中重新對齊堆棧 -mstringop-strategy= 選擇生成字符串操作的策略 -mtbm 支持 TBM 內(nèi)建函數(shù)及代碼生成 -mthreads 使用 Mingw 特定的線程支持 -mtls-dialect= 使用給定的線程局部存儲模式 -mtls-direct-seg-refs 當訪問線程局部數(shù)據(jù)時直接引用 %gs -mtune= 為指定的 CPU 優(yōu)化代碼 -muse-libstdc-wrappers 生成依賴 Cygwin DLL 包裝的代碼以支持對 C++ 運算符 new/ delete 的替換 -mveclibabi= 指定要使用的向量庫 ABI -mvect8-ret-in-mem 將 8 字節(jié)向量在內(nèi)存中返回 -mvzeroupper Generate vzeroupper instruction before a transfer of control flow out of the function. -mwin32 設定 Windows 定義 -mwindows 創(chuàng)建圖形界面程序 -mx32 Generate 32bit x86-64 code -mxop 支持 XOP 內(nèi)建函數(shù)及代碼生成 -mxsave Support XSAVE and XRSTOR instructions -mxsaveopt Support XSAVEOPT instruction Known assembler dialects (for use with the -masm-dialect= option): att intel Known ABIs (for use with the -mabi= option): ms sysv Known code models (for use with the -mcmodel= option): 32 kernel large medium small Valid arguments to -mfpmath=: 387 387+sse 387,sse both sse sse+387 sse,387 Known vectorization library ABIs (for use with the -mveclibabi= option): acml svml Known address mode (for use with the -maddress-mode= option): long short Valid arguments to -mstringop-strategy=: byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop Known TLS dialects (for use with the -mtls-dialect= option): gnu gnu2 下列選項與具體語言無關: --debug 此開關缺少可用文檔 --dumpbase 此開關缺少可用文檔 --dumpdir 此開關缺少可用文檔 --help 顯示此信息 --help=<類型> 顯示一或多項特定類型選項的描述。類型可能是 optimizers、target、warnings、undocumented 或 params --optimize 此開關缺少可用文檔 --param <參數(shù)>=<值> 將參數(shù)參數(shù)設為給定值。下面給出所有參數(shù)的列表 --param= 此開關缺少可用文檔 --pedantic-errors 此開關缺少可用文檔 --profile 此開關缺少可用文檔 --target-help --help=target 的別名 --version 此開關缺少可用文檔 -Werror= 將指定的警告當作錯誤 -Wfatal-errors 發(fā)現(xiàn)第一個錯誤時即退出 -Wframe-larger-than=<N> 當一個函數(shù)的堆??蚣苄枰嘤?N 字節(jié)的內(nèi)存時給出警告 -Wmissing-noreturn 此開關缺少可用文檔 -Wunreachable-code 不起作用。為向前兼容保留的選項。 -aux-info <文件> 將聲明信息寫入文件 -aux-info= 此開關缺少可用文檔 -auxbase 此開關缺少可用文檔 -auxbase-strip 此開關缺少可用文檔 -dumpbase <文件> 設定內(nèi)存轉儲使用的文件基本名 -dumpdir <目錄> 設定內(nèi)存轉儲使用的目錄名 -fPIC 盡可能生成與位置無關的代碼(大模式) -fPIE 為可執(zhí)行文件盡可能生成與位置無關的代碼(大模式) -fabi-version= 此開關缺少可用文檔 -falign-functions= 此開關缺少可用文檔 -falign-jumps= 此開關缺少可用文檔 -falign-labels= 此開關缺少可用文檔 -falign-loops= 此開關缺少可用文檔 -fargument-alias 不起作用。為向前兼容保留的選項。 -fargument-noalias 不起作用。為向前兼容保留的選項。 -fargument-noalias-anything 不起作用。為向前兼容保留的選項。 -fargument-noalias-global 不起作用。為向前兼容保留的選項。 -fassociative-math Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding. -fauto-inc-dec 生成 auto-inc/dec指令 -fbounds-check 生成檢查數(shù)組訪問是否越界的代碼 -fcall-saved-<寄存器> 認為寄存器在函數(shù)調(diào)用后值不變 -fcall-used-<寄存器> 認為寄存器的值將被函數(shù)調(diào)用所改變 -fcheck-data-deps 比較幾個數(shù)據(jù)依賴分析的結果。 -fcompare-debug-second 只為 -fcompare-debug 運行第二遍編譯 -fcompare-debug[=<選項>] 分別在帶與不帶“選項”,例如 -gtoggle,的情況下編譯,然后比較最后的指令輸出 -fcse-skip-blocks 不起作用。為向前兼容保留的選項。 -fdbg-cnt-list 列出所有可用的調(diào)試計數(shù)器及其極限和計數(shù)。 -fdbg-cnt=<計數(shù)器>:<極限>[,<計數(shù)器>:<極限>,...] 設定調(diào)試計數(shù)器極限。 -fdebug-prefix-map= 在調(diào)試信息中將一個目錄名映射到另一個 -fdebug-types-section Output .debug_types section when using DWARF v4 debuginfo. -fdelete-dead-exceptions Delete dead instructions that may throw exceptions -fdiagnostics-show-caret Show the source line with a caret indicating the column -fdiagnostics-show-location=[once|every-line] 指定在自動換行的診斷信息開始給出源位置的頻率 -fdiagnostics-show-option 在診斷信息后輸出控制它們的命令行選項 -fdisable- -fdisable-[tree|rtl|ipa]-<pass>=range1+range2 disables an optimization pass -fdump-<類型> 將一些編譯器內(nèi)部信息轉儲到一個文件里 -fdump-final-insns=文件名 在翻譯完畢后將指令輸出到文件中 -fdump-go-spec=filename Write all declarations to file as Go code -fdump-noaddr 在調(diào)試轉儲中不輸出地址 -fdump-passes Dump optimization passes -fdump-unnumbered 在調(diào)試轉儲中不輸出指令數(shù)、行號標記和地址 -fdump-unnumbered-links 在調(diào)試轉儲中不輸出前一條和后一條指令號碼 -fdwarf2-cfi-asm 用 GAS 匯編指示來啟用 CFI 表 -feliminate-dwarf2-dups 進行 DWARF2 冗余消除 -feliminate-unused-debug-symbols 在調(diào)試信息中進行無用類型消除 -feliminate-unused-debug-types 在調(diào)試信息中進行無用類型消除 -femit-class-debug-always 保留 C++ 類調(diào)試信息。 -fenable- -fenable-[tree|rtl|ipa]-<pass>=range1+range2 enables an optimization pass -fexcess-precision=[fast|standard] 指定如何處理有額外精度的浮點數(shù) -ffast-math 此開關缺少可用文檔 -ffat-lto-objects Output lto objects containing both the intermediate language and binary output. -ffixed-<寄存器> 認為寄存器對編譯器而言不可用 -fforce-addr 不起作用。為向前兼容保留的選項。 -ffp-contract= -ffp-contract=[off|on|fast] Perform floating- point expression contraction. -ffunction-cse 允許將函數(shù)地址保存在寄存器中 -ffunction-sections 將每個函數(shù)分別放在它們各自的節(jié)中 -fgnu-tm Enable support for GNU transactional memory -fgraphite 啟用 Graphite 表示的輸入輸出 -fhelp 此開關缺少可用文檔 -fhelp= 此開關缺少可用文檔 -fident 處理 #ident 指令 -findirect-inlining 進行間接內(nèi)聯(lián) -finhibit-size-directive 不生成 .size 偽指令 -finline-limit- 此開關缺少可用文檔 -finline-limit=<N> 將內(nèi)聯(lián)函數(shù)的大小限制在 N 以內(nèi) -finstrument-functions 在函數(shù)入口和出口加入取樣調(diào)用 -finstrument-functions-exclude-file-list= -finstrument-functions-exclude-file- list=文件名,... 取樣時排除列出的文件中的函數(shù) -finstrument-functions-exclude-function-list= -finstrument-functions-exclude- function-list=函數(shù)名,... 取樣時排除列出的函數(shù) -fipa-matrix-reorg 不起作用。為向前兼容保留的選項。 -fipa-struct-reorg 不起作用。為向前兼容保留的選項。 -fira-algorithm= -fira-algorithm=|CB|priority] 設置使用的 IRA 算法 -fira-loop-pressure Use IRA based register pressure calculation in RTL loop optimizations. -fira-region= -fira-region=[one|all|mixed] 設置 IRA 的區(qū)域 -fira-share-save-slots 為保存不同的硬寄存器的共享槽。 -fira-share-spill-slots 為溢出的偽寄存器共享堆棧槽。 -fira-verbose=<N> 控制 IRA 診斷信息的級別。 -fkeep-inline-functions 為完全內(nèi)聯(lián)的函數(shù)生成代碼 -fkeep-static-consts 保留未用到的靜態(tài)常量 -fleading-underscore 給外部符號添加起始的下劃線 -floop-flatten 不起作用。為向前兼容保留的選項。 -floop-optimize 不起作用。為向前兼容保留的選項。 -flto 啟用鏈接時優(yōu)化。 -flto-compression-level=<N> 為 IL 使用 zlib 壓縮級別 N -flto-partition=1to1 Partition symbols and vars at linktime based on object files they originate from -flto-partition=balanced Partition functions and vars at linktime into approximately same sized buckets -flto-partition=max Put every symbol into separate partition -flto-partition=none Disable partioning and streaming -flto-report 報告各種鏈接時優(yōu)化統(tǒng)計 -flto= Link-time optimization with number of parallel jobs or jobserver. -fmax-errors=<n> 報告錯誤數(shù)量的上限值 -fmem-report 報告永久性內(nèi)存分配 -fmem-report-wpa Report on permanent memory allocation in WPA only -fmerge-debug-strings 試圖合并不同編譯單元中的相同調(diào)試字符串 -fmessage-length=<N> 將診斷信息限制在每行 N 個字符。0 取消自動換行 -fmodulo-sched-allow-regmoves 進行基于 SMS 且允許寄存器轉移的模調(diào)度 -fopt-info[-<type>=filename] Dump compiler optimization details -fpartial-inlining 進行部分內(nèi)聯(lián) -fpcc-struct-return 在內(nèi)存而不是寄存器中返回小聚合 -fpic 盡可能生成與位置無關的代碼(小模式) -fpie 為可執(zhí)行文件盡可能生成與位置無關的代碼(小模式) -fplugin-arg-<插件>-<鍵>[=<值>] 為插件指定參數(shù)鍵=值 -fplugin= 指定要加載的插件 -fpost-ipa-mem-report 在跨進程優(yōu)化前報告內(nèi)存分配 -fpre-ipa-mem-report 在跨進程優(yōu)化前報告內(nèi)存分配 -fprofile 啟用基本程序取樣代碼 -fprofile-arcs 插入基于弧的程序取樣代碼 -fprofile-correction 啟用對流不一致取樣數(shù)據(jù)輸入的修正 -fprofile-dir= Set the top-level directory for storing the profile data. The default is 'pwd'. -fprofile-generate 啟用一些公共選項來生成樣本文件,以便進行基于取樣的優(yōu)化 -fprofile-generate= 啟用生成取樣信息的公共選項以支持基于取樣反饋的優(yōu)化,同時設置 -fprofile-dir= -fprofile-report Report on consistency of profile -fprofile-use 啟用一些公共選項以進行基于取樣的優(yōu)化 -fprofile-use= 啟用公共選項以進行基于取樣反饋的優(yōu)化,同時設置 -fprofile-dir= -fprofile-values 為取樣表達式的值插入相關代碼 -frandom-seed 此開關缺少可用文檔 -frandom-seed=<字符串> 使用字符串使編譯可以復現(xiàn) -freciprocal-math 與 -fassociative-math 相同,作用于包含除法的表達式。 -frecord-gcc-switches 在目標文件中記錄 gcc 命令行開關。 -free Turn on Redundant Extensions Elimination pass. -frerun-loop-opt 不起作用。為向前兼容保留的選項。 -fsanitize=address Enable AddressSanitizer, a memory error detector -fsanitize=thread Enable ThreadSanitizer, a data race detector -fsched-stalled-insns-dep=<N> 設置排隊中指令的進行早調(diào)度的依賴距離檢查 -fsched-stalled-insns=<N> 指定能被早期調(diào)度的在排隊中的指令的最大數(shù)量 -fsched-verbose=<N> 指定調(diào)度器的冗余級別 -fsched2-use-traces 不起作用。為向前兼容保留的選項。 -fsee 不起作用。為向前兼容保留的選項。 -fshow-column 診斷信息中給出行號。默認打開 -fsplit-stack Generate discontiguous stack frames -fstack-check 在程序中插入檢查棧溢出的代碼。與 fstack-check=specific 相同 -fstack-check=[no|generic|specific] 在程序中插入檢查棧溢出的代碼 -fstack-limit 此開關缺少可用文檔 -fstack-limit-symbol=<寄存器> 當堆棧越過寄存器時引發(fā)陷阱 -fstack-limit-symbol=<符號> 當堆棧越過符號時引發(fā)陷阱 -fstack-protector 使用 propolice 來保護堆棧 -fstack-protector-all 為每個函數(shù)使用堆棧保護機制 -fstack-reuse= -fstack-reuse=[all|named_vars|none] Set stack reuse level for local variables. -fstack-usage Output stack usage information on a per-function basis -fstrength-reduce 不起作用。為向前兼容保留的選項。 -fstrict-overflow 將有符號數(shù)溢出的行為視為未定義的 -fstrict-volatile-bitfields Force bitfield accesses to match their type width -fsync-libcalls Implement __atomic operations via libcalls to legacy __sync functions -fsyntax-only 檢查語法錯誤,然后停止 -ftarget-help 此開關缺少可用文檔 -ftest-coverage 生成“gcov”需要的數(shù)據(jù)文件 -ftime-report 報告每趟匯編的耗時 -ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] 設定默認的線程局部存儲代碼生成模式 -ftracer 通過尾復制進行超塊合成 -ftree-loop-linear Enable loop interchange transforms. Same as -floop-interchange -ftree-parallelize-loops= 啟用循環(huán)的自動并行化 -ftree-salias 不起作用。為向前兼容保留的選項。 -ftree-store-ccp 不起作用。為向前兼容保留的選項。 -ftree-store-copy-prop 不起作用。為向前兼容保留的選項。 -ftree-vectorizer-verbose=<number> This switch is deprecated. Use -fopt-info instead. -fuse-ld=bfd Use the bfd linker instead of the default linker -fuse-ld=gold Use the gold linker instead of the default linker -fuse-linker-plugin 此開關缺少可用文檔 -fverbose-asm 為匯編輸出添加額外注釋 -fversion 此開關缺少可用文檔 -fvisibility=[default|internal|hidden|protected] 設置符號的默認可見性 -fwritable-relocated-rdata Put relocated read-only data into .data section. -fzee 不起作用。為向前兼容保留的選項。 -fzero-initialized-in-bss 將初始化為零的數(shù)據(jù)存放在 bss 節(jié)中 -g 生成默認格式的調(diào)試信息 -gcoff 生成 COFF 格式的調(diào)試信息 -gdwarf- 生成 DWARF v2(或更新)格式的調(diào)試信息 -ggdb 生成默認擴展格式的調(diào)試信息 -gno-pubnames Don't generate DWARF pubnames and pubtypes sections. -gno-record-gcc-switches Don't record gcc command line switches in DWARF DW_AT_producer. -gno-split-dwarf Don't generate debug information in separate .dwo files -gno-strict-dwarf 生成較所選版本更先進的 DWARF 附加信息 -gpubnames Generate DWARF pubnames and pubtypes sections. -grecord-gcc-switches Record gcc command line switches in DWARF DW_AT_producer. -gsplit-dwarf Generate debug information in separate .dwo files -gstabs 生成 STABS 格式的調(diào)試信息 -gstabs+ 生成擴展 STABS 格式的調(diào)試信息 -gstrict-dwarf 不生成較所選版本更先進的 DWARF 附加信息 -gtoggle 切換調(diào)試信息生成 -gvms 生成 VMS 格式的調(diào)試信息 -gxcoff 生成 XCOFF 格式的調(diào)試信息 -gxcoff+ 生成 XCOFF 擴展格式的調(diào)試信息 -imultiarch <dir> Set <dir> to be the multiarch include subdirectory -iplugindir=<目錄> 將目錄設定為默認的插件子目錄 -p 啟用函數(shù)取樣 -pedantic-errors 與 -pedantic 類似,但將它們視作錯誤 -quiet 不顯示編譯的函數(shù)或逝去的時間 Usage: /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/as [option...] [asmfile...] Options: -a[sub-option...] turn on listings Sub-options [default hls]: c omit false conditionals d omit debugging directives g include general info h include high-level source l include assembly m include macro expansions n omit forms processing s include symbols =FILE list to FILE (must be last sub-option) --alternate initially turn on alternate macro syntax --compress-debug-sections compress DWARF debug sections using zlib --nocompress-debug-sections don't compress DWARF debug sections -D produce assembler debugging messages --debug-prefix-map OLD=NEW map OLD to NEW in debug information --defsym SYM=VAL define symbol SYM to given value -f skip whitespace and comment preprocessing -g --gen-debug generate debugging information --gstabs generate STABS debugging information --gstabs+ generate STABS debug info with GNU extensions --gdwarf-2 generate DWARF2 debugging information --gdwarf-sections generate per-function section names for DWARF line information --hash-size=<value> set the hash table size close to <value> --help show this message and exit --target-help show target specific options -I DIR add DIR to search list for .include directives -J don't warn about signed overflow -K warn when differences altered for long displacements -L,--keep-locals keep local symbols (e.g. starting with `L') -M,--mri assemble in MRI compatibility mode --MD FILE write dependency information in FILE (default none) -nocpp ignored -o OBJFILE name the object-file output OBJFILE (default a.out) -R fold data section into text section --reduce-memory-overheads prefer smaller memory use at the cost of longer assembly times --statistics print various measured statistics from execution --strip-local-absolute strip local absolute symbols --traditional-format Use same format as native assembler when possible --version print assembler version number and exit -W --no-warn suppress warnings --warn don't suppress warnings --fatal-warnings treat warnings as errors -w ignored -X ignored -Z generate object file even after errors --listing-lhs-width set the width in words of the output data column of the listing --listing-lhs-width2 set the width in words of the continuation lines of the output data column; ignored if smaller than the width of the first line --listing-rhs-width set the max width in characters of the lines from the source file --listing-cont-lines set the maximum number of continuation lines used for the output data column of the listing @FILE read options from FILE -n Do not optimize code alignment -q quieten some warnings --32/--64/--x32 generate 32bit/64bit/x32 code --divide ignored -march=CPU[,+EXTENSION...] generate code for CPU and EXTENSION, CPU is one of: generic32, generic64, i386, i486, i586, i686, pentium, pentiumpro, pentiumii, pentiumiii, pentium4, prescott, nocona, core, core2, corei7, l1om, k1om, k6, k6_2, athlon, opteron, k8, amdfam10, bdver1, bdver2, bdver3, bdver4, btver1, btver2 EXTENSION is combination of: 8087, 287, 387, no87, mmx, nommx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, sse4, nosse, avx, avx2, avx512f, avx512cd, avx512er, avx512pf, noavx, vmx, vmfunc, smx, xsave, xsaveopt, aes, pclmul, fsgsbase, rdrnd, f16c, bmi2, fma, fma4, xop, lwp, movbe, cx16, ept, lzcnt, hle, rtm, invpcid, clflush, nop, syscall, rdtscp, 3dnow, 3dnowa, padlock, svme, sse4a, abm, bmi, tbm, adx, rdseed, prfchw, smap, mpx, sha, clflushopt, xsavec, xsaves, prefetchwt1 -mtune=CPU optimize for CPU, CPU is one of: generic32, generic64, i8086, i186, i286, i386, i486, i586, i686, pentium, pentiumpro, pentiumii, pentiumiii, pentium4, prescott, nocona, core, core2, corei7, l1om, k1om, k6, k6_2, athlon, opteron, k8, amdfam10, bdver1, bdver2, bdver3, bdver4, btver1, btver2 -msse2avx encode SSE instructions with VEX prefix -msse-check=[none|error|warning] check SSE instructions -moperand-check=[none|error|warning] check operand combinations for validity -mavxscalar=[128|256] encode scalar AVX instructions with specific vector length -mevexlig=[128|256|512] encode scalar EVEX instructions with specific vector length -mevexwig=[0|1] encode EVEX instructions with specific EVEX.W value for EVEX.W bit ignored instructions -mmnemonic=[att|intel] use AT&T/Intel mnemonic -msyntax=[att|intel] use AT&T/Intel syntax -mindex-reg support pseudo index registers -mnaked-reg don't require `%' prefix for registers -mold-gcc support old (<= 2.8.1) versions of gcc -madd-bnd-prefix add BND prefix for all valid branches -mbig-obj generate big object files Report bugs to <http://www.sourceware.org/bugzilla/> Usage: collect2 [options] Wrap linker and generate constructor code if needed. Options: -debug Enable debug output --help Display this information -v, --version Display this program's version number Overview: http://gcc.gnu.org/onlinedocs/gccint/Collect2.html Report bugs: <http://gcc.gnu.org/bugs.html> 用法:/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld [選項] 文件... 選項: -a 關鍵字 Shared library control for HP/UX compatibility -A 架構, --architecture 架構 設定 CPU 架構 -b 目標, --format 目標 指定隨后的輸入文件的目標 -c 文件, --mri-script 文件 讀取 MRI 格式的鏈接腳本 -d, -dc, -dp 強制公共符號必須定義 -e 地址, --entry 地址 設定起始地址 -E, --export-dynamic 導出所有動態(tài)符號 --no-export-dynamic Undo the effect of --export-dynamic -EB 鏈接高位字節(jié)在前的目標文件 -EL 鏈接低位字節(jié)在前的目標文件 -f 共享庫, --auxiliary 共享庫 指定為某共享對象符號表的輔助過濾器 -F 共享庫, --filter 共享庫 指定為某共享對象符號表的過濾器 -g 忽略 -G 大小, --gpsize 大小 小數(shù)據(jù)的大小(如果未給出大小,與 --shared 相同) -h 文件名, -soname 文件名 設定共享庫的內(nèi)部名稱 -I 程序, --dynamic-linker 程序 將“程序”設為要使用的動態(tài)鏈接器 -l 庫名, --library 庫名 搜索庫“庫名” -L 目錄, --library-path 目錄 將“目錄”添加到庫搜索路徑中 --sysroot=<DIRECTORY> Override the default sysroot location -m 仿真 設定仿真 -M, --print-map 在標準輸出上打印鏈接圖文件 -n, --nmagic 不將數(shù)據(jù)對齊至頁邊界 -N, --omagic 不將數(shù)據(jù)對齊至頁邊界,不將 text 節(jié)只讀 --no-omagic 將數(shù)據(jù)對齊至頁邊界,令 text 節(jié)只讀 -o 文件, --output 文件 設定輸出文件名 -O 優(yōu)化輸出文件 -plugin PLUGIN Load named plugin -plugin-opt ARG Send arg to last-loaded plugin -flto Ignored for GCC LTO option compatibility -flto-partition= Ignored for GCC LTO option compatibility -fuse-ld= Ignored for GCC linker option compatibility -Qy 為 SVR4 兼容性所忽略 -q, --emit-relocs Generate relocations in final output -r, -i, --relocatable 生成可重新定位的輸出 -R 文件, --just-symbols 文件 僅鏈接符號 (如果是目標,與 --rpath 相同) -s, --strip-all 剔除所有符號信息 -S, --strip-debug 剔除調(diào)試符號信息 --strip-discarded 剔除被丟棄的節(jié)中的符號 --no-strip-discarded 不剔除被丟棄的節(jié)中的符號 -t, --trace 跟蹤文件打開操作 -T 文件, --script 文件 讀取鏈接腳本 --default-script 文件, -dT Read default linker script -u 符號, --undefined 符號 Start with undefined reference to SYMBOL --unique [=節(jié)] 不合并名為“節(jié)”的輸入節(jié)或孤立節(jié) -Ur 生成全局構造/析構函數(shù)表 -v, --version 顯示版本信息 -V 顯示版本和仿真信息 -x, --discard-all 丟棄所有局部符號 -X, --discard-locals 丟棄臨時局部符號(默認) --discard-none 不丟棄任何局部符號 -y 符號, --trace-symbol 符號 Trace mentions of SYMBOL -Y 路徑 Default search path for Solaris compatibility -(, --start-group 開始一個組 -), --end-group 結束一個組 --accept-unknown-input-arch 接受無法決定其架構的輸入文件 --no-accept-unknown-input-arch 拒絕架構不明的輸入文件 --as-needed Only set DT_NEEDED for following dynamic libs if used --no-as-needed Always set DT_NEEDED for dynamic libraries mentioned on the command line -assert 關鍵字 為 SunOS 兼容性所忽略 -Bdynamic, -dy, -call_shared 鏈接到共享庫 -Bstatic, -dn, -non_shared, -static 不鏈接到共享庫 -Bsymbolic Bind global references locally -Bsymbolic-functions Bind global function references locally --check-sections Check section addresses for overlaps (default) --no-check-sections Do not check section addresses for overlaps --copy-dt-needed-entries Copy DT_NEEDED links mentioned inside DSOs that follow --no-copy-dt-needed-entries Do not copy DT_NEEDED links mentioned inside DSOs that follow --cref 輸出交叉引用表 --defsym 符號=表達式 定義一個符號 --demangle [=風格] 解修飾符號名[使用“風格”] --embedded-relocs Generate embedded relocs --fatal-warnings 將警告當作錯誤 --no-fatal-warnings Do not treat warnings as errors (default) -fini 符號 Call SYMBOL at unload-time --force-exe-suffix 強制為生成的文件添加 .exe 后綴 --gc-sections 刪除未使用的節(jié)(在某些目標上) --no-gc-sections 不刪除未使用的節(jié)(默認) --print-gc-sections List removed unused sections on stderr --no-print-gc-sections Do not list removed unused sections --hash-size=<NUMBER> 初始的散列表大小設定接近“數(shù)” --help 顯示選項幫助 -init 符號 Call SYMBOL at load-time -Map 文件 寫入一個鏈接圖文件 --no-define-common Do not define Common storage --no-demangle Do not demangle symbol names --no-keep-memory 更多地使用磁盤 I/O 而不是內(nèi)存 --no-undefined 不允許在目標文件中存在無法解析的引用 --allow-shlib-undefined Allow unresolved references in shared libraries --no-allow-shlib-undefined 不允許在共享庫中存在無法解析的引用 --allow-multiple-definition 允許多個定義 --no-undefined-version 不允許未定義的版本 --default-symver 生成默認的符號版本 --default-imported-symver 為導入符號生成默認的符號版本 --no-warn-mismatch 不為不匹配的輸入文件發(fā)出警告 --no-warn-search-mismatch Don't warn on finding an incompatible library --no-whole-archive 關閉 --whole-archive --noinhibit-exec Create an output file even if errors occur -nostdlib Only use library directories specified on the command line --oformat 目標 指定輸出文件的目標 --print-output-format Print default output format -qmagic 為 Linux 兼容性所忽略 --reduce-memory-overheads Reduce memory overheads, possibly taking much longer --relax Reduce code size by using target specific optimizations --no-relax Do not use relaxation techniques to reduce code size --retain-symbols-file 文件 只保留在“文件”中列出的符號 -rpath 路徑 設定運行時共享庫的搜索路徑 -rpath-link 路徑 設定鏈接時共享庫的搜索路徑 -shared, -Bshareable 創(chuàng)建一個共享庫 -pie, --pic-executable 生成一個位置無關的可執(zhí)行文件 --sort-common [=ascending|descending] Sort common symbols by alignment [in specified order] --sort-section 名稱|對齊 Sort sections by name or maximum alignment --spare-dynamic-tags 計數(shù) How many tags to reserve in .dynamic section --split-by-file [=大小] Split output sections every SIZE octets --split-by-reloc [=計數(shù)] Split output sections every COUNT relocs --stats 打印內(nèi)存使用統(tǒng)計 --target-help 顯示目標相關的選項 --task-link 符號 Do task level linking --traditional-format Use same format as native linker --section-start 節(jié)=地址 設定有名節(jié)的地址 -Tbss 地址 設定 .bss 節(jié)的地址 -Tdata 地址 設定 .data 節(jié)的地址 -Ttext 地址 設定 .text 節(jié)的地址 -Ttext-segment 地址 Set address of text segment -Trodata-segment 地址 Set address of rodata segment -Tldata-segment 地址 Set address of ldata segment --unresolved-symbols=<method> How to handle unresolved symbols. <method> is: ignore-all, report-all, ignore-in-object-files, ignore-in-shared-libs --verbose [=NUMBER] 鏈接過程中輸出大量相關信息 --version-script 文件 讀取版本信息腳本 --version-exports-section 符號 Take export symbols list from .exports, using SYMBOL as the version. --dynamic-list-data Add data symbols to dynamic list --dynamic-list-cpp-new Use C++ operator new/delete dynamic list --dynamic-list-cpp-typeinfo Use C++ typeinfo dynamic list --dynamic-list 文件 Read dynamic list --warn-common 為重復的公共符號給出警告 --warn-constructors Warn if global constructors/destructors are seen --warn-multiple-gp Warn if the multiple GP values are used --warn-once 為每一個未定義的符號只警告一次 --warn-section-align Warn if start of section changes due to alignment --warn-shared-textrel Warn if shared object has DT_TEXTREL --warn-alternate-em Warn if an object has alternate ELF machine code --warn-unresolved-symbols 將不能解析的符號視作警告 --error-unresolved-symbols 將不能解析的符號視作錯誤 --whole-archive Include all objects from following archives --wrap 符號 Use wrapper functions for SYMBOL --ignore-unresolved-symbol 符號 Unresolved SYMBOL will not cause an error or warning @FILE Read options from FILE /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld:支持的目標: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld:支持的仿真:i386pe /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld:仿真特定選項: i386pe: --base_file <基址文件> 為可重定位的 DLL 生成一個基址文件 --dll 設定 DLL 的默認映象基地址 --file-alignment <大小> 設定文件對齊邊界 --heap <大小> 設定堆的初始大小 --image-base <地址> 設定可執(zhí)行文件的起始地址 --major-image-version <數(shù)> 設定可執(zhí)行文件的版本號 --major-os-version <數(shù)> 設定對操作系統(tǒng)版本的最低要求 --major-subsystem-version <數(shù)> 設定對操作系統(tǒng)子系統(tǒng)版本的最低要求 --minor-image-version <數(shù)> 設定可執(zhí)行文件的修訂版本號 --minor-os-version <數(shù)> 設定對操作系統(tǒng)修訂版本的最低要求 --minor-subsystem-version <數(shù)> 設定對操作系統(tǒng)子系統(tǒng)修訂版本的最低要求 --section-alignment <大小> 設定節(jié)的對齊邊界 --stack <大小> 設定初始棧的大小 --subsystem <名>[:<版本>] 設定需要的操作系統(tǒng)子系統(tǒng)[和版本號] --support-old-code 支持與舊式代碼的交互工作 --[no-]leading-underscore Set explicit symbol underscore prefix mode --thumb-entry=<symbol> Set the entry point to be Thumb <symbol> --insert-timestamp Use a real timestamp rather than zero. This makes binaries non-deterministic --add-stdcall-alias 導出帶與不帶 @nn 的符號 --disable-stdcall-fixup 不將 _sym 鏈接至 _sym@nn --enable-stdcall-fixup 將 _sym 鏈接至 _sym@nn 而不給出警告 --exclude-symbols 符號,符號,... 將一些符號排除在自動導入以外 --exclude-all-symbols Exclude all symbols from automatic export --exclude-libs 庫,庫,... 將一些庫排除在自動導入以外 --exclude-modules-for-implib mod,mod,... Exclude objects, archive members from auto export, place into import library instead. --export-all-symbols 自動將所有全局量導出至 DLL --kill-at 從導出符號中移去 @nn --out-implib <文件> 生成導入庫 --output-def <文件> 為建立的 DLL 生成一個 .DEF 文件 --warn-duplicate-exports Warn about duplicate exports --compat-implib 生成后向兼容的導入庫; 同時生成 __imp_<符號>。 --enable-auto-image-base[=<address>] Automatically choose image base for DLLs (optionally starting with address) unless specifically set with --image-base --disable-auto-image-base 不自動選擇映象基地址。(默認) --dll-search-prefix=<字符串> 動態(tài)鏈接至 DLL 而缺少導入庫時,使用 <字符串><基本名>.dll 而不是 lib<基本名>.dll --enable-auto-import Do sophisticated linking of _sym to __imp_sym for DATA references --disable-auto-import 不為 DLL 自動導入 DATA 項 --enable-runtime-pseudo-reloc Work around auto-import limitations by adding pseudo-relocations resolved at runtime. --disable-runtime-pseudo-reloc Do not add runtime pseudo-relocations for auto-imported DATA. --enable-extra-pe-debug 當生成或鏈接至 DLL 時(尤其當自動導入時)啟用 詳細的調(diào)試輸出 --large-address-aware 可執(zhí)行文件支持大于 2 GB 的虛擬內(nèi)存地址 --disable-large-address-aware Executable does not support virtual addresses greater than 2 gigabytes --enable-long-section-names Use long COFF section names even in executable image files --disable-long-section-names Never use long COFF section names, even in object files --dynamicbase Image base address may be relocated using address space layout randomization (ASLR) --forceinteg Code integrity checks are enforced --nxcompat Image is compatible with data execution prevention --no-isolation Image understands isolation but do not isolate the image --no-seh Image does not use SEH. No SE handler may be called in this image --no-bind Do not bind this image --wdmdriver Driver uses the WDM model --tsaware Image is Terminal Server aware 向 <http://www.sourceware.org/bugzilla/> 報告程序缺陷 For bug reporting instructions, please see: <http://gcc.gnu.org/bugs.html>文檔中找不到的選項
-Wno-psabi
suppress these va_list mangling warnings with gcc -Wno-psabi。
-fno-short-enums
-fshort-enums支持給enum類型分配它聲明的值域范圍的字節(jié)數(shù);
enum類型等于大小足夠的最小整數(shù)類型。
也就是說
typedef enum num{one = 1,two = 2,three = 3,four = 4,}NUM;NUM num1;
sizeof(num1)不增加這個-fshort-enums選項的時候為4,增加后為大小為1;
-fno-short-enums則是無這個選項優(yōu)化處理。gcc是默認沒有-fshort-enums這個選項的;
-fno-strict-aliasing
Allows the compiler to assume the strictest aliasing rules applicable to the language being compiled. For C (and C++), this activates optimizations based on the type of expressions. In particular, an object of one type is assumed never to reside at the same address as an object of a different type, unless the types are almost the same. For example, an unsigned int can alias an int, but not avoid* or a double. A character type may alias any other type.要確保不違反這個規(guī)則,那么確實需要讓不同指針指向同一個內(nèi)存位置怎么辦?對于已有的代碼,違反的地方非常多,那么可以加gcc的-fno-strict-aliasing參數(shù)。其實在開啟優(yōu)化選項-O2和-O3的情況下,gcc會自動采用strictaliasing進行編譯器的優(yōu)化。為了允許不同指針指向同一個內(nèi)存位置,需要加gcc的編譯選項: CFLAGS+=-fno-strict-aliasing。
If optimization level is >= 2 in gcc-4.1, strict-aliasing is used, and this could cause probelms when a pointer is referencing to a different type of object and the object is refered thereafter by using this pointer. That is the case in this example. So you should force the compiler to not use strict-aliasing by a argument "-fno-strict-aliasing" if you want to use "-O2" or "-O3".錯誤實例:
float f = j;unsigned int* p = (unsigned int*)(&f);在存在強制類型轉換的情況下,采用-O1和采用-O2或-O3產(chǎn)生的運行結果是不同的。
-mfpu = name(neon or vfpvx) -mfloat-abi = name(soft、hard、 softfp)
ARM平臺指定浮點數(shù)運算優(yōu)化,軟浮點和硬浮點,以及浮點運算向量單元。
NEON:SIMD(Single Instruction Multiple Data 單指令多重數(shù)據(jù)) 指令集, 其針對多媒體和訊號處理程式具備標準化的加速能力。
VFP: (Vector Float Point), 向量浮點運算單元,arm11(s3c6410 支持VFPv2),Cortex-A8(s5pv210)支持VFPv3.
NEON和VFPv3 浮點協(xié)處理器共享寄存器組,所以在匯編時,指令是一樣的。
軟浮點是通過浮點庫去實現(xiàn)浮點運算的,效率低;硬浮點是通過浮點運算單元(FPU)來完成的,效率高。
(1)硬浮點(hard-float)
編譯器將代碼直接編譯成硬件浮點協(xié)處理器(浮點運算單元FPU)能識別的指令,這些指令在執(zhí)行的時候ARM核直接把它轉給協(xié)處理器執(zhí)行。FPU 通常有一套額外的寄存器來完成浮點參數(shù)傳遞和運算。使用實際的硬件浮點運算單元(FPU)會帶來性能的提升。
(2)軟浮點(soft-float)
編譯器把浮點運算轉成浮點運算的函數(shù)調(diào)用和庫函數(shù)調(diào)用,沒有FPU的指令調(diào)用,也沒有浮點寄存器的參數(shù)傳遞。浮點參數(shù)的傳遞也是通過ARM寄存器或者堆棧完成?,F(xiàn)在的Linux系統(tǒng)默認編譯選擇使用hard-float,如果系統(tǒng)沒有任何浮點處理器單元,這就會產(chǎn)生非法指令和異常。因而一般的系統(tǒng)鏡像都采用軟浮點以兼容沒有VFP的處理器。
如果只指定 -mfpu,那么默認編譯不會選擇選擇硬件浮點指令集
如果只指定 -mfloat-abi = hard或者softfp,那么編譯會使用硬件浮點指令集
…….未完待續(xù),碰到了新的再添加。
總結
以上是生活随笔為你收集整理的gcc编译部分编译选项的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java去处科学技术法,java撤销科学
- 下一篇: RocketMQ-单条消息大小上限