1GCC(1) GNU GCC(1)
2
3
4
6 gcc - GNU project C and C++ compiler
7
9 gcc [-c⎪-S⎪-E] [-std=standard]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-pedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...] [-mmachine-option...]
15 [-o outfile] infile...
16
17 Only the most useful options are listed here; see below for the remain‐
18 der. g++ accepts mostly the same options as gcc.
19
21 When you invoke GCC, it normally does preprocessing, compilation,
22 assembly and linking. The "overall options" allow you to stop this
23 process at an intermediate stage. For example, the -c option says not
24 to run the linker. Then the output consists of object files output by
25 the assembler.
26
27 Other options are passed on to one stage of processing. Some options
28 control the preprocessor and others the compiler itself. Yet other
29 options control the assembler and linker; most of these are not docu‐
30 mented here, since you rarely need to use any of them.
31
32 Most of the command line options that you can use with GCC are useful
33 for C programs; when an option is only useful with another language
34 (usually C++), the explanation says so explicitly. If the description
35 for a particular option does not mention a source language, you can use
36 that option with all supported languages.
37
38 The gcc program accepts options and file names as operands. Many
39 options have multi-letter names; therefore multiple single-letter
40 options may not be grouped: -dr is very different from -d -r.
41
42 You can mix options and other arguments. For the most part, the order
43 you use doesn't matter. Order does matter when you use several options
44 of the same kind; for example, if you specify -L more than once, the
45 directories are searched in the order specified.
46
47 Many options have long names starting with -f or with -W---for example,
48 -fstrength-reduce, -Wformat and so on. Most of these have both posi‐
49 tive and negative forms; the negative form of -ffoo would be -fno-foo.
50 This manual documents only one of these two forms, whichever one is not
51 the default.
52
54 Option Summary
55
56 Here is a summary of all the options, grouped by type. Explanations
57 are in the following sections.
58
59 Overall Options
60 -c -S -E -o file -combine -pipe -pass-exit-codes -x language
61 -v -### --help --target-help --version
62
63 C Language Options
64 -ansi -std=standard -fgnu89-inline -aux-info filename -fno-asm
65 -fno-builtin -fno-builtin-function -fhosted -ffreestanding
66 -fms-extensions -trigraphs -no-integrated-cpp -traditional -tra‐
67 ditional-cpp -fallow-single-precision -fcond-mismatch
68 -fsigned-bitfields -fsigned-char -funsigned-bitfields -fun‐
69 signed-char
70
71 C++ Language Options
72 -fabi-version=n -fno-access-control -fcheck-new -fconserve-space
73 -ffriend-injection -fno-const-strings -fno-elide-constructors
74 -fno-enforce-eh-specs -ffor-scope -fno-for-scope -fno-gnu-key‐
75 words -fno-implicit-templates -fno-implicit-inline-templates
76 -fno-implement-inlines -fms-extensions -fno-nonansi-builtins
77 -fno-operator-names -fno-optional-diags -fpermissive -frepo
78 -fno-rtti -fstats -ftemplate-depth-n -fno-threadsafe-statics
79 -fuse-cxa-atexit -fno-weak -nostdinc++ -fno-default-inline
80 -fvisibility-inlines-hidden -Wabi -Wctor-dtor-privacy -Wnon-vir‐
81 tual-dtor -Wreorder -Weffc++ -Wno-deprecated -Wstrict-null-sen‐
82 tinel -Wno-non-template-friend -Wold-style-cast -Woverloaded-vir‐
83 tual -Wno-pmf-conversions -Wsign-promo
84
85 Objective-C and Objective-C++ Language Options
86 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
87 -fno-nil-receivers -fobjc-call-cxx-cdtors -fobjc-direct-dispatch
88 -fobjc-exceptions -fobjc-gc -freplace-objc-classes -fzero-link
89 -gen-decls -Wassign-intercept -Wno-protocol -Wselector
90 -Wstrict-selector-match -Wundeclared-selector
91
92 Language Independent Options
93 -fmessage-length=n -fdiagnostics-show-location=[once⎪every-line]
94 -fdiagnostics-show-options
95
96 Warning Options
97 -fsyntax-only -pedantic -pedantic-errors -w -Wextra -Wall
98 -Waggregate-return -Wno-attributes -Wc++-compat -Wcast-align
99 -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wno-depre‐
100 cated-declarations -Wdisabled-optimization -Wno-div-by-zero
101 -Wno-endif-labels -Werror -Werror-implicit-function-declaration
102 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 -Wno-for‐
103 mat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k
104 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wim‐
105 port -Wno-import -Winit-self -Winline -Wno-int-to-pointer-cast
106 -Wno-invalid-offsetof -Winvalid-pch -Wlarger-than-len -Wun‐
107 safe-loop-optimizations -Wlong-long -Wmain -Wmissing-braces
108 -Wmissing-field-initializers -Wmissing-format-attribute -Wmiss‐
109 ing-include-dirs -Wmissing-noreturn -Wno-multichar -Wnonnull
110 -Wpacked -Wpadded -Wparentheses -Wpointer-arith
111 -Wno-pointer-to-int-cast -Wredundant-decls -Wreturn-type -Wse‐
112 quence-point -Wshadow -Wsign-compare -Wstack-protector
113 -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default
114 -Wswitch-enum -Wsystem-headers -Wtrigraphs -Wundef -Wuninitial‐
115 ized -Wunknown-pragmas -Wno-pragmas -Wunreachable-code -Wunused
116 -Wunused-function -Wunused-label -Wunused-parameter
117 -Wunused-value -Wunused-variable -Wvariadic-macros
118 -Wvolatile-register-var -Wwrite-strings
119
120 C-only Warning Options
121 -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
122 -Wnested-externs -Wold-style-definition -Wstrict-prototypes
123 -Wtraditional -Wdeclaration-after-statement -Wpointer-sign
124
125 Debugging Options
126 -dletters -dumpspecs -dumpmachine -dumpversion -fdump-unnumbered
127 -fdump-translation-unit[-n] -fdump-class-hierarchy[-n]
128 -fdump-ipa-all -fdump-ipa-cgraph -fdump-tree-all -fdump-tree-origi‐
129 nal[-n] -fdump-tree-optimized[-n] -fdump-tree-inlined[-n]
130 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias -fdump-tree-ch
131 -fdump-tree-ssa[-n] -fdump-tree-pre[-n] -fdump-tree-ccp[-n]
132 -fdump-tree-dce[-n] -fdump-tree-gimple[-raw] -fdump-tree-mud‐
133 flap[-n] -fdump-tree-dom[-n] -fdump-tree-dse[-n]
134 -fdump-tree-phiopt[-n] -fdump-tree-forwprop[-n] -fdump-tree-copyre‐
135 name[-n] -fdump-tree-nrv -fdump-tree-vect -fdump-tree-sink
136 -fdump-tree-sra[-n] -fdump-tree-salias -fdump-tree-fre[-n]
137 -fdump-tree-vrp[-n] -ftree-vectorizer-verbose=n
138 -fdump-tree-storeccp[-n] -feliminate-dwarf2-dups -felimi‐
139 nate-unused-debug-types -feliminate-unused-debug-symbols
140 -fmem-report -fprofile-arcs -frandom-seed=string -fsched-verbose=n
141 -ftest-coverage -ftime-report -fvar-tracking -g -glevel -gcoff
142 -gdwarf-2 -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ -p
143 -pg -print-file-name=library -print-libgcc-file-name
144 -print-multi-directory -print-multi-lib -print-prog-name=program
145 -print-search-dirs -Q -save-temps -time
146
147 Optimization Options
148 -falign-functions=n -falign-jumps=n -falign-labels=n
149 -falign-loops=n -fbounds-check -fmudflap -fmudflapth -fmudflapir
150 -fbranch-probabilities -fprofile-values -fvpt -fbranch-tar‐
151 get-load-optimize -fbranch-target-load-optimize2 -fbtr-bb-exclusive
152 -fcaller-saves -fcprop-registers -fcse-follow-jumps
153 -fcse-skip-blocks -fcx-limited-range -fdata-sections -fde‐
154 layed-branch -fdelete-null-pointer-checks -fearly-inlining -fex‐
155 pensive-optimizations -ffast-math -ffloat-store -fforce-addr
156 -ffunction-sections -fgcse -fgcse-lm -fgcse-sm -fgcse-las
157 -fgcse-after-reload -floop-optimize -fcrossjumping -fif-conversion
158 -fif-conversion2 -finline-functions -finline-functions-called-once
159 -finline-limit=n -fkeep-inline-functions -fkeep-static-consts
160 -fmerge-constants -fmerge-all-constants -fmodulo-sched
161 -fno-branch-count-reg -fno-default-inline -fno-defer-pop
162 -floop-optimize2 -fmove-loop-invariants -fno-function-cse
163 -fno-guess-branch-probability -fno-inline -fno-math-errno
164 -fno-peephole -fno-peephole2 -funsafe-math-optimizations -fun‐
165 safe-loop-optimizations -ffinite-math-only -fno-trapping-math
166 -fno-zero-initialized-in-bss -fomit-frame-pointer -foptimize-reg‐
167 ister-move -foptimize-sibling-calls -fprefetch-loop-arrays -fpro‐
168 file-generate -fprofile-use -fregmove -frename-registers -fre‐
169 order-blocks -freorder-blocks-and-partition -freorder-functions
170 -frerun-cse-after-loop -frerun-loop-opt -frounding-math -fsched‐
171 ule-insns -fschedule-insns2 -fno-sched-interblock -fno-sched-spec
172 -fsched-spec-load -fsched-spec-load-dangerous
173 -fsched-stalled-insns=n -fsched-stalled-insns-dep=n
174 -fsched2-use-superblocks -fsched2-use-traces -freschedule-mod‐
175 ulo-scheduled-loops -fsignaling-nans -fsingle-precision-constant
176 -fstack-protector -fstack-protector-all -fstrength-reduce
177 -fstrict-aliasing -ftracer -fthread-jumps -funroll-all-loops
178 -funroll-loops -fpeel-loops -fsplit-ivs-in-unroller
179 -funswitch-loops -fvariable-expansion-in-unroller -ftree-pre
180 -ftree-ccp -ftree-dce -ftree-loop-optimize -ftree-loop-linear
181 -ftree-loop-im -ftree-loop-ivcanon -fivopts -ftree-dominator-opts
182 -ftree-dse -ftree-copyrename -ftree-sink -ftree-ch -ftree-sra
183 -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize
184 -ftree-vect-loop-version -ftree-salias -fweb -ftree-copy-prop
185 -ftree-store-ccp -ftree-store-copy-prop -fwhole-program --param
186 name=value -O -O0 -O1 -O2 -O3 -Os
187
188 Preprocessor Options
189 -Aquestion=answer -A-question[=answer] -C -dD -dI -dM -dN
190 -Dmacro[=defn] -E -H -idirafter dir -include file -imacros file
191 -iprefix file -iwithprefix dir -iwithprefixbefore dir -isystem
192 dir -isysroot dir -M -MM -MF -MG -MP -MQ -MT -nostdinc -P
193 -fworking-directory -remap -trigraphs -undef -Umacro -Wp,option
194 -Xpreprocessor option
195
196 Assembler Option
197 -Wa,option -Xassembler option
198
199 Linker Options
200 object-file-name -llibrary -nostartfiles -nodefaultlibs -nost‐
201 dlib -pie -rdynamic -s -static -static-libgcc -shared
202 -shared-libgcc -symbolic -Wl,option -Xlinker option -u symbol
203
204 Directory Options
205 -Bprefix -Idir -iquotedir -Ldir -specs=file -I- --sysroot=dir
206
207 Target Options
208 -V version -b machine
209
210 Machine Dependent Options
211 ARC Options -EB -EL -mmangle-cpu -mcpu=cpu -mtext=text-section
212 -mdata=data-section -mrodata=readonly-data-section
213
214 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
215 -mapcs-stack-check -mno-apcs-stack-check -mapcs-float
216 -mno-apcs-float -mapcs-reentrant -mno-apcs-reentrant -msched-pro‐
217 log -mno-sched-prolog -mlittle-endian -mbig-endian -mwords-lit‐
218 tle-endian -mfloat-abi=name -msoft-float -mhard-float -mfpe
219 -mthumb-interwork -mno-thumb-interwork -mcpu=name -march=name
220 -mfpu=name -mstructure-size-boundary=n -mabort-on-noreturn
221 -mlong-calls -mno-long-calls -msingle-pic-base -mno-sin‐
222 gle-pic-base -mpic-register=reg -mnop-fun-dllimport -mcir‐
223 rus-fix-invalid-insns -mno-cirrus-fix-invalid-insns -mpoke-func‐
224 tion-name -mthumb -marm -mtpcs-frame -mtpcs-leaf-frame
225 -mcaller-super-interworking -mcallee-super-interworking -mtp=name
226
227 AVR Options -mmcu=mcu -msize -minit-stack=n -mno-interrupts
228 -mcall-prologues -mno-tablejump -mtiny-stack -mint8
229
230 Blackfin Options -momit-leaf-frame-pointer
231 -mno-omit-leaf-frame-pointer -mspecld-anomaly -mno-specld-anomaly
232 -mcsync-anomaly -mno-csync-anomaly -mlow-64k -mno-low64k
233 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
234 -mlong-calls -mno-long-calls
235
236 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
237 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
238 -mno-side-effects -mstack-align -mdata-align -mconst-align
239 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
240 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
241 -mno-mul-bug-workaround
242
243 CRX Options -mmac -mpush-args
244
245 Darwin Options -all_load -allowable_client -arch
246 -arch_errors_fatal -arch_only -bind_at_load -bundle -bun‐
247 dle_loader -client_name -compatibility_version -current_version
248 -dead_strip -dependency-file -dylib_file -dylinker_install_name
249 -dynamic -dynamiclib -exported_symbols_list -filelist
250 -flat_namespace -force_cpusubtype_ALL -force_flat_namespace
251 -headerpad_max_install_names -image_base -init -install_name
252 -keep_private_externs -multi_module -multiply_defined -multi‐
253 ply_defined_unused -noall_load -no_dead_strip_inits_and_terms
254 -nofixprebinding -nomultidefs -noprebind -noseglinkedit
255 -pagezero_size -prebind -prebind_all_twolevel_modules -pri‐
256 vate_bundle -read_only_relocs -sectalign -sectobjectsymbols
257 -whyload -seg1addr -sectcreate -sectobjectsymbols -sectorder
258 -segaddr -segs_read_only_addr -segs_read_write_addr -seg_addr_table
259 -seg_addr_table_filename -seglinkedit -segprot
260 -segs_read_only_addr -segs_read_write_addr -single_module -static
261 -sub_library -sub_umbrella -twolevel_namespace -umbrella -unde‐
262 fined -unexported_symbols_list -weak_reference_mismatches -what‐
263 sloaded -F -gused -gfull -mmacosx-version-min=version
264 -mone-byte-bool
265
266 DEC Alpha Options -mno-fp-regs -msoft-float -malpha-as -mgas
267 -mieee -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
268 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
269 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
270 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
271 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
272
273 DEC Alpha/VMS Options -mvms-return-codes
274
275 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
276 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
277 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
278 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
279 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
280 -mno-pack -mno-eflags -mcond-move -mno-cond-move -moptimize-mem‐
281 bar -mno-optimize-membar -mscc -mno-scc -mcond-exec
282 -mno-cond-exec -mvliw-branch -mno-vliw-branch -mmulti-cond-exec
283 -mno-multi-cond-exec -mnested-cond-exec -mno-nested-cond-exec
284 -mtomcat-stats -mTLS -mtls -mcpu=cpu
285
286 H8/300 Options -mrelax -mh -ms -mn -mint32 -malign-300
287
288 HPPA Options -march=architecture-type -mbig-switch -mdis‐
289 able-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
290 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
291 -mlinker-opt -mlong-calls -mlong-load-store -mno-big-switch
292 -mno-disable-fpregs -mno-disable-indexing -mno-fast-indirect-calls
293 -mno-gas -mno-jump-in-delay -mno-long-load-store -mno-porta‐
294 ble-runtime -mno-soft-float -mno-space-regs -msoft-float
295 -mpa-risc-1-0 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime
296 -mschedule=cpu-type -mspace-regs -msio -mwsio -munix=unix-std
297 -nolibdld -static -threads
298
299 i386 and x86-64 Options -mtune=cpu-type -march=cpu-type -mfp‐
300 math=unit -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387
301 -msoft-float -msvr3-shlib -mno-wide-multiply -mrtd -malign-dou‐
302 ble -mpreferred-stack-boundary=num -mmmx -msse -msse2 -msse3
303 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -mthreads
304 -mno-align-stringops -minline-all-stringops -mpush-args -maccumu‐
305 late-outgoing-args -m128bit-long-double -m96bit-long-double
306 -mregparm=num -msseregparm -momit-leaf-frame-pointer
307 -mno-red-zone -mno-tls-direct-seg-refs -mcmodel=code-model -m32
308 -m64 -mlarge-data-threshold=num
309
310 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
311 -mno-pic -mvolatile-asm-stop -mregister-names -mno-sdata -mcon‐
312 stant-gp -mauto-pic -minline-float-divide-min-latency -min‐
313 line-float-divide-max-throughput -minline-int-divide-min-latency
314 -minline-int-divide-max-throughput -minline-sqrt-min-latency -min‐
315 line-sqrt-max-throughput -mno-dwarf2-asm -mearly-stop-bits
316 -mfixed-range=register-range -mtls-size=tls-size -mtune=cpu-type
317 -mt -pthread -milp32 -mlp64
318
319 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
320 -mno-align-loops -missue-rate=number -mbranch-cost=number
321 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
322 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
323
324 M32C Options -mcpu=cpu -msim -memregs=number
325
326 M680x0 Options -m68000 -m68020 -m68020-40 -m68020-60 -m68030
327 -m68040 -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000
328 -mc68020 -mnobitfield -mrtd -mshort -msoft-float -mpcrel
329 -malign-int -mstrict-align -msep-data -mno-sep-data
330 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
331
332 M68hc1x Options -m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12
333 -mauto-incdec -minmax -mlong-calls -mshort
334 -msoft-reg-count=count
335
336 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div -mre‐
337 lax-immediates -mno-relax-immediates -mwide-bitfields
338 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
339 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
340 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
341 -mstack-increment
342
343 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
344 -mips3 -mips4 -mips32 -mips32r2 -mips64 -mips16 -mno-mips16
345 -mabi=abi -mabicalls -mno-abicalls -mxgot -mno-xgot -mgp32
346 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float -msingle-float
347 -mdouble-float -mdsp -mpaired-single -mips3d -mlong64 -mlong32
348 -msym32 -mno-sym32 -Gnum -membedded-data -mno-embedded-data
349 -muninit-const-in-rodata -mno-uninit-const-in-rodata
350 -msplit-addresses -mno-split-addresses -mexplicit-relocs
351 -mno-explicit-relocs -mcheck-zero-division -mno-check-zero-divi‐
352 sion -mdivide-traps -mdivide-breaks -mmemcpy -mno-memcpy
353 -mlong-calls -mno-long-calls -mmad -mno-mad -mfused-madd
354 -mno-fused-madd -nocpp -mfix-r4000 -mno-fix-r4000 -mfix-r4400
355 -mno-fix-r4400 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
356 -mfix-sb1 -mno-fix-sb1 -mflush-func=func -mno-flush-func
357 -mbranch-likely -mno-branch-likely -mfp-exceptions -mno-fp-excep‐
358 tions -mvr4130-align -mno-vr4130-align
359
360 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
361 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv -mto‐
362 plevel-symbols -melf -mbranch-predict -mno-branch-predict
363 -mbase-addresses -mno-base-addresses -msingle-exit -mno-sin‐
364 gle-exit
365
366 MN10300 Options -mmult-bug -mno-mult-bug -mam33 -mno-am33
367 -mam33-2 -mno-am33-2 -mreturn-pointer-on-d0 -mno-crt0 -mrelax
368
369 MT Options -mno-crt0 -mbacc -msim -march=cpu-type
370
371 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
372 -m10 -mbcopy -mbcopy-builtin -mint32 -mno-int16 -mint16
373 -mno-int32 -mfloat32 -mno-float64 -mfloat64 -mno-float32 -mab‐
374 shi -mno-abshi -mbranch-expensive -mbranch-cheap -msplit
375 -mno-split -munix-asm -mdec-asm
376
377 PowerPC Options See RS/6000 and PowerPC Options.
378
379 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type -mpower
380 -mno-power -mpower2 -mno-power2 -mpowerpc -mpowerpc64 -mno-pow‐
381 erpc -maltivec -mno-altivec -mpowerpc-gpopt -mno-powerpc-gpopt
382 -mpowerpc-gfxopt -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopc‐
383 ntb -mno-popcntb -mfprnd -mno-fprnd -mmfpgpr -mno-mfpgpr
384 -mnew-mnemonics -mold-mnemonics -mfull-toc -mminimal-toc
385 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
386 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
387 -mhard-float -mmultiple -mno-multiple -mstring -mno-string
388 -mupdate -mno-update -mfused-madd -mno-fused-madd -mbit-align
389 -mno-bit-align -mstrict-align -mno-strict-align -mrelocatable
390 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib -mtoc
391 -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian -mdy‐
392 namic-no-pic -maltivec -mswdiv -mprioritize-restricted-insns=pri‐
393 ority -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
394 -mcall-sysv -mcall-netbsd -maix-struct-return
395 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt -misel
396 -mno-isel -misel=yes -misel=no -mspe -mno-spe -mspe=yes -mspe=no
397 -mvrsave -mno-vrsave -mfloat-gprs=yes -mfloat-gprs=no
398 -mfloat-gprs=single -mfloat-gprs=double -mprototype -mno-prototype
399 -msim -mmvme -mads -myellowknife -memb -msdata -msdata=opt
400 -mvxworks -mwindiss -G num -pthread
401
402 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
403 -mhard-float -msoft-float -mlong-double-64 -mlong-double-128
404 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack
405 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle -m64 -m31 -mde‐
406 bug -mno-debug -mesa -mzarch -mtpf-trace -mno-tpf-trace
407 -mfused-madd -mno-fused-madd -mwarn-framesize -mwarn-dynamicstack
408 -mstack-size -mstack-guard
409
410 SH Options -m1 -m2 -m2e -m3 -m3e -m4-nofpu -m4-single-only
411 -m4-single -m4 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al
412 -m5-64media -m5-64media-nofpu -m5-32media -m5-32media-nofpu
413 -m5-compact -m5-compact-nofpu -mb -ml -mdalign -mrelax
414 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave
415 -mieee -misize -mpadstruct -mspace -mprefergot -musermode
416 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name -mad‐
417 just-unroll -mindexed-addressing -mgettrcost=number -mpt-fixed
418 -minvalid-symbols
419
420 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
421 -m32 -m64 -mapp-regs -mno-app-regs -mfaster-structs
422 -mno-faster-structs -mfpu -mno-fpu -mhard-float -msoft-float
423 -mhard-quad-float -msoft-quad-float -mimpure-text
424 -mno-impure-text -mlittle-endian -mstack-bias -mno-stack-bias
425 -munaligned-doubles -mno-unaligned-doubles -mv8plus -mno-v8plus
426 -mvis -mno-vis -threads -pthreads -pthread
427
428 System V Options -Qy -Qn -YP,paths -Ym,dir
429
430 TMS320C3x/C4x Options -mcpu=cpu -mbig -msmall -mregparm -mmem‐
431 parm -mfast-fix -mmpyi -mbk -mti -mdp-isr-reload -mrpts=count
432 -mrptb -mdb -mloop-unsigned -mparallel-insns -mparallel-mpy
433 -mpreserve-float
434
435 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep -mpro‐
436 log-function -mno-prolog-function -mspace -mtda=n -msda=n
437 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt -mno-dis‐
438 able-callt -mv850e1 -mv850e -mv850 -mbig-switch
439
440 VAX Options -mg -mgnu -munix
441
442 x86-64 Options See i386 and x86-64 Options.
443
444 Xstormy16 Options -msim
445
446 Xtensa Options -mconst16 -mno-const16 -mfused-madd -mno-fused-madd
447 -mtext-section-literals -mno-text-section-literals -mtarget-align
448 -mno-target-align -mlongcalls -mno-longcalls
449
450 zSeries Options See S/390 and zSeries Options.
451
452 Code Generation Options
453 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
454 -fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables
455 -finhibit-size-directive -finstrument-functions -fno-common
456 -fno-ident -fpcc-struct-return -fpic -fPIC -fpie -fPIE
457 -fno-jump-tables -freg-struct-return -fshared-data -fshort-enums
458 -fshort-double -fshort-wchar -fverbose-asm -fpack-struct[=n]
459 -fstack-check -fstack-limit-register=reg -fstack-limit-symbol=sym
460 -fargument-alias -fargument-noalias -fargument-noalias-global
461 -fleading-underscore -ftls-model=model -ftrapv -fwrapv
462 -fbounds-check -fvisibility -fopenmp
463
464 Options Controlling the Kind of Output
465
466 Compilation can involve up to four stages: preprocessing, compilation
467 proper, assembly and linking, always in that order. GCC is capable of
468 preprocessing and compiling several files either into several assembler
469 input files, or into one assembler input file; then each assembler
470 input file produces an object file, and linking combines all the object
471 files (those newly compiled, and those specified as input) into an exe‐
472 cutable file.
473
474 For any given input file, the file name suffix determines what kind of
475 compilation is done:
476
477 file.c
478 C source code which must be preprocessed.
479
480 file.i
481 C source code which should not be preprocessed.
482
483 file.ii
484 C++ source code which should not be preprocessed.
485
486 file.m
487 Objective-C source code. Note that you must link with the libobjc
488 library to make an Objective-C program work.
489
490 file.mi
491 Objective-C source code which should not be preprocessed.
492
493 file.mm
494 file.M
495 Objective-C++ source code. Note that you must link with the
496 libobjc library to make an Objective-C++ program work. Note that
497 .M refers to a literal capital M.
498
499 file.mii
500 Objective-C++ source code which should not be preprocessed.
501
502 file.h
503 C, C++, Objective-C or Objective-C++ header file to be turned into
504 a precompiled header.
505
506 file.cc
507 file.cp
508 file.cxx
509 file.cpp
510 file.CPP
511 file.c++
512 file.C
513 C++ source code which must be preprocessed. Note that in .cxx, the
514 last two letters must both be literally x. Likewise, .C refers to
515 a literal capital C.
516
517 file.mm
518 file.M
519 Objective-C++ source code which must be preprocessed.
520
521 file.mii
522 Objective-C++ source code which should not be preprocessed.
523
524 file.hh
525 file.H
526 C++ header file to be turned into a precompiled header.
527
528 file.f
529 file.for
530 file.FOR
531 Fixed form Fortran source code which should not be preprocessed.
532
533 file.F
534 file.fpp
535 file.FPP
536 Fixed form Fortran source code which must be preprocessed (with the
537 traditional preprocessor).
538
539 file.f90
540 file.f95
541 Free form Fortran source code which should not be preprocessed.
542
543 file.F90
544 file.F95
545 Free form Fortran source code which must be preprocessed (with the
546 traditional preprocessor).
547
548 file.ads
549 Ada source code file which contains a library unit declaration (a
550 declaration of a package, subprogram, or generic, or a generic
551 instantiation), or a library unit renaming declaration (a package,
552 generic, or subprogram renaming declaration). Such files are also
553 called specs.
554
555 file.adb
556 Ada source code file containing a library unit body (a subprogram
557 or package body). Such files are also called bodies.
558
559 file.s
560 Assembler code.
561
562 file.S
563 Assembler code which must be preprocessed.
564
565 other
566 An object file to be fed straight into linking. Any file name with
567 no recognized suffix is treated this way.
568
569 You can specify the input language explicitly with the -x option:
570
571 -x language
572 Specify explicitly the language for the following input files
573 (rather than letting the compiler choose a default based on the
574 file name suffix). This option applies to all following input
575 files until the next -x option. Possible values for language are:
576
577 c c-header c-cpp-output
578 c++ c++-header c++-cpp-output
579 objective-c objective-c-header objective-c-cpp-output
580 objective-c++ objective-c++-header objective-c++-cpp-output
581 assembler assembler-with-cpp
582 ada
583 f95 f95-cpp-input
584 java
585 treelang
586
587 -x none
588 Turn off any specification of a language, so that subsequent files
589 are handled according to their file name suffixes (as they are if
590 -x has not been used at all).
591
592 -pass-exit-codes
593 Normally the gcc program will exit with the code of 1 if any phase
594 of the compiler returns a non-success return code. If you specify
595 -pass-exit-codes, the gcc program will instead return with numeri‐
596 cally highest error produced by any phase that returned an error
597 indication.
598
599 If you only want some of the stages of compilation, you can use -x (or
600 filename suffixes) to tell gcc where to start, and one of the options
601 -c, -S, or -E to say where gcc is to stop. Note that some combinations
602 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
603
604 -c Compile or assemble the source files, but do not link. The linking
605 stage simply is not done. The ultimate output is in the form of an
606 object file for each source file.
607
608 By default, the object file name for a source file is made by
609 replacing the suffix .c, .i, .s, etc., with .o.
610
611 Unrecognized input files, not requiring compilation or assembly,
612 are ignored.
613
614 -S Stop after the stage of compilation proper; do not assemble. The
615 output is in the form of an assembler code file for each non-assem‐
616 bler input file specified.
617
618 By default, the assembler file name for a source file is made by
619 replacing the suffix .c, .i, etc., with .s.
620
621 Input files that don't require compilation are ignored.
622
623 -E Stop after the preprocessing stage; do not run the compiler proper.
624 The output is in the form of preprocessed source code, which is
625 sent to the standard output.
626
627 Input files which don't require preprocessing are ignored.
628
629 -o file
630 Place output in file file. This applies regardless to whatever
631 sort of output is being produced, whether it be an executable file,
632 an object file, an assembler file or preprocessed C code.
633
634 If -o is not specified, the default is to put an executable file in
635 a.out, the object file for source.suffix in source.o, its assembler
636 file in source.s, a precompiled header file in source.suffix.gch,
637 and all preprocessed C source on standard output.
638
639 -v Print (on standard error output) the commands executed to run the
640 stages of compilation. Also print the version number of the com‐
641 piler driver program and of the preprocessor and the compiler
642 proper.
643
644 -###
645 Like -v except the commands are not executed and all command argu‐
646 ments are quoted. This is useful for shell scripts to capture the
647 driver-generated command lines.
648
649 -pipe
650 Use pipes rather than temporary files for communication between the
651 various stages of compilation. This fails to work on some systems
652 where the assembler is unable to read from a pipe; but the GNU
653 assembler has no trouble.
654
655 -combine
656 If you are compiling multiple source files, this option tells the
657 driver to pass all the source files to the compiler at once (for
658 those languages for which the compiler can handle this). This will
659 allow intermodule analysis (IMA) to be performed by the compiler.
660 Currently the only language for which this is supported is C. If
661 you pass source files for multiple languages to the driver, using
662 this option, the driver will invoke the compiler(s) that support
663 IMA once each, passing each compiler all the source files appropri‐
664 ate for it. For those languages that do not support IMA this
665 option will be ignored, and the compiler will be invoked once for
666 each source file in that language. If you use this option in con‐
667 junction with -save-temps, the compiler will generate multiple pre-
668 processed files (one for each source file), but only one (combined)
669 .o or .s file.
670
671 --help
672 Print (on the standard output) a description of the command line
673 options understood by gcc. If the -v option is also specified then
674 --help will also be passed on to the various processes invoked by
675 gcc, so that they can display the command line options they accept.
676 If the -Wextra option is also specified then command line options
677 which have no documentation associated with them will also be dis‐
678 played.
679
680 --target-help
681 Print (on the standard output) a description of target specific
682 command line options for each tool.
683
684 --version
685 Display the version number and copyrights of the invoked GCC.
686
687 Compiling C++ Programs
688
689 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
690 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh or .H; and
691 preprocessed C++ files use the suffix .ii. GCC recognizes files with
692 these names and compiles them as C++ programs even if you call the com‐
693 piler the same way as for compiling C programs (usually with the name
694 gcc).
695
696 However, C++ programs often require class libraries as well as a com‐
697 piler that understands the C++ language---and under some circumstances,
698 you might want to compile programs or header files from standard input,
699 or otherwise without a suffix that flags them as C++ programs. You
700 might also like to precompile a C header file with a .h extension to be
701 used in C++ compilations. g++ is a program that calls GCC with the
702 default language set to C++, and automatically specifies linking
703 against the C++ library. On many systems, g++ is also installed with
704 the name c++.
705
706 When you compile C++ programs, you may specify many of the same com‐
707 mand-line options that you use for compiling programs in any language;
708 or command-line options meaningful for C and related languages; or
709 options that are meaningful only for C++ programs.
710
711 Options Controlling C Dialect
712
713 The following options control the dialect of C (or languages derived
714 from C, such as C++, Objective-C and Objective-C++) that the compiler
715 accepts:
716
717 -ansi
718 In C mode, support all ISO C90 programs. In C++ mode, remove GNU
719 extensions that conflict with ISO C++.
720
721 This turns off certain features of GCC that are incompatible with
722 ISO C90 (when compiling C code), or of standard C++ (when compiling
723 C++ code), such as the "asm" and "typeof" keywords, and predefined
724 macros such as "unix" and "vax" that identify the type of system
725 you are using. It also enables the undesirable and rarely used ISO
726 trigraph feature. For the C compiler, it disables recognition of
727 C++ style // comments as well as the "inline" keyword.
728
729 The alternate keywords "__asm__", "__extension__", "__inline__" and
730 "__typeof__" continue to work despite -ansi. You would not want to
731 use them in an ISO C program, of course, but it is useful to put
732 them in header files that might be included in compilations done
733 with -ansi. Alternate predefined macros such as "__unix__" and
734 "__vax__" are also available, with or without -ansi.
735
736 The -ansi option does not cause non-ISO programs to be rejected
737 gratuitously. For that, -pedantic is required in addition to
738 -ansi.
739
740 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
741 used. Some header files may notice this macro and refrain from
742 declaring certain functions or defining certain macros that the ISO
743 standard doesn't call for; this is to avoid interfering with any
744 programs that might use these names for other things.
745
746 Functions which would normally be built in but do not have seman‐
747 tics defined by ISO C (such as "alloca" and "ffs") are not built-in
748 functions with -ansi is used.
749
750 -std=
751 Determine the language standard. This option is currently only
752 supported when compiling C or C++. A value for this option must be
753 provided; possible values are
754
755 c89
756 iso9899:1990
757 ISO C90 (same as -ansi).
758
759 iso9899:199409
760 ISO C90 as modified in amendment 1.
761
762 c99
763 c9x
764 iso9899:1999
765 iso9899:199x
766 ISO C99. Note that this standard is not yet fully supported;
767 see <http://gcc.gnu.org/gcc-4.1/c99status.html> for more infor‐
768 mation. The names c9x and iso9899:199x are deprecated.
769
770 gnu89
771 Default, ISO C90 plus GNU extensions (including some C99 fea‐
772 tures).
773
774 gnu99
775 gnu9x
776 ISO C99 plus GNU extensions. When ISO C99 is fully implemented
777 in GCC, this will become the default. The name gnu9x is depre‐
778 cated.
779
780 c++98
781 The 1998 ISO C++ standard plus amendments.
782
783 gnu++98
784 The same as -std=c++98 plus GNU extensions. This is the
785 default for C++ code.
786
787 Even when this option is not specified, you can still use some of
788 the features of newer standards in so far as they do not conflict
789 with previous C standards. For example, you may use "__restrict__"
790 even when -std=c99 is not specified.
791
792 The -std options specifying some version of ISO C have the same
793 effects as -ansi, except that features that were not in ISO C90 but
794 are in the specified version (for example, // comments and the
795 "inline" keyword in ISO C99) are not disabled.
796
797 -fgnu89-inline
798 The option -fgnu89-inline tells GCC to use the traditional GNU
799 semantics for "inline" functions when in C99 mode.
800 Using this option is roughly equivalent to adding the
801 "gnu_inline" function attribute to all inline functions.
802
803 This option is accepted by GCC versions 4.1.3 and up. In GCC ver‐
804 sions prior to 4.3, C99 inline semantics are not supported, and
805 thus this option is effectively assumed to be present regardless of
806 whether or not it is specified; the only effect of specifying it
807 explicitly is to disable warnings about using inline functions in
808 C99 mode. Likewise, the option -fno-gnu89-inline is not supported
809 in versions of GCC before 4.3. It will be supported only in C99 or
810 gnu99 mode, not in C89 or gnu89 mode.
811
812 The preprocesor macros "__GNUC_GNU_INLINE__" and
813 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
814 effect for "inline" functions.
815
816 -aux-info filename
817 Output to the given filename prototyped declarations for all func‐
818 tions declared and/or defined in a translation unit, including
819 those in header files. This option is silently ignored in any lan‐
820 guage other than C.
821
822 Besides declarations, the file indicates, in comments, the origin
823 of each declaration (source file and line), whether the declaration
824 was implicit, prototyped or unprototyped (I, N for new or O for
825 old, respectively, in the first character after the line number and
826 the colon), and whether it came from a declaration or a definition
827 (C or F, respectively, in the following character). In the case of
828 function definitions, a K&R-style list of arguments followed by
829 their declarations is also provided, inside comments, after the
830 declaration.
831
832 -fno-asm
833 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
834 code can use these words as identifiers. You can use the keywords
835 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
836 -fno-asm.
837
838 In C++, this switch only affects the "typeof" keyword, since "asm"
839 and "inline" are standard keywords. You may want to use the
840 -fno-gnu-keywords flag instead, which has the same effect. In C99
841 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
842 and "typeof" keywords, since "inline" is a standard keyword in ISO
843 C99.
844
845 -fno-builtin
846 -fno-builtin-function
847 Don't recognize built-in functions that do not begin with
848 __builtin_ as prefix.
849
850 GCC normally generates special code to handle certain built-in
851 functions more efficiently; for instance, calls to "alloca" may
852 become single instructions that adjust the stack directly, and
853 calls to "memcpy" may become inline copy loops. The resulting code
854 is often both smaller and faster, but since the function calls no
855 longer appear as such, you cannot set a breakpoint on those calls,
856 nor can you change the behavior of the functions by linking with a
857 different library. In addition, when a function is recognized as a
858 built-in function, GCC may use information about that function to
859 warn about problems with calls to that function, or to generate
860 more efficient code, even if the resulting code still contains
861 calls to that function. For example, warnings are given with
862 -Wformat for bad calls to "printf", when "printf" is built in, and
863 "strlen" is known not to modify global memory.
864
865 With the -fno-builtin-function option only the built-in function
866 function is disabled. function must not begin with __builtin_. If
867 a function is named this is not built-in in this version of GCC,
868 this option is ignored. There is no corresponding -fbuiltin-func‐
869 tion option; if you wish to enable built-in functions selectively
870 when using -fno-builtin or -ffreestanding, you may define macros
871 such as:
872
873 #define abs(n) __builtin_abs ((n))
874 #define strcpy(d, s) __builtin_strcpy ((d), (s))
875
876 -fhosted
877 Assert that compilation takes place in a hosted environment. This
878 implies -fbuiltin. A hosted environment is one in which the entire
879 standard library is available, and in which "main" has a return
880 type of "int". Examples are nearly everything except a kernel.
881 This is equivalent to -fno-freestanding.
882
883 -ffreestanding
884 Assert that compilation takes place in a freestanding environment.
885 This implies -fno-builtin. A freestanding environment is one in
886 which the standard library may not exist, and program startup may
887 not necessarily be at "main". The most obvious example is an OS
888 kernel. This is equivalent to -fno-hosted.
889
890 -fms-extensions
891 Accept some non-standard constructs used in Microsoft header files.
892
893 Some cases of unnamed fields in structures and unions are only
894 accepted with this option.
895
896 -trigraphs
897 Support ISO C trigraphs. The -ansi option (and -std options for
898 strict ISO C conformance) implies -trigraphs.
899
900 -no-integrated-cpp
901 Performs a compilation in two passes: preprocessing and compiling.
902 This option allows a user supplied "cc1", "cc1plus", or "cc1obj"
903 via the -B option. The user supplied compilation step can then add
904 in an additional preprocessing step after normal preprocessing but
905 before compiling. The default is to use the integrated cpp (inter‐
906 nal cpp)
907
908 The semantics of this option will change if "cc1", "cc1plus", and
909 "cc1obj" are merged.
910
911 -traditional
912 -traditional-cpp
913 Formerly, these options caused GCC to attempt to emulate a pre-
914 standard C compiler. They are now only supported with the -E
915 switch. The preprocessor continues to support a pre-standard mode.
916 See the GNU CPP manual for details.
917
918 -fcond-mismatch
919 Allow conditional expressions with mismatched types in the second
920 and third arguments. The value of such an expression is void.
921 This option is not supported for C++.
922
923 -funsigned-char
924 Let the type "char" be unsigned, like "unsigned char".
925
926 Each kind of machine has a default for what "char" should be. It
927 is either like "unsigned char" by default or like "signed char" by
928 default.
929
930 Ideally, a portable program should always use "signed char" or
931 "unsigned char" when it depends on the signedness of an object.
932 But many programs have been written to use plain "char" and expect
933 it to be signed, or expect it to be unsigned, depending on the
934 machines they were written for. This option, and its inverse, let
935 you make such a program work with the opposite default.
936
937 The type "char" is always a distinct type from each of "signed
938 char" or "unsigned char", even though its behavior is always just
939 like one of those two.
940
941 -fsigned-char
942 Let the type "char" be signed, like "signed char".
943
944 Note that this is equivalent to -fno-unsigned-char, which is the
945 negative form of -funsigned-char. Likewise, the option
946 -fno-signed-char is equivalent to -funsigned-char.
947
948 -fsigned-bitfields
949 -funsigned-bitfields
950 -fno-signed-bitfields
951 -fno-unsigned-bitfields
952 These options control whether a bit-field is signed or unsigned,
953 when the declaration does not use either "signed" or "unsigned".
954 By default, such a bit-field is signed, because this is consistent:
955 the basic integer types such as "int" are signed types.
956
957 Options Controlling C++ Dialect
958
959 This section describes the command-line options that are only meaning‐
960 ful for C++ programs; but you can also use most of the GNU compiler
961 options regardless of what language your program is in. For example,
962 you might compile a file "firstClass.C" like this:
963
964 g++ -g -frepo -O -c firstClass.C
965
966 In this example, only -frepo is an option meant only for C++ programs;
967 you can use the other options with any language supported by GCC.
968
969 Here is a list of options that are only for compiling C++ programs:
970
971 -fabi-version=n
972 Use version n of the C++ ABI. Version 2 is the version of the C++
973 ABI that first appeared in G++ 3.4. Version 1 is the version of
974 the C++ ABI that first appeared in G++ 3.2. Version 0 will always
975 be the version that conforms most closely to the C++ ABI specifica‐
976 tion. Therefore, the ABI obtained using version 0 will change as
977 ABI bugs are fixed.
978
979 The default is version 2.
980
981 -fno-access-control
982 Turn off all access checking. This switch is mainly useful for
983 working around bugs in the access control code.
984
985 -fcheck-new
986 Check that the pointer returned by "operator new" is non-null
987 before attempting to modify the storage allocated. This check is
988 normally unnecessary because the C++ standard specifies that "oper‐
989 ator new" will only return 0 if it is declared throw(), in which
990 case the compiler will always check the return value even without
991 this option. In all other cases, when "operator new" has a non-
992 empty exception specification, memory exhaustion is signalled by
993 throwing "std::bad_alloc". See also new (nothrow).
994
995 -fconserve-space
996 Put uninitialized or runtime-initialized global variables into the
997 common segment, as C does. This saves space in the executable at
998 the cost of not diagnosing duplicate definitions. If you compile
999 with this flag and your program mysteriously crashes after "main()"
1000 has completed, you may have an object that is being destroyed twice
1001 because two definitions were merged.
1002
1003 This option is no longer useful on most targets, now that support
1004 has been added for putting variables into BSS without making them
1005 common.
1006
1007 -ffriend-injection
1008 Inject friend functions into the enclosing namespace, so that they
1009 are visible outside the scope of the class in which they are
1010 declared. Friend functions were documented to work this way in the
1011 old Annotated C++ Reference Manual, and versions of G++ before 4.1
1012 always worked that way. However, in ISO C++ a friend function
1013 which is not declared in an enclosing scope can only be found using
1014 argument dependent lookup. This option causes friends to be
1015 injected as they were in earlier releases.
1016
1017 This option is for compatibility, and may be removed in a future
1018 release of G++.
1019
1020 -fno-const-strings
1021 Give string constants type "char *" instead of type "const char *".
1022 By default, G++ uses type "const char *" as required by the stan‐
1023 dard. Even if you use -fno-const-strings, you cannot actually mod‐
1024 ify the value of a string constant.
1025
1026 This option might be removed in a future release of G++. For maxi‐
1027 mum portability, you should structure your code so that it works
1028 with string constants that have type "const char *".
1029
1030 -fno-elide-constructors
1031 The C++ standard allows an implementation to omit creating a tempo‐
1032 rary which is only used to initialize another object of the same
1033 type. Specifying this option disables that optimization, and
1034 forces G++ to call the copy constructor in all cases.
1035
1036 -fno-enforce-eh-specs
1037 Don't generate code to check for violation of exception specifica‐
1038 tions at runtime. This option violates the C++ standard, but may
1039 be useful for reducing code size in production builds, much like
1040 defining NDEBUG. This does not give user code permission to throw
1041 exceptions in violation of the exception specifications; the com‐
1042 piler will still optimize based on the specifications, so throwing
1043 an unexpected exception will result in undefined behavior.
1044
1045 -ffor-scope
1046 -fno-for-scope
1047 If -ffor-scope is specified, the scope of variables declared in a
1048 for-init-statement is limited to the for loop itself, as specified
1049 by the C++ standard. If -fno-for-scope is specified, the scope of
1050 variables declared in a for-init-statement extends to the end of
1051 the enclosing scope, as was the case in old versions of G++, and
1052 other (traditional) implementations of C++.
1053
1054 The default if neither flag is given to follow the standard, but to
1055 allow and give a warning for old-style code that would otherwise be
1056 invalid, or have different behavior.
1057
1058 -fno-gnu-keywords
1059 Do not recognize "typeof" as a keyword, so that code can use this
1060 word as an identifier. You can use the keyword "__typeof__"
1061 instead. -ansi implies -fno-gnu-keywords.
1062
1063 -fno-implicit-templates
1064 Never emit code for non-inline templates which are instantiated
1065 implicitly (i.e. by use); only emit code for explicit instantia‐
1066 tions.
1067
1068 -fno-implicit-inline-templates
1069 Don't emit code for implicit instantiations of inline templates,
1070 either. The default is to handle inlines differently so that com‐
1071 piles with and without optimization will need the same set of
1072 explicit instantiations.
1073
1074 -fno-implement-inlines
1075 To save space, do not emit out-of-line copies of inline functions
1076 controlled by #pragma implementation. This will cause linker
1077 errors if these functions are not inlined everywhere they are
1078 called.
1079
1080 -fms-extensions
1081 Disable pedantic warnings about constructs used in MFC, such as
1082 implicit int and getting a pointer to member function via non-stan‐
1083 dard syntax.
1084
1085 -fno-nonansi-builtins
1086 Disable built-in declarations of functions that are not mandated by
1087 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
1088 "bzero", "conjf", and other related functions.
1089
1090 -fno-operator-names
1091 Do not treat the operator name keywords "and", "bitand", "bitor",
1092 "compl", "not", "or" and "xor" as synonyms as keywords.
1093
1094 -fno-optional-diags
1095 Disable diagnostics that the standard says a compiler does not need
1096 to issue. Currently, the only such diagnostic issued by G++ is the
1097 one for a name having multiple meanings within a class.
1098
1099 -fpermissive
1100 Downgrade some diagnostics about nonconformant code from errors to
1101 warnings. Thus, using -fpermissive will allow some nonconforming
1102 code to compile.
1103
1104 -frepo
1105 Enable automatic template instantiation at link time. This option
1106 also implies -fno-implicit-templates.
1107
1108 -fno-rtti
1109 Disable generation of information about every class with virtual
1110 functions for use by the C++ runtime type identification features
1111 (dynamic_cast and typeid). If you don't use those parts of the
1112 language, you can save some space by using this flag. Note that
1113 exception handling uses the same information, but it will generate
1114 it as needed.
1115
1116 -fstats
1117 Emit statistics about front-end processing at the end of the compi‐
1118 lation. This information is generally only useful to the G++
1119 development team.
1120
1121 -ftemplate-depth-n
1122 Set the maximum instantiation depth for template classes to n. A
1123 limit on the template instantiation depth is needed to detect end‐
1124 less recursions during template class instantiation. ANSI/ISO C++
1125 conforming programs must not rely on a maximum depth greater than
1126 17.
1127
1128 -fno-threadsafe-statics
1129 Do not emit the extra code to use the routines specified in the C++
1130 ABI for thread-safe initialization of local statics. You can use
1131 this option to reduce code size slightly in code that doesn't need
1132 to be thread-safe.
1133
1134 -fuse-cxa-atexit
1135 Register destructors for objects with static storage duration with
1136 the "__cxa_atexit" function rather than the "atexit" function.
1137 This option is required for fully standards-compliant handling of
1138 static destructors, but will only work if your C library supports
1139 "__cxa_atexit".
1140
1141 -fvisibility-inlines-hidden
1142 Causes all inlined methods to be marked with "__attribute__ ((visi‐
1143 bility ("hidden")))" so that they do not appear in the export table
1144 of a DSO and do not require a PLT indirection when used within the
1145 DSO. Enabling this option can have a dramatic effect on load and
1146 link times of a DSO as it massively reduces the size of the dynamic
1147 export table when the library makes heavy use of templates.
1148
1149 You may mark a method as having a visibility explicitly to negate
1150 the effect of the switch for that method. For example, if you do
1151 want to compare pointers to a particular inline method, or the
1152 method has local static data, you might mark it as having default
1153 visibility.
1154
1155 -fno-weak
1156 Do not use weak symbol support, even if it is provided by the
1157 linker. By default, G++ will use weak symbols if they are avail‐
1158 able. This option exists only for testing, and should not be used
1159 by end-users; it will result in inferior code and has no benefits.
1160 This option may be removed in a future release of G++.
1161
1162 -nostdinc++
1163 Do not search for header files in the standard directories specific
1164 to C++, but do still search the other standard directories. (This
1165 option is used when building the C++ library.)
1166
1167 In addition, these optimization, warning, and code generation options
1168 have meanings only for C++ programs:
1169
1170 -fno-default-inline
1171 Do not assume inline for functions defined inside a class scope.
1172 Note that these functions will have linkage like inline func‐
1173 tions; they just won't be inlined by default.
1174
1175 -Wabi (C++ only)
1176 Warn when G++ generates code that is probably not compatible with
1177 the vendor-neutral C++ ABI. Although an effort has been made to
1178 warn about all such cases, there are probably some cases that are
1179 not warned about, even though G++ is generating incompatible code.
1180 There may also be cases where warnings are emitted even though the
1181 code that is generated will be compatible.
1182
1183 You should rewrite your code to avoid these warnings if you are
1184 concerned about the fact that code generated by G++ may not be
1185 binary compatible with code generated by other compilers.
1186
1187 The known incompatibilities at this point include:
1188
1189 * Incorrect handling of tail-padding for bit-fields. G++ may
1190 attempt to pack data into the same byte as a base class. For
1191 example:
1192
1193 struct A { virtual void f(); int f1 : 1; };
1194 struct B : public A { int f2 : 1; };
1195
1196 In this case, G++ will place "B::f2" into the same byte
1197 as"A::f1"; other compilers will not. You can avoid this prob‐
1198 lem by explicitly padding "A" so that its size is a multiple of
1199 the byte size on your platform; that will cause G++ and other
1200 compilers to layout "B" identically.
1201
1202 * Incorrect handling of tail-padding for virtual bases. G++ does
1203 not use tail padding when laying out virtual bases. For exam‐
1204 ple:
1205
1206 struct A { virtual void f(); char c1; };
1207 struct B { B(); char c2; };
1208 struct C : public A, public virtual B {};
1209
1210 In this case, G++ will not place "B" into the tail-padding for
1211 "A"; other compilers will. You can avoid this problem by
1212 explicitly padding "A" so that its size is a multiple of its
1213 alignment (ignoring virtual base classes); that will cause G++
1214 and other compilers to layout "C" identically.
1215
1216 * Incorrect handling of bit-fields with declared widths greater
1217 than that of their underlying types, when the bit-fields appear
1218 in a union. For example:
1219
1220 union U { int i : 4096; };
1221
1222 Assuming that an "int" does not have 4096 bits, G++ will make
1223 the union too small by the number of bits in an "int".
1224
1225 * Empty classes can be placed at incorrect offsets. For example:
1226
1227 struct A {};
1228
1229 struct B {
1230 A a;
1231 virtual void f ();
1232 };
1233
1234 struct C : public B, public A {};
1235
1236 G++ will place the "A" base class of "C" at a nonzero offset;
1237 it should be placed at offset zero. G++ mistakenly believes
1238 that the "A" data member of "B" is already at offset zero.
1239
1240 * Names of template functions whose types involve "typename" or
1241 template template parameters can be mangled incorrectly.
1242
1243 template <typename Q>
1244 void f(typename Q::X) {}
1245
1246 template <template <typename> class Q>
1247 void f(typename Q<int>::X) {}
1248
1249 Instantiations of these templates may be mangled incorrectly.
1250
1251 -Wctor-dtor-privacy (C++ only)
1252 Warn when a class seems unusable because all the constructors or
1253 destructors in that class are private, and it has neither friends
1254 nor public static member functions.
1255
1256 -Wnon-virtual-dtor (C++ only)
1257 Warn when a class appears to be polymorphic, thereby requiring a
1258 virtual destructor, yet it declares a non-virtual one. This warn‐
1259 ing is enabled by -Wall.
1260
1261 -Wreorder (C++ only)
1262 Warn when the order of member initializers given in the code does
1263 not match the order in which they must be executed. For instance:
1264
1265 struct A {
1266 int i;
1267 int j;
1268 A(): j (0), i (1) { }
1269 };
1270
1271 The compiler will rearrange the member initializers for i and j to
1272 match the declaration order of the members, emitting a warning to
1273 that effect. This warning is enabled by -Wall.
1274
1275 The following -W... options are not affected by -Wall.
1276
1277 -Weffc++ (C++ only)
1278 Warn about violations of the following style guidelines from Scott
1279 Meyers' Effective C++ book:
1280
1281 * Item 11: Define a copy constructor and an assignment operator
1282 for classes with dynamically allocated memory.
1283
1284 * Item 12: Prefer initialization to assignment in constructors.
1285
1286 * Item 14: Make destructors virtual in base classes.
1287
1288 * Item 15: Have "operator=" return a reference to *this.
1289
1290 * Item 23: Don't try to return a reference when you must return
1291 an object.
1292
1293 Also warn about violations of the following style guidelines from
1294 Scott Meyers' More Effective C++ book:
1295
1296 * Item 6: Distinguish between prefix and postfix forms of incre‐
1297 ment and decrement operators.
1298
1299 * Item 7: Never overload "&&", "⎪⎪", or ",".
1300
1301 When selecting this option, be aware that the standard library
1302 headers do not obey all of these guidelines; use grep -v to filter
1303 out those warnings.
1304
1305 -Wno-deprecated (C++ only)
1306 Do not warn about usage of deprecated features.
1307
1308 -Wstrict-null-sentinel (C++ only)
1309 Warn also about the use of an uncasted "NULL" as sentinel. When
1310 compiling only with GCC this is a valid sentinel, as "NULL" is
1311 defined to "__null". Although it is a null pointer constant not a
1312 null pointer, it is guaranteed to of the same size as a pointer.
1313 But this use is not portable across different compilers.
1314
1315 -Wno-non-template-friend (C++ only)
1316 Disable warnings when non-templatized friend functions are declared
1317 within a template. Since the advent of explicit template specifi‐
1318 cation support in G++, if the name of the friend is an unqualified-
1319 id (i.e., friend foo(int)), the C++ language specification demands
1320 that the friend declare or define an ordinary, nontemplate func‐
1321 tion. (Section 14.5.3). Before G++ implemented explicit specifi‐
1322 cation, unqualified-ids could be interpreted as a particular spe‐
1323 cialization of a templatized function. Because this non-conforming
1324 behavior is no longer the default behavior for G++, -Wnon-tem‐
1325 plate-friend allows the compiler to check existing code for poten‐
1326 tial trouble spots and is on by default. This new compiler behav‐
1327 ior can be turned off with -Wno-non-template-friend which keeps the
1328 conformant compiler code but disables the helpful warning.
1329
1330 -Wold-style-cast (C++ only)
1331 Warn if an old-style (C-style) cast to a non-void type is used
1332 within a C++ program. The new-style casts (dynamic_cast,
1333 static_cast, reinterpret_cast, and const_cast) are less vulnerable
1334 to unintended effects and much easier to search for.
1335
1336 -Woverloaded-virtual (C++ only)
1337 Warn when a function declaration hides virtual functions from a
1338 base class. For example, in:
1339
1340 struct A {
1341 virtual void f();
1342 };
1343
1344 struct B: public A {
1345 void f(int);
1346 };
1347
1348 the "A" class version of "f" is hidden in "B", and code like:
1349
1350 B* b;
1351 b->f();
1352
1353 will fail to compile.
1354
1355 -Wno-pmf-conversions (C++ only)
1356 Disable the diagnostic for converting a bound pointer to member
1357 function to a plain pointer.
1358
1359 -Wsign-promo (C++ only)
1360 Warn when overload resolution chooses a promotion from unsigned or
1361 enumerated type to a signed type, over a conversion to an unsigned
1362 type of the same size. Previous versions of G++ would try to pre‐
1363 serve unsignedness, but the standard mandates the current behavior.
1364
1365 struct A {
1366 operator int ();
1367 A& operator = (int);
1368 };
1369
1370 main ()
1371 {
1372 A a,b;
1373 a = b;
1374 }
1375
1376 In this example, G++ will synthesize a default A& operator = (const
1377 A&);, while cfront will use the user-defined operator =.
1378
1379 Options Controlling Objective-C and Objective-C++ Dialects
1380
1381 (NOTE: This manual does not describe the Objective-C and Objective-C++
1382 languages themselves. See
1383
1384 This section describes the command-line options that are only meaning‐
1385 ful for Objective-C and Objective-C++ programs, but you can also use
1386 most of the language-independent GNU compiler options. For example,
1387 you might compile a file "some_class.m" like this:
1388
1389 gcc -g -fgnu-runtime -O -c some_class.m
1390
1391 In this example, -fgnu-runtime is an option meant only for Objective-C
1392 and Objective-C++ programs; you can use the other options with any lan‐
1393 guage supported by GCC.
1394
1395 Note that since Objective-C is an extension of the C language, Objec‐
1396 tive-C compilations may also use options specific to the C front-end
1397 (e.g., -Wtraditional). Similarly, Objective-C++ compilations may use
1398 C++-specific options (e.g., -Wabi).
1399
1400 Here is a list of options that are only for compiling Objective-C and
1401 Objective-C++ programs:
1402
1403 -fconstant-string-class=class-name
1404 Use class-name as the name of the class to instantiate for each
1405 literal string specified with the syntax "@"..."". The default
1406 class name is "NXConstantString" if the GNU runtime is being used,
1407 and "NSConstantString" if the NeXT runtime is being used (see
1408 below). The -fconstant-cfstrings option, if also present, will
1409 override the -fconstant-string-class setting and cause "@"...""
1410 literals to be laid out as constant CoreFoundation strings.
1411
1412 -fgnu-runtime
1413 Generate object code compatible with the standard GNU Objective-C
1414 runtime. This is the default for most types of systems.
1415
1416 -fnext-runtime
1417 Generate output compatible with the NeXT runtime. This is the
1418 default for NeXT-based systems, including Darwin and Mac OS X. The
1419 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
1420 is used.
1421
1422 -fno-nil-receivers
1423 Assume that all Objective-C message dispatches (e.g., "[receiver
1424 message:arg]") in this translation unit ensure that the receiver is
1425 not "nil". This allows for more efficient entry points in the run‐
1426 time to be used. Currently, this option is only available in con‐
1427 junction with the NeXT runtime on Mac OS X 10.3 and later.
1428
1429 -fobjc-call-cxx-cdtors
1430 For each Objective-C class, check if any of its instance variables
1431 is a C++ object with a non-trivial default constructor. If so,
1432 synthesize a special "- (id) .cxx_construct" instance method that
1433 will run non-trivial default constructors on any such instance
1434 variables, in order, and then return "self". Similarly, check if
1435 any instance variable is a C++ object with a non-trivial destruc‐
1436 tor, and if so, synthesize a special "- (void) .cxx_destruct"
1437 method that will run all such default destructors, in reverse
1438 order.
1439
1440 The "- (id) .cxx_construct" and/or "- (void) .cxx_destruct" methods
1441 thusly generated will only operate on instance variables declared
1442 in the current Objective-C class, and not those inherited from
1443 superclasses. It is the responsibility of the Objective-C runtime
1444 to invoke all such methods in an object's inheritance hierarchy.
1445 The "- (id) .cxx_construct" methods will be invoked by the runtime
1446 immediately after a new object instance is allocated; the "- (void)
1447 .cxx_destruct" methods will be invoked immediately before the run‐
1448 time deallocates an object instance.
1449
1450 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
1451 later has support for invoking the "- (id) .cxx_construct" and "-
1452 (void) .cxx_destruct" methods.
1453
1454 -fobjc-direct-dispatch
1455 Allow fast jumps to the message dispatcher. On Darwin this is
1456 accomplished via the comm page.
1457
1458 -fobjc-exceptions
1459 Enable syntactic support for structured exception handling in
1460 Objective-C, similar to what is offered by C++ and Java. Cur‐
1461 rently, this option is only available in conjunction with the NeXT
1462 runtime on Mac OS X 10.3 and later.
1463
1464 @try {
1465 ...
1466 @throw expr;
1467 ...
1468 }
1469 @catch (AnObjCClass *exc) {
1470 ...
1471 @throw expr;
1472 ...
1473 @throw;
1474 ...
1475 }
1476 @catch (AnotherClass *exc) {
1477 ...
1478 }
1479 @catch (id allOthers) {
1480 ...
1481 }
1482 @finally {
1483 ...
1484 @throw expr;
1485 ...
1486 }
1487
1488 The @throw statement may appear anywhere in an Objective-C or
1489 Objective-C++ program; when used inside of a @catch block, the
1490 @throw may appear without an argument (as shown above), in which
1491 case the object caught by the @catch will be rethrown.
1492
1493 Note that only (pointers to) Objective-C objects may be thrown and
1494 caught using this scheme. When an object is thrown, it will be
1495 caught by the nearest @catch clause capable of handling objects of
1496 that type, analogously to how "catch" blocks work in C++ and Java.
1497 A "@catch(id ...)" clause (as shown above) may also be provided to
1498 catch any and all Objective-C exceptions not caught by previous
1499 @catch clauses (if any).
1500
1501 The @finally clause, if present, will be executed upon exit from
1502 the immediately preceding "@try ... @catch" section. This will
1503 happen regardless of whether any exceptions are thrown, caught or
1504 rethrown inside the "@try ... @catch" section, analogously to the
1505 behavior of the "finally" clause in Java.
1506
1507 There are several caveats to using the new exception mechanism:
1508
1509 * Although currently designed to be binary compatible with
1510 "NS_HANDLER"-style idioms provided by the "NSException" class,
1511 the new exceptions can only be used on Mac OS X 10.3 (Panther)
1512 and later systems, due to additional functionality needed in
1513 the (NeXT) Objective-C runtime.
1514
1515 * As mentioned above, the new exceptions do not support handling
1516 types other than Objective-C objects. Furthermore, when used
1517 from Objective-C++, the Objective-C exception model does not
1518 interoperate with C++ exceptions at this time. This means you
1519 cannot @throw an exception from Objective-C and "catch" it in
1520 C++, or vice versa (i.e., "throw ... @catch").
1521
1522 The -fobjc-exceptions switch also enables the use of synchroniza‐
1523 tion blocks for thread-safe execution:
1524
1525 @synchronized (ObjCClass *guard) {
1526 ...
1527 }
1528
1529 Upon entering the @synchronized block, a thread of execution shall
1530 first check whether a lock has been placed on the corresponding
1531 "guard" object by another thread. If it has, the current thread
1532 shall wait until the other thread relinquishes its lock. Once
1533 "guard" becomes available, the current thread will place its own
1534 lock on it, execute the code contained in the @synchronized block,
1535 and finally relinquish the lock (thereby making "guard" available
1536 to other threads).
1537
1538 Unlike Java, Objective-C does not allow for entire methods to be
1539 marked @synchronized. Note that throwing exceptions out of @syn‐
1540 chronized blocks is allowed, and will cause the guarding object to
1541 be unlocked properly.
1542
1543 -fobjc-gc
1544 Enable garbage collection (GC) in Objective-C and Objective-C++
1545 programs.
1546
1547 -freplace-objc-classes
1548 Emit a special marker instructing ld(1) not to statically link in
1549 the resulting object file, and allow dyld(1) to load it in at run
1550 time instead. This is used in conjunction with the Fix-and-Con‐
1551 tinue debugging mode, where the object file in question may be
1552 recompiled and dynamically reloaded in the course of program execu‐
1553 tion, without the need to restart the program itself. Currently,
1554 Fix-and-Continue functionality is only available in conjunction
1555 with the NeXT runtime on Mac OS X 10.3 and later.
1556
1557 -fzero-link
1558 When compiling for the NeXT runtime, the compiler ordinarily
1559 replaces calls to "objc_getClass("...")" (when the name of the
1560 class is known at compile time) with static class references that
1561 get initialized at load time, which improves run-time performance.
1562 Specifying the -fzero-link flag suppresses this behavior and causes
1563 calls to "objc_getClass("...")" to be retained. This is useful in
1564 Zero-Link debugging mode, since it allows for individual class
1565 implementations to be modified during program execution.
1566
1567 -gen-decls
1568 Dump interface declarations for all classes seen in the source file
1569 to a file named sourcename.decl.
1570
1571 -Wassign-intercept
1572 Warn whenever an Objective-C assignment is being intercepted by the
1573 garbage collector.
1574
1575 -Wno-protocol
1576 If a class is declared to implement a protocol, a warning is issued
1577 for every method in the protocol that is not implemented by the
1578 class. The default behavior is to issue a warning for every method
1579 not explicitly implemented in the class, even if a method implemen‐
1580 tation is inherited from the superclass. If you use the -Wno-pro‐
1581 tocol option, then methods inherited from the superclass are con‐
1582 sidered to be implemented, and no warning is issued for them.
1583
1584 -Wselector
1585 Warn if multiple methods of different types for the same selector
1586 are found during compilation. The check is performed on the list
1587 of methods in the final stage of compilation. Additionally, a
1588 check is performed for each selector appearing in a "@selec‐
1589 tor(...)" expression, and a corresponding method for that selector
1590 has been found during compilation. Because these checks scan the
1591 method table only at the end of compilation, these warnings are not
1592 produced if the final stage of compilation is not reached, for
1593 example because an error is found during compilation, or because
1594 the -fsyntax-only option is being used.
1595
1596 -Wstrict-selector-match
1597 Warn if multiple methods with differing argument and/or return
1598 types are found for a given selector when attempting to send a mes‐
1599 sage using this selector to a receiver of type "id" or "Class".
1600 When this flag is off (which is the default behavior), the compiler
1601 will omit such warnings if any differences found are confined to
1602 types which share the same size and alignment.
1603
1604 -Wundeclared-selector
1605 Warn if a "@selector(...)" expression referring to an undeclared
1606 selector is found. A selector is considered undeclared if no
1607 method with that name has been declared before the "@selector(...)"
1608 expression, either explicitly in an @interface or @protocol decla‐
1609 ration, or implicitly in an @implementation section. This option
1610 always performs its checks as soon as a "@selector(...)" expression
1611 is found, while -Wselector only performs its checks in the final
1612 stage of compilation. This also enforces the coding style conven‐
1613 tion that methods and selectors must be declared before being used.
1614
1615 -print-objc-runtime-info
1616 Generate C header describing the largest structure that is passed
1617 by value, if any.
1618
1619 Options to Control Diagnostic Messages Formatting
1620
1621 Traditionally, diagnostic messages have been formatted irrespective of
1622 the output device's aspect (e.g. its width, ...). The options
1623 described below can be used to control the diagnostic messages format‐
1624 ting algorithm, e.g. how many characters per line, how often source
1625 location information should be reported. Right now, only the C++ front
1626 end can honor these options. However it is expected, in the near
1627 future, that the remaining front ends would be able to digest them cor‐
1628 rectly.
1629
1630 -fmessage-length=n
1631 Try to format error messages so that they fit on lines of about n
1632 characters. The default is 72 characters for g++ and 0 for the
1633 rest of the front ends supported by GCC. If n is zero, then no
1634 line-wrapping will be done; each error message will appear on a
1635 single line.
1636
1637 -fdiagnostics-show-location=once
1638 Only meaningful in line-wrapping mode. Instructs the diagnostic
1639 messages reporter to emit once source location information; that
1640 is, in case the message is too long to fit on a single physical
1641 line and has to be wrapped, the source location won't be emitted
1642 (as prefix) again, over and over, in subsequent continuation lines.
1643 This is the default behavior.
1644
1645 -fdiagnostics-show-location=every-line
1646 Only meaningful in line-wrapping mode. Instructs the diagnostic
1647 messages reporter to emit the same source location information (as
1648 prefix) for physical lines that result from the process of breaking
1649 a message which is too long to fit on a single line.
1650
1651 -fdiagnostics-show-options
1652 This option instructs the diagnostic machinery to add text to each
1653 diagnostic emitted, which indicates which command line option
1654 directly controls that diagnostic, when such an option is known to
1655 the diagnostic machinery.
1656
1657 Options to Request or Suppress Warnings
1658
1659 Warnings are diagnostic messages that report constructions which are
1660 not inherently erroneous but which are risky or suggest there may have
1661 been an error.
1662
1663 You can request many specific warnings with options beginning -W, for
1664 example -Wimplicit to request warnings on implicit declarations. Each
1665 of these specific warning options also has a negative form beginning
1666 -Wno- to turn off warnings; for example, -Wno-implicit. This manual
1667 lists only one of the two forms, whichever is not the default.
1668
1669 The following options control the amount and kinds of warnings produced
1670 by GCC; for further, language-specific options also refer to C++
1671 Dialect Options and Objective-C and Objective-C++ Dialect Options.
1672
1673 -fsyntax-only
1674 Check the code for syntax errors, but don't do anything beyond
1675 that.
1676
1677 -pedantic
1678 Issue all the warnings demanded by strict ISO C and ISO C++; reject
1679 all programs that use forbidden extensions, and some other programs
1680 that do not follow ISO C and ISO C++. For ISO C, follows the ver‐
1681 sion of the ISO C standard specified by any -std option used.
1682
1683 Valid ISO C and ISO C++ programs should compile properly with or
1684 without this option (though a rare few will require -ansi or a -std
1685 option specifying the required version of ISO C). However, without
1686 this option, certain GNU extensions and traditional C and C++ fea‐
1687 tures are supported as well. With this option, they are rejected.
1688
1689 -pedantic does not cause warning messages for use of the alternate
1690 keywords whose names begin and end with __. Pedantic warnings are
1691 also disabled in the expression that follows "__extension__". How‐
1692 ever, only system header files should use these escape routes;
1693 application programs should avoid them.
1694
1695 Some users try to use -pedantic to check programs for strict ISO C
1696 conformance. They soon find that it does not do quite what they
1697 want: it finds some non-ISO practices, but not all---only those for
1698 which ISO C requires a diagnostic, and some others for which diag‐
1699 nostics have been added.
1700
1701 A feature to report any failure to conform to ISO C might be useful
1702 in some instances, but would require considerable additional work
1703 and would be quite different from -pedantic. We don't have plans
1704 to support such a feature in the near future.
1705
1706 Where the standard specified with -std represents a GNU extended
1707 dialect of C, such as gnu89 or gnu99, there is a corresponding base
1708 standard, the version of ISO C on which the GNU extended dialect is
1709 based. Warnings from -pedantic are given where they are required
1710 by the base standard. (It would not make sense for such warnings
1711 to be given only for features not in the specified GNU C dialect,
1712 since by definition the GNU dialects of C include all features the
1713 compiler supports with the given option, and there would be nothing
1714 to warn about.)
1715
1716 -pedantic-errors
1717 Like -pedantic, except that errors are produced rather than warn‐
1718 ings.
1719
1720 -w Inhibit all warning messages.
1721
1722 -Wno-import
1723 Inhibit warning messages about the use of #import.
1724
1725 -Wchar-subscripts
1726 Warn if an array subscript has type "char". This is a common cause
1727 of error, as programmers often forget that this type is signed on
1728 some machines. This warning is enabled by -Wall.
1729
1730 -Wcomment
1731 Warn whenever a comment-start sequence /* appears in a /* comment,
1732 or whenever a Backslash-Newline appears in a // comment. This
1733 warning is enabled by -Wall.
1734
1735 -Wfatal-errors
1736 This option causes the compiler to abort compilation on the first
1737 error occurred rather than trying to keep going and printing fur‐
1738 ther error messages.
1739
1740 -Wformat
1741 Check calls to "printf" and "scanf", etc., to make sure that the
1742 arguments supplied have types appropriate to the format string
1743 specified, and that the conversions specified in the format string
1744 make sense. This includes standard functions, and others specified
1745 by format attributes, in the "printf", "scanf", "strftime" and
1746 "strfmon" (an X/Open extension, not in the C standard) families (or
1747 other target-specific families). Which functions are checked with‐
1748 out format attributes having been specified depends on the standard
1749 version selected, and such checks of functions without the
1750 attribute specified are disabled by -ffreestanding or -fno-builtin.
1751
1752 The formats are checked against the format features supported by
1753 GNU libc version 2.2. These include all ISO C90 and C99 features,
1754 as well as features from the Single Unix Specification and some BSD
1755 and GNU extensions. Other library implementations may not support
1756 all these features; GCC does not support warning about features
1757 that go beyond a particular library's limitations. However, if
1758 -pedantic is used with -Wformat, warnings will be given about for‐
1759 mat features not in the selected standard version (but not for
1760 "strfmon" formats, since those are not in any version of the C
1761 standard).
1762
1763 Since -Wformat also checks for null format arguments for several
1764 functions, -Wformat also implies -Wnonnull.
1765
1766 -Wformat is included in -Wall. For more control over some aspects
1767 of format checking, the options -Wformat-y2k, -Wno-for‐
1768 mat-extra-args, -Wno-format-zero-length, -Wformat-nonliteral,
1769 -Wformat-security, and -Wformat=2 are available, but are not
1770 included in -Wall.
1771
1772 -Wformat-y2k
1773 If -Wformat is specified, also warn about "strftime" formats which
1774 may yield only a two-digit year.
1775
1776 -Wno-format-extra-args
1777 If -Wformat is specified, do not warn about excess arguments to a
1778 "printf" or "scanf" format function. The C standard specifies that
1779 such arguments are ignored.
1780
1781 Where the unused arguments lie between used arguments that are
1782 specified with $ operand number specifications, normally warnings
1783 are still given, since the implementation could not know what type
1784 to pass to "va_arg" to skip the unused arguments. However, in the
1785 case of "scanf" formats, this option will suppress the warning if
1786 the unused arguments are all pointers, since the Single Unix Speci‐
1787 fication says that such unused arguments are allowed.
1788
1789 -Wno-format-zero-length
1790 If -Wformat is specified, do not warn about zero-length formats.
1791 The C standard specifies that zero-length formats are allowed.
1792
1793 -Wformat-nonliteral
1794 If -Wformat is specified, also warn if the format string is not a
1795 string literal and so cannot be checked, unless the format function
1796 takes its format arguments as a "va_list".
1797
1798 -Wformat-security
1799 If -Wformat is specified, also warn about uses of format functions
1800 that represent possible security problems. At present, this warns
1801 about calls to "printf" and "scanf" functions where the format
1802 string is not a string literal and there are no format arguments,
1803 as in "printf (foo);". This may be a security hole if the format
1804 string came from untrusted input and contains %n. (This is cur‐
1805 rently a subset of what -Wformat-nonliteral warns about, but in
1806 future warnings may be added to -Wformat-security that are not
1807 included in -Wformat-nonliteral.)
1808
1809 -Wformat=2
1810 Enable -Wformat plus format checks not included in -Wformat. Cur‐
1811 rently equivalent to -Wformat -Wformat-nonliteral -Wformat-security
1812 -Wformat-y2k.
1813
1814 -Wnonnull
1815 Warn about passing a null pointer for arguments marked as requiring
1816 a non-null value by the "nonnull" function attribute.
1817
1818 -Wnonnull is included in -Wall and -Wformat. It can be disabled
1819 with the -Wno-nonnull option.
1820
1821 -Winit-self (C, C++, Objective-C and Objective-C++ only)
1822 Warn about uninitialized variables which are initialized with them‐
1823 selves. Note this option can only be used with the -Wuninitialized
1824 option, which in turn only works with -O1 and above.
1825
1826 For example, GCC will warn about "i" being uninitialized in the
1827 following snippet only when -Winit-self has been specified:
1828
1829 int f()
1830 {
1831 int i = i;
1832 return i;
1833 }
1834
1835 -Wimplicit-int
1836 Warn when a declaration does not specify a type. This warning is
1837 enabled by -Wall.
1838
1839 -Wimplicit-function-declaration
1840 -Werror-implicit-function-declaration
1841 Give a warning (or error) whenever a function is used before being
1842 declared. The form -Wno-error-implicit-function-declaration is not
1843 supported. This warning is enabled by -Wall (as a warning, not an
1844 error).
1845
1846 -Wimplicit
1847 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
1848 warning is enabled by -Wall.
1849
1850 -Wmain
1851 Warn if the type of main is suspicious. main should be a function
1852 with external linkage, returning int, taking either zero arguments,
1853 two, or three arguments of appropriate types. This warning is
1854 enabled by -Wall.
1855
1856 -Wmissing-braces
1857 Warn if an aggregate or union initializer is not fully bracketed.
1858 In the following example, the initializer for a is not fully brack‐
1859 eted, but that for b is fully bracketed.
1860
1861 int a[2][2] = { 0, 1, 2, 3 };
1862 int b[2][2] = { { 0, 1 }, { 2, 3 } };
1863
1864 This warning is enabled by -Wall.
1865
1866 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
1867 Warn if a user-supplied include directory does not exist.
1868
1869 -Wparentheses
1870 Warn if parentheses are omitted in certain contexts, such as when
1871 there is an assignment in a context where a truth value is
1872 expected, or when operators are nested whose precedence people
1873 often get confused about. Only the warning for an assignment used
1874 as a truth value is supported when compiling C++; the other warn‐
1875 ings are only supported when compiling C.
1876
1877 Also warn if a comparison like x<=y<=z appears; this is equivalent
1878 to (x<=y ? 1 : 0) <= z, which is a different interpretation from
1879 that of ordinary mathematical notation.
1880
1881 Also warn about constructions where there may be confusion to which
1882 "if" statement an "else" branch belongs. Here is an example of
1883 such a case:
1884
1885 {
1886 if (a)
1887 if (b)
1888 foo ();
1889 else
1890 bar ();
1891 }
1892
1893 In C, every "else" branch belongs to the innermost possible "if"
1894 statement, which in this example is "if (b)". This is often not
1895 what the programmer expected, as illustrated in the above example
1896 by indentation the programmer chose. When there is the potential
1897 for this confusion, GCC will issue a warning when this flag is
1898 specified. To eliminate the warning, add explicit braces around
1899 the innermost "if" statement so there is no way the "else" could
1900 belong to the enclosing "if". The resulting code would look like
1901 this:
1902
1903 {
1904 if (a)
1905 {
1906 if (b)
1907 foo ();
1908 else
1909 bar ();
1910 }
1911 }
1912
1913 This warning is enabled by -Wall.
1914
1915 -Wsequence-point
1916 Warn about code that may have undefined semantics because of viola‐
1917 tions of sequence point rules in the C standard.
1918
1919 The C standard defines the order in which expressions in a C pro‐
1920 gram are evaluated in terms of sequence points, which represent a
1921 partial ordering between the execution of parts of the program:
1922 those executed before the sequence point, and those executed after
1923 it. These occur after the evaluation of a full expression (one
1924 which is not part of a larger expression), after the evaluation of
1925 the first operand of a "&&", "⎪⎪", "? :" or "," (comma) operator,
1926 before a function is called (but after the evaluation of its argu‐
1927 ments and the expression denoting the called function), and in cer‐
1928 tain other places. Other than as expressed by the sequence point
1929 rules, the order of evaluation of subexpressions of an expression
1930 is not specified. All these rules describe only a partial order
1931 rather than a total order, since, for example, if two functions are
1932 called within one expression with no sequence point between them,
1933 the order in which the functions are called is not specified. How‐
1934 ever, the standards committee have ruled that function calls do not
1935 overlap.
1936
1937 It is not specified when between sequence points modifications to
1938 the values of objects take effect. Programs whose behavior depends
1939 on this have undefined behavior; the C standard specifies that
1940 "Between the previous and next sequence point an object shall have
1941 its stored value modified at most once by the evaluation of an
1942 expression. Furthermore, the prior value shall be read only to
1943 determine the value to be stored.". If a program breaks these
1944 rules, the results on any particular implementation are entirely
1945 unpredictable.
1946
1947 Examples of code with undefined behavior are "a = a++;", "a[n] =
1948 b[n++]" and "a[i++] = i;". Some more complicated cases are not
1949 diagnosed by this option, and it may give an occasional false posi‐
1950 tive result, but in general it has been found fairly effective at
1951 detecting this sort of problem in programs.
1952
1953 The present implementation of this option only works for C pro‐
1954 grams. A future implementation may also work for C++ programs.
1955
1956 The C standard is worded confusingly, therefore there is some
1957 debate over the precise meaning of the sequence point rules in sub‐
1958 tle cases. Links to discussions of the problem, including proposed
1959 formal definitions, may be found on the GCC readings page, at
1960 <http://gcc.gnu.org/readings.html>.
1961
1962 This warning is enabled by -Wall.
1963
1964 -Wreturn-type
1965 Warn whenever a function is defined with a return-type that
1966 defaults to "int". Also warn about any "return" statement with no
1967 return-value in a function whose return-type is not "void".
1968
1969 For C, also warn if the return type of a function has a type quali‐
1970 fier such as "const". Such a type qualifier has no effect, since
1971 the value returned by a function is not an lvalue. ISO C prohibits
1972 qualified "void" return types on function definitions, so such
1973 return types always receive a warning even without this option.
1974
1975 For C++, a function without return type always produces a diagnos‐
1976 tic message, even when -Wno-return-type is specified. The only
1977 exceptions are main and functions defined in system headers.
1978
1979 This warning is enabled by -Wall.
1980
1981 -Wswitch
1982 Warn whenever a "switch" statement has an index of enumerated type
1983 and lacks a "case" for one or more of the named codes of that enu‐
1984 meration. (The presence of a "default" label prevents this warn‐
1985 ing.) "case" labels outside the enumeration range also provoke
1986 warnings when this option is used. This warning is enabled by
1987 -Wall.
1988
1989 -Wswitch-default
1990 Warn whenever a "switch" statement does not have a "default" case.
1991
1992 -Wswitch-enum
1993 Warn whenever a "switch" statement has an index of enumerated type
1994 and lacks a "case" for one or more of the named codes of that enu‐
1995 meration. "case" labels outside the enumeration range also provoke
1996 warnings when this option is used.
1997
1998 -Wtrigraphs
1999 Warn if any trigraphs are encountered that might change the meaning
2000 of the program (trigraphs within comments are not warned about).
2001 This warning is enabled by -Wall.
2002
2003 -Wunused-function
2004 Warn whenever a static function is declared but not defined or a
2005 non-inline static function is unused. This warning is enabled by
2006 -Wall.
2007
2008 -Wunused-label
2009 Warn whenever a label is declared but not used. This warning is
2010 enabled by -Wall.
2011
2012 To suppress this warning use the unused attribute.
2013
2014 -Wunused-parameter
2015 Warn whenever a function parameter is unused aside from its decla‐
2016 ration.
2017
2018 To suppress this warning use the unused attribute.
2019
2020 -Wunused-variable
2021 Warn whenever a local variable or non-constant static variable is
2022 unused aside from its declaration. This warning is enabled by
2023 -Wall.
2024
2025 To suppress this warning use the unused attribute.
2026
2027 -Wunused-value
2028 Warn whenever a statement computes a result that is explicitly not
2029 used. This warning is enabled by -Wall.
2030
2031 To suppress this warning cast the expression to void.
2032
2033 -Wunused
2034 All the above -Wunused options combined.
2035
2036 In order to get a warning about an unused function parameter, you
2037 must either specify -Wextra -Wunused (note that -Wall implies
2038 -Wunused), or separately specify -Wunused-parameter.
2039
2040 -Wuninitialized
2041 Warn if an automatic variable is used without first being initial‐
2042 ized or if a variable may be clobbered by a "setjmp" call.
2043
2044 These warnings are possible only in optimizing compilation, because
2045 they require data flow information that is computed only when opti‐
2046 mizing. If you don't specify -O, you simply won't get these warn‐
2047 ings.
2048
2049 If you want to warn about code which uses the uninitialized value
2050 of the variable in its own initializer, use the -Winit-self option.
2051
2052 These warnings occur for individual uninitialized or clobbered ele‐
2053 ments of structure, union or array variables as well as for vari‐
2054 ables which are uninitialized or clobbered as a whole. They do not
2055 occur for variables or elements declared "volatile". Because these
2056 warnings depend on optimization, the exact variables or elements
2057 for which there are warnings will depend on the precise optimiza‐
2058 tion options and version of GCC used.
2059
2060 Note that there may be no warning about a variable that is used
2061 only to compute a value that itself is never used, because such
2062 computations may be deleted by data flow analysis before the warn‐
2063 ings are printed.
2064
2065 These warnings are made optional because GCC is not smart enough to
2066 see all the reasons why the code might be correct despite appearing
2067 to have an error. Here is one example of how this can happen:
2068
2069 {
2070 int x;
2071 switch (y)
2072 {
2073 case 1: x = 1;
2074 break;
2075 case 2: x = 4;
2076 break;
2077 case 3: x = 5;
2078 }
2079 foo (x);
2080 }
2081
2082 If the value of "y" is always 1, 2 or 3, then "x" is always ini‐
2083 tialized, but GCC doesn't know this. Here is another common case:
2084
2085 {
2086 int save_y;
2087 if (change_y) save_y = y, y = new_y;
2088 ...
2089 if (change_y) y = save_y;
2090 }
2091
2092 This has no bug because "save_y" is used only if it is set.
2093
2094 This option also warns when a non-volatile automatic variable might
2095 be changed by a call to "longjmp". These warnings as well are pos‐
2096 sible only in optimizing compilation.
2097
2098 The compiler sees only the calls to "setjmp". It cannot know where
2099 "longjmp" will be called; in fact, a signal handler could call it
2100 at any point in the code. As a result, you may get a warning even
2101 when there is in fact no problem because "longjmp" cannot in fact
2102 be called at the place which would cause a problem.
2103
2104 Some spurious warnings can be avoided if you declare all the func‐
2105 tions you use that never return as "noreturn".
2106
2107 This warning is enabled by -Wall.
2108
2109 -Wunknown-pragmas
2110 Warn when a #pragma directive is encountered which is not under‐
2111 stood by GCC. If this command line option is used, warnings will
2112 even be issued for unknown pragmas in system header files. This is
2113 not the case if the warnings were only enabled by the -Wall command
2114 line option.
2115
2116 -Wno-pragmas
2117 Do not warn about misuses of pragmas, such as incorrect parameters,
2118 invalid syntax, or conflicts between pragmas. See also -Wun‐
2119 known-pragmas.
2120
2121 -Wstrict-aliasing
2122 This option is only active when -fstrict-aliasing is active. It
2123 warns about code which might break the strict aliasing rules that
2124 the compiler is using for optimization. The warning does not catch
2125 all cases, but does attempt to catch the more common pitfalls. It
2126 is included in -Wall.
2127
2128 -Wstrict-aliasing=2
2129 This option is only active when -fstrict-aliasing is active. It
2130 warns about code which might break the strict aliasing rules that
2131 the compiler is using for optimization. This warning catches more
2132 cases than -Wstrict-aliasing, but it will also give a warning for
2133 some ambiguous cases that are safe.
2134
2135 -Wall
2136 All of the above -W options combined. This enables all the warn‐
2137 ings about constructions that some users consider questionable, and
2138 that are easy to avoid (or modify to prevent the warning), even in
2139 conjunction with macros. This also enables some language-specific
2140 warnings described in C++ Dialect Options and Objective-C and
2141 Objective-C++ Dialect Options.
2142
2143 The following -W... options are not implied by -Wall. Some of them
2144 warn about constructions that users generally do not consider question‐
2145 able, but which occasionally you might wish to check for; others warn
2146 about constructions that are necessary or hard to avoid in some cases,
2147 and there is no simple way to modify the code to suppress the warning.
2148
2149 -Wextra
2150 (This option used to be called -W. The older name is still sup‐
2151 ported, but the newer name is more descriptive.) Print extra warn‐
2152 ing messages for these events:
2153
2154 * A function can return either with or without a value. (Falling
2155 off the end of the function body is considered returning with‐
2156 out a value.) For example, this function would evoke such a
2157 warning:
2158
2159 foo (a)
2160 {
2161 if (a > 0)
2162 return a;
2163 }
2164
2165 * An expression-statement or the left-hand side of a comma
2166 expression contains no side effects. To suppress the warning,
2167 cast the unused expression to void. For example, an expression
2168 such as x[i,j] will cause a warning, but x[(void)i,j] will not.
2169
2170 * An unsigned value is compared against zero with < or >=.
2171
2172 * Storage-class specifiers like "static" are not the first things
2173 in a declaration. According to the C Standard, this usage is
2174 obsolescent.
2175
2176 * If -Wall or -Wunused is also specified, warn about unused argu‐
2177 ments.
2178
2179 * A comparison between signed and unsigned values could produce
2180 an incorrect result when the signed value is converted to
2181 unsigned. (But don't warn if -Wno-sign-compare is also speci‐
2182 fied.)
2183
2184 * An aggregate has an initializer which does not initialize all
2185 members. This warning can be independently controlled by
2186 -Wmissing-field-initializers.
2187
2188 * A function parameter is declared without a type specifier in
2189 K&R-style functions:
2190
2191 void foo(bar) { }
2192
2193 * An empty body occurs in an if or else statement.
2194
2195 * A pointer is compared against integer zero with <, <=, >, or
2196 >=.
2197
2198 * A variable might be changed by longjmp or vfork.
2199
2200 * Any of several floating-point events that often indicate
2201 errors, such as overflow, underflow, loss of precision, etc.
2202
2203 *<(C++ only)>
2204 An enumerator and a non-enumerator both appear in a conditional
2205 expression.
2206
2207 *<(C++ only)>
2208 A non-static reference or non-static const member appears in a
2209 class without constructors.
2210
2211 *<(C++ only)>
2212 Ambiguous virtual bases.
2213
2214 *<(C++ only)>
2215 Subscripting an array which has been declared register.
2216
2217 *<(C++ only)>
2218 Taking the address of a variable which has been declared regis‐
2219 ter.
2220
2221 *<(C++ only)>
2222 A base class is not initialized in a derived class' copy con‐
2223 structor.
2224
2225 -Wno-div-by-zero
2226 Do not warn about compile-time integer division by zero. Floating
2227 point division by zero is not warned about, as it can be a legiti‐
2228 mate way of obtaining infinities and NaNs.
2229
2230 -Wsystem-headers
2231 Print warning messages for constructs found in system header files.
2232 Warnings from system headers are normally suppressed, on the
2233 assumption that they usually do not indicate real problems and
2234 would only make the compiler output harder to read. Using this
2235 command line option tells GCC to emit warnings from system headers
2236 as if they occurred in user code. However, note that using -Wall
2237 in conjunction with this option will not warn about unknown pragmas
2238 in system headers---for that, -Wunknown-pragmas must also be used.
2239
2240 -Wfloat-equal
2241 Warn if floating point values are used in equality comparisons.
2242
2243 The idea behind this is that sometimes it is convenient (for the
2244 programmer) to consider floating-point values as approximations to
2245 infinitely precise real numbers. If you are doing this, then you
2246 need to compute (by analyzing the code, or in some other way) the
2247 maximum or likely maximum error that the computation introduces,
2248 and allow for it when performing comparisons (and when producing
2249 output, but that's a different problem). In particular, instead of
2250 testing for equality, you would check to see whether the two values
2251 have ranges that overlap; and this is done with the relational
2252 operators, so equality comparisons are probably mistaken.
2253
2254 -Wtraditional (C only)
2255 Warn about certain constructs that behave differently in tradi‐
2256 tional and ISO C. Also warn about ISO C constructs that have no
2257 traditional C equivalent, and/or problematic constructs which
2258 should be avoided.
2259
2260 * Macro parameters that appear within string literals in the
2261 macro body. In traditional C macro replacement takes place
2262 within string literals, but does not in ISO C.
2263
2264 * In traditional C, some preprocessor directives did not exist.
2265 Traditional preprocessors would only consider a line to be a
2266 directive if the # appeared in column 1 on the line. Therefore
2267 -Wtraditional warns about directives that traditional C under‐
2268 stands but would ignore because the # does not appear as the
2269 first character on the line. It also suggests you hide direc‐
2270 tives like #pragma not understood by traditional C by indenting
2271 them. Some traditional implementations would not recognize
2272 #elif, so it suggests avoiding it altogether.
2273
2274 * A function-like macro that appears without arguments.
2275
2276 * The unary plus operator.
2277
2278 * The U integer constant suffix, or the F or L floating point
2279 constant suffixes. (Traditional C does support the L suffix on
2280 integer constants.) Note, these suffixes appear in macros
2281 defined in the system headers of most modern systems, e.g. the
2282 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
2283 code might normally lead to spurious warnings, however GCC's
2284 integrated preprocessor has enough context to avoid warning in
2285 these cases.
2286
2287 * A function declared external in one block and then used after
2288 the end of the block.
2289
2290 * A "switch" statement has an operand of type "long".
2291
2292 * A non-"static" function declaration follows a "static" one.
2293 This construct is not accepted by some traditional C compilers.
2294
2295 * The ISO type of an integer constant has a different width or
2296 signedness from its traditional type. This warning is only
2297 issued if the base of the constant is ten. I.e. hexadecimal or
2298 octal values, which typically represent bit patterns, are not
2299 warned about.
2300
2301 * Usage of ISO string concatenation is detected.
2302
2303 * Initialization of automatic aggregates.
2304
2305 * Identifier conflicts with labels. Traditional C lacks a sepa‐
2306 rate namespace for labels.
2307
2308 * Initialization of unions. If the initializer is zero, the
2309 warning is omitted. This is done under the assumption that the
2310 zero initializer in user code appears conditioned on e.g.
2311 "__STDC__" to avoid missing initializer warnings and relies on
2312 default initialization to zero in the traditional C case.
2313
2314 * Conversions by prototypes between fixed/floating point values
2315 and vice versa. The absence of these prototypes when compiling
2316 with traditional C would cause serious problems. This is a
2317 subset of the possible conversion warnings, for the full set
2318 use -Wconversion.
2319
2320 * Use of ISO C style function definitions. This warning inten‐
2321 tionally is not issued for prototype declarations or variadic
2322 functions because these ISO C features will appear in your code
2323 when using libiberty's traditional C compatibility macros,
2324 "PARAMS" and "VPARAMS". This warning is also bypassed for
2325 nested functions because that feature is already a GCC exten‐
2326 sion and thus not relevant to traditional C compatibility.
2327
2328 -Wdeclaration-after-statement (C only)
2329 Warn when a declaration is found after a statement in a block.
2330 This construct, known from C++, was introduced with ISO C99 and is
2331 by default allowed in GCC. It is not supported by ISO C90 and was
2332 not supported by GCC versions before GCC 3.0.
2333
2334 -Wundef
2335 Warn if an undefined identifier is evaluated in an #if directive.
2336
2337 -Wno-endif-labels
2338 Do not warn whenever an #else or an #endif are followed by text.
2339
2340 -Wshadow
2341 Warn whenever a local variable shadows another local variable,
2342 parameter or global variable or whenever a built-in function is
2343 shadowed.
2344
2345 -Wlarger-than-len
2346 Warn whenever an object of larger than len bytes is defined.
2347
2348 -Wunsafe-loop-optimizations
2349 Warn if the loop cannot be optimized because the compiler could not
2350 assume anything on the bounds of the loop indices. With -fun‐
2351 safe-loop-optimizations warn if the compiler made such assumptions.
2352
2353 -Wpointer-arith
2354 Warn about anything that depends on the "size of" a function type
2355 or of "void". GNU C assigns these types a size of 1, for conve‐
2356 nience in calculations with "void *" pointers and pointers to func‐
2357 tions.
2358
2359 -Wbad-function-cast (C only)
2360 Warn whenever a function call is cast to a non-matching type. For
2361 example, warn if "int malloc()" is cast to "anything *".
2362
2363 -Wc++-compat
2364 Warn about ISO C constructs that are outside of the common subset
2365 of ISO C and ISO C++, e.g. request for implicit conversion from
2366 "void *" to a pointer to non-"void" type.
2367
2368 -Wcast-qual
2369 Warn whenever a pointer is cast so as to remove a type qualifier
2370 from the target type. For example, warn if a "const char *" is
2371 cast to an ordinary "char *".
2372
2373 -Wcast-align
2374 Warn whenever a pointer is cast such that the required alignment of
2375 the target is increased. For example, warn if a "char *" is cast
2376 to an "int *" on machines where integers can only be accessed at
2377 two- or four-byte boundaries.
2378
2379 -Wwrite-strings
2380 When compiling C, give string constants the type "const
2381 char[length]" so that copying the address of one into a non-"const"
2382 "char *" pointer will get a warning; when compiling C++, warn about
2383 the deprecated conversion from string constants to "char *". These
2384 warnings will help you find at compile time code that can try to
2385 write into a string constant, but only if you have been very care‐
2386 ful about using "const" in declarations and prototypes. Otherwise,
2387 it will just be a nuisance; this is why we did not make -Wall
2388 request these warnings.
2389
2390 -Wconversion
2391 Warn if a prototype causes a type conversion that is different from
2392 what would happen to the same argument in the absence of a proto‐
2393 type. This includes conversions of fixed point to floating and
2394 vice versa, and conversions changing the width or signedness of a
2395 fixed point argument except when the same as the default promotion.
2396
2397 Also, warn if a negative integer constant expression is implicitly
2398 converted to an unsigned type. For example, warn about the assign‐
2399 ment "x = -1" if "x" is unsigned. But do not warn about explicit
2400 casts like "(unsigned) -1".
2401
2402 -Wsign-compare
2403 Warn when a comparison between signed and unsigned values could
2404 produce an incorrect result when the signed value is converted to
2405 unsigned. This warning is also enabled by -Wextra; to get the
2406 other warnings of -Wextra without this warning, use -Wextra
2407 -Wno-sign-compare.
2408
2409 -Waggregate-return
2410 Warn if any functions that return structures or unions are defined
2411 or called. (In languages where you can return an array, this also
2412 elicits a warning.)
2413
2414 -Wno-attributes
2415 Do not warn if an unexpected "__attribute__" is used, such as
2416 unrecognized attributes, function attributes applied to variables,
2417 etc. This will not stop errors for incorrect use of supported
2418 attributes.
2419
2420 -Wstrict-prototypes (C only)
2421 Warn if a function is declared or defined without specifying the
2422 argument types. (An old-style function definition is permitted
2423 without a warning if preceded by a declaration which specifies the
2424 argument types.)
2425
2426 -Wold-style-definition (C only)
2427 Warn if an old-style function definition is used. A warning is
2428 given even if there is a previous prototype.
2429
2430 -Wmissing-prototypes (C only)
2431 Warn if a global function is defined without a previous prototype
2432 declaration. This warning is issued even if the definition itself
2433 provides a prototype. The aim is to detect global functions that
2434 fail to be declared in header files.
2435
2436 -Wmissing-declarations (C only)
2437 Warn if a global function is defined without a previous declara‐
2438 tion. Do so even if the definition itself provides a prototype.
2439 Use this option to detect global functions that are not declared in
2440 header files.
2441
2442 -Wmissing-field-initializers
2443 Warn if a structure's initializer has some fields missing. For
2444 example, the following code would cause such a warning, because
2445 "x.h" is implicitly zero:
2446
2447 struct s { int f, g, h; };
2448 struct s x = { 3, 4 };
2449
2450 This option does not warn about designated initializers, so the
2451 following modification would not trigger a warning:
2452
2453 struct s { int f, g, h; };
2454 struct s x = { .f = 3, .g = 4 };
2455
2456 This warning is included in -Wextra. To get other -Wextra warnings
2457 without this one, use -Wextra -Wno-missing-field-initializers.
2458
2459 -Wmissing-noreturn
2460 Warn about functions which might be candidates for attribute "nore‐
2461 turn". Note these are only possible candidates, not absolute ones.
2462 Care should be taken to manually verify functions actually do not
2463 ever return before adding the "noreturn" attribute, otherwise sub‐
2464 tle code generation bugs could be introduced. You will not get a
2465 warning for "main" in hosted C environments.
2466
2467 -Wmissing-format-attribute
2468 Warn about function pointers which might be candidates for "format"
2469 attributes. Note these are only possible candidates, not absolute
2470 ones. GCC will guess that function pointers with "format"
2471 attributes that are used in assignment, initialization, parameter
2472 passing or return statements should have a corresponding "format"
2473 attribute in the resulting type. I.e. the left-hand side of the
2474 assignment or initialization, the type of the parameter variable,
2475 or the return type of the containing function respectively should
2476 also have a "format" attribute to avoid the warning.
2477
2478 GCC will also warn about function definitions which might be candi‐
2479 dates for "format" attributes. Again, these are only possible can‐
2480 didates. GCC will guess that "format" attributes might be appro‐
2481 priate for any function that calls a function like "vprintf" or
2482 "vscanf", but this might not always be the case, and some functions
2483 for which "format" attributes are appropriate may not be detected.
2484
2485 -Wno-multichar
2486 Do not warn if a multicharacter constant ('FOOF') is used. Usually
2487 they indicate a typo in the user's code, as they have implementa‐
2488 tion-defined values, and should not be used in portable code.
2489
2490 -Wnormalized=<none⎪id⎪nfc⎪nfkc>
2491 In ISO C and ISO C++, two identifiers are different if they are
2492 different sequences of characters. However, sometimes when charac‐
2493 ters outside the basic ASCII character set are used, you can have
2494 two different character sequences that look the same. To avoid
2495 confusion, the ISO 10646 standard sets out some normalization rules
2496 which when applied ensure that two sequences that look the same are
2497 turned into the same sequence. GCC can warn you if you are using
2498 identifiers which have not been normalized; this option controls
2499 that warning.
2500
2501 There are four levels of warning that GCC supports. The default is
2502 -Wnormalized=nfc, which warns about any identifier which is not in
2503 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
2504 form for most uses.
2505
2506 Unfortunately, there are some characters which ISO C and ISO C++
2507 allow in identifiers that when turned into NFC aren't allowable as
2508 identifiers. That is, there's no way to use these symbols in por‐
2509 table ISO C or C++ and have all your identifiers in NFC. -Wnormal‐
2510 ized=id suppresses the warning for these characters. It is hoped
2511 that future versions of the standards involved will correct this,
2512 which is why this option is not the default.
2513
2514 You can switch the warning off for all characters by writing -Wnor‐
2515 malized=none. You would only want to do this if you were using
2516 some other normalization scheme (like "D"), because otherwise you
2517 can easily create bugs that are literally impossible to see.
2518
2519 Some characters in ISO 10646 have distinct meanings but look iden‐
2520 tical in some fonts or display methodologies, especially once for‐
2521 matting has been applied. For instance "\u207F", "SUPERSCRIPT
2522 LATIN SMALL LETTER N", will display just like a regular "n" which
2523 has been placed in a superscript. ISO 10646 defines the NFKC nor‐
2524 malisation scheme to convert all these into a standard form as
2525 well, and GCC will warn if your code is not in NFKC if you use
2526 -Wnormalized=nfkc. This warning is comparable to warning about
2527 every identifier that contains the letter O because it might be
2528 confused with the digit 0, and so is not the default, but may be
2529 useful as a local coding convention if the programming environment
2530 is unable to be fixed to display these characters distinctly.
2531
2532 -Wno-deprecated-declarations
2533 Do not warn about uses of functions, variables, and types marked as
2534 deprecated by using the "deprecated" attribute. (@pxref{Function
2535 Attributes}, @pxref{Variable Attributes}, @pxref{Type Attributes}.)
2536
2537 -Wpacked
2538 Warn if a structure is given the packed attribute, but the packed
2539 attribute has no effect on the layout or size of the structure.
2540 Such structures may be mis-aligned for little benefit. For
2541 instance, in this code, the variable "f.x" in "struct bar" will be
2542 misaligned even though "struct bar" does not itself have the packed
2543 attribute:
2544
2545 struct foo {
2546 int x;
2547 char a, b, c, d;
2548 } __attribute__((packed));
2549 struct bar {
2550 char z;
2551 struct foo f;
2552 };
2553
2554 -Wpadded
2555 Warn if padding is included in a structure, either to align an ele‐
2556 ment of the structure or to align the whole structure. Sometimes
2557 when this happens it is possible to rearrange the fields of the
2558 structure to reduce the padding and so make the structure smaller.
2559
2560 -Wredundant-decls
2561 Warn if anything is declared more than once in the same scope, even
2562 in cases where multiple declaration is valid and changes nothing.
2563
2564 -Wnested-externs (C only)
2565 Warn if an "extern" declaration is encountered within a function.
2566
2567 -Wunreachable-code
2568 Warn if the compiler detects that code will never be executed.
2569
2570 This option is intended to warn when the compiler detects that at
2571 least a whole line of source code will never be executed, because
2572 some condition is never satisfied or because it is after a proce‐
2573 dure that never returns.
2574
2575 It is possible for this option to produce a warning even though
2576 there are circumstances under which part of the affected line can
2577 be executed, so care should be taken when removing apparently-
2578 unreachable code.
2579
2580 For instance, when a function is inlined, a warning may mean that
2581 the line is unreachable in only one inlined copy of the function.
2582
2583 This option is not made part of -Wall because in a debugging ver‐
2584 sion of a program there is often substantial code which checks cor‐
2585 rect functioning of the program and is, hopefully, unreachable
2586 because the program does work. Another common use of unreachable
2587 code is to provide behavior which is selectable at compile-time.
2588
2589 -Winline
2590 Warn if a function can not be inlined and it was declared as
2591 inline. Even with this option, the compiler will not warn about
2592 failures to inline functions declared in system headers.
2593
2594 The compiler uses a variety of heuristics to determine whether or
2595 not to inline a function. For example, the compiler takes into
2596 account the size of the function being inlined and the amount of
2597 inlining that has already been done in the current function.
2598 Therefore, seemingly insignificant changes in the source program
2599 can cause the warnings produced by -Winline to appear or disappear.
2600
2601 -Wno-invalid-offsetof (C++ only)
2602 Suppress warnings from applying the offsetof macro to a non-POD
2603 type. According to the 1998 ISO C++ standard, applying offsetof to
2604 a non-POD type is undefined. In existing C++ implementations, how‐
2605 ever, offsetof typically gives meaningful results even when applied
2606 to certain kinds of non-POD types. (Such as a simple struct that
2607 fails to be a POD type only by virtue of having a constructor.)
2608 This flag is for users who are aware that they are writing non‐
2609 portable code and who have deliberately chosen to ignore the warn‐
2610 ing about it.
2611
2612 The restrictions on offsetof may be relaxed in a future version of
2613 the C++ standard.
2614
2615 -Wno-int-to-pointer-cast (C only)
2616 Suppress warnings from casts to pointer type of an integer of a
2617 different size.
2618
2619 -Wno-pointer-to-int-cast (C only)
2620 Suppress warnings from casts from a pointer to an integer type of a
2621 different size.
2622
2623 -Winvalid-pch
2624 Warn if a precompiled header is found in the search path but can't
2625 be used.
2626
2627 -Wlong-long
2628 Warn if long long type is used. This is default. To inhibit the
2629 warning messages, use -Wno-long-long. Flags -Wlong-long and
2630 -Wno-long-long are taken into account only when -pedantic flag is
2631 used.
2632
2633 -Wvariadic-macros
2634 Warn if variadic macros are used in pedantic ISO C90 mode, or the
2635 GNU alternate syntax when in pedantic ISO C99 mode. This is
2636 default. To inhibit the warning messages, use -Wno-vari‐
2637 adic-macros.
2638
2639 -Wvolatile-register-var
2640 Warn if a register variable is declared volatile. The volatile
2641 modifier does not inhibit all optimizations that may eliminate
2642 reads and/or writes to register variables.
2643
2644 -Wdisabled-optimization
2645 Warn if a requested optimization pass is disabled. This warning
2646 does not generally indicate that there is anything wrong with your
2647 code; it merely indicates that GCC's optimizers were unable to han‐
2648 dle the code effectively. Often, the problem is that your code is
2649 too big or too complex; GCC will refuse to optimize programs when
2650 the optimization itself is likely to take inordinate amounts of
2651 time.
2652
2653 -Wpointer-sign
2654 Warn for pointer argument passing or assignment with different
2655 signedness. This option is only supported for C and Objective-C.
2656 It is implied by -Wall and by -pedantic, which can be disabled with
2657 -Wno-pointer-sign.
2658
2659 -Werror
2660 Make all warnings into errors.
2661
2662 -Wstack-protector
2663 This option is only active when -fstack-protector is active. It
2664 warns about functions that will not be protected against stack
2665 smashing.
2666
2667 Options for Debugging Your Program or GCC
2668
2669 GCC has various special options that are used for debugging either your
2670 program or GCC:
2671
2672 -g Produce debugging information in the operating system's native for‐
2673 mat (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this
2674 debugging information.
2675
2676 On most systems that use stabs format, -g enables use of extra
2677 debugging information that only GDB can use; this extra information
2678 makes debugging work better in GDB but will probably make other
2679 debuggers crash or refuse to read the program. If you want to con‐
2680 trol for certain whether to generate the extra information, use
2681 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
2682
2683 GCC allows you to use -g with -O. The shortcuts taken by optimized
2684 code may occasionally produce surprising results: some variables
2685 you declared may not exist at all; flow of control may briefly move
2686 where you did not expect it; some statements may not be executed
2687 because they compute constant results or their values were already
2688 at hand; some statements may execute in different places because
2689 they were moved out of loops.
2690
2691 Nevertheless it proves possible to debug optimized output. This
2692 makes it reasonable to use the optimizer for programs that might
2693 have bugs.
2694
2695 The following options are useful when GCC is generated with the
2696 capability for more than one debugging format.
2697
2698 -ggdb
2699 Produce debugging information for use by GDB. This means to use
2700 the most expressive format available (DWARF 2, stabs, or the native
2701 format if neither of those are supported), including GDB extensions
2702 if at all possible.
2703
2704 -gstabs
2705 Produce debugging information in stabs format (if that is sup‐
2706 ported), without GDB extensions. This is the format used by DBX on
2707 most BSD systems. On MIPS, Alpha and System V Release 4 systems
2708 this option produces stabs debugging output which is not understood
2709 by DBX or SDB. On System V Release 4 systems this option requires
2710 the GNU assembler.
2711
2712 -feliminate-unused-debug-symbols
2713 Produce debugging information in stabs format (if that is sup‐
2714 ported), for only symbols that are actually used.
2715
2716 -gstabs+
2717 Produce debugging information in stabs format (if that is sup‐
2718 ported), using GNU extensions understood only by the GNU debugger
2719 (GDB). The use of these extensions is likely to make other debug‐
2720 gers crash or refuse to read the program.
2721
2722 -gcoff
2723 Produce debugging information in COFF format (if that is sup‐
2724 ported). This is the format used by SDB on most System V systems
2725 prior to System V Release 4.
2726
2727 -gxcoff
2728 Produce debugging information in XCOFF format (if that is sup‐
2729 ported). This is the format used by the DBX debugger on IBM
2730 RS/6000 systems.
2731
2732 -gxcoff+
2733 Produce debugging information in XCOFF format (if that is sup‐
2734 ported), using GNU extensions understood only by the GNU debugger
2735 (GDB). The use of these extensions is likely to make other debug‐
2736 gers crash or refuse to read the program, and may cause assemblers
2737 other than the GNU assembler (GAS) to fail with an error.
2738
2739 -gdwarf-2
2740 Produce debugging information in DWARF version 2 format (if that is
2741 supported). This is the format used by DBX on IRIX 6. With this
2742 option, GCC uses features of DWARF version 3 when they are useful;
2743 version 3 is upward compatible with version 2, but may still cause
2744 problems for older debuggers.
2745
2746 -gvms
2747 Produce debugging information in VMS debug format (if that is sup‐
2748 ported). This is the format used by DEBUG on VMS systems.
2749
2750 -glevel
2751 -ggdblevel
2752 -gstabslevel
2753 -gcofflevel
2754 -gxcofflevel
2755 -gvmslevel
2756 Request debugging information and also use level to specify how
2757 much information. The default level is 2.
2758
2759 Level 1 produces minimal information, enough for making backtraces
2760 in parts of the program that you don't plan to debug. This
2761 includes descriptions of functions and external variables, but no
2762 information about local variables and no line numbers.
2763
2764 Level 3 includes extra information, such as all the macro defini‐
2765 tions present in the program. Some debuggers support macro expan‐
2766 sion when you use -g3.
2767
2768 -gdwarf-2 does not accept a concatenated debug level, because GCC
2769 used to support an option -gdwarf that meant to generate debug
2770 information in version 1 of the DWARF format (which is very differ‐
2771 ent from version 2), and it would have been too confusing. That
2772 debug format is long obsolete, but the option cannot be changed
2773 now. Instead use an additional -glevel option to change the debug
2774 level for DWARF2.
2775
2776 -feliminate-dwarf2-dups
2777 Compress DWARF2 debugging information by eliminating duplicated
2778 information about each symbol. This option only makes sense when
2779 generating DWARF2 debugging information with -gdwarf-2.
2780
2781 -p Generate extra code to write profile information suitable for the
2782 analysis program prof. You must use this option when compiling the
2783 source files you want data about, and you must also use it when
2784 linking.
2785
2786 -pg Generate extra code to write profile information suitable for the
2787 analysis program gprof. You must use this option when compiling
2788 the source files you want data about, and you must also use it when
2789 linking.
2790
2791 -Q Makes the compiler print out each function name as it is compiled,
2792 and print some statistics about each pass when it finishes.
2793
2794 -ftime-report
2795 Makes the compiler print some statistics about the time consumed by
2796 each pass when it finishes.
2797
2798 -fmem-report
2799 Makes the compiler print some statistics about permanent memory
2800 allocation when it finishes.
2801
2802 -fprofile-arcs
2803 Add code so that program flow arcs are instrumented. During execu‐
2804 tion the program records how many times each branch and call is
2805 executed and how many times it is taken or returns. When the com‐
2806 piled program exits it saves this data to a file called aux‐
2807 name.gcda for each source file. The data may be used for profile-
2808 directed optimizations (-fbranch-probabilities), or for test cover‐
2809 age analysis (-ftest-coverage). Each object file's auxname is gen‐
2810 erated from the name of the output file, if explicitly specified
2811 and it is not the final executable, otherwise it is the basename of
2812 the source file. In both cases any suffix is removed (e.g.
2813 foo.gcda for input file dir/foo.c, or dir/foo.gcda for output file
2814 specified as -o dir/foo.o).
2815
2816 --coverage
2817 This option is used to compile and link code instrumented for cov‐
2818 erage analysis. The option is a synonym for -fprofile-arcs
2819 -ftest-coverage (when compiling) and -lgcov (when linking). See
2820 the documentation for those options for more details.
2821
2822 @bullet
2823 Compile the source files with -fprofile-arcs plus optimization
2824 and code generation options. For test coverage analysis, use
2825 the additional -ftest-coverage option. You do not need to pro‐
2826 file every source file in a program.
2827
2828 @cvmmfu
2829 Link your object files with -lgcov or -fprofile-arcs (the lat‐
2830 ter implies the former).
2831
2832 @dwnngv
2833 Run the program on a representative workload to generate the
2834 arc profile information. This may be repeated any number of
2835 times. You can run concurrent instances of your program, and
2836 provided that the file system supports locking, the data files
2837 will be correctly updated. Also "fork" calls are detected and
2838 correctly handled (double counting will not happen).
2839
2840 @exoohw
2841 For profile-directed optimizations, compile the source files
2842 again with the same optimization and code generation options
2843 plus -fbranch-probabilities.
2844
2845 @fyppix
2846 For test coverage analysis, use gcov to produce human readable
2847 information from the .gcno and .gcda files. Refer to the gcov
2848 documentation for further information.
2849
2850 With -fprofile-arcs, for each function of your program GCC creates
2851 a program flow graph, then finds a spanning tree for the graph.
2852 Only arcs that are not on the spanning tree have to be instru‐
2853 mented: the compiler adds code to count the number of times that
2854 these arcs are executed. When an arc is the only exit or only
2855 entrance to a block, the instrumentation code can be added to the
2856 block; otherwise, a new basic block must be created to hold the
2857 instrumentation code.
2858
2859 -ftest-coverage
2860 Produce a notes file that the gcov code-coverage utility can use to
2861 show program coverage. Each source file's note file is called aux‐
2862 name.gcno. Refer to the -fprofile-arcs option above for a descrip‐
2863 tion of auxname and instructions on how to generate test coverage
2864 data. Coverage data will match the source files more closely, if
2865 you do not optimize.
2866
2867 -dletters
2868 -fdump-rtl-pass
2869 Says to make debugging dumps during compilation at times specified
2870 by letters. This is used for debugging the RTL-based passes of
2871 the compiler. The file names for most of the dumps are made by
2872 appending a pass number and a word to the dumpname. dumpname is
2873 generated from the name of the output file, if explicitly specified
2874 and it is not an executable, otherwise it is the basename of the
2875 source file.
2876
2877 Most debug dumps can be enabled either passing a letter to the -d
2878 option, or with a long -fdump-rtl switch; here are the possible
2879 letters for use in letters and pass, and their meanings:
2880
2881 -dA Annotate the assembler output with miscellaneous debugging
2882 information.
2883
2884 -db
2885 -fdump-rtl-bp
2886 Dump after computing branch probabilities, to file.09.bp.
2887
2888 -dB
2889 -fdump-rtl-bbro
2890 Dump after block reordering, to file.30.bbro.
2891
2892 -dc
2893 -fdump-rtl-combine
2894 Dump after instruction combination, to the file file.17.com‐
2895 bine.
2896
2897 -dC
2898 -fdump-rtl-ce1
2899 -fdump-rtl-ce2
2900 -dC and -fdump-rtl-ce1 enable dumping after the first if con‐
2901 version, to the file file.11.ce1. -dC and -fdump-rtl-ce2
2902 enable dumping after the second if conversion, to the file
2903 file.18.ce2.
2904
2905 -dd
2906 -fdump-rtl-btl
2907 -fdump-rtl-dbr
2908 -dd and -fdump-rtl-btl enable dumping after branch target load
2909 optimization, to file.31.btl. -dd and -fdump-rtl-dbr enable
2910 dumping after delayed branch scheduling, to file.36.dbr.
2911
2912 -dD Dump all macro definitions, at the end of preprocessing, in
2913 addition to normal output.
2914
2915 -dE
2916 -fdump-rtl-ce3
2917 Dump after the third if conversion, to file.28.ce3.
2918
2919 -df
2920 -fdump-rtl-cfg
2921 -fdump-rtl-life
2922 -df and -fdump-rtl-cfg enable dumping after control and data
2923 flow analysis, to file.08.cfg. -df and -fdump-rtl-cfg enable
2924 dumping dump after life analysis, to file.16.life.
2925
2926 -dg
2927 -fdump-rtl-greg
2928 Dump after global register allocation, to file.23.greg.
2929
2930 -dG
2931 -fdump-rtl-gcse
2932 -fdump-rtl-bypass
2933 -dG and -fdump-rtl-gcse enable dumping after GCSE, to
2934 file.05.gcse. -dG and -fdump-rtl-bypass enable dumping after
2935 jump bypassing and control flow optimizations, to
2936 file.07.bypass.
2937
2938 -dh
2939 -fdump-rtl-eh
2940 Dump after finalization of EH handling code, to file.02.eh.
2941
2942 -di
2943 -fdump-rtl-sibling
2944 Dump after sibling call optimizations, to file.01.sibling.
2945
2946 -dj
2947 -fdump-rtl-jump
2948 Dump after the first jump optimization, to file.03.jump.
2949
2950 -dk
2951 -fdump-rtl-stack
2952 Dump after conversion from registers to stack, to
2953 file.33.stack.
2954
2955 -dl
2956 -fdump-rtl-lreg
2957 Dump after local register allocation, to file.22.lreg.
2958
2959 -dL
2960 -fdump-rtl-loop
2961 -fdump-rtl-loop2
2962 -dL and -fdump-rtl-loop enable dumping after the first loop
2963 optimization pass, to file.06.loop. -dL and -fdump-rtl-loop2
2964 enable dumping after the second pass, to file.13.loop2.
2965
2966 -dm
2967 -fdump-rtl-sms
2968 Dump after modulo scheduling, to file.20.sms.
2969
2970 -dM
2971 -fdump-rtl-mach
2972 Dump after performing the machine dependent reorganization
2973 pass, to file.35.mach.
2974
2975 -dn
2976 -fdump-rtl-rnreg
2977 Dump after register renumbering, to file.29.rnreg.
2978
2979 -dN
2980 -fdump-rtl-regmove
2981 Dump after the register move pass, to file.19.regmove.
2982
2983 -do
2984 -fdump-rtl-postreload
2985 Dump after post-reload optimizations, to file.24.postreload.
2986
2987 -dr
2988 -fdump-rtl-expand
2989 Dump after RTL generation, to file.00.expand.
2990
2991 -dR
2992 -fdump-rtl-sched2
2993 Dump after the second scheduling pass, to file.32.sched2.
2994
2995 -ds
2996 -fdump-rtl-cse
2997 Dump after CSE (including the jump optimization that sometimes
2998 follows CSE), to file.04.cse.
2999
3000 -dS
3001 -fdump-rtl-sched
3002 Dump after the first scheduling pass, to file.21.sched.
3003
3004 -dt
3005 -fdump-rtl-cse2
3006 Dump after the second CSE pass (including the jump optimization
3007 that sometimes follows CSE), to file.15.cse2.
3008
3009 -dT
3010 -fdump-rtl-tracer
3011 Dump after running tracer, to file.12.tracer.
3012
3013 -dV
3014 -fdump-rtl-vpt
3015 -fdump-rtl-vartrack
3016 -dV and -fdump-rtl-vpt enable dumping after the value profile
3017 transformations, to file.10.vpt. -dV and -fdump-rtl-vartrack
3018 enable dumping after variable tracking, to file.34.vartrack.
3019
3020 -dw
3021 -fdump-rtl-flow2
3022 Dump after the second flow pass, to file.26.flow2.
3023
3024 -dz
3025 -fdump-rtl-peephole2
3026 Dump after the peephole pass, to file.27.peephole2.
3027
3028 -dZ
3029 -fdump-rtl-web
3030 Dump after live range splitting, to file.14.web.
3031
3032 -da
3033 -fdump-rtl-all
3034 Produce all the dumps listed above.
3035
3036 -dH Produce a core dump whenever an error occurs.
3037
3038 -dm Print statistics on memory usage, at the end of the run, to
3039 standard error.
3040
3041 -dp Annotate the assembler output with a comment indicating which
3042 pattern and alternative was used. The length of each instruc‐
3043 tion is also printed.
3044
3045 -dP Dump the RTL in the assembler output as a comment before each
3046 instruction. Also turns on -dp annotation.
3047
3048 -dv For each of the other indicated dump files (either with -d or
3049 -fdump-rtl-pass), dump a representation of the control flow
3050 graph suitable for viewing with VCG to file.pass.vcg.
3051
3052 -dx Just generate RTL for a function instead of compiling it. Usu‐
3053 ally used with r (-fdump-rtl-expand).
3054
3055 -dy Dump debugging information during parsing, to standard error.
3056
3057 -fdump-unnumbered
3058 When doing debugging dumps (see -d option above), suppress instruc‐
3059 tion numbers and line number note output. This makes it more fea‐
3060 sible to use diff on debugging dumps for compiler invocations with
3061 different options, in particular with and without -g.
3062
3063 -fdump-translation-unit (C++ only)
3064 -fdump-translation-unit-options (C++ only)
3065 Dump a representation of the tree structure for the entire transla‐
3066 tion unit to a file. The file name is made by appending .tu to the
3067 source file name. If the -options form is used, options controls
3068 the details of the dump as described for the -fdump-tree options.
3069
3070 -fdump-class-hierarchy (C++ only)
3071 -fdump-class-hierarchy-options (C++ only)
3072 Dump a representation of each class's hierarchy and virtual func‐
3073 tion table layout to a file. The file name is made by appending
3074 .class to the source file name. If the -options form is used,
3075 options controls the details of the dump as described for the
3076 -fdump-tree options.
3077
3078 -fdump-ipa-switch
3079 Control the dumping at various stages of inter-procedural analysis
3080 language tree to a file. The file name is generated by appending a
3081 switch specific suffix to the source file name. The following
3082 dumps are possible:
3083
3084 all Enables all inter-procedural analysis dumps; currently the only
3085 produced dump is the cgraph dump.
3086
3087 cgraph
3088 Dumps information about call-graph optimization, unused func‐
3089 tion removal, and inlining decisions.
3090
3091 -fdump-tree-switch
3092 -fdump-tree-switch-options
3093 Control the dumping at various stages of processing the intermedi‐
3094 ate language tree to a file. The file name is generated by append‐
3095 ing a switch specific suffix to the source file name. If the
3096 -options form is used, options is a list of - separated options
3097 that control the details of the dump. Not all options are applica‐
3098 ble to all dumps, those which are not meaningful will be ignored.
3099 The following options are available
3100
3101 address
3102 Print the address of each node. Usually this is not meaningful
3103 as it changes according to the environment and source file.
3104 Its primary use is for tying up a dump file with a debug envi‐
3105 ronment.
3106
3107 slim
3108 Inhibit dumping of members of a scope or body of a function
3109 merely because that scope has been reached. Only dump such
3110 items when they are directly reachable by some other path.
3111 When dumping pretty-printed trees, this option inhibits dumping
3112 the bodies of control structures.
3113
3114 raw Print a raw representation of the tree. By default, trees are
3115 pretty-printed into a C-like representation.
3116
3117 details
3118 Enable more detailed dumps (not honored by every dump option).
3119
3120 stats
3121 Enable dumping various statistics about the pass (not honored
3122 by every dump option).
3123
3124 blocks
3125 Enable showing basic block boundaries (disabled in raw dumps).
3126
3127 vops
3128 Enable showing virtual operands for every statement.
3129
3130 lineno
3131 Enable showing line numbers for statements.
3132
3133 uid Enable showing the unique ID ("DECL_UID") for each variable.
3134
3135 all Turn on all options, except raw, slim and lineno.
3136
3137 The following tree dumps are possible:
3138
3139 original
3140 Dump before any tree based optimization, to file.original.
3141
3142 optimized
3143 Dump after all tree based optimization, to file.optimized.
3144
3145 inlined
3146 Dump after function inlining, to file.inlined.
3147
3148 gimple
3149 Dump each function before and after the gimplification pass to
3150 a file. The file name is made by appending .gimple to the
3151 source file name.
3152
3153 cfg Dump the control flow graph of each function to a file. The
3154 file name is made by appending .cfg to the source file name.
3155
3156 vcg Dump the control flow graph of each function to a file in VCG
3157 format. The file name is made by appending .vcg to the source
3158 file name. Note that if the file contains more than one func‐
3159 tion, the generated file cannot be used directly by VCG. You
3160 will need to cut and paste each function's graph into its own
3161 separate file first.
3162
3163 ch Dump each function after copying loop headers. The file name
3164 is made by appending .ch to the source file name.
3165
3166 ssa Dump SSA related information to a file. The file name is made
3167 by appending .ssa to the source file name.
3168
3169 salias
3170 Dump structure aliasing variable information to a file. This
3171 file name is made by appending .salias to the source file name.
3172
3173 alias
3174 Dump aliasing information for each function. The file name is
3175 made by appending .alias to the source file name.
3176
3177 ccp Dump each function after CCP. The file name is made by append‐
3178 ing .ccp to the source file name.
3179
3180 storeccp
3181 Dump each function after STORE-CCP. The file name is made by
3182 appending .storeccp to the source file name.
3183
3184 pre Dump trees after partial redundancy elimination. The file name
3185 is made by appending .pre to the source file name.
3186
3187 fre Dump trees after full redundancy elimination. The file name is
3188 made by appending .fre to the source file name.
3189
3190 copyprop
3191 Dump trees after copy propagation. The file name is made by
3192 appending .copyprop to the source file name.
3193
3194 store_copyprop
3195 Dump trees after store copy-propagation. The file name is made
3196 by appending .store_copyprop to the source file name.
3197
3198 dce Dump each function after dead code elimination. The file name
3199 is made by appending .dce to the source file name.
3200
3201 mudflap
3202 Dump each function after adding mudflap instrumentation. The
3203 file name is made by appending .mudflap to the source file
3204 name.
3205
3206 sra Dump each function after performing scalar replacement of
3207 aggregates. The file name is made by appending .sra to the
3208 source file name.
3209
3210 sink
3211 Dump each function after performing code sinking. The file
3212 name is made by appending .sink to the source file name.
3213
3214 dom Dump each function after applying dominator tree optimizations.
3215 The file name is made by appending .dom to the source file
3216 name.
3217
3218 dse Dump each function after applying dead store elimination. The
3219 file name is made by appending .dse to the source file name.
3220
3221 phiopt
3222 Dump each function after optimizing PHI nodes into straightline
3223 code. The file name is made by appending .phiopt to the source
3224 file name.
3225
3226 forwprop
3227 Dump each function after forward propagating single use vari‐
3228 ables. The file name is made by appending .forwprop to the
3229 source file name.
3230
3231 copyrename
3232 Dump each function after applying the copy rename optimization.
3233 The file name is made by appending .copyrename to the source
3234 file name.
3235
3236 nrv Dump each function after applying the named return value opti‐
3237 mization on generic trees. The file name is made by appending
3238 .nrv to the source file name.
3239
3240 vect
3241 Dump each function after applying vectorization of loops. The
3242 file name is made by appending .vect to the source file name.
3243
3244 vrp Dump each function after Value Range Propagation (VRP). The
3245 file name is made by appending .vrp to the source file name.
3246
3247 all Enable all the available tree dumps with the flags provided in
3248 this option.
3249
3250 -ftree-vectorizer-verbose=n
3251 This option controls the amount of debugging output the vectorizer
3252 prints. This information is written to standard error, unless
3253 -fdump-tree-all or -fdump-tree-vect is specified, in which case it
3254 is output to the usual dump listing file, .vect.
3255
3256 -frandom-seed=string
3257 This option provides a seed that GCC uses when it would otherwise
3258 use random numbers. It is used to generate certain symbol names
3259 that have to be different in every compiled file. It is also used
3260 to place unique stamps in coverage data files and the object files
3261 that produce them. You can use the -frandom-seed option to produce
3262 reproducibly identical object files.
3263
3264 The string should be different for every file you compile.
3265
3266 -fsched-verbose=n
3267 On targets that use instruction scheduling, this option controls
3268 the amount of debugging output the scheduler prints. This informa‐
3269 tion is written to standard error, unless -dS or -dR is specified,
3270 in which case it is output to the usual dump listing file, .sched
3271 or .sched2 respectively. However for n greater than nine, the out‐
3272 put is always printed to standard error.
3273
3274 For n greater than zero, -fsched-verbose outputs the same informa‐
3275 tion as -dRS. For n greater than one, it also output basic block
3276 probabilities, detailed ready list information and unit/insn info.
3277 For n greater than two, it includes RTL at abort point, control-
3278 flow and regions info. And for n over four, -fsched-verbose also
3279 includes dependence info.
3280
3281 -save-temps
3282 Store the usual "temporary" intermediate files permanently; place
3283 them in the current directory and name them based on the source
3284 file. Thus, compiling foo.c with -c -save-temps would produce
3285 files foo.i and foo.s, as well as foo.o. This creates a prepro‐
3286 cessed foo.i output file even though the compiler now normally uses
3287 an integrated preprocessor.
3288
3289 When used in combination with the -x command line option,
3290 -save-temps is sensible enough to avoid over writing an input
3291 source file with the same extension as an intermediate file. The
3292 corresponding intermediate file may be obtained by renaming the
3293 source file before using -save-temps.
3294
3295 -time
3296 Report the CPU time taken by each subprocess in the compilation
3297 sequence. For C source files, this is the compiler proper and
3298 assembler (plus the linker if linking is done). The output looks
3299 like this:
3300
3301 # cc1 0.12 0.01
3302 # as 0.00 0.01
3303
3304 The first number on each line is the "user time", that is time
3305 spent executing the program itself. The second number is "system
3306 time", time spent executing operating system routines on behalf of
3307 the program. Both numbers are in seconds.
3308
3309 -fvar-tracking
3310 Run variable tracking pass. It computes where variables are stored
3311 at each position in code. Better debugging information is then
3312 generated (if the debugging information format supports this infor‐
3313 mation).
3314
3315 It is enabled by default when compiling with optimization (-Os, -O,
3316 -O2, ...), debugging information (-g) and the debug info format
3317 supports it.
3318
3319 -print-file-name=library
3320 Print the full absolute name of the library file library that would
3321 be used when linking---and don't do anything else. With this
3322 option, GCC does not compile or link anything; it just prints the
3323 file name.
3324
3325 -print-multi-directory
3326 Print the directory name corresponding to the multilib selected by
3327 any other switches present in the command line. This directory is
3328 supposed to exist in GCC_EXEC_PREFIX.
3329
3330 -print-multi-lib
3331 Print the mapping from multilib directory names to compiler
3332 switches that enable them. The directory name is separated from
3333 the switches by ;, and each switch starts with an @} instead of the
3334 @samp{-, without spaces between multiple switches. This is sup‐
3335 posed to ease shell-processing.
3336
3337 -print-prog-name=program
3338 Like -print-file-name, but searches for a program such as cpp.
3339
3340 -print-libgcc-file-name
3341 Same as -print-file-name=libgcc.a.
3342
3343 This is useful when you use -nostdlib or -nodefaultlibs but you do
3344 want to link with libgcc.a. You can do
3345
3346 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
3347
3348 -print-search-dirs
3349 Print the name of the configured installation directory and a list
3350 of program and library directories gcc will search---and don't do
3351 anything else.
3352
3353 This is useful when gcc prints the error message installation prob‐
3354 lem, cannot exec cpp0: No such file or directory. To resolve this
3355 you either need to put cpp0 and the other compiler components where
3356 gcc expects to find them, or you can set the environment variable
3357 GCC_EXEC_PREFIX to the directory where you installed them. Don't
3358 forget the trailing /.
3359
3360 -dumpmachine
3361 Print the compiler's target machine (for example,
3362 i686-pc-linux-gnu)---and don't do anything else.
3363
3364 -dumpversion
3365 Print the compiler version (for example, 3.0)---and don't do any‐
3366 thing else.
3367
3368 -dumpspecs
3369 Print the compiler's built-in specs---and don't do anything else.
3370 (This is used when GCC itself is being built.)
3371
3372 -feliminate-unused-debug-types
3373 Normally, when producing DWARF2 output, GCC will emit debugging
3374 information for all types declared in a compilation unit, regard‐
3375 less of whether or not they are actually used in that compilation
3376 unit. Sometimes this is useful, such as if, in the debugger, you
3377 want to cast a value to a type that is not actually used in your
3378 program (but is declared). More often, however, this results in a
3379 significant amount of wasted space. With this option, GCC will
3380 avoid producing debug symbol output for types that are nowhere used
3381 in the source file being compiled.
3382
3383 Options That Control Optimization
3384
3385 These options control various sorts of optimizations.
3386
3387 Without any optimization option, the compiler's goal is to reduce the
3388 cost of compilation and to make debugging produce the expected results.
3389 Statements are independent: if you stop the program with a breakpoint
3390 between statements, you can then assign a new value to any variable or
3391 change the program counter to any other statement in the function and
3392 get exactly the results you would expect from the source code.
3393
3394 Turning on optimization flags makes the compiler attempt to improve the
3395 performance and/or code size at the expense of compilation time and
3396 possibly the ability to debug the program.
3397
3398 The compiler performs optimization based on the knowledge it has of the
3399 program. Optimization levels -O and above, in particular, enable unit-
3400 at-a-time mode, which allows the compiler to consider information
3401 gained from later functions in the file when compiling a function.
3402 Compiling multiple files at once to a single output file in unit-at-a-
3403 time mode allows the compiler to use information gained from all of the
3404 files when compiling each of them.
3405
3406 Not all optimizations are controlled directly by a flag. Only opti‐
3407 mizations that have a flag are listed.
3408
3409 -O
3410 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
3411 lot more memory for a large function.
3412
3413 With -O, the compiler tries to reduce code size and execution time,
3414 without performing any optimizations that take a great deal of com‐
3415 pilation time.
3416
3417 -O turns on the following optimization flags: -fdefer-pop -fde‐
3418 layed-branch -fguess-branch-probability -fcprop-registers
3419 -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp
3420 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs
3421 -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -funit-at-a-time
3422 -fmerge-constants
3423
3424 -O also turns on -fomit-frame-pointer on machines where doing so
3425 does not interfere with debugging.
3426
3427 -O doesn't turn on -ftree-sra for the Ada compiler. This option
3428 must be explicitly specified on the command line to be enabled for
3429 the Ada compiler.
3430
3431 -O2 Optimize even more. GCC performs nearly all supported optimiza‐
3432 tions that do not involve a space-speed tradeoff. The compiler
3433 does not perform loop unrolling or function inlining when you spec‐
3434 ify -O2. As compared to -O, this option increases both compilation
3435 time and the performance of the generated code.
3436
3437 -O2 turns on all optimization flags specified by -O. It also turns
3438 on the following optimization flags: -fthread-jumps -fcrossjumping
3439 -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks
3440 -fgcse -fgcse-lm -fexpensive-optimizations -fstrength-reduce -fre‐
3441 run-cse-after-loop -frerun-loop-opt -fcaller-saves -fpeephole2
3442 -fschedule-insns -fschedule-insns2 -fsched-interblock
3443 -fsched-spec -fregmove -fstrict-aliasing
3444 -fdelete-null-pointer-checks -freorder-blocks -freorder-functions
3445 -falign-functions -falign-jumps -falign-loops -falign-labels
3446 -ftree-vrp -ftree-pre
3447
3448 Please note the warning under -fgcse about invoking -O2 on programs
3449 that use computed gotos.
3450
3451 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
3452 and also turns on the -finline-functions, -funswitch-loops and
3453 -fgcse-after-reload options.
3454
3455 -O0 Do not optimize. This is the default.
3456
3457 -Os Optimize for size. -Os enables all -O2 optimizations that do not
3458 typically increase code size. It also performs further optimiza‐
3459 tions designed to reduce code size.
3460
3461 -Os disables the following optimization flags: -falign-functions
3462 -falign-jumps -falign-loops -falign-labels -freorder-blocks
3463 -freorder-blocks-and-partition -fprefetch-loop-arrays
3464 -ftree-vect-loop-version
3465
3466 If you use multiple -O options, with or without level numbers, the
3467 last such option is the one that is effective.
3468
3469 Options of the form -fflag specify machine-independent flags. Most
3470 flags have both positive and negative forms; the negative form of -ffoo
3471 would be -fno-foo. In the table below, only one of the forms is
3472 listed---the one you typically will use. You can figure out the other
3473 form by either removing no- or adding it.
3474
3475 The following options control specific optimizations. They are either
3476 activated by -O options or are related to ones that are. You can use
3477 the following flags in the rare cases when "fine-tuning" of optimiza‐
3478 tions to be performed is desired.
3479
3480 -fno-default-inline
3481 Do not make member functions inline by default merely because they
3482 are defined inside the class scope (C++ only). Otherwise, when you
3483 specify -O, member functions defined inside class scope are com‐
3484 piled inline by default; i.e., you don't need to add inline in
3485 front of the member function name.
3486
3487 -fno-defer-pop
3488 Always pop the arguments to each function call as soon as that
3489 function returns. For machines which must pop arguments after a
3490 function call, the compiler normally lets arguments accumulate on
3491 the stack for several function calls and pops them all at once.
3492
3493 Disabled at levels -O, -O2, -O3, -Os.
3494
3495 -fforce-mem
3496 Force memory operands to be copied into registers before doing
3497 arithmetic on them. This produces better code by making all memory
3498 references potential common subexpressions. When they are not com‐
3499 mon subexpressions, instruction combination should eliminate the
3500 separate register-load. This option is now a nop and will be
3501 removed in 4.2.
3502
3503 -fforce-addr
3504 Force memory address constants to be copied into registers before
3505 doing arithmetic on them.
3506
3507 -fomit-frame-pointer
3508 Don't keep the frame pointer in a register for functions that don't
3509 need one. This avoids the instructions to save, set up and restore
3510 frame pointers; it also makes an extra register available in many
3511 functions. It also makes debugging impossible on some machines.
3512
3513 On some machines, such as the VAX, this flag has no effect, because
3514 the standard calling sequence automatically handles the frame
3515 pointer and nothing is saved by pretending it doesn't exist. The
3516 machine-description macro "FRAME_POINTER_REQUIRED" controls whether
3517 a target machine supports this flag.
3518
3519 Enabled at levels -O, -O2, -O3, -Os.
3520
3521 -foptimize-sibling-calls
3522 Optimize sibling and tail recursive calls.
3523
3524 Enabled at levels -O2, -O3, -Os.
3525
3526 -fno-inline
3527 Don't pay attention to the "inline" keyword. Normally this option
3528 is used to keep the compiler from expanding any functions inline.
3529 Note that if you are not optimizing, no functions can be expanded
3530 inline.
3531
3532 -finline-functions
3533 Integrate all simple functions into their callers. The compiler
3534 heuristically decides which functions are simple enough to be worth
3535 integrating in this way.
3536
3537 If all calls to a given function are integrated, and the function
3538 is declared "static", then the function is normally not output as
3539 assembler code in its own right.
3540
3541 Enabled at level -O3.
3542
3543 -finline-functions-called-once
3544 Consider all "static" functions called once for inlining into their
3545 caller even if they are not marked "inline". If a call to a given
3546 function is integrated, then the function is not output as assem‐
3547 bler code in its own right.
3548
3549 Enabled if -funit-at-a-time is enabled.
3550
3551 -fearly-inlining
3552 Inline functions marked by "always_inline" and functions whose body
3553 seems smaller than the function call overhead early before doing
3554 -fprofile-generate instrumentation and real inlining pass. Doing
3555 so makes profiling significantly cheaper and usually inlining
3556 faster on programs having large chains of nested wrapper functions.
3557
3558 Enabled by default.
3559
3560 -finline-limit=n
3561 By default, GCC limits the size of functions that can be inlined.
3562 This flag allows the control of this limit for functions that are
3563 explicitly marked as inline (i.e., marked with the inline keyword
3564 or defined within the class definition in c++). n is the size of
3565 functions that can be inlined in number of pseudo instructions (not
3566 counting parameter handling). The default value of n is 600.
3567 Increasing this value can result in more inlined code at the cost
3568 of compilation time and memory consumption. Decreasing usually
3569 makes the compilation faster and less code will be inlined (which
3570 presumably means slower programs). This option is particularly
3571 useful for programs that use inlining heavily such as those based
3572 on recursive templates with C++.
3573
3574 Inlining is actually controlled by a number of parameters, which
3575 may be specified individually by using --param name=value. The
3576 -finline-limit=n option sets some of these parameters as follows:
3577
3578 max-inline-insns-single
3579 is set to I<n>/2.
3580
3581 max-inline-insns-auto
3582 is set to I<n>/2.
3583
3584 min-inline-insns
3585 is set to 130 or I<n>/4, whichever is smaller.
3586
3587 max-inline-insns-rtl
3588 is set to I<n>.
3589
3590 See below for a documentation of the individual parameters control‐
3591 ling inlining.
3592
3593 Note: pseudo instruction represents, in this particular context, an
3594 abstract measurement of function's size. In no way does it repre‐
3595 sent a count of assembly instructions and as such its exact meaning
3596 might change from one release to an another.
3597
3598 -fkeep-inline-functions
3599 In C, emit "static" functions that are declared "inline" into the
3600 object file, even if the function has been inlined into all of its
3601 callers. This switch does not affect functions using the "extern
3602 inline" extension in GNU C. In C++, emit any and all inline func‐
3603 tions into the object file.
3604
3605 -fkeep-static-consts
3606 Emit variables declared "static const" when optimization isn't
3607 turned on, even if the variables aren't referenced.
3608
3609 GCC enables this option by default. If you want to force the com‐
3610 piler to check if the variable was referenced, regardless of
3611 whether or not optimization is turned on, use the
3612 -fno-keep-static-consts option.
3613
3614 -fmerge-constants
3615 Attempt to merge identical constants (string constants and floating
3616 point constants) across compilation units.
3617
3618 This option is the default for optimized compilation if the assem‐
3619 bler and linker support it. Use -fno-merge-constants to inhibit
3620 this behavior.
3621
3622 Enabled at levels -O, -O2, -O3, -Os.
3623
3624 -fmerge-all-constants
3625 Attempt to merge identical constants and identical variables.
3626
3627 This option implies -fmerge-constants. In addition to -fmerge-con‐
3628 stants this considers e.g. even constant initialized arrays or ini‐
3629 tialized constant variables with integral or floating point types.
3630 Languages like C or C++ require each non-automatic variable to have
3631 distinct location, so using this option will result in non-conform‐
3632 ing behavior.
3633
3634 -fmodulo-sched
3635 Perform swing modulo scheduling immediately before the first sched‐
3636 uling pass. This pass looks at innermost loops and reorders their
3637 instructions by overlapping different iterations.
3638
3639 -fno-branch-count-reg
3640 Do not use "decrement and branch" instructions on a count register,
3641 but instead generate a sequence of instructions that decrement a
3642 register, compare it against zero, then branch based upon the
3643 result. This option is only meaningful on architectures that sup‐
3644 port such instructions, which include x86, PowerPC, IA-64 and
3645 S/390.
3646
3647 The default is -fbranch-count-reg, enabled when -fstrength-reduce
3648 is enabled.
3649
3650 -fno-function-cse
3651 Do not put function addresses in registers; make each instruction
3652 that calls a constant function contain the function's address
3653 explicitly.
3654
3655 This option results in less efficient code, but some strange hacks
3656 that alter the assembler output may be confused by the optimiza‐
3657 tions performed when this option is not used.
3658
3659 The default is -ffunction-cse
3660
3661 -fno-zero-initialized-in-bss
3662 If the target supports a BSS section, GCC by default puts variables
3663 that are initialized to zero into BSS. This can save space in the
3664 resulting code.
3665
3666 This option turns off this behavior because some programs explic‐
3667 itly rely on variables going to the data section. E.g., so that
3668 the resulting executable can find the beginning of that section
3669 and/or make assumptions based on that.
3670
3671 The default is -fzero-initialized-in-bss.
3672
3673 -fbounds-check
3674 For front-ends that support it, generate additional code to check
3675 that indices used to access arrays are within the declared range.
3676 This is currently only supported by the Java and Fortran
3677 front-ends, where this option defaults to true and false respec‐
3678 tively.
3679
3680 -fmudflap -fmudflapth -fmudflapir
3681 For front-ends that support it (C and C++), instrument all risky
3682 pointer/array dereferencing operations, some standard library
3683 string/heap functions, and some other associated constructs with
3684 range/validity tests. Modules so instrumented should be immune to
3685 buffer overflows, invalid heap use, and some other classes of C/C++
3686 programming errors. The instrumentation relies on a separate run‐
3687 time library (libmudflap), which will be linked into a program if
3688 -fmudflap is given at link time. Run-time behavior of the instru‐
3689 mented program is controlled by the MUDFLAP_OPTIONS environment
3690 variable. See "env MUDFLAP_OPTIONS=-help a.out" for its options.
3691
3692 Use -fmudflapth instead of -fmudflap to compile and to link if your
3693 program is multi-threaded. Use -fmudflapir, in addition to -fmud‐
3694 flap or -fmudflapth, if instrumentation should ignore pointer
3695 reads. This produces less instrumentation (and therefore faster
3696 execution) and still provides some protection against outright mem‐
3697 ory corrupting writes, but allows erroneously read data to propa‐
3698 gate within a program.
3699
3700 -fstrength-reduce
3701 Perform the optimizations of loop strength reduction and elimina‐
3702 tion of iteration variables.
3703
3704 Enabled at levels -O2, -O3, -Os.
3705
3706 -fthread-jumps
3707 Perform optimizations where we check to see if a jump branches to a
3708 location where another comparison subsumed by the first is found.
3709 If so, the first branch is redirected to either the destination of
3710 the second branch or a point immediately following it, depending on
3711 whether the condition is known to be true or false.
3712
3713 Enabled at levels -O2, -O3, -Os.
3714
3715 -fcse-follow-jumps
3716 In common subexpression elimination, scan through jump instructions
3717 when the target of the jump is not reached by any other path. For
3718 example, when CSE encounters an "if" statement with an "else"
3719 clause, CSE will follow the jump when the condition tested is
3720 false.
3721
3722 Enabled at levels -O2, -O3, -Os.
3723
3724 -fcse-skip-blocks
3725 This is similar to -fcse-follow-jumps, but causes CSE to follow
3726 jumps which conditionally skip over blocks. When CSE encounters a
3727 simple "if" statement with no else clause, -fcse-skip-blocks causes
3728 CSE to follow the jump around the body of the "if".
3729
3730 Enabled at levels -O2, -O3, -Os.
3731
3732 -frerun-cse-after-loop
3733 Re-run common subexpression elimination after loop optimizations
3734 has been performed.
3735
3736 Enabled at levels -O2, -O3, -Os.
3737
3738 -frerun-loop-opt
3739 Run the loop optimizer twice.
3740
3741 Enabled at levels -O2, -O3, -Os.
3742
3743 -fgcse
3744 Perform a global common subexpression elimination pass. This pass
3745 also performs global constant and copy propagation.
3746
3747 Note: When compiling a program using computed gotos, a GCC exten‐
3748 sion, you may get better runtime performance if you disable the
3749 global common subexpression elimination pass by adding -fno-gcse to
3750 the command line.
3751
3752 Enabled at levels -O2, -O3, -Os.
3753
3754 -fgcse-lm
3755 When -fgcse-lm is enabled, global common subexpression elimination
3756 will attempt to move loads which are only killed by stores into
3757 themselves. This allows a loop containing a load/store sequence to
3758 be changed to a load outside the loop, and a copy/store within the
3759 loop.
3760
3761 Enabled by default when gcse is enabled.
3762
3763 -fgcse-sm
3764 When -fgcse-sm is enabled, a store motion pass is run after global
3765 common subexpression elimination. This pass will attempt to move
3766 stores out of loops. When used in conjunction with -fgcse-lm,
3767 loops containing a load/store sequence can be changed to a load
3768 before the loop and a store after the loop.
3769
3770 Not enabled at any optimization level.
3771
3772 -fgcse-las
3773 When -fgcse-las is enabled, the global common subexpression elimi‐
3774 nation pass eliminates redundant loads that come after stores to
3775 the same memory location (both partial and full redundancies).
3776
3777 Not enabled at any optimization level.
3778
3779 -fgcse-after-reload
3780 When -fgcse-after-reload is enabled, a redundant load elimination
3781 pass is performed after reload. The purpose of this pass is to
3782 cleanup redundant spilling.
3783
3784 -floop-optimize
3785 Perform loop optimizations: move constant expressions out of loops,
3786 simplify exit test conditions and optionally do strength-reduction
3787 as well.
3788
3789 Enabled at levels -O, -O2, -O3, -Os.
3790
3791 -floop-optimize2
3792 Perform loop optimizations using the new loop optimizer. The opti‐
3793 mizations (loop unrolling, peeling and unswitching, loop invariant
3794 motion) are enabled by separate flags.
3795
3796 -funsafe-loop-optimizations
3797 If given, the loop optimizer will assume that loop indices do not
3798 overflow, and that the loops with nontrivial exit condition are not
3799 infinite. This enables a wider range of loop optimizations even if
3800 the loop optimizer itself cannot prove that these assumptions are
3801 valid. Using -Wunsafe-loop-optimizations, the compiler will warn
3802 you if it finds this kind of loop.
3803
3804 -fcrossjumping
3805 Perform cross-jumping transformation. This transformation unifies
3806 equivalent code and save code size. The resulting code may or may
3807 not perform better than without cross-jumping.
3808
3809 Enabled at levels -O2, -O3, -Os.
3810
3811 -fif-conversion
3812 Attempt to transform conditional jumps into branch-less equiva‐
3813 lents. This include use of conditional moves, min, max, set flags
3814 and abs instructions, and some tricks doable by standard arith‐
3815 metics. The use of conditional execution on chips where it is
3816 available is controlled by "if-conversion2".
3817
3818 Enabled at levels -O, -O2, -O3, -Os.
3819
3820 -fif-conversion2
3821 Use conditional execution (where available) to transform condi‐
3822 tional jumps into branch-less equivalents.
3823
3824 Enabled at levels -O, -O2, -O3, -Os.
3825
3826 -fdelete-null-pointer-checks
3827 Use global dataflow analysis to identify and eliminate useless
3828 checks for null pointers. The compiler assumes that dereferencing
3829 a null pointer would have halted the program. If a pointer is
3830 checked after it has already been dereferenced, it cannot be null.
3831
3832 In some environments, this assumption is not true, and programs can
3833 safely dereference null pointers. Use
3834 -fno-delete-null-pointer-checks to disable this optimization for
3835 programs which depend on that behavior.
3836
3837 Enabled at levels -O2, -O3, -Os.
3838
3839 -fexpensive-optimizations
3840 Perform a number of minor optimizations that are relatively expen‐
3841 sive.
3842
3843 Enabled at levels -O2, -O3, -Os.
3844
3845 -foptimize-register-move
3846 -fregmove
3847 Attempt to reassign register numbers in move instructions and as
3848 operands of other simple instructions in order to maximize the
3849 amount of register tying. This is especially helpful on machines
3850 with two-operand instructions.
3851
3852 Note -fregmove and -foptimize-register-move are the same optimiza‐
3853 tion.
3854
3855 Enabled at levels -O2, -O3, -Os.
3856
3857 -fdelayed-branch
3858 If supported for the target machine, attempt to reorder instruc‐
3859 tions to exploit instruction slots available after delayed branch
3860 instructions.
3861
3862 Enabled at levels -O, -O2, -O3, -Os.
3863
3864 -fschedule-insns
3865 If supported for the target machine, attempt to reorder instruc‐
3866 tions to eliminate execution stalls due to required data being
3867 unavailable. This helps machines that have slow floating point or
3868 memory load instructions by allowing other instructions to be
3869 issued until the result of the load or floating point instruction
3870 is required.
3871
3872 Enabled at levels -O2, -O3, -Os.
3873
3874 -fschedule-insns2
3875 Similar to -fschedule-insns, but requests an additional pass of
3876 instruction scheduling after register allocation has been done.
3877 This is especially useful on machines with a relatively small num‐
3878 ber of registers and where memory load instructions take more than
3879 one cycle.
3880
3881 Enabled at levels -O2, -O3, -Os.
3882
3883 -fno-sched-interblock
3884 Don't schedule instructions across basic blocks. This is normally
3885 enabled by default when scheduling before register allocation, i.e.
3886 with -fschedule-insns or at -O2 or higher.
3887
3888 -fno-sched-spec
3889 Don't allow speculative motion of non-load instructions. This is
3890 normally enabled by default when scheduling before register alloca‐
3891 tion, i.e. with -fschedule-insns or at -O2 or higher.
3892
3893 -fsched-spec-load
3894 Allow speculative motion of some load instructions. This only
3895 makes sense when scheduling before register allocation, i.e. with
3896 -fschedule-insns or at -O2 or higher.
3897
3898 -fsched-spec-load-dangerous
3899 Allow speculative motion of more load instructions. This only
3900 makes sense when scheduling before register allocation, i.e. with
3901 -fschedule-insns or at -O2 or higher.
3902
3903 -fsched-stalled-insns=n
3904 Define how many insns (if any) can be moved prematurely from the
3905 queue of stalled insns into the ready list, during the second
3906 scheduling pass.
3907
3908 -fsched-stalled-insns-dep=n
3909 Define how many insn groups (cycles) will be examined for a depen‐
3910 dency on a stalled insn that is candidate for premature removal
3911 from the queue of stalled insns. Has an effect only during the
3912 second scheduling pass, and only if -fsched-stalled-insns is used
3913 and its value is not zero.
3914
3915 -fsched2-use-superblocks
3916 When scheduling after register allocation, do use superblock sched‐
3917 uling algorithm. Superblock scheduling allows motion across basic
3918 block boundaries resulting on faster schedules. This option is
3919 experimental, as not all machine descriptions used by GCC model the
3920 CPU closely enough to avoid unreliable results from the algorithm.
3921
3922 This only makes sense when scheduling after register allocation,
3923 i.e. with -fschedule-insns2 or at -O2 or higher.
3924
3925 -fsched2-use-traces
3926 Use -fsched2-use-superblocks algorithm when scheduling after regis‐
3927 ter allocation and additionally perform code duplication in order
3928 to increase the size of superblocks using tracer pass. See
3929 -ftracer for details on trace formation.
3930
3931 This mode should produce faster but significantly longer programs.
3932 Also without -fbranch-probabilities the traces constructed may not
3933 match the reality and hurt the performance. This only makes sense
3934 when scheduling after register allocation, i.e. with -fsched‐
3935 ule-insns2 or at -O2 or higher.
3936
3937 -freschedule-modulo-scheduled-loops
3938 The modulo scheduling comes before the traditional scheduling, if a
3939 loop was modulo scheduled we may want to prevent the later schedul‐
3940 ing passes from changing its schedule, we use this option to con‐
3941 trol that.
3942
3943 -fcaller-saves
3944 Enable values to be allocated in registers that will be clobbered
3945 by function calls, by emitting extra instructions to save and
3946 restore the registers around such calls. Such allocation is done
3947 only when it seems to result in better code than would otherwise be
3948 produced.
3949
3950 This option is always enabled by default on certain machines, usu‐
3951 ally those which have no call-preserved registers to use instead.
3952
3953 Enabled at levels -O2, -O3, -Os.
3954
3955 -ftree-pre
3956 Perform Partial Redundancy Elimination (PRE) on trees. This flag
3957 is enabled by default at -O2 and -O3.
3958
3959 -ftree-fre
3960 Perform Full Redundancy Elimination (FRE) on trees. The difference
3961 between FRE and PRE is that FRE only considers expressions that are
3962 computed on all paths leading to the redundant computation. This
3963 analysis faster than PRE, though it exposes fewer redundancies.
3964 This flag is enabled by default at -O and higher.
3965
3966 -ftree-copy-prop
3967 Perform copy propagation on trees. This pass eliminates unneces‐
3968 sary copy operations. This flag is enabled by default at -O and
3969 higher.
3970
3971 -ftree-store-copy-prop
3972 Perform copy propagation of memory loads and stores. This pass
3973 eliminates unnecessary copy operations in memory references (struc‐
3974 tures, global variables, arrays, etc). This flag is enabled by
3975 default at -O2 and higher.
3976
3977 -ftree-salias
3978 Perform structural alias analysis on trees. This flag is enabled
3979 by default at -O and higher.
3980
3981 -ftree-sink
3982 Perform forward store motion on trees. This flag is enabled by
3983 default at -O and higher.
3984
3985 -ftree-ccp
3986 Perform sparse conditional constant propagation (CCP) on trees.
3987 This pass only operates on local scalar variables and is enabled by
3988 default at -O and higher.
3989
3990 -ftree-store-ccp
3991 Perform sparse conditional constant propagation (CCP) on trees.
3992 This pass operates on both local scalar variables and memory stores
3993 and loads (global variables, structures, arrays, etc). This flag
3994 is enabled by default at -O2 and higher.
3995
3996 -ftree-dce
3997 Perform dead code elimination (DCE) on trees. This flag is enabled
3998 by default at -O and higher.
3999
4000 -ftree-dominator-opts
4001 Perform a variety of simple scalar cleanups (constant/copy propaga‐
4002 tion, redundancy elimination, range propagation and expression sim‐
4003 plification) based on a dominator tree traversal. This also per‐
4004 forms jump threading (to reduce jumps to jumps). This flag is
4005 enabled by default at -O and higher.
4006
4007 -ftree-ch
4008 Perform loop header copying on trees. This is beneficial since it
4009 increases effectiveness of code motion optimizations. It also
4010 saves one jump. This flag is enabled by default at -O and higher.
4011 It is not enabled for -Os, since it usually increases code size.
4012
4013 -ftree-loop-optimize
4014 Perform loop optimizations on trees. This flag is enabled by
4015 default at -O and higher.
4016
4017 -ftree-loop-linear
4018 Perform linear loop transformations on tree. This flag can improve
4019 cache performance and allow further loop optimizations to take
4020 place.
4021
4022 -ftree-loop-im
4023 Perform loop invariant motion on trees. This pass moves only
4024 invariants that would be hard to handle at RTL level (function
4025 calls, operations that expand to nontrivial sequences of insns).
4026 With -funswitch-loops it also moves operands of conditions that are
4027 invariant out of the loop, so that we can use just trivial invari‐
4028 antness analysis in loop unswitching. The pass also includes store
4029 motion.
4030
4031 -ftree-loop-ivcanon
4032 Create a canonical counter for number of iterations in the loop for
4033 that determining number of iterations requires complicated analy‐
4034 sis. Later optimizations then may determine the number easily.
4035 Useful especially in connection with unrolling.
4036
4037 -fivopts
4038 Perform induction variable optimizations (strength reduction,
4039 induction variable merging and induction variable elimination) on
4040 trees.
4041
4042 -ftree-sra
4043 Perform scalar replacement of aggregates. This pass replaces
4044 structure references with scalars to prevent committing structures
4045 to memory too early. This flag is enabled by default at -O and
4046 higher.
4047
4048 -ftree-copyrename
4049 Perform copy renaming on trees. This pass attempts to rename com‐
4050 piler temporaries to other variables at copy locations, usually
4051 resulting in variable names which more closely resemble the origi‐
4052 nal variables. This flag is enabled by default at -O and higher.
4053
4054 -ftree-ter
4055 Perform temporary expression replacement during the SSA->normal
4056 phase. Single use/single def temporaries are replaced at their use
4057 location with their defining expression. This results in non-GIM‐
4058 PLE code, but gives the expanders much more complex trees to work
4059 on resulting in better RTL generation. This is enabled by default
4060 at -O and higher.
4061
4062 -ftree-lrs
4063 Perform live range splitting during the SSA->normal phase. Dis‐
4064 tinct live ranges of a variable are split into unique variables,
4065 allowing for better optimization later. This is enabled by default
4066 at -O and higher.
4067
4068 -ftree-vectorize
4069 Perform loop vectorization on trees.
4070
4071 -ftree-vect-loop-version
4072 Perform loop versioning when doing loop vectorization on trees.
4073 When a loop appears to be vectorizable except that data alignment
4074 or data dependence cannot be determined at compile time then vec‐
4075 torized and non-vectorized versions of the loop are generated along
4076 with runtime checks for alignment or dependence to control which
4077 version is executed. This option is enabled by default except at
4078 level -Os where it is disabled.
4079
4080 -ftree-vrp
4081 Perform Value Range Propagation on trees. This is similar to the
4082 constant propagation pass, but instead of values, ranges of values
4083 are propagated. This allows the optimizers to remove unnecessary
4084 range checks like array bound checks and null pointer checks. This
4085 is enabled by default at -O2 and higher. Null pointer check elimi‐
4086 nation is only done if -fdelete-null-pointer-checks is enabled.
4087
4088 -ftracer
4089 Perform tail duplication to enlarge superblock size. This trans‐
4090 formation simplifies the control flow of the function allowing
4091 other optimizations to do better job.
4092
4093 -funroll-loops
4094 Unroll loops whose number of iterations can be determined at com‐
4095 pile time or upon entry to the loop. -funroll-loops implies both
4096 -fstrength-reduce and -frerun-cse-after-loop. This option makes
4097 code larger, and may or may not make it run faster.
4098
4099 -funroll-all-loops
4100 Unroll all loops, even if their number of iterations is uncertain
4101 when the loop is entered. This usually makes programs run more
4102 slowly. -funroll-all-loops implies the same options as -fun‐
4103 roll-loops,
4104
4105 -fsplit-ivs-in-unroller
4106 Enables expressing of values of induction variables in later itera‐
4107 tions of the unrolled loop using the value in the first iteration.
4108 This breaks long dependency chains, thus improving efficiency of
4109 the scheduling passes.
4110
4111 Combination of -fweb and CSE is often sufficient to obtain the same
4112 effect. However in cases the loop body is more complicated than a
4113 single basic block, this is not reliable. It also does not work at
4114 all on some of the architectures due to restrictions in the CSE
4115 pass.
4116
4117 This optimization is enabled by default.
4118
4119 -fvariable-expansion-in-unroller
4120 With this option, the compiler will create multiple copies of some
4121 local variables when unrolling a loop which can result in superior
4122 code.
4123
4124 -fprefetch-loop-arrays
4125 If supported by the target machine, generate instructions to
4126 prefetch memory to improve the performance of loops that access
4127 large arrays.
4128
4129 These options may generate better or worse code; results are highly
4130 dependent on the structure of loops within the source code.
4131
4132 -fno-peephole
4133 -fno-peephole2
4134 Disable any machine-specific peephole optimizations. The differ‐
4135 ence between -fno-peephole and -fno-peephole2 is in how they are
4136 implemented in the compiler; some targets use one, some use the
4137 other, a few use both.
4138
4139 -fpeephole is enabled by default. -fpeephole2 enabled at levels
4140 -O2, -O3, -Os.
4141
4142 -fno-guess-branch-probability
4143 Do not guess branch probabilities using heuristics.
4144
4145 GCC will use heuristics to guess branch probabilities if they are
4146 not provided by profiling feedback (-fprofile-arcs). These heuris‐
4147 tics are based on the control flow graph. If some branch probabil‐
4148 ities are specified by __builtin_expect, then the heuristics will
4149 be used to guess branch probabilities for the rest of the control
4150 flow graph, taking the __builtin_expect info into account. The
4151 interactions between the heuristics and __builtin_expect can be
4152 complex, and in some cases, it may be useful to disable the heuris‐
4153 tics so that the effects of __builtin_expect are easier to under‐
4154 stand.
4155
4156 The default is -fguess-branch-probability at levels -O, -O2, -O3,
4157 -Os.
4158
4159 -freorder-blocks
4160 Reorder basic blocks in the compiled function in order to reduce
4161 number of taken branches and improve code locality.
4162
4163 Enabled at levels -O2, -O3.
4164
4165 -freorder-blocks-and-partition
4166 In addition to reordering basic blocks in the compiled function, in
4167 order to reduce number of taken branches, partitions hot and cold
4168 basic blocks into separate sections of the assembly and .o files,
4169 to improve paging and cache locality performance.
4170
4171 This optimization is automatically turned off in the presence of
4172 exception handling, for linkonce sections, for functions with a
4173 user-defined section attribute and on any architecture that does
4174 not support named sections.
4175
4176 -freorder-functions
4177 Reorder functions in the object file in order to improve code
4178 locality. This is implemented by using special subsections
4179 ".text.hot" for most frequently executed functions and
4180 ".text.unlikely" for unlikely executed functions. Reordering is
4181 done by the linker so object file format must support named sec‐
4182 tions and linker must place them in a reasonable way.
4183
4184 Also profile feedback must be available in to make this option
4185 effective. See -fprofile-arcs for details.
4186
4187 Enabled at levels -O2, -O3, -Os.
4188
4189 -fstrict-aliasing
4190 Allows the compiler to assume the strictest aliasing rules applica‐
4191 ble to the language being compiled. For C (and C++), this acti‐
4192 vates optimizations based on the type of expressions. In particu‐
4193 lar, an object of one type is assumed never to reside at the same
4194 address as an object of a different type, unless the types are
4195 almost the same. For example, an "unsigned int" can alias an
4196 "int", but not a "void*" or a "double". A character type may alias
4197 any other type.
4198
4199 Pay special attention to code like this:
4200
4201 union a_union {
4202 int i;
4203 double d;
4204 };
4205
4206 int f() {
4207 a_union t;
4208 t.d = 3.0;
4209 return t.i;
4210 }
4211
4212 The practice of reading from a different union member than the one
4213 most recently written to (called "type-punning") is common. Even
4214 with -fstrict-aliasing, type-punning is allowed, provided the mem‐
4215 ory is accessed through the union type. So, the code above will
4216 work as expected. However, this code might not:
4217
4218 int f() {
4219 a_union t;
4220 int* ip;
4221 t.d = 3.0;
4222 ip = &t.i;
4223 return *ip;
4224 }
4225
4226 Every language that wishes to perform language-specific alias anal‐
4227 ysis should define a function that computes, given an "tree" node,
4228 an alias set for the node. Nodes in different alias sets are not
4229 allowed to alias. For an example, see the C front-end function
4230 "c_get_alias_set".
4231
4232 Enabled at levels -O2, -O3, -Os.
4233
4234 -falign-functions
4235 -falign-functions=n
4236 Align the start of functions to the next power-of-two greater than
4237 n, skipping up to n bytes. For instance, -falign-functions=32
4238 aligns functions to the next 32-byte boundary, but -falign-func‐
4239 tions=24 would align to the next 32-byte boundary only if this can
4240 be done by skipping 23 bytes or less.
4241
4242 -fno-align-functions and -falign-functions=1 are equivalent and
4243 mean that functions will not be aligned.
4244
4245 Some assemblers only support this flag when n is a power of two; in
4246 that case, it is rounded up.
4247
4248 If n is not specified or is zero, use a machine-dependent default.
4249
4250 Enabled at levels -O2, -O3.
4251
4252 -falign-labels
4253 -falign-labels=n
4254 Align all branch targets to a power-of-two boundary, skipping up to
4255 n bytes like -falign-functions. This option can easily make code
4256 slower, because it must insert dummy operations for when the branch
4257 target is reached in the usual flow of the code.
4258
4259 -fno-align-labels and -falign-labels=1 are equivalent and mean that
4260 labels will not be aligned.
4261
4262 If -falign-loops or -falign-jumps are applicable and are greater
4263 than this value, then their values are used instead.
4264
4265 If n is not specified or is zero, use a machine-dependent default
4266 which is very likely to be 1, meaning no alignment.
4267
4268 Enabled at levels -O2, -O3.
4269
4270 -falign-loops
4271 -falign-loops=n
4272 Align loops to a power-of-two boundary, skipping up to n bytes like
4273 -falign-functions. The hope is that the loop will be executed many
4274 times, which will make up for any execution of the dummy opera‐
4275 tions.
4276
4277 -fno-align-loops and -falign-loops=1 are equivalent and mean that
4278 loops will not be aligned.
4279
4280 If n is not specified or is zero, use a machine-dependent default.
4281
4282 Enabled at levels -O2, -O3.
4283
4284 -falign-jumps
4285 -falign-jumps=n
4286 Align branch targets to a power-of-two boundary, for branch targets
4287 where the targets can only be reached by jumping, skipping up to n
4288 bytes like -falign-functions. In this case, no dummy operations
4289 need be executed.
4290
4291 -fno-align-jumps and -falign-jumps=1 are equivalent and mean that
4292 loops will not be aligned.
4293
4294 If n is not specified or is zero, use a machine-dependent default.
4295
4296 Enabled at levels -O2, -O3.
4297
4298 -funit-at-a-time
4299 Parse the whole compilation unit before starting to produce code.
4300 This allows some extra optimizations to take place but consumes
4301 more memory (in general). There are some compatibility issues with
4302 unit-at-at-time mode:
4303
4304 * enabling unit-at-a-time mode may change the order in which
4305 functions, variables, and top-level "asm" statements are emit‐
4306 ted, and will likely break code relying on some particular
4307 ordering. The majority of such top-level "asm" statements,
4308 though, can be replaced by "section" attributes.
4309
4310 * unit-at-a-time mode removes unreferenced static variables and
4311 functions. This may result in undefined references when an
4312 "asm" statement refers directly to variables or functions that
4313 are otherwise unused. In that case either the variable/func‐
4314 tion shall be listed as an operand of the "asm" statement oper‐
4315 and or, in the case of top-level "asm" statements the attribute
4316 "used" shall be used on the declaration.
4317
4318 * Static functions now can use non-standard passing conventions
4319 that may break "asm" statements calling functions directly.
4320 Again, attribute "used" will prevent this behavior.
4321
4322 As a temporary workaround, -fno-unit-at-a-time can be used, but
4323 this scheme may not be supported by future releases of GCC.
4324
4325 Enabled at levels -O, -O2, -O3, -Os.
4326
4327 -fweb
4328 Constructs webs as commonly used for register allocation purposes
4329 and assign each web individual pseudo register. This allows the
4330 register allocation pass to operate on pseudos directly, but also
4331 strengthens several other optimization passes, such as CSE, loop
4332 optimizer and trivial dead code remover. It can, however, make
4333 debugging impossible, since variables will no longer stay in a
4334 "home register".
4335
4336 Enabled by default with -funroll-loops.
4337
4338 -fwhole-program
4339 Assume that the current compilation unit represents whole program
4340 being compiled. All public functions and variables with the excep‐
4341 tion of "main" and those merged by attribute "externally_visible"
4342 become static functions and in a affect gets more aggressively
4343 optimized by interprocedural optimizers. While this option is
4344 equivalent to proper use of "static" keyword for programs consist‐
4345 ing of single file, in combination with option --combine this flag
4346 can be used to compile most of smaller scale C programs since the
4347 functions and variables become local for the whole combined compi‐
4348 lation unit, not for the single source file itself.
4349
4350 -fno-cprop-registers
4351 After register allocation and post-register allocation instruction
4352 splitting, we perform a copy-propagation pass to try to reduce
4353 scheduling dependencies and occasionally eliminate the copy.
4354
4355 Disabled at levels -O, -O2, -O3, -Os.
4356
4357 -fprofile-generate
4358 Enable options usually used for instrumenting application to pro‐
4359 duce profile useful for later recompilation with profile feedback
4360 based optimization. You must use -fprofile-generate both when com‐
4361 piling and when linking your program.
4362
4363 The following options are enabled: "-fprofile-arcs", "-fpro‐
4364 file-values", "-fvpt".
4365
4366 -fprofile-use
4367 Enable profile feedback directed optimizations, and optimizations
4368 generally profitable only with profile feedback available.
4369
4370 The following options are enabled: "-fbranch-probabilities",
4371 "-fvpt", "-funroll-loops", "-fpeel-loops", "-ftracer",
4372 "-fno-loop-optimize".
4373
4374 The following options control compiler behavior regarding floating
4375 point arithmetic. These options trade off between speed and correct‐
4376 ness. All must be specifically enabled.
4377
4378 -ffloat-store
4379 Do not store floating point variables in registers, and inhibit
4380 other options that might change whether a floating point value is
4381 taken from a register or memory.
4382
4383 This option prevents undesirable excess precision on machines such
4384 as the 68000 where the floating registers (of the 68881) keep more
4385 precision than a "double" is supposed to have. Similarly for the
4386 x86 architecture. For most programs, the excess precision does
4387 only good, but a few programs rely on the precise definition of
4388 IEEE floating point. Use -ffloat-store for such programs, after
4389 modifying them to store all pertinent intermediate computations
4390 into variables.
4391
4392 -ffast-math
4393 Sets -fno-math-errno, -funsafe-math-optimizations, -fno-trap‐
4394 ping-math, -ffinite-math-only, -fno-rounding-math, -fno-signal‐
4395 ing-nans and fcx-limited-range.
4396
4397 This option causes the preprocessor macro "__FAST_MATH__" to be
4398 defined.
4399
4400 This option should never be turned on by any -O option since it can
4401 result in incorrect output for programs which depend on an exact
4402 implementation of IEEE or ISO rules/specifications for math func‐
4403 tions.
4404
4405 -fno-math-errno
4406 Do not set ERRNO after calling math functions that are executed
4407 with a single instruction, e.g., sqrt. A program that relies on
4408 IEEE exceptions for math error handling may want to use this flag
4409 for speed while maintaining IEEE arithmetic compatibility.
4410
4411 This option should never be turned on by any -O option since it can
4412 result in incorrect output for programs which depend on an exact
4413 implementation of IEEE or ISO rules/specifications for math func‐
4414 tions.
4415
4416 The default is -fmath-errno.
4417
4418 On Darwin systems, the math library never sets "errno". There is
4419 therefore no reason for the compiler to consider the possibility
4420 that it might, and -fno-math-errno is the default.
4421
4422 -funsafe-math-optimizations
4423 Allow optimizations for floating-point arithmetic that (a) assume
4424 that arguments and results are valid and (b) may violate IEEE or
4425 ANSI standards. When used at link-time, it may include libraries
4426 or startup files that change the default FPU control word or other
4427 similar optimizations.
4428
4429 This option should never be turned on by any -O option since it can
4430 result in incorrect output for programs which depend on an exact
4431 implementation of IEEE or ISO rules/specifications for math func‐
4432 tions.
4433
4434 The default is -fno-unsafe-math-optimizations.
4435
4436 -ffinite-math-only
4437 Allow optimizations for floating-point arithmetic that assume that
4438 arguments and results are not NaNs or +-Infs.
4439
4440 This option should never be turned on by any -O option since it can
4441 result in incorrect output for programs which depend on an exact
4442 implementation of IEEE or ISO rules/specifications.
4443
4444 The default is -fno-finite-math-only.
4445
4446 -fno-trapping-math
4447 Compile code assuming that floating-point operations cannot gener‐
4448 ate user-visible traps. These traps include division by zero,
4449 overflow, underflow, inexact result and invalid operation. This
4450 option implies -fno-signaling-nans. Setting this option may allow
4451 faster code if one relies on "non-stop" IEEE arithmetic, for exam‐
4452 ple.
4453
4454 This option should never be turned on by any -O option since it can
4455 result in incorrect output for programs which depend on an exact
4456 implementation of IEEE or ISO rules/specifications for math func‐
4457 tions.
4458
4459 The default is -ftrapping-math.
4460
4461 -frounding-math
4462 Disable transformations and optimizations that assume default
4463 floating point rounding behavior. This is round-to-zero for all
4464 floating point to integer conversions, and round-to-nearest for all
4465 other arithmetic truncations. This option should be specified for
4466 programs that change the FP rounding mode dynamically, or that may
4467 be executed with a non-default rounding mode. This option disables
4468 constant folding of floating point expressions at compile-time
4469 (which may be affected by rounding mode) and arithmetic transforma‐
4470 tions that are unsafe in the presence of sign-dependent rounding
4471 modes.
4472
4473 The default is -fno-rounding-math.
4474
4475 This option is experimental and does not currently guarantee to
4476 disable all GCC optimizations that are affected by rounding mode.
4477 Future versions of GCC may provide finer control of this setting
4478 using C99's "FENV_ACCESS" pragma. This command line option will be
4479 used to specify the default state for "FENV_ACCESS".
4480
4481 -fsignaling-nans
4482 Compile code assuming that IEEE signaling NaNs may generate user-
4483 visible traps during floating-point operations. Setting this
4484 option disables optimizations that may change the number of excep‐
4485 tions visible with signaling NaNs. This option implies -ftrap‐
4486 ping-math.
4487
4488 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
4489 defined.
4490
4491 The default is -fno-signaling-nans.
4492
4493 This option is experimental and does not currently guarantee to
4494 disable all GCC optimizations that affect signaling NaN behavior.
4495
4496 -fsingle-precision-constant
4497 Treat floating point constant as single precision constant instead
4498 of implicitly converting it to double precision constant.
4499
4500 -fcx-limited-range
4501 -fno-cx-limited-range
4502 When enabled, this option states that a range reduction step is not
4503 needed when performing complex division. The default is
4504 -fno-cx-limited-range, but is enabled by -ffast-math.
4505
4506 This option controls the default setting of the ISO C99 "CX_LIM‐
4507 ITED_RANGE" pragma. Nevertheless, the option applies to all lan‐
4508 guages.
4509
4510 The following options control optimizations that may improve perfor‐
4511 mance, but are not enabled by any -O options. This section includes
4512 experimental options that may produce broken code.
4513
4514 -fbranch-probabilities
4515 After running a program compiled with -fprofile-arcs, you can com‐
4516 pile it a second time using -fbranch-probabilities, to improve
4517 optimizations based on the number of times each branch was taken.
4518 When the program compiled with -fprofile-arcs exits it saves arc
4519 execution counts to a file called sourcename.gcda for each source
4520 file The information in this data file is very dependent on the
4521 structure of the generated code, so you must use the same source
4522 code and the same optimization options for both compilations.
4523
4524 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
4525 JUMP_INSN and CALL_INSN. These can be used to improve optimiza‐
4526 tion. Currently, they are only used in one place: in reorg.c,
4527 instead of guessing which path a branch is mostly to take, the
4528 REG_BR_PROB values are used to exactly determine which path is
4529 taken more often.
4530
4531 -fprofile-values
4532 If combined with -fprofile-arcs, it adds code so that some data
4533 about values of expressions in the program is gathered.
4534
4535 With -fbranch-probabilities, it reads back the data gathered from
4536 profiling values of expressions and adds REG_VALUE_PROFILE notes to
4537 instructions for their later usage in optimizations.
4538
4539 Enabled with -fprofile-generate and -fprofile-use.
4540
4541 -fvpt
4542 If combined with -fprofile-arcs, it instructs the compiler to add a
4543 code to gather information about values of expressions.
4544
4545 With -fbranch-probabilities, it reads back the data gathered and
4546 actually performs the optimizations based on them. Currently the
4547 optimizations include specialization of division operation using
4548 the knowledge about the value of the denominator.
4549
4550 -frename-registers
4551 Attempt to avoid false dependencies in scheduled code by making use
4552 of registers left over after register allocation. This optimiza‐
4553 tion will most benefit processors with lots of registers. Depend‐
4554 ing on the debug information format adopted by the target, however,
4555 it can make debugging impossible, since variables will no longer
4556 stay in a "home register".
4557
4558 Enabled by default with -funroll-loops.
4559
4560 -ftracer
4561 Perform tail duplication to enlarge superblock size. This trans‐
4562 formation simplifies the control flow of the function allowing
4563 other optimizations to do better job.
4564
4565 Enabled with -fprofile-use.
4566
4567 -funroll-loops
4568 Unroll loops whose number of iterations can be determined at com‐
4569 pile time or upon entry to the loop. -funroll-loops implies -fre‐
4570 run-cse-after-loop, -fweb and -frename-registers. It also turns on
4571 complete loop peeling (i.e. complete removal of loops with small
4572 constant number of iterations). This option makes code larger, and
4573 may or may not make it run faster.
4574
4575 Enabled with -fprofile-use.
4576
4577 -funroll-all-loops
4578 Unroll all loops, even if their number of iterations is uncertain
4579 when the loop is entered. This usually makes programs run more
4580 slowly. -funroll-all-loops implies the same options as -fun‐
4581 roll-loops.
4582
4583 -fpeel-loops
4584 Peels the loops for that there is enough information that they do
4585 not roll much (from profile feedback). It also turns on complete
4586 loop peeling (i.e. complete removal of loops with small constant
4587 number of iterations).
4588
4589 Enabled with -fprofile-use.
4590
4591 -fmove-loop-invariants
4592 Enables the loop invariant motion pass in the new loop optimizer.
4593 Enabled at level -O1
4594
4595 -funswitch-loops
4596 Move branches with loop invariant conditions out of the loop, with
4597 duplicates of the loop on both branches (modified according to
4598 result of the condition).
4599
4600 -fprefetch-loop-arrays
4601 If supported by the target machine, generate instructions to
4602 prefetch memory to improve the performance of loops that access
4603 large arrays.
4604
4605 Disabled at level -Os.
4606
4607 -ffunction-sections
4608 -fdata-sections
4609 Place each function or data item into its own section in the output
4610 file if the target supports arbitrary sections. The name of the
4611 function or the name of the data item determines the section's name
4612 in the output file.
4613
4614 Use these options on systems where the linker can perform optimiza‐
4615 tions to improve locality of reference in the instruction space.
4616 Most systems using the ELF object format and SPARC processors run‐
4617 ning Solaris 2 have linkers with such optimizations. AIX may have
4618 these optimizations in the future.
4619
4620 Only use these options when there are significant benefits from
4621 doing so. When you specify these options, the assembler and linker
4622 will create larger object and executable files and will also be
4623 slower. You will not be able to use "gprof" on all systems if you
4624 specify this option and you may have problems with debugging if you
4625 specify both this option and -g.
4626
4627 -fbranch-target-load-optimize
4628 Perform branch target register load optimization before prologue /
4629 epilogue threading. The use of target registers can typically be
4630 exposed only during reload, thus hoisting loads out of loops and
4631 doing inter-block scheduling needs a separate optimization pass.
4632
4633 -fbranch-target-load-optimize2
4634 Perform branch target register load optimization after prologue /
4635 epilogue threading.
4636
4637 -fbtr-bb-exclusive
4638 When performing branch target register load optimization, don't re‐
4639 use branch target registers in within any basic block.
4640
4641 -fstack-protector
4642 Emit extra code to check for buffer overflows, such as stack smash‐
4643 ing attacks. This is done by adding a guard variable to functions
4644 with vulnerable objects. This includes functions that call alloca,
4645 and functions with buffers larger than 8 bytes. The guards are
4646 initialized when a function is entered and then checked when the
4647 function exits. If a guard check fails, an error message is
4648 printed and the program exits.
4649
4650 -fstack-protector-all
4651 Like -fstack-protector except that all functions are protected.
4652
4653 --param name=value
4654 In some places, GCC uses various constants to control the amount of
4655 optimization that is done. For example, GCC will not inline func‐
4656 tions that contain more that a certain number of instructions. You
4657 can control some of these constants on the command-line using the
4658 --param option.
4659
4660 The names of specific parameters, and the meaning of the values,
4661 are tied to the internals of the compiler, and are subject to
4662 change without notice in future releases.
4663
4664 In each case, the value is an integer. The allowable choices for
4665 name are given in the following table:
4666
4667 salias-max-implicit-fields
4668 The maximum number of fields in a variable without direct
4669 structure accesses for which structure aliasing will consider
4670 trying to track each field. The default is 5
4671
4672 sra-max-structure-size
4673 The maximum structure size, in bytes, at which the scalar
4674 replacement of aggregates (SRA) optimization will perform block
4675 copies. The default value, 0, implies that GCC will select the
4676 most appropriate size itself.
4677
4678 sra-field-structure-ratio
4679 The threshold ratio (as a percentage) between instantiated
4680 fields and the complete structure size. We say that if the
4681 ratio of the number of bytes in instantiated fields to the num‐
4682 ber of bytes in the complete structure exceeds this parameter,
4683 then block copies are not used. The default is 75.
4684
4685 max-crossjump-edges
4686 The maximum number of incoming edges to consider for crossjump‐
4687 ing. The algorithm used by -fcrossjumping is O(N^2) in the
4688 number of edges incoming to each block. Increasing values mean
4689 more aggressive optimization, making the compile time increase
4690 with probably small improvement in executable size.
4691
4692 min-crossjump-insns
4693 The minimum number of instructions which must be matched at the
4694 end of two blocks before crossjumping will be performed on
4695 them. This value is ignored in the case where all instructions
4696 in the block being crossjumped from are matched. The default
4697 value is 5.
4698
4699 max-grow-copy-bb-insns
4700 The maximum code size expansion factor when copying basic
4701 blocks instead of jumping. The expansion is relative to a jump
4702 instruction. The default value is 8.
4703
4704 max-goto-duplication-insns
4705 The maximum number of instructions to duplicate to a block that
4706 jumps to a computed goto. To avoid O(N^2) behavior in a number
4707 of passes, GCC factors computed gotos early in the compilation
4708 process, and unfactors them as late as possible. Only computed
4709 jumps at the end of a basic blocks with no more than max-goto-
4710 duplication-insns are unfactored. The default value is 8.
4711
4712 max-delay-slot-insn-search
4713 The maximum number of instructions to consider when looking for
4714 an instruction to fill a delay slot. If more than this arbi‐
4715 trary number of instructions is searched, the time savings from
4716 filling the delay slot will be minimal so stop searching.
4717 Increasing values mean more aggressive optimization, making the
4718 compile time increase with probably small improvement in exe‐
4719 cutable run time.
4720
4721 max-delay-slot-live-search
4722 When trying to fill delay slots, the maximum number of instruc‐
4723 tions to consider when searching for a block with valid live
4724 register information. Increasing this arbitrarily chosen value
4725 means more aggressive optimization, increasing the compile
4726 time. This parameter should be removed when the delay slot
4727 code is rewritten to maintain the control-flow graph.
4728
4729 max-gcse-memory
4730 The approximate maximum amount of memory that will be allocated
4731 in order to perform the global common subexpression elimination
4732 optimization. If more memory than specified is required, the
4733 optimization will not be done.
4734
4735 max-gcse-passes
4736 The maximum number of passes of GCSE to run. The default is 1.
4737
4738 max-pending-list-length
4739 The maximum number of pending dependencies scheduling will
4740 allow before flushing the current state and starting over.
4741 Large functions with few branches or calls can create exces‐
4742 sively large lists which needlessly consume memory and
4743 resources.
4744
4745 max-inline-insns-single
4746 Several parameters control the tree inliner used in gcc. This
4747 number sets the maximum number of instructions (counted in
4748 GCC's internal representation) in a single function that the
4749 tree inliner will consider for inlining. This only affects
4750 functions declared inline and methods implemented in a class
4751 declaration (C++). The default value is 450.
4752
4753 max-inline-insns-auto
4754 When you use -finline-functions (included in -O3), a lot of
4755 functions that would otherwise not be considered for inlining
4756 by the compiler will be investigated. To those functions, a
4757 different (more restrictive) limit compared to functions
4758 declared inline can be applied. The default value is 90.
4759
4760 large-function-insns
4761 The limit specifying really large functions. For functions
4762 larger than this limit after inlining inlining is constrained
4763 by --param large-function-growth. This parameter is useful
4764 primarily to avoid extreme compilation time caused by non-lin‐
4765 ear algorithms used by the backend. This parameter is ignored
4766 when -funit-at-a-time is not used. The default value is 2700.
4767
4768 large-function-growth
4769 Specifies maximal growth of large function caused by inlining
4770 in percents. This parameter is ignored when -funit-at-a-time
4771 is not used. The default value is 100 which limits large func‐
4772 tion growth to 2.0 times the original size.
4773
4774 large-unit-insns
4775 The limit specifying large translation unit. Growth caused by
4776 inlining of units larger than this limit is limited by --param
4777 inline-unit-growth. For small units this might be too tight
4778 (consider unit consisting of function A that is inline and B
4779 that just calls A three time. If B is small relative to A, the
4780 growth of unit is 300\% and yet such inlining is very sane.
4781 For very large units consisting of small inlininable functions
4782 however the overall unit growth limit is needed to avoid expo‐
4783 nential explosion of code size. Thus for smaller units, the
4784 size is increased to --param large-unit-insns before aplying
4785 --param inline-unit-growth. The default is 10000
4786
4787 inline-unit-growth
4788 Specifies maximal overall growth of the compilation unit caused
4789 by inlining. This parameter is ignored when -funit-at-a-time
4790 is not used. The default value is 50 which limits unit growth
4791 to 1.5 times the original size.
4792
4793 max-inline-insns-recursive
4794 max-inline-insns-recursive-auto
4795 Specifies maximum number of instructions out-of-line copy of
4796 self recursive inline function can grow into by performing
4797 recursive inlining.
4798
4799 For functions declared inline --param max-inline-insns-recur‐
4800 sive is taken into account. For function not declared inline,
4801 recursive inlining happens only when -finline-functions
4802 (included in -O3) is enabled and --param max-inline-insns-
4803 recursive-auto is used. The default value is 450.
4804
4805 max-inline-recursive-depth
4806 max-inline-recursive-depth-auto
4807 Specifies maximum recursion depth used by the recursive inlin‐
4808 ing.
4809
4810 For functions declared inline --param max-inline-recursive-
4811 depth is taken into account. For function not declared inline,
4812 recursive inlining happens only when -finline-functions
4813 (included in -O3) is enabled and --param max-inline-recursive-
4814 depth-auto is used. The default value is 450.
4815
4816 min-inline-recursive-probability
4817 Recursive inlining is profitable only for function having deep
4818 recursion in average and can hurt for function having little
4819 recursion depth by increasing the prologue size or complexity
4820 of function body to other optimizers.
4821
4822 When profile feedback is available (see -fprofile-generate) the
4823 actual recursion depth can be guessed from probability that
4824 function will recurse via given call expression. This parame‐
4825 ter limits inlining only to call expression whose probability
4826 exceeds given threshold (in percents). The default value is
4827 10.
4828
4829 inline-call-cost
4830 Specify cost of call instruction relative to simple arithmetics
4831 operations (having cost of 1). Increasing this cost disquali‐
4832 fies inlining of non-leaf functions and at the same time
4833 increases size of leaf function that is believed to reduce
4834 function size by being inlined. In effect it increases amount
4835 of inlining for code having large abstraction penalty (many
4836 functions that just pass the arguments to other functions) and
4837 decrease inlining for code with low abstraction penalty. The
4838 default value is 16.
4839
4840 max-unrolled-insns
4841 The maximum number of instructions that a loop should have if
4842 that loop is unrolled, and if the loop is unrolled, it deter‐
4843 mines how many times the loop code is unrolled.
4844
4845 max-average-unrolled-insns
4846 The maximum number of instructions biased by probabilities of
4847 their execution that a loop should have if that loop is
4848 unrolled, and if the loop is unrolled, it determines how many
4849 times the loop code is unrolled.
4850
4851 max-unroll-times
4852 The maximum number of unrollings of a single loop.
4853
4854 max-peeled-insns
4855 The maximum number of instructions that a loop should have if
4856 that loop is peeled, and if the loop is peeled, it determines
4857 how many times the loop code is peeled.
4858
4859 max-peel-times
4860 The maximum number of peelings of a single loop.
4861
4862 max-completely-peeled-insns
4863 The maximum number of insns of a completely peeled loop.
4864
4865 max-completely-peel-times
4866 The maximum number of iterations of a loop to be suitable for
4867 complete peeling.
4868
4869 max-unswitch-insns
4870 The maximum number of insns of an unswitched loop.
4871
4872 max-unswitch-level
4873 The maximum number of branches unswitched in a single loop.
4874
4875 lim-expensive
4876 The minimum cost of an expensive expression in the loop invari‐
4877 ant motion.
4878
4879 iv-consider-all-candidates-bound
4880 Bound on number of candidates for induction variables below
4881 that all candidates are considered for each use in induction
4882 variable optimizations. Only the most relevant candidates are
4883 considered if there are more candidates, to avoid quadratic
4884 time complexity.
4885
4886 iv-max-considered-uses
4887 The induction variable optimizations give up on loops that con‐
4888 tain more induction variable uses.
4889
4890 iv-always-prune-cand-set-bound
4891 If number of candidates in the set is smaller than this value,
4892 we always try to remove unnecessary ivs from the set during its
4893 optimization when a new iv is added to the set.
4894
4895 scev-max-expr-size
4896 Bound on size of expressions used in the scalar evolutions ana‐
4897 lyzer. Large expressions slow the analyzer.
4898
4899 vect-max-version-checks
4900 The maximum number of runtime checks that can be performed when
4901 doing loop versioning in the vectorizer. See option ftree-
4902 vect-loop-version for more information.
4903
4904 max-iterations-to-track
4905 The maximum number of iterations of a loop the brute force
4906 algorithm for analysis of # of iterations of the loop tries to
4907 evaluate.
4908
4909 hot-bb-count-fraction
4910 Select fraction of the maximal count of repetitions of basic
4911 block in program given basic block needs to have to be consid‐
4912 ered hot.
4913
4914 hot-bb-frequency-fraction
4915 Select fraction of the maximal frequency of executions of basic
4916 block in function given basic block needs to have to be consid‐
4917 ered hot
4918
4919 max-predicted-iterations
4920 The maximum number of loop iterations we predict statically.
4921 This is useful in cases where function contain single loop with
4922 known bound and other loop with unknown. We predict the known
4923 number of iterations correctly, while the unknown number of
4924 iterations average to roughly 10. This means that the loop
4925 without bounds would appear artificially cold relative to the
4926 other one.
4927
4928 tracer-dynamic-coverage
4929 tracer-dynamic-coverage-feedback
4930 This value is used to limit superblock formation once the given
4931 percentage of executed instructions is covered. This limits
4932 unnecessary code size expansion.
4933
4934 The tracer-dynamic-coverage-feedback is used only when profile
4935 feedback is available. The real profiles (as opposed to stati‐
4936 cally estimated ones) are much less balanced allowing the
4937 threshold to be larger value.
4938
4939 tracer-max-code-growth
4940 Stop tail duplication once code growth has reached given per‐
4941 centage. This is rather hokey argument, as most of the dupli‐
4942 cates will be eliminated later in cross jumping, so it may be
4943 set to much higher values than is the desired code growth.
4944
4945 tracer-min-branch-ratio
4946 Stop reverse growth when the reverse probability of best edge
4947 is less than this threshold (in percent).
4948
4949 tracer-min-branch-ratio
4950 tracer-min-branch-ratio-feedback
4951 Stop forward growth if the best edge do have probability lower
4952 than this threshold.
4953
4954 Similarly to tracer-dynamic-coverage two values are present,
4955 one for compilation for profile feedback and one for compila‐
4956 tion without. The value for compilation with profile feedback
4957 needs to be more conservative (higher) in order to make tracer
4958 effective.
4959
4960 max-cse-path-length
4961 Maximum number of basic blocks on path that cse considers. The
4962 default is 10.
4963
4964 max-cse-insns
4965 The maximum instructions CSE process before flushing. The
4966 default is 1000.
4967
4968 global-var-threshold
4969 Counts the number of function calls (n) and the number of call-
4970 clobbered variables (v). If nxv is larger than this limit, a
4971 single artificial variable will be created to represent all the
4972 call-clobbered variables at function call sites. This artifi‐
4973 cial variable will then be made to alias every call-clobbered
4974 variable. (done as "int * size_t" on the host machine; beware
4975 overflow).
4976
4977 max-aliased-vops
4978 Maximum number of virtual operands allowed to represent aliases
4979 before triggering the alias grouping heuristic. Alias grouping
4980 reduces compile times and memory consumption needed for alias‐
4981 ing at the expense of precision loss in alias information.
4982
4983 ggc-min-expand
4984 GCC uses a garbage collector to manage its own memory alloca‐
4985 tion. This parameter specifies the minimum percentage by which
4986 the garbage collector's heap should be allowed to expand
4987 between collections. Tuning this may improve compilation
4988 speed; it has no effect on code generation.
4989
4990 The default is 30% + 70% * (RAM/1GB) with an upper bound of
4991 100% when RAM >= 1GB. If "getrlimit" is available, the notion
4992 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
4993 "RLIMIT_AS". If GCC is not able to calculate RAM on a particu‐
4994 lar platform, the lower bound of 30% is used. Setting this
4995 parameter and ggc-min-heapsize to zero causes a full collection
4996 to occur at every opportunity. This is extremely slow, but can
4997 be useful for debugging.
4998
4999 ggc-min-heapsize
5000 Minimum size of the garbage collector's heap before it begins
5001 bothering to collect garbage. The first collection occurs
5002 after the heap expands by ggc-min-expand% beyond ggc-min-heap‐
5003 size. Again, tuning this may improve compilation speed, and
5004 has no effect on code generation.
5005
5006 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
5007 which tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
5008 exceeded, but with a lower bound of 4096 (four megabytes) and
5009 an upper bound of 131072 (128 megabytes). If GCC is not able
5010 to calculate RAM on a particular platform, the lower bound is
5011 used. Setting this parameter very large effectively disables
5012 garbage collection. Setting this parameter and ggc-min-expand
5013 to zero causes a full collection to occur at every opportunity.
5014
5015 max-reload-search-insns
5016 The maximum number of instruction reload should look backward
5017 for equivalent register. Increasing values mean more aggres‐
5018 sive optimization, making the compile time increase with proba‐
5019 bly slightly better performance. The default value is 100.
5020
5021 max-cselib-memory-location
5022 The maximum number of memory locations cselib should take into
5023 account. Increasing values mean more aggressive optimization,
5024 making the compile time increase with probably slightly better
5025 performance. The default value is 500.
5026
5027 max-flow-memory-location
5028 Similar as max-cselib-memory-location but for dataflow live‐
5029 ness. The default value is 100.
5030
5031 reorder-blocks-duplicate
5032 reorder-blocks-duplicate-feedback
5033 Used by basic block reordering pass to decide whether to use
5034 unconditional branch or duplicate the code on its destination.
5035 Code is duplicated when its estimated size is smaller than this
5036 value multiplied by the estimated size of unconditional jump in
5037 the hot spots of the program.
5038
5039 The reorder-block-duplicate-feedback is used only when profile
5040 feedback is available and may be set to higher values than
5041 reorder-block-duplicate since information about the hot spots
5042 is more accurate.
5043
5044 max-sched-ready-insns
5045 The maximum number of instructions ready to be issued the
5046 scheduler should consider at any given time during the first
5047 scheduling pass. Increasing values mean more thorough
5048 searches, making the compilation time increase with probably
5049 little benefit. The default value is 100.
5050
5051 max-sched-region-blocks
5052 The maximum number of blocks in a region to be considered for
5053 interblock scheduling. The default value is 10.
5054
5055 max-sched-region-insns
5056 The maximum number of insns in a region to be considered for
5057 interblock scheduling. The default value is 100.
5058
5059 min-sched-prob
5060 The minimum probability of reaching a source block for
5061 interblock speculative scheduling. The default value is 40.
5062
5063 max-last-value-rtl
5064 The maximum size measured as number of RTLs that can be
5065 recorded in an expression in combiner for a pseudo register as
5066 last known value of that register. The default is 10000.
5067
5068 integer-share-limit
5069 Small integer constants can use a shared data structure, reduc‐
5070 ing the compiler's memory usage and increasing its speed. This
5071 sets the maximum value of a shared integer constant's. The
5072 default value is 256.
5073
5074 min-virtual-mappings
5075 Specifies the minimum number of virtual mappings in the incre‐
5076 mental SSA updater that should be registered to trigger the
5077 virtual mappings heuristic defined by virtual-mappings-ratio.
5078 The default value is 100.
5079
5080 virtual-mappings-ratio
5081 If the number of virtual mappings is virtual-mappings-ratio
5082 bigger than the number of virtual symbols to be updated, then
5083 the incremental SSA updater switches to a full update for those
5084 symbols. The default ratio is 3.
5085
5086 ssp-buffer-size
5087 The minimum size of buffers (i.e. arrays) that will receive
5088 stack smashing protection when -fstack-protection is used.
5089
5090 max-jump-thread-duplication-stmts
5091 Maximum number of statements allowed in a block that needs to
5092 be duplicated when threading jumps.
5093
5094 max-fields-for-field-sensitive
5095 Maximum number of fields in a structure we will treat in a
5096 field sensitive manner during pointer analysis.
5097
5098 Options Controlling the Preprocessor
5099
5100 These options control the C preprocessor, which is run on each C source
5101 file before actual compilation.
5102
5103 If you use the -E option, nothing is done except preprocessing. Some
5104 of these options make sense only together with -E because they cause
5105 the preprocessor output to be unsuitable for actual compilation.
5106
5107 You can use -Wp,option to bypass the compiler driver and pass
5108 option directly through to the preprocessor. If option contains
5109 commas, it is split into multiple options at the commas. However,
5110 many options are modified, translated or interpreted by the com‐
5111 piler driver before being passed to the preprocessor, and -Wp
5112 forcibly bypasses this phase. The preprocessor's direct interface
5113 is undocumented and subject to change, so whenever possible you
5114 should avoid using -Wp and let the driver handle the options
5115 instead.
5116
5117 -Xpreprocessor option
5118 Pass option as an option to the preprocessor. You can use this to
5119 supply system-specific preprocessor options which GCC does not know
5120 how to recognize.
5121
5122 If you want to pass an option that takes an argument, you must use
5123 -Xpreprocessor twice, once for the option and once for the argu‐
5124 ment.
5125
5126 -D name
5127 Predefine name as a macro, with definition 1.
5128
5129 -D name=definition
5130 The contents of definition are tokenized and processed as if they
5131 appeared during translation phase three in a #define directive. In
5132 particular, the definition will be truncated by embedded newline
5133 characters.
5134
5135 If you are invoking the preprocessor from a shell or shell-like
5136 program you may need to use the shell's quoting syntax to protect
5137 characters such as spaces that have a meaning in the shell syntax.
5138
5139 If you wish to define a function-like macro on the command line,
5140 write its argument list with surrounding parentheses before the
5141 equals sign (if any). Parentheses are meaningful to most shells,
5142 so you will need to quote the option. With sh and csh,
5143 -D'name(args...)=definition' works.
5144
5145 -D and -U options are processed in the order they are given on the
5146 command line. All -imacros file and -include file options are pro‐
5147 cessed after all -D and -U options.
5148
5149 -U name
5150 Cancel any previous definition of name, either built in or provided
5151 with a -D option.
5152
5153 -undef
5154 Do not predefine any system-specific or GCC-specific macros. The
5155 standard predefined macros remain defined.
5156
5157 -I dir
5158 Add the directory dir to the list of directories to be searched for
5159 header files. Directories named by -I are searched before the
5160 standard system include directories. If the directory dir is a
5161 standard system include directory, the option is ignored to ensure
5162 that the default search order for system directories and the spe‐
5163 cial treatment of system headers are not defeated .
5164
5165 -o file
5166 Write output to file. This is the same as specifying file as the
5167 second non-option argument to cpp. gcc has a different interpreta‐
5168 tion of a second non-option argument, so you must use -o to specify
5169 the output file.
5170
5171 -Wall
5172 Turns on all optional warnings which are desirable for normal code.
5173 At present this is -Wcomment, -Wtrigraphs, -Wmultichar and a warn‐
5174 ing about integer promotion causing a change of sign in "#if"
5175 expressions. Note that many of the preprocessor's warnings are on
5176 by default and have no options to control them.
5177
5178 -Wcomment
5179 -Wcomments
5180 Warn whenever a comment-start sequence /* appears in a /* comment,
5181 or whenever a backslash-newline appears in a // comment. (Both
5182 forms have the same effect.)
5183
5184 -Wtrigraphs
5185 Most trigraphs in comments cannot affect the meaning of the pro‐
5186 gram. However, a trigraph that would form an escaped newline (??/
5187 at the end of a line) can, by changing where the comment begins or
5188 ends. Therefore, only trigraphs that would form escaped newlines
5189 produce warnings inside a comment.
5190
5191 This option is implied by -Wall. If -Wall is not given, this
5192 option is still enabled unless trigraphs are enabled. To get tri‐
5193 graph conversion without warnings, but get the other -Wall warn‐
5194 ings, use -trigraphs -Wall -Wno-trigraphs.
5195
5196 -Wtraditional
5197 Warn about certain constructs that behave differently in tradi‐
5198 tional and ISO C. Also warn about ISO C constructs that have no
5199 traditional C equivalent, and problematic constructs which should
5200 be avoided.
5201
5202 -Wimport
5203 Warn the first time #import is used.
5204
5205 -Wundef
5206 Warn whenever an identifier which is not a macro is encountered in
5207 an #if directive, outside of defined. Such identifiers are
5208 replaced with zero.
5209
5210 -Wunused-macros
5211 Warn about macros defined in the main file that are unused. A
5212 macro is used if it is expanded or tested for existence at least
5213 once. The preprocessor will also warn if the macro has not been
5214 used at the time it is redefined or undefined.
5215
5216 Built-in macros, macros defined on the command line, and macros
5217 defined in include files are not warned about.
5218
5219 Note: If a macro is actually used, but only used in skipped condi‐
5220 tional blocks, then CPP will report it as unused. To avoid the
5221 warning in such a case, you might improve the scope of the macro's
5222 definition by, for example, moving it into the first skipped block.
5223 Alternatively, you could provide a dummy use with something like:
5224
5225 #if defined the_macro_causing_the_warning
5226 #endif
5227
5228 -Wendif-labels
5229 Warn whenever an #else or an #endif are followed by text. This
5230 usually happens in code of the form
5231
5232 #if FOO
5233 ...
5234 #else FOO
5235 ...
5236 #endif FOO
5237
5238 The second and third "FOO" should be in comments, but often are not
5239 in older programs. This warning is on by default.
5240
5241 -Werror
5242 Make all warnings into hard errors. Source code which triggers
5243 warnings will be rejected.
5244
5245 -Wsystem-headers
5246 Issue warnings for code in system headers. These are normally
5247 unhelpful in finding bugs in your own code, therefore suppressed.
5248 If you are responsible for the system library, you may want to see
5249 them.
5250
5251 -w Suppress all warnings, including those which GNU CPP issues by
5252 default.
5253
5254 -pedantic
5255 Issue all the mandatory diagnostics listed in the C standard. Some
5256 of them are left out by default, since they trigger frequently on
5257 harmless code.
5258
5259 -pedantic-errors
5260 Issue all the mandatory diagnostics, and make all mandatory diag‐
5261 nostics into errors. This includes mandatory diagnostics that GCC
5262 issues without -pedantic but treats as warnings.
5263
5264 -M Instead of outputting the result of preprocessing, output a rule
5265 suitable for make describing the dependencies of the main source
5266 file. The preprocessor outputs one make rule containing the object
5267 file name for that source file, a colon, and the names of all the
5268 included files, including those coming from -include or -imacros
5269 command line options.
5270
5271 Unless specified explicitly (with -MT or -MQ), the object file name
5272 consists of the basename of the source file with any suffix
5273 replaced with object file suffix. If there are many included files
5274 then the rule is split into several lines using \-newline. The
5275 rule has no commands.
5276
5277 This option does not suppress the preprocessor's debug output, such
5278 as -dM. To avoid mixing such debug output with the dependency
5279 rules you should explicitly specify the dependency output file with
5280 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
5281 Debug output will still be sent to the regular output stream as
5282 normal.
5283
5284 Passing -M to the driver implies -E, and suppresses warnings with
5285 an implicit -w.
5286
5287 -MM Like -M but do not mention header files that are found in system
5288 header directories, nor header files that are included, directly or
5289 indirectly, from such a header.
5290
5291 This implies that the choice of angle brackets or double quotes in
5292 an #include directive does not in itself determine whether that
5293 header will appear in -MM dependency output. This is a slight
5294 change in semantics from GCC versions 3.0 and earlier.
5295
5296 -MF file
5297 When used with -M or -MM, specifies a file to write the dependen‐
5298 cies to. If no -MF switch is given the preprocessor sends the
5299 rules to the same place it would have sent preprocessed output.
5300
5301 When used with the driver options -MD or -MMD, -MF overrides the
5302 default dependency output file.
5303
5304 -MG In conjunction with an option such as -M requesting dependency gen‐
5305 eration, -MG assumes missing header files are generated files and
5306 adds them to the dependency list without raising an error. The
5307 dependency filename is taken directly from the "#include" directive
5308 without prepending any path. -MG also suppresses preprocessed out‐
5309 put, as a missing header file renders this useless.
5310
5311 This feature is used in automatic updating of makefiles.
5312
5313 -MP This option instructs CPP to add a phony target for each dependency
5314 other than the main file, causing each to depend on nothing. These
5315 dummy rules work around errors make gives if you remove header
5316 files without updating the Makefile to match.
5317
5318 This is typical output:
5319
5320 test.o: test.c test.h
5321
5322 test.h:
5323
5324 -MT target
5325 Change the target of the rule emitted by dependency generation. By
5326 default CPP takes the name of the main input file, including any
5327 path, deletes any file suffix such as .c, and appends the plat‐
5328 form's usual object suffix. The result is the target.
5329
5330 An -MT option will set the target to be exactly the string you
5331 specify. If you want multiple targets, you can specify them as a
5332 single argument to -MT, or use multiple -MT options.
5333
5334 For example, -MT '$(objpfx)foo.o' might give
5335
5336 $(objpfx)foo.o: foo.c
5337
5338 -MQ target
5339 Same as -MT, but it quotes any characters which are special to
5340 Make. -MQ '$(objpfx)foo.o' gives
5341
5342 $$(objpfx)foo.o: foo.c
5343
5344 The default target is automatically quoted, as if it were given
5345 with -MQ.
5346
5347 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
5348 The driver determines file based on whether an -o option is given.
5349 If it is, the driver uses its argument but with a suffix of .d,
5350 otherwise it take the basename of the input file and applies a .d
5351 suffix.
5352
5353 If -MD is used in conjunction with -E, any -o switch is understood
5354 to specify the dependency output file (but @pxref{dashMF,,-MF}),
5355 but if used without -E, each -o is understood to specify a target
5356 object file.
5357
5358 Since -E is not implied, -MD can be used to generate a dependency
5359 output file as a side-effect of the compilation process.
5360
5361 -MMD
5362 Like -MD except mention only user header files, not system header
5363 files.
5364
5365 -fpch-deps
5366 When using precompiled headers, this flag will cause the depen‐
5367 dency-output flags to also list the files from the precompiled
5368 header's dependencies. If not specified only the precompiled
5369 header would be listed and not the files that were used to create
5370 it because those files are not consulted when a precompiled header
5371 is used.
5372
5373 -fpch-preprocess
5374 This option allows use of a precompiled header together with -E.
5375 It inserts a special "#pragma", "#pragma GCC pch_preprocess "<file‐
5376 name>"" in the output to mark the place where the precompiled
5377 header was found, and its filename. When -fpreprocessed is in use,
5378 GCC recognizes this "#pragma" and loads the PCH.
5379
5380 This option is off by default, because the resulting preprocessed
5381 output is only really suitable as input to GCC. It is switched on
5382 by -save-temps.
5383
5384 You should not write this "#pragma" in your own code, but it is
5385 safe to edit the filename if the PCH file is available in a differ‐
5386 ent location. The filename may be absolute or it may be relative
5387 to GCC's current directory.
5388
5389 -x c
5390 -x c++
5391 -x objective-c
5392 -x assembler-with-cpp
5393 Specify the source language: C, C++, Objective-C, or assembly.
5394 This has nothing to do with standards conformance or extensions; it
5395 merely selects which base syntax to expect. If you give none of
5396 these options, cpp will deduce the language from the extension of
5397 the source file: .c, .cc, .m, or .S. Some other common extensions
5398 for C++ and assembly are also recognized. If cpp does not recog‐
5399 nize the extension, it will treat the file as C; this is the most
5400 generic mode.
5401
5402 Note: Previous versions of cpp accepted a -lang option which
5403 selected both the language and the standards conformance level.
5404 This option has been removed, because it conflicts with the -l
5405 option.
5406
5407 -std=standard
5408 -ansi
5409 Specify the standard to which the code should conform. Currently
5410 CPP knows about C and C++ standards; others may be added in the
5411 future.
5412
5413 standard may be one of:
5414
5415 "iso9899:1990"
5416 "c89"
5417 The ISO C standard from 1990. c89 is the customary shorthand
5418 for this version of the standard.
5419
5420 The -ansi option is equivalent to -std=c89.
5421
5422 "iso9899:199409"
5423 The 1990 C standard, as amended in 1994.
5424
5425 "iso9899:1999"
5426 "c99"
5427 "iso9899:199x"
5428 "c9x"
5429 The revised ISO C standard, published in December 1999. Before
5430 publication, this was known as C9X.
5431
5432 "gnu89"
5433 The 1990 C standard plus GNU extensions. This is the default.
5434
5435 "gnu99"
5436 "gnu9x"
5437 The 1999 C standard plus GNU extensions.
5438
5439 "c++98"
5440 The 1998 ISO C++ standard plus amendments.
5441
5442 "gnu++98"
5443 The same as -std=c++98 plus GNU extensions. This is the
5444 default for C++ code.
5445
5446 -I- Split the include path. Any directories specified with -I options
5447 before -I- are searched only for headers requested with
5448 "#include "file""; they are not searched for "#include <file>". If
5449 additional directories are specified with -I options after the -I-,
5450 those directories are searched for all #include directives.
5451
5452 In addition, -I- inhibits the use of the directory of the current
5453 file directory as the first search directory for "#include "file"".
5454 This option has been deprecated.
5455
5456 -nostdinc
5457 Do not search the standard system directories for header files.
5458 Only the directories you have specified with -I options (and the
5459 directory of the current file, if appropriate) are searched.
5460
5461 -nostdinc++
5462 Do not search for header files in the C++-specific standard direc‐
5463 tories, but do still search the other standard directories. (This
5464 option is used when building the C++ library.)
5465
5466 -include file
5467 Process file as if "#include "file"" appeared as the first line of
5468 the primary source file. However, the first directory searched for
5469 file is the preprocessor's working directory instead of the direc‐
5470 tory containing the main source file. If not found there, it is
5471 searched for in the remainder of the "#include "..."" search chain
5472 as normal.
5473
5474 If multiple -include options are given, the files are included in
5475 the order they appear on the command line.
5476
5477 -imacros file
5478 Exactly like -include, except that any output produced by scanning
5479 file is thrown away. Macros it defines remain defined. This
5480 allows you to acquire all the macros from a header without also
5481 processing its declarations.
5482
5483 All files specified by -imacros are processed before all files
5484 specified by -include.
5485
5486 -idirafter dir
5487 Search dir for header files, but do it after all directories speci‐
5488 fied with -I and the standard system directories have been
5489 exhausted. dir is treated as a system include directory.
5490
5491 -iprefix prefix
5492 Specify prefix as the prefix for subsequent -iwithprefix options.
5493 If the prefix represents a directory, you should include the final
5494 /.
5495
5496 -iwithprefix dir
5497 -iwithprefixbefore dir
5498 Append dir to the prefix specified previously with -iprefix, and
5499 add the resulting directory to the include search path. -iwithpre‐
5500 fixbefore puts it in the same place -I would; -iwithprefix puts it
5501 where -idirafter would.
5502
5503 -isysroot dir
5504 This option is like the --sysroot option, but applies only to
5505 header files. See the --sysroot option for more information.
5506
5507 -isystem dir
5508 Search dir for header files, after all directories specified by -I
5509 but before the standard system directories. Mark it as a system
5510 directory, so that it gets the same special treatment as is applied
5511 to the standard system directories.
5512
5513 -iquote dir
5514 Search dir only for header files requested with "#include "file"";
5515 they are not searched for "#include <file>", before all directories
5516 specified by -I and before the standard system directories.
5517
5518 -fdollars-in-identifiers
5519 Accept $ in identifiers.
5520
5521 -fextended-identifiers
5522 Accept universal character names in identifiers. This option is
5523 experimental; in a future version of GCC, it will be enabled by
5524 default for C99 and C++.
5525
5526 -fpreprocessed
5527 Indicate to the preprocessor that the input file has already been
5528 preprocessed. This suppresses things like macro expansion, tri‐
5529 graph conversion, escaped newline splicing, and processing of most
5530 directives. The preprocessor still recognizes and removes com‐
5531 ments, so that you can pass a file preprocessed with -C to the com‐
5532 piler without problems. In this mode the integrated preprocessor
5533 is little more than a tokenizer for the front ends.
5534
5535 -fpreprocessed is implicit if the input file has one of the exten‐
5536 sions .i, .ii or .mi. These are the extensions that GCC uses for
5537 preprocessed files created by -save-temps.
5538
5539 -ftabstop=width
5540 Set the distance between tab stops. This helps the preprocessor
5541 report correct column numbers in warnings or errors, even if tabs
5542 appear on the line. If the value is less than 1 or greater than
5543 100, the option is ignored. The default is 8.
5544
5545 -fexec-charset=charset
5546 Set the execution character set, used for string and character con‐
5547 stants. The default is UTF-8. charset can be any encoding sup‐
5548 ported by the system's "iconv" library routine.
5549
5550 -fwide-exec-charset=charset
5551 Set the wide execution character set, used for wide string and
5552 character constants. The default is UTF-32 or UTF-16, whichever
5553 corresponds to the width of "wchar_t". As with -fexec-charset,
5554 charset can be any encoding supported by the system's "iconv"
5555 library routine; however, you will have problems with encodings
5556 that do not fit exactly in "wchar_t".
5557
5558 -finput-charset=charset
5559 Set the input character set, used for translation from the charac‐
5560 ter set of the input file to the source character set used by GCC.
5561 If the locale does not specify, or GCC cannot get this information
5562 from the locale, the default is UTF-8. This can be overridden by
5563 either the locale or this command line option. Currently the com‐
5564 mand line option takes precedence if there's a conflict. charset
5565 can be any encoding supported by the system's "iconv" library rou‐
5566 tine.
5567
5568 -fworking-directory
5569 Enable generation of linemarkers in the preprocessor output that
5570 will let the compiler know the current working directory at the
5571 time of preprocessing. When this option is enabled, the preproces‐
5572 sor will emit, after the initial linemarker, a second linemarker
5573 with the current working directory followed by two slashes. GCC
5574 will use this directory, when it's present in the preprocessed
5575 input, as the directory emitted as the current working directory in
5576 some debugging information formats. This option is implicitly
5577 enabled if debugging information is enabled, but this can be inhib‐
5578 ited with the negated form -fno-working-directory. If the -P flag
5579 is present in the command line, this option has no effect, since no
5580 "#line" directives are emitted whatsoever.
5581
5582 -fno-show-column
5583 Do not print column numbers in diagnostics. This may be necessary
5584 if diagnostics are being scanned by a program that does not under‐
5585 stand the column numbers, such as dejagnu.
5586
5587 -A predicate=answer
5588 Make an assertion with the predicate predicate and answer answer.
5589 This form is preferred to the older form -A predicate(answer),
5590 which is still supported, because it does not use shell special
5591 characters.
5592
5593 -A -predicate=answer
5594 Cancel an assertion with the predicate predicate and answer answer.
5595
5596 -dCHARS
5597 CHARS is a sequence of one or more of the following characters, and
5598 must not be preceded by a space. Other characters are interpreted
5599 by the compiler proper, or reserved for future versions of GCC, and
5600 so are silently ignored. If you specify characters whose behavior
5601 conflicts, the result is undefined.
5602
5603 M Instead of the normal output, generate a list of #define direc‐
5604 tives for all the macros defined during the execution of the
5605 preprocessor, including predefined macros. This gives you a
5606 way of finding out what is predefined in your version of the
5607 preprocessor. Assuming you have no file foo.h, the command
5608
5609 touch foo.h; cpp -dM foo.h
5610
5611 will show all the predefined macros.
5612
5613 D Like M except in two respects: it does not include the prede‐
5614 fined macros, and it outputs both the #define directives and
5615 the result of preprocessing. Both kinds of output go to the
5616 standard output file.
5617
5618 N Like D, but emit only the macro names, not their expansions.
5619
5620 I Output #include directives in addition to the result of prepro‐
5621 cessing.
5622
5623 -P Inhibit generation of linemarkers in the output from the preproces‐
5624 sor. This might be useful when running the preprocessor on some‐
5625 thing that is not C code, and will be sent to a program which might
5626 be confused by the linemarkers.
5627
5628 -C Do not discard comments. All comments are passed through to the
5629 output file, except for comments in processed directives, which are
5630 deleted along with the directive.
5631
5632 You should be prepared for side effects when using -C; it causes
5633 the preprocessor to treat comments as tokens in their own right.
5634 For example, comments appearing at the start of what would be a
5635 directive line have the effect of turning that line into an ordi‐
5636 nary source line, since the first token on the line is no longer a
5637 #.
5638
5639 -CC Do not discard comments, including during macro expansion. This is
5640 like -C, except that comments contained within macros are also
5641 passed through to the output file where the macro is expanded.
5642
5643 In addition to the side-effects of the -C option, the -CC option
5644 causes all C++-style comments inside a macro to be converted to
5645 C-style comments. This is to prevent later use of that macro from
5646 inadvertently commenting out the remainder of the source line.
5647
5648 The -CC option is generally used to support lint comments.
5649
5650 -traditional-cpp
5651 Try to imitate the behavior of old-fashioned C preprocessors, as
5652 opposed to ISO C preprocessors.
5653
5654 -trigraphs
5655 Process trigraph sequences. These are three-character sequences,
5656 all starting with ??, that are defined by ISO C to stand for single
5657 characters. For example, ??/ stands for \, so '??/n' is a charac‐
5658 ter constant for a newline. By default, GCC ignores trigraphs, but
5659 in standard-conforming modes it converts them. See the -std and
5660 -ansi options.
5661
5662 The nine trigraphs and their replacements are
5663
5664 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
5665 Replacement: [ ] { } # \ ^ ⎪ ~
5666
5667 -remap
5668 Enable special code to work around file systems which only permit
5669 very short file names, such as MS-DOS.
5670
5671 --help
5672 --target-help
5673 Print text describing all the command line options instead of pre‐
5674 processing anything.
5675
5676 -v Verbose mode. Print out GNU CPP's version number at the beginning
5677 of execution, and report the final form of the include path.
5678
5679 -H Print the name of each header file used, in addition to other nor‐
5680 mal activities. Each name is indented to show how deep in the
5681 #include stack it is. Precompiled header files are also printed,
5682 even if they are found to be invalid; an invalid precompiled header
5683 file is printed with ...x and a valid one with ...! .
5684
5685 -version
5686 --version
5687 Print out GNU CPP's version number. With one dash, proceed to pre‐
5688 process as normal. With two dashes, exit immediately.
5689
5690 Passing Options to the Assembler
5691
5692 You can pass options to the assembler.
5693
5694 -Wa,option
5695 Pass option as an option to the assembler. If option contains com‐
5696 mas, it is split into multiple options at the commas.
5697
5698 -Xassembler option
5699 Pass option as an option to the assembler. You can use this to
5700 supply system-specific assembler options which GCC does not know
5701 how to recognize.
5702
5703 If you want to pass an option that takes an argument, you must use
5704 -Xassembler twice, once for the option and once for the argument.
5705
5706 Options for Linking
5707
5708 These options come into play when the compiler links object files into
5709 an executable output file. They are meaningless if the compiler is not
5710 doing a link step.
5711
5712 object-file-name
5713 A file name that does not end in a special recognized suffix is
5714 considered to name an object file or library. (Object files are
5715 distinguished from libraries by the linker according to the file
5716 contents.) If linking is done, these object files are used as
5717 input to the linker.
5718
5719 -c
5720 -S
5721 -E If any of these options is used, then the linker is not run, and
5722 object file names should not be used as arguments.
5723
5724 -llibrary
5725 -l library
5726 Search the library named library when linking. (The second alter‐
5727 native with the library as a separate argument is only for POSIX
5728 compliance and is not recommended.)
5729
5730 It makes a difference where in the command you write this option;
5731 the linker searches and processes libraries and object files in the
5732 order they are specified. Thus, foo.o -lz bar.o searches library z
5733 after file foo.o but before bar.o. If bar.o refers to functions in
5734 z, those functions may not be loaded.
5735
5736 The linker searches a standard list of directories for the library,
5737 which is actually a file named liblibrary.a. The linker then uses
5738 this file as if it had been specified precisely by name.
5739
5740 The directories searched include several standard system directo‐
5741 ries plus any that you specify with -L.
5742
5743 Normally the files found this way are library files---archive files
5744 whose members are object files. The linker handles an archive file
5745 by scanning through it for members which define symbols that have
5746 so far been referenced but not defined. But if the file that is
5747 found is an ordinary object file, it is linked in the usual fash‐
5748 ion. The only difference between using an -l option and specifying
5749 a file name is that -l surrounds library with lib and .a and
5750 searches several directories.
5751
5752 -lobjc
5753 You need this special case of the -l option in order to link an
5754 Objective-C or Objective-C++ program.
5755
5756 -nostartfiles
5757 Do not use the standard system startup files when linking. The
5758 standard system libraries are used normally, unless -nostdlib or
5759 -nodefaultlibs is used.
5760
5761 -nodefaultlibs
5762 Do not use the standard system libraries when linking. Only the
5763 libraries you specify will be passed to the linker. The standard
5764 startup files are used normally, unless -nostartfiles is used. The
5765 compiler may generate calls to "memcmp", "memset", "memcpy" and
5766 "memmove". These entries are usually resolved by entries in libc.
5767 These entry points should be supplied through some other mechanism
5768 when this option is specified.
5769
5770 -nostdlib
5771 Do not use the standard system startup files or libraries when
5772 linking. No startup files and only the libraries you specify will
5773 be passed to the linker. The compiler may generate calls to "mem‐
5774 cmp", "memset", "memcpy" and "memmove". These entries are usually
5775 resolved by entries in libc. These entry points should be supplied
5776 through some other mechanism when this option is specified.
5777
5778 One of the standard libraries bypassed by -nostdlib and -nodefault‐
5779 libs is libgcc.a, a library of internal subroutines that GCC uses
5780 to overcome shortcomings of particular machines, or special needs
5781 for some languages.
5782
5783 In most cases, you need libgcc.a even when you want to avoid other
5784 standard libraries. In other words, when you specify -nostdlib or
5785 -nodefaultlibs you should usually specify -lgcc as well. This
5786 ensures that you have no unresolved references to internal GCC
5787 library subroutines. (For example, __main, used to ensure C++ con‐
5788 structors will be called.)
5789
5790 -pie
5791 Produce a position independent executable on targets which support
5792 it. For predictable results, you must also specify the same set of
5793 options that were used to generate code (-fpie, -fPIE, or model
5794 suboptions) when you specify this option.
5795
5796 -rdynamic
5797 Pass the flag -export-dynamic to the ELF linker, on targets that
5798 support it. This instructs the linker to add all symbols, not only
5799 used ones, to the dynamic symbol table. This option is needed for
5800 some uses of "dlopen" or to allow obtaining backtraces from within
5801 a program.
5802
5803 -s Remove all symbol table and relocation information from the exe‐
5804 cutable.
5805
5806 -static
5807 On systems that support dynamic linking, this prevents linking with
5808 the shared libraries. On other systems, this option has no effect.
5809
5810 -shared
5811 Produce a shared object which can then be linked with other objects
5812 to form an executable. Not all systems support this option. For
5813 predictable results, you must also specify the same set of options
5814 that were used to generate code (-fpic, -fPIC, or model suboptions)
5815 when you specify this option.[1]
5816
5817 -shared-libgcc
5818 -static-libgcc
5819 On systems that provide libgcc as a shared library, these options
5820 force the use of either the shared or static version respectively.
5821 If no shared version of libgcc was built when the compiler was con‐
5822 figured, these options have no effect.
5823
5824 There are several situations in which an application should use the
5825 shared libgcc instead of the static version. The most common of
5826 these is when the application wishes to throw and catch exceptions
5827 across different shared libraries. In that case, each of the
5828 libraries as well as the application itself should use the shared
5829 libgcc.
5830
5831 Therefore, the G++ and GCJ drivers automatically add -shared-libgcc
5832 whenever you build a shared library or a main executable, because
5833 C++ and Java programs typically use exceptions, so this is the
5834 right thing to do.
5835
5836 If, instead, you use the GCC driver to create shared libraries, you
5837 may find that they will not always be linked with the shared
5838 libgcc. If GCC finds, at its configuration time, that you have a
5839 non-GNU linker or a GNU linker that does not support option
5840 --eh-frame-hdr, it will link the shared version of libgcc into
5841 shared libraries by default. Otherwise, it will take advantage of
5842 the linker and optimize away the linking with the shared version of
5843 libgcc, linking with the static version of libgcc by default. This
5844 allows exceptions to propagate through such shared libraries, with‐
5845 out incurring relocation costs at library load time.
5846
5847 However, if a library or main executable is supposed to throw or
5848 catch exceptions, you must link it using the G++ or GCJ driver, as
5849 appropriate for the languages used in the program, or using the
5850 option -shared-libgcc, such that it is linked with the shared
5851 libgcc.
5852
5853 -symbolic
5854 Bind references to global symbols when building a shared object.
5855 Warn about any unresolved references (unless overridden by the link
5856 editor option -Xlinker -z -Xlinker defs). Only a few systems sup‐
5857 port this option.
5858
5859 -Xlinker option
5860 Pass option as an option to the linker. You can use this to supply
5861 system-specific linker options which GCC does not know how to rec‐
5862 ognize.
5863
5864 If you want to pass an option that takes an argument, you must use
5865 -Xlinker twice, once for the option and once for the argument. For
5866 example, to pass -assert definitions, you must write -Xlinker
5867 -assert -Xlinker definitions. It does not work to write -Xlinker
5868 "-assert definitions", because this passes the entire string as a
5869 single argument, which is not what the linker expects.
5870
5871 -Wl,option
5872 Pass option as an option to the linker. If option contains commas,
5873 it is split into multiple options at the commas.
5874
5875 -u symbol
5876 Pretend the symbol symbol is undefined, to force linking of library
5877 modules to define it. You can use -u multiple times with different
5878 symbols to force loading of additional library modules.
5879
5880 Options for Directory Search
5881
5882 These options specify directories to search for header files, for
5883 libraries and for parts of the compiler:
5884
5885 -Idir
5886 Add the directory dir to the head of the list of directories to be
5887 searched for header files. This can be used to override a system
5888 header file, substituting your own version, since these directories
5889 are searched before the system header file directories. However,
5890 you should not use this option to add directories that contain ven‐
5891 dor-supplied system header files (use -isystem for that). If you
5892 use more than one -I option, the directories are scanned in left-
5893 to-right order; the standard system directories come after.
5894
5895 If a standard system include directory, or a directory specified
5896 with -isystem, is also specified with -I, the -I option will be
5897 ignored. The directory will still be searched but as a system
5898 directory at its normal position in the system include chain. This
5899 is to ensure that GCC's procedure to fix buggy system headers and
5900 the ordering for the include_next directive are not inadvertently
5901 changed. If you really need to change the search order for system
5902 directories, use the -nostdinc and/or -isystem options.
5903
5904 -iquotedir
5905 Add the directory dir to the head of the list of directories to be
5906 searched for header files only for the case of #include "file";
5907 they are not searched for #include <file>, otherwise just like -I.
5908
5909 -Ldir
5910 Add directory dir to the list of directories to be searched for -l.
5911
5912 -Bprefix
5913 This option specifies where to find the executables, libraries,
5914 include files, and data files of the compiler itself.
5915
5916 The compiler driver program runs one or more of the subprograms
5917 cpp, cc1, as and ld. It tries prefix as a prefix for each program
5918 it tries to run, both with and without machine/version/.
5919
5920 For each subprogram to be run, the compiler driver first tries the
5921 -B prefix, if any. If that name is not found, or if -B was not
5922 specified, the driver tries two standard prefixes, which are
5923 /usr/lib/gcc/ and /usr/local/lib/gcc/. If neither of those results
5924 in a file name that is found, the unmodified program name is
5925 searched for using the directories specified in your PATH environ‐
5926 ment variable.
5927
5928 The compiler will check to see if the path provided by the -B
5929 refers to a directory, and if necessary it will add a directory
5930 separator character at the end of the path.
5931
5932 -B prefixes that effectively specify directory names also apply to
5933 libraries in the linker, because the compiler translates these
5934 options into -L options for the linker. They also apply to
5935 includes files in the preprocessor, because the compiler translates
5936 these options into -isystem options for the preprocessor. In this
5937 case, the compiler appends include to the prefix.
5938
5939 The run-time support file libgcc.a can also be searched for using
5940 the -B prefix, if needed. If it is not found there, the two stan‐
5941 dard prefixes above are tried, and that is all. The file is left
5942 out of the link if it is not found by those means.
5943
5944 Another way to specify a prefix much like the -B prefix is to use
5945 the environment variable GCC_EXEC_PREFIX.
5946
5947 As a special kludge, if the path provided by -B is [dir/]stageN/,
5948 where N is a number in the range 0 to 9, then it will be replaced
5949 by [dir/]include. This is to help with boot-strapping the com‐
5950 piler.
5951
5952 -specs=file
5953 Process file after the compiler reads in the standard specs file,
5954 in order to override the defaults that the gcc driver program uses
5955 when determining what switches to pass to cc1, cc1plus, as, ld,
5956 etc. More than one -specs=file can be specified on the command
5957 line, and they are processed in order, from left to right.
5958
5959 --sysroot=dir
5960 Use dir as the logical root directory for headers and libraries.
5961 For example, if the compiler would normally search for headers in
5962 /usr/include and libraries in /usr/lib, it will instead search
5963 dir/usr/include and dir/usr/lib.
5964
5965 If you use both this option and the -isysroot option, then the
5966 --sysroot option will apply to libraries, but the -isysroot option
5967 will apply to header files.
5968
5969 The GNU linker (beginning with version 2.16) has the necessary sup‐
5970 port for this option. If your linker does not support this option,
5971 the header file aspect of --sysroot will still work, but the
5972 library aspect will not.
5973
5974 -I- This option has been deprecated. Please use -iquote instead for -I
5975 directories before the -I- and remove the -I-. Any directories you
5976 specify with -I options before the -I- option are searched only for
5977 the case of #include "file"; they are not searched for #include
5978 <file>.
5979
5980 If additional directories are specified with -I options after the
5981 -I-, these directories are searched for all #include directives.
5982 (Ordinarily all -I directories are used this way.)
5983
5984 In addition, the -I- option inhibits the use of the current direc‐
5985 tory (where the current input file came from) as the first search
5986 directory for #include "file". There is no way to override this
5987 effect of -I-. With -I. you can specify searching the directory
5988 which was current when the compiler was invoked. That is not
5989 exactly the same as what the preprocessor does by default, but it
5990 is often satisfactory.
5991
5992 -I- does not inhibit the use of the standard system directories for
5993 header files. Thus, -I- and -nostdinc are independent.
5994
5995 Specifying Target Machine and Compiler Version
5996
5997 The usual way to run GCC is to run the executable called gcc, or
5998 <machine>-gcc when cross-compiling, or <machine>-gcc-<version> to run a
5999 version other than the one that was installed last. Sometimes this is
6000 inconvenient, so GCC provides options that will switch to another
6001 cross-compiler or version.
6002
6003 -b machine
6004 The argument machine specifies the target machine for compilation.
6005
6006 The value to use for machine is the same as was specified as the
6007 machine type when configuring GCC as a cross-compiler. For exam‐
6008 ple, if a cross-compiler was configured with configure arm-elf,
6009 meaning to compile for an arm processor with elf binaries, then you
6010 would specify -b arm-elf to run that cross compiler. Because there
6011 are other options beginning with -b, the configuration must contain
6012 a hyphen.
6013
6014 -V version
6015 The argument version specifies which version of GCC to run. This
6016 is useful when multiple versions are installed. For example, ver‐
6017 sion might be 4.0, meaning to run GCC version 4.0.
6018
6019 The -V and -b options work by running the <machine>-gcc-<version> exe‐
6020 cutable, so there's no real reason to use them if you can just run that
6021 directly.
6022
6023 Hardware Models and Configurations
6024
6025 Earlier we discussed the standard option -b which chooses among differ‐
6026 ent installed compilers for completely different target machines, such
6027 as VAX vs. 68000 vs. 80386.
6028
6029 In addition, each of these target machine types can have its own spe‐
6030 cial options, starting with -m, to choose among various hardware models
6031 or configurations---for example, 68010 vs 68020, floating coprocessor
6032 or none. A single installed version of the compiler can compile for
6033 any model or configuration, according to the options specified.
6034
6035 Some configurations of the compiler also support additional special
6036 options, usually for compatibility with other compilers on the same
6037 platform.
6038
6039 ARC Options
6040
6041 These options are defined for ARC implementations:
6042
6043 -EL Compile code for little endian mode. This is the default.
6044
6045 -EB Compile code for big endian mode.
6046
6047 -mmangle-cpu
6048 Prepend the name of the cpu to all public symbol names. In multi‐
6049 ple-processor systems, there are many ARC variants with different
6050 instruction and register set characteristics. This flag prevents
6051 code compiled for one cpu to be linked with code compiled for
6052 another. No facility exists for handling variants that are "almost
6053 identical". This is an all or nothing option.
6054
6055 -mcpu=cpu
6056 Compile code for ARC variant cpu. Which variants are supported
6057 depend on the configuration. All variants support -mcpu=base, this
6058 is the default.
6059
6060 -mtext=text-section
6061 -mdata=data-section
6062 -mrodata=readonly-data-section
6063 Put functions, data, and readonly data in text-section, data-sec‐
6064 tion, and readonly-data-section respectively by default. This can
6065 be overridden with the "section" attribute.
6066
6067 ARM Options
6068
6069 These -m options are defined for Advanced RISC Machines (ARM) architec‐
6070 tures:
6071
6072 -mabi=name
6073 Generate code for the specified ABI. Permissible values are: apcs-
6074 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
6075
6076 -mapcs-frame
6077 Generate a stack frame that is compliant with the ARM Procedure
6078 Call Standard for all functions, even if this is not strictly nec‐
6079 essary for correct execution of the code. Specifying
6080 -fomit-frame-pointer with this option will cause the stack frames
6081 not to be generated for leaf functions. The default is
6082 -mno-apcs-frame.
6083
6084 -mapcs
6085 This is a synonym for -mapcs-frame.
6086
6087 -mthumb-interwork
6088 Generate code which supports calling between the ARM and Thumb
6089 instruction sets. Without this option the two instruction sets
6090 cannot be reliably used inside one program. The default is
6091 -mno-thumb-interwork, since slightly larger code is generated when
6092 -mthumb-interwork is specified.
6093
6094 -mno-sched-prolog
6095 Prevent the reordering of instructions in the function prolog, or
6096 the merging of those instruction with the instructions in the func‐
6097 tion's body. This means that all functions will start with a rec‐
6098 ognizable set of instructions (or in fact one of a choice from a
6099 small set of different function prologues), and this information
6100 can be used to locate the start if functions inside an executable
6101 piece of code. The default is -msched-prolog.
6102
6103 -mhard-float
6104 Generate output containing floating point instructions. This is
6105 the default.
6106
6107 -msoft-float
6108 Generate output containing library calls for floating point. Warn‐
6109 ing: the requisite libraries are not available for all ARM targets.
6110 Normally the facilities of the machine's usual C compiler are used,
6111 but this cannot be done directly in cross-compilation. You must
6112 make your own arrangements to provide suitable library functions
6113 for cross-compilation.
6114
6115 -msoft-float changes the calling convention in the output file;
6116 therefore, it is only useful if you compile all of a program with
6117 this option. In particular, you need to compile libgcc.a, the
6118 library that comes with GCC, with -msoft-float in order for this to
6119 work.
6120
6121 -mfloat-abi=name
6122 Specifies which ABI to use for floating point values. Permissible
6123 values are: soft, softfp and hard.
6124
6125 soft and hard are equivalent to -msoft-float and -mhard-float
6126 respectively. softfp allows the generation of floating point
6127 instructions, but still uses the soft-float calling conventions.
6128
6129 -mlittle-endian
6130 Generate code for a processor running in little-endian mode. This
6131 is the default for all standard configurations.
6132
6133 -mbig-endian
6134 Generate code for a processor running in big-endian mode; the
6135 default is to compile code for a little-endian processor.
6136
6137 -mwords-little-endian
6138 This option only applies when generating code for big-endian pro‐
6139 cessors. Generate code for a little-endian word order but a big-
6140 endian byte order. That is, a byte order of the form 32107654.
6141 Note: this option should only be used if you require compatibility
6142 with code for big-endian ARM processors generated by versions of
6143 the compiler prior to 2.8.
6144
6145 -mcpu=name
6146 This specifies the name of the target ARM processor. GCC uses this
6147 name to determine what kind of instructions it can emit when gener‐
6148 ating assembly code. Permissible names are: arm2, arm250, arm3,
6149 arm6, arm60, arm600, arm610, arm620, arm7, arm7m, arm7d, arm7dm,
6150 arm7di, arm7dmi, arm70, arm700, arm700i, arm710, arm710c, arm7100,
6151 arm7500, arm7500fe, arm7tdmi, arm7tdmi-s, arm8, strongarm, stron‐
6152 garm110, strongarm1100, arm8, arm810, arm9, arm9e, arm920, arm920t,
6153 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
6154 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
6155 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
6156 arm1176jz-s, arm1176jzf-s, xscale, iwmmxt, ep9312.
6157
6158 -mtune=name
6159 This option is very similar to the -mcpu= option, except that
6160 instead of specifying the actual target processor type, and hence
6161 restricting which instructions can be used, it specifies that GCC
6162 should tune the performance of the code as if the target were of
6163 the type specified in this option, but still choosing the instruc‐
6164 tions that it will generate based on the cpu specified by a -mcpu=
6165 option. For some ARM implementations better performance can be
6166 obtained by using this option.
6167
6168 -march=name
6169 This specifies the name of the target ARM architecture. GCC uses
6170 this name to determine what kind of instructions it can emit when
6171 generating assembly code. This option can be used in conjunction
6172 with or instead of the -mcpu= option. Permissible names are:
6173 armv2, armv2a, armv3, armv3m, armv4, armv4t, armv5, armv5t,
6174 armv5te, armv6, armv6j, iwmmxt, ep9312.
6175
6176 -mfpu=name
6177 -mfpe=number
6178 -mfp=number
6179 This specifies what floating point hardware (or hardware emulation)
6180 is available on the target. Permissible names are: fpa, fpe2,
6181 fpe3, maverick, vfp. -mfp and -mfpe are synonyms for -mfpu=fpenum‐
6182 ber, for compatibility with older versions of GCC.
6183
6184 If -msoft-float is specified this specifies the format of floating
6185 point values.
6186
6187 -mstructure-size-boundary=n
6188 The size of all structures and unions will be rounded up to a mul‐
6189 tiple of the number of bits set by this option. Permissible values
6190 are 8, 32 and 64. The default value varies for different
6191 toolchains. For the COFF targeted toolchain the default value is
6192 8. A value of 64 is only allowed if the underlying ABI supports
6193 it.
6194
6195 Specifying the larger number can produce faster, more efficient
6196 code, but can also increase the size of the program. Different
6197 values are potentially incompatible. Code compiled with one value
6198 cannot necessarily expect to work with code or libraries compiled
6199 with another value, if they exchange information using structures
6200 or unions.
6201
6202 -mabort-on-noreturn
6203 Generate a call to the function "abort" at the end of a "noreturn"
6204 function. It will be executed if the function tries to return.
6205
6206 -mlong-calls
6207 -mno-long-calls
6208 Tells the compiler to perform function calls by first loading the
6209 address of the function into a register and then performing a sub‐
6210 routine call on this register. This switch is needed if the target
6211 function will lie outside of the 64 megabyte addressing range of
6212 the offset based version of subroutine call instruction.
6213
6214 Even if this switch is enabled, not all function calls will be
6215 turned into long calls. The heuristic is that static functions,
6216 functions which have the short-call attribute, functions that are
6217 inside the scope of a #pragma no_long_calls directive and functions
6218 whose definitions have already been compiled within the current
6219 compilation unit, will not be turned into long calls. The excep‐
6220 tion to this rule is that weak function definitions, functions with
6221 the long-call attribute or the section attribute, and functions
6222 that are within the scope of a #pragma long_calls directive, will
6223 always be turned into long calls.
6224
6225 This feature is not enabled by default. Specifying -mno-long-calls
6226 will restore the default behavior, as will placing the function
6227 calls within the scope of a #pragma long_calls_off directive. Note
6228 these switches have no effect on how the compiler generates code to
6229 handle function calls via function pointers.
6230
6231 -mnop-fun-dllimport
6232 Disable support for the "dllimport" attribute.
6233
6234 -msingle-pic-base
6235 Treat the register used for PIC addressing as read-only, rather
6236 than loading it in the prologue for each function. The run-time
6237 system is responsible for initializing this register with an appro‐
6238 priate value before execution begins.
6239
6240 -mpic-register=reg
6241 Specify the register to be used for PIC addressing. The default is
6242 R10 unless stack-checking is enabled, when R9 is used.
6243
6244 -mcirrus-fix-invalid-insns
6245 Insert NOPs into the instruction stream to in order to work around
6246 problems with invalid Maverick instruction combinations. This
6247 option is only valid if the -mcpu=ep9312 option has been used to
6248 enable generation of instructions for the Cirrus Maverick floating
6249 point co-processor. This option is not enabled by default, since
6250 the problem is only present in older Maverick implementations. The
6251 default can be re-enabled by use of the -mno-cir‐
6252 rus-fix-invalid-insns switch.
6253
6254 -mpoke-function-name
6255 Write the name of each function into the text section, directly
6256 preceding the function prologue. The generated code is similar to
6257 this:
6258
6259 t0
6260 .ascii "arm_poke_function_name", 0
6261 .align
6262 t1
6263 .word 0xff000000 + (t1 - t0)
6264 arm_poke_function_name
6265 mov ip, sp
6266 stmfd sp!, {fp, ip, lr, pc}
6267 sub fp, ip, #4
6268
6269 When performing a stack backtrace, code can inspect the value of
6270 "pc" stored at "fp + 0". If the trace function then looks at loca‐
6271 tion "pc - 12" and the top 8 bits are set, then we know that there
6272 is a function name embedded immediately preceding this location and
6273 has length "((pc[-3]) & 0xff000000)".
6274
6275 -mthumb
6276 Generate code for the 16-bit Thumb instruction set. The default is
6277 to use the 32-bit ARM instruction set.
6278
6279 -mtpcs-frame
6280 Generate a stack frame that is compliant with the Thumb Procedure
6281 Call Standard for all non-leaf functions. (A leaf function is one
6282 that does not call any other functions.) The default is
6283 -mno-tpcs-frame.
6284
6285 -mtpcs-leaf-frame
6286 Generate a stack frame that is compliant with the Thumb Procedure
6287 Call Standard for all leaf functions. (A leaf function is one that
6288 does not call any other functions.) The default is
6289 -mno-apcs-leaf-frame.
6290
6291 -mcallee-super-interworking
6292 Gives all externally visible functions in the file being compiled
6293 an ARM instruction set header which switches to Thumb mode before
6294 executing the rest of the function. This allows these functions to
6295 be called from non-interworking code.
6296
6297 -mcaller-super-interworking
6298 Allows calls via function pointers (including virtual functions) to
6299 execute correctly regardless of whether the target code has been
6300 compiled for interworking or not. There is a small overhead in the
6301 cost of executing a function pointer if this option is enabled.
6302
6303 -mtp=name
6304 Specify the access model for the thread local storage pointer. The
6305 valid models are soft, which generates calls to "__aeabi_read_tp",
6306 cp15, which fetches the thread pointer from "cp15" directly (sup‐
6307 ported in the arm6k architecture), and auto, which uses the best
6308 available method for the selected processor. The default setting
6309 is auto.
6310
6311 AVR Options
6312
6313 These options are defined for AVR implementations:
6314
6315 -mmcu=mcu
6316 Specify ATMEL AVR instruction set or MCU type.
6317
6318 Instruction set avr1 is for the minimal AVR core, not supported by
6319 the C compiler, only for assembler programs (MCU types: at90s1200,
6320 attiny10, attiny11, attiny12, attiny15, attiny28).
6321
6322 Instruction set avr2 (default) is for the classic AVR core with up
6323 to 8K program memory space (MCU types: at90s2313, at90s2323,
6324 attiny22, at90s2333, at90s2343, at90s4414, at90s4433, at90s4434,
6325 at90s8515, at90c8534, at90s8535).
6326
6327 Instruction set avr3 is for the classic AVR core with up to 128K
6328 program memory space (MCU types: atmega103, atmega603, at43usb320,
6329 at76c711).
6330
6331 Instruction set avr4 is for the enhanced AVR core with up to 8K
6332 program memory space (MCU types: atmega8, atmega83, atmega85).
6333
6334 Instruction set avr5 is for the enhanced AVR core with up to 128K
6335 program memory space (MCU types: atmega16, atmega161, atmega163,
6336 atmega32, atmega323, atmega64, atmega128, at43usb355, at94k).
6337
6338 -msize
6339 Output instruction sizes to the asm file.
6340
6341 -minit-stack=N
6342 Specify the initial stack address, which may be a symbol or numeric
6343 value, __stack is the default.
6344
6345 -mno-interrupts
6346 Generated code is not compatible with hardware interrupts. Code
6347 size will be smaller.
6348
6349 -mcall-prologues
6350 Functions prologues/epilogues expanded as call to appropriate sub‐
6351 routines. Code size will be smaller.
6352
6353 -mno-tablejump
6354 Do not generate tablejump insns which sometimes increase code size.
6355
6356 -mtiny-stack
6357 Change only the low 8 bits of the stack pointer.
6358
6359 -mint8
6360 Assume int to be 8 bit integer. This affects the sizes of all
6361 types: A char will be 1 byte, an int will be 1 byte, an long will
6362 be 2 bytes and long long will be 4 bytes. Please note that this
6363 option does not comply to the C standards, but it will provide you
6364 with smaller code size.
6365
6366 Blackfin Options
6367
6368 -momit-leaf-frame-pointer
6369 Don't keep the frame pointer in a register for leaf functions.
6370 This avoids the instructions to save, set up and restore frame
6371 pointers and makes an extra register available in leaf functions.
6372 The option -fomit-frame-pointer removes the frame pointer for all
6373 functions which might make debugging harder.
6374
6375 -mspecld-anomaly
6376 When enabled, the compiler will ensure that the generated code does
6377 not contain speculative loads after jump instructions. This option
6378 is enabled by default.
6379
6380 -mno-specld-anomaly
6381 Don't generate extra code to prevent speculative loads from occur‐
6382 ring.
6383
6384 -mcsync-anomaly
6385 When enabled, the compiler will ensure that the generated code does
6386 not contain CSYNC or SSYNC instructions too soon after conditional
6387 branches. This option is enabled by default.
6388
6389 -mno-csync-anomaly
6390 Don't generate extra code to prevent CSYNC or SSYNC instructions
6391 from occurring too soon after a conditional branch.
6392
6393 -mlow-64k
6394 When enabled, the compiler is free to take advantage of the knowl‐
6395 edge that the entire program fits into the low 64k of memory.
6396
6397 -mno-low-64k
6398 Assume that the program is arbitrarily large. This is the default.
6399
6400 -mid-shared-library
6401 Generate code that supports shared libraries via the library ID
6402 method. This allows for execute in place and shared libraries in
6403 an environment without virtual memory management. This option
6404 implies -fPIC.
6405
6406 -mno-id-shared-library
6407 Generate code that doesn't assume ID based shared libraries are
6408 being used. This is the default.
6409
6410 -mshared-library-id=n
6411 Specified the identification number of the ID based shared library
6412 being compiled. Specifying a value of 0 will generate more compact
6413 code, specifying other values will force the allocation of that
6414 number to the current library but is no more space or time effi‐
6415 cient than omitting this option.
6416
6417 -mlong-calls
6418 -mno-long-calls
6419 Tells the compiler to perform function calls by first loading the
6420 address of the function into a register and then performing a sub‐
6421 routine call on this register. This switch is needed if the target
6422 function will lie outside of the 24 bit addressing range of the
6423 offset based version of subroutine call instruction.
6424
6425 This feature is not enabled by default. Specifying -mno-long-calls
6426 will restore the default behavior. Note these switches have no
6427 effect on how the compiler generates code to handle function calls
6428 via function pointers.
6429
6430 CRIS Options
6431
6432 These options are defined specifically for the CRIS ports.
6433
6434 -march=architecture-type
6435 -mcpu=architecture-type
6436 Generate code for the specified architecture. The choices for
6437 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
6438 ETRAX 100, and ETRAX 100 LX. Default is v0 except for
6439 cris-axis-linux-gnu, where the default is v10.
6440
6441 -mtune=architecture-type
6442 Tune to architecture-type everything applicable about the generated
6443 code, except for the ABI and the set of available instructions.
6444 The choices for architecture-type are the same as for -march=archi‐
6445 tecture-type.
6446
6447 -mmax-stack-frame=n
6448 Warn when the stack frame of a function exceeds n bytes.
6449
6450 -melinux-stacksize=n
6451 Only available with the cris-axis-aout target. Arranges for indi‐
6452 cations in the program to the kernel loader that the stack of the
6453 program should be set to n bytes.
6454
6455 -metrax4
6456 -metrax100
6457 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
6458 -march=v8 respectively.
6459
6460 -mmul-bug-workaround
6461 -mno-mul-bug-workaround
6462 Work around a bug in the "muls" and "mulu" instructions for CPU
6463 models where it applies. This option is active by default.
6464
6465 -mpdebug
6466 Enable CRIS-specific verbose debug-related information in the
6467 assembly code. This option also has the effect to turn off the
6468 #NO_APP formatted-code indicator to the assembler at the beginning
6469 of the assembly file.
6470
6471 -mcc-init
6472 Do not use condition-code results from previous instruction; always
6473 emit compare and test instructions before use of condition codes.
6474
6475 -mno-side-effects
6476 Do not emit instructions with side-effects in addressing modes
6477 other than post-increment.
6478
6479 -mstack-align
6480 -mno-stack-align
6481 -mdata-align
6482 -mno-data-align
6483 -mconst-align
6484 -mno-const-align
6485 These options (no-options) arranges (eliminate arrangements) for
6486 the stack-frame, individual data and constants to be aligned for
6487 the maximum single data access size for the chosen CPU model. The
6488 default is to arrange for 32-bit alignment. ABI details such as
6489 structure layout are not affected by these options.
6490
6491 -m32-bit
6492 -m16-bit
6493 -m8-bit
6494 Similar to the stack- data- and const-align options above, these
6495 options arrange for stack-frame, writable data and constants to all
6496 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit align‐
6497 ment.
6498
6499 -mno-prologue-epilogue
6500 -mprologue-epilogue
6501 With -mno-prologue-epilogue, the normal function prologue and epi‐
6502 logue that sets up the stack-frame are omitted and no return
6503 instructions or return sequences are generated in the code. Use
6504 this option only together with visual inspection of the compiled
6505 code: no warnings or errors are generated when call-saved registers
6506 must be saved, or storage for local variable needs to be allocated.
6507
6508 -mno-gotplt
6509 -mgotplt
6510 With -fpic and -fPIC, don't generate (do generate) instruction
6511 sequences that load addresses for functions from the PLT part of
6512 the GOT rather than (traditional on other architectures) calls to
6513 the PLT. The default is -mgotplt.
6514
6515 -maout
6516 Legacy no-op option only recognized with the cris-axis-aout target.
6517
6518 -melf
6519 Legacy no-op option only recognized with the cris-axis-elf and
6520 cris-axis-linux-gnu targets.
6521
6522 -melinux
6523 Only recognized with the cris-axis-aout target, where it selects a
6524 GNU/linux-like multilib, include files and instruction set for
6525 -march=v8.
6526
6527 -mlinux
6528 Legacy no-op option only recognized with the cris-axis-linux-gnu
6529 target.
6530
6531 -sim
6532 This option, recognized for the cris-axis-aout and cris-axis-elf
6533 arranges to link with input-output functions from a simulator
6534 library. Code, initialized data and zero-initialized data are
6535 allocated consecutively.
6536
6537 -sim2
6538 Like -sim, but pass linker options to locate initialized data at
6539 0x40000000 and zero-initialized data at 0x80000000.
6540
6541 CRX Options
6542
6543 These options are defined specifically for the CRX ports.
6544
6545 -mmac
6546 Enable the use of multiply-accumulate instructions. Disabled by
6547 default.
6548
6549 -mpush-args
6550 Push instructions will be used to pass outgoing arguments when
6551 functions are called. Enabled by default.
6552
6553 Darwin Options
6554
6555 These options are defined for all architectures running the Darwin
6556 operating system.
6557
6558 FSF GCC on Darwin does not create "fat" object files; it will create an
6559 object file for the single architecture that it was built to target.
6560 Apple's GCC on Darwin does create "fat" files if multiple -arch options
6561 are used; it does so by running the compiler or linker multiple times
6562 and joining the results together with lipo.
6563
6564 The subtype of the file created (like ppc7400 or ppc970 or i686) is
6565 determined by the flags that specify the ISA that GCC is targetting,
6566 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
6567 override this.
6568
6569 The Darwin tools vary in their behavior when presented with an ISA mis‐
6570 match. The assembler, as, will only permit instructions to be used
6571 that are valid for the subtype of the file it is generating, so you
6572 cannot put 64-bit instructions in an ppc750 object file. The linker
6573 for shared libraries, /usr/bin/libtool, will fail and print an error if
6574 asked to create a shared library with a less restrictive subtype than
6575 its input files (for instance, trying to put a ppc970 object file in a
6576 ppc7400 library). The linker for executables, ld, will quietly give
6577 the executable the most restrictive subtype of any of its input files.
6578
6579 -Fdir
6580 Add the framework directory dir to the head of the list of directo‐
6581 ries to be searched for header files. These directories are inter‐
6582 leaved with those specified by -I options and are scanned in a
6583 left-to-right order.
6584
6585 A framework directory is a directory with frameworks in it. A
6586 framework is a directory with a "Headers" and/or "PrivateHeaders"
6587 directory contained directly in it that ends in ".framework". The
6588 name of a framework is the name of this directory excluding the
6589 ".framework". Headers associated with the framework are found in
6590 one of those two directories, with "Headers" being searched first.
6591 A subframework is a framework directory that is in a framework's
6592 "Frameworks" directory. Includes of subframework headers can only
6593 appear in a header of a framework that contains the subframework,
6594 or in a sibling subframework header. Two subframeworks are sib‐
6595 lings if they occur in the same framework. A subframework should
6596 not have the same name as a framework, a warning will be issued if
6597 this is violated. Currently a subframework cannot have subframe‐
6598 works, in the future, the mechanism may be extended to support
6599 this. The standard frameworks can be found in "/Sys‐
6600 tem/Library/Frameworks" and "/Library/Frameworks". An example
6601 include looks like "#include <Framework/header.h>", where Framework
6602 denotes the name of the framework and header.h is found in the
6603 "PrivateHeaders" or "Headers" directory.
6604
6605 -gused
6606 Emit debugging information for symbols that are used. For STABS
6607 debugging format, this enables -feliminate-unused-debug-symbols.
6608 This is by default ON.
6609
6610 -gfull
6611 Emit debugging information for all symbols and types.
6612
6613 -mmacosx-version-min=version
6614 The earliest version of MacOS X that this executable will run on is
6615 version. Typical values of version include 10.1, 10.2, and 10.3.9.
6616
6617 The default for this option is to make choices that seem to be most
6618 useful.
6619
6620 -mone-byte-bool
6621 Override the defaults for bool so that sizeof(bool)==1. By default
6622 sizeof(bool) is 4 when compiling for Darwin/PowerPC and 1 when com‐
6623 piling for Darwin/x86, so this option has no effect on x86.
6624
6625 Warning: The -mone-byte-bool switch causes GCC to generate code
6626 that is not binary compatible with code generated without that
6627 switch. Using this switch may require recompiling all other mod‐
6628 ules in a program, including system libraries. Use this switch to
6629 conform to a non-default data model.
6630
6631 -mfix-and-continue
6632 -ffix-and-continue
6633 -findirect-data
6634 Generate code suitable for fast turn around development. Needed to
6635 enable gdb to dynamically load ".o" files into already running pro‐
6636 grams. -findirect-data and -ffix-and-continue are provided for
6637 backwards compatibility.
6638
6639 -all_load
6640 Loads all members of static archive libraries. See man ld(1) for
6641 more information.
6642
6643 -arch_errors_fatal
6644 Cause the errors having to do with files that have the wrong archi‐
6645 tecture to be fatal.
6646
6647 -bind_at_load
6648 Causes the output file to be marked such that the dynamic linker
6649 will bind all undefined references when the file is loaded or
6650 launched.
6651
6652 -bundle
6653 Produce a Mach-o bundle format file. See man ld(1) for more infor‐
6654 mation.
6655
6656 -bundle_loader executable
6657 This option specifies the executable that will be loading the build
6658 output file being linked. See man ld(1) for more information.
6659
6660 -dynamiclib
6661 When passed this option, GCC will produce a dynamic library instead
6662 of an executable when linking, using the Darwin libtool command.
6663
6664 -force_cpusubtype_ALL
6665 This causes GCC's output file to have the ALL subtype, instead of
6666 one controlled by the -mcpu or -march option.
6667
6668 -allowable_client client_name
6669 -client_name
6670 -compatibility_version
6671 -current_version
6672 -dead_strip
6673 -dependency-file
6674 -dylib_file
6675 -dylinker_install_name
6676 -dynamic
6677 -exported_symbols_list
6678 -filelist
6679 -flat_namespace
6680 -force_flat_namespace
6681 -headerpad_max_install_names
6682 -image_base
6683 -init
6684 -install_name
6685 -keep_private_externs
6686 -multi_module
6687 -multiply_defined
6688 -multiply_defined_unused
6689 -noall_load
6690 -no_dead_strip_inits_and_terms
6691 -nofixprebinding
6692 -nomultidefs
6693 -noprebind
6694 -noseglinkedit
6695 -pagezero_size
6696 -prebind
6697 -prebind_all_twolevel_modules
6698 -private_bundle
6699 -read_only_relocs
6700 -sectalign
6701 -sectobjectsymbols
6702 -whyload
6703 -seg1addr
6704 -sectcreate
6705 -sectobjectsymbols
6706 -sectorder
6707 -segaddr
6708 -segs_read_only_addr
6709 -segs_read_write_addr
6710 -seg_addr_table
6711 -seg_addr_table_filename
6712 -seglinkedit
6713 -segprot
6714 -segs_read_only_addr
6715 -segs_read_write_addr
6716 -single_module
6717 -static
6718 -sub_library
6719 -sub_umbrella
6720 -twolevel_namespace
6721 -umbrella
6722 -undefined
6723 -unexported_symbols_list
6724 -weak_reference_mismatches
6725 -whatsloaded
6726 These options are passed to the Darwin linker. The Darwin linker
6727 man page describes them in detail.
6728
6729 DEC Alpha Options
6730
6731 These -m options are defined for the DEC Alpha implementations:
6732
6733 -mno-soft-float
6734 -msoft-float
6735 Use (do not use) the hardware floating-point instructions for
6736 floating-point operations. When -msoft-float is specified, func‐
6737 tions in libgcc.a will be used to perform floating-point opera‐
6738 tions. Unless they are replaced by routines that emulate the
6739 floating-point operations, or compiled in such a way as to call
6740 such emulations routines, these routines will issue floating-point
6741 operations. If you are compiling for an Alpha without floating-
6742 point operations, you must ensure that the library is built so as
6743 not to call them.
6744
6745 Note that Alpha implementations without floating-point operations
6746 are required to have floating-point registers.
6747
6748 -mfp-reg
6749 -mno-fp-regs
6750 Generate code that uses (does not use) the floating-point register
6751 set. -mno-fp-regs implies -msoft-float. If the floating-point
6752 register set is not used, floating point operands are passed in
6753 integer registers as if they were integers and floating-point
6754 results are passed in $0 instead of $f0. This is a non-standard
6755 calling sequence, so any function with a floating-point argument or
6756 return value called by code compiled with -mno-fp-regs must also be
6757 compiled with that option.
6758
6759 A typical use of this option is building a kernel that does not
6760 use, and hence need not save and restore, any floating-point regis‐
6761 ters.
6762
6763 -mieee
6764 The Alpha architecture implements floating-point hardware optimized
6765 for maximum performance. It is mostly compliant with the IEEE
6766 floating point standard. However, for full compliance, software
6767 assistance is required. This option generates code fully IEEE com‐
6768 pliant code except that the inexact-flag is not maintained (see
6769 below). If this option is turned on, the preprocessor macro
6770 "_IEEE_FP" is defined during compilation. The resulting code is
6771 less efficient but is able to correctly support denormalized num‐
6772 bers and exceptional IEEE values such as not-a-number and
6773 plus/minus infinity. Other Alpha compilers call this option
6774 -ieee_with_no_inexact.
6775
6776 -mieee-with-inexact
6777 This is like -mieee except the generated code also maintains the
6778 IEEE inexact-flag. Turning on this option causes the generated
6779 code to implement fully-compliant IEEE math. In addition to
6780 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
6781 On some Alpha implementations the resulting code may execute sig‐
6782 nificantly slower than the code generated by default. Since there
6783 is very little code that depends on the inexact-flag, you should
6784 normally not specify this option. Other Alpha compilers call this
6785 option -ieee_with_inexact.
6786
6787 -mfp-trap-mode=trap-mode
6788 This option controls what floating-point related traps are enabled.
6789 Other Alpha compilers call this option -fptm trap-mode. The trap
6790 mode can be set to one of four values:
6791
6792 n This is the default (normal) setting. The only traps that are
6793 enabled are the ones that cannot be disabled in software (e.g.,
6794 division by zero trap).
6795
6796 u In addition to the traps enabled by n, underflow traps are
6797 enabled as well.
6798
6799 su Like su, but the instructions are marked to be safe for soft‐
6800 ware completion (see Alpha architecture manual for details).
6801
6802 sui Like su, but inexact traps are enabled as well.
6803
6804 -mfp-rounding-mode=rounding-mode
6805 Selects the IEEE rounding mode. Other Alpha compilers call this
6806 option -fprm rounding-mode. The rounding-mode can be one of:
6807
6808 n Normal IEEE rounding mode. Floating point numbers are rounded
6809 towards the nearest machine number or towards the even machine
6810 number in case of a tie.
6811
6812 m Round towards minus infinity.
6813
6814 c Chopped rounding mode. Floating point numbers are rounded
6815 towards zero.
6816
6817 d Dynamic rounding mode. A field in the floating point control
6818 register (fpcr, see Alpha architecture reference manual) con‐
6819 trols the rounding mode in effect. The C library initializes
6820 this register for rounding towards plus infinity. Thus, unless
6821 your program modifies the fpcr, d corresponds to round towards
6822 plus infinity.
6823
6824 -mtrap-precision=trap-precision
6825 In the Alpha architecture, floating point traps are imprecise.
6826 This means without software assistance it is impossible to recover
6827 from a floating trap and program execution normally needs to be
6828 terminated. GCC can generate code that can assist operating system
6829 trap handlers in determining the exact location that caused a
6830 floating point trap. Depending on the requirements of an applica‐
6831 tion, different levels of precisions can be selected:
6832
6833 p Program precision. This option is the default and means a trap
6834 handler can only identify which program caused a floating point
6835 exception.
6836
6837 f Function precision. The trap handler can determine the func‐
6838 tion that caused a floating point exception.
6839
6840 i Instruction precision. The trap handler can determine the
6841 exact instruction that caused a floating point exception.
6842
6843 Other Alpha compilers provide the equivalent options called
6844 -scope_safe and -resumption_safe.
6845
6846 -mieee-conformant
6847 This option marks the generated code as IEEE conformant. You must
6848 not use this option unless you also specify -mtrap-precision=i and
6849 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
6850 to emit the line .eflag 48 in the function prologue of the gener‐
6851 ated assembly file. Under DEC Unix, this has the effect that IEEE-
6852 conformant math library routines will be linked in.
6853
6854 -mbuild-constants
6855 Normally GCC examines a 32- or 64-bit integer constant to see if it
6856 can construct it from smaller constants in two or three instruc‐
6857 tions. If it cannot, it will output the constant as a literal and
6858 generate code to load it from the data segment at runtime.
6859
6860 Use this option to require GCC to construct all integer constants
6861 using code, even if it takes more instructions (the maximum is
6862 six).
6863
6864 You would typically use this option to build a shared library
6865 dynamic loader. Itself a shared library, it must relocate itself
6866 in memory before it can find the variables and constants in its own
6867 data segment.
6868
6869 -malpha-as
6870 -mgas
6871 Select whether to generate code to be assembled by the vendor-sup‐
6872 plied assembler (-malpha-as) or by the GNU assembler -mgas.
6873
6874 -mbwx
6875 -mno-bwx
6876 -mcix
6877 -mno-cix
6878 -mfix
6879 -mno-fix
6880 -mmax
6881 -mno-max
6882 Indicate whether GCC should generate code to use the optional BWX,
6883 CIX, FIX and MAX instruction sets. The default is to use the
6884 instruction sets supported by the CPU type specified via -mcpu=
6885 option or that of the CPU on which GCC was built if none was speci‐
6886 fied.
6887
6888 -mfloat-vax
6889 -mfloat-ieee
6890 Generate code that uses (does not use) VAX F and G floating point
6891 arithmetic instead of IEEE single and double precision.
6892
6893 -mexplicit-relocs
6894 -mno-explicit-relocs
6895 Older Alpha assemblers provided no way to generate symbol reloca‐
6896 tions except via assembler macros. Use of these macros does not
6897 allow optimal instruction scheduling. GNU binutils as of version
6898 2.12 supports a new syntax that allows the compiler to explicitly
6899 mark which relocations should apply to which instructions. This
6900 option is mostly useful for debugging, as GCC detects the capabili‐
6901 ties of the assembler when it is built and sets the default accord‐
6902 ingly.
6903
6904 -msmall-data
6905 -mlarge-data
6906 When -mexplicit-relocs is in effect, static data is accessed via
6907 gp-relative relocations. When -msmall-data is used, objects 8
6908 bytes long or smaller are placed in a small data area (the ".sdata"
6909 and ".sbss" sections) and are accessed via 16-bit relocations off
6910 of the $gp register. This limits the size of the small data area
6911 to 64KB, but allows the variables to be directly accessed via a
6912 single instruction.
6913
6914 The default is -mlarge-data. With this option the data area is
6915 limited to just below 2GB. Programs that require more than 2GB of
6916 data must use "malloc" or "mmap" to allocate the data in the heap
6917 instead of in the program's data segment.
6918
6919 When generating code for shared libraries, -fpic implies
6920 -msmall-data and -fPIC implies -mlarge-data.
6921
6922 -msmall-text
6923 -mlarge-text
6924 When -msmall-text is used, the compiler assumes that the code of
6925 the entire program (or shared library) fits in 4MB, and is thus
6926 reachable with a branch instruction. When -msmall-data is used,
6927 the compiler can assume that all local symbols share the same $gp
6928 value, and thus reduce the number of instructions required for a
6929 function call from 4 to 1.
6930
6931 The default is -mlarge-text.
6932
6933 -mcpu=cpu_type
6934 Set the instruction set and instruction scheduling parameters for
6935 machine type cpu_type. You can specify either the EV style name or
6936 the corresponding chip number. GCC supports scheduling parameters
6937 for the EV4, EV5 and EV6 family of processors and will choose the
6938 default values for the instruction set from the processor you spec‐
6939 ify. If you do not specify a processor type, GCC will default to
6940 the processor on which the compiler was built.
6941
6942 Supported values for cpu_type are
6943
6944 ev4
6945 ev45
6946 21064
6947 Schedules as an EV4 and has no instruction set extensions.
6948
6949 ev5
6950 21164
6951 Schedules as an EV5 and has no instruction set extensions.
6952
6953 ev56
6954 21164a
6955 Schedules as an EV5 and supports the BWX extension.
6956
6957 pca56
6958 21164pc
6959 21164PC
6960 Schedules as an EV5 and supports the BWX and MAX extensions.
6961
6962 ev6
6963 21264
6964 Schedules as an EV6 and supports the BWX, FIX, and MAX exten‐
6965 sions.
6966
6967 ev67
6968 21264a
6969 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
6970 extensions.
6971
6972 -mtune=cpu_type
6973 Set only the instruction scheduling parameters for machine type
6974 cpu_type. The instruction set is not changed.
6975
6976 -mmemory-latency=time
6977 Sets the latency the scheduler should assume for typical memory
6978 references as seen by the application. This number is highly
6979 dependent on the memory access patterns used by the application and
6980 the size of the external cache on the machine.
6981
6982 Valid options for time are
6983
6984 number
6985 A decimal number representing clock cycles.
6986
6987 L1
6988 L2
6989 L3
6990 main
6991 The compiler contains estimates of the number of clock cycles
6992 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
6993 (also called Dcache, Scache, and Bcache), as well as to main
6994 memory. Note that L3 is only valid for EV5.
6995
6996 DEC Alpha/VMS Options
6997
6998 These -m options are defined for the DEC Alpha/VMS implementations:
6999
7000 -mvms-return-codes
7001 Return VMS condition codes from main. The default is to return
7002 POSIX style condition (e.g. error) codes.
7003
7004 FRV Options
7005
7006 -mgpr-32
7007 Only use the first 32 general purpose registers.
7008
7009 -mgpr-64
7010 Use all 64 general purpose registers.
7011
7012 -mfpr-32
7013 Use only the first 32 floating point registers.
7014
7015 -mfpr-64
7016 Use all 64 floating point registers
7017
7018 -mhard-float
7019 Use hardware instructions for floating point operations.
7020
7021 -msoft-float
7022 Use library routines for floating point operations.
7023
7024 -malloc-cc
7025 Dynamically allocate condition code registers.
7026
7027 -mfixed-cc
7028 Do not try to dynamically allocate condition code registers, only
7029 use "icc0" and "fcc0".
7030
7031 -mdword
7032 Change ABI to use double word insns.
7033
7034 -mno-dword
7035 Do not use double word instructions.
7036
7037 -mdouble
7038 Use floating point double instructions.
7039
7040 -mno-double
7041 Do not use floating point double instructions.
7042
7043 -mmedia
7044 Use media instructions.
7045
7046 -mno-media
7047 Do not use media instructions.
7048
7049 -mmuladd
7050 Use multiply and add/subtract instructions.
7051
7052 -mno-muladd
7053 Do not use multiply and add/subtract instructions.
7054
7055 -mfdpic
7056 Select the FDPIC ABI, that uses function descriptors to represent
7057 pointers to functions. Without any PIC/PIE-related options, it
7058 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
7059 small data are within a 12-bit range from the GOT base address;
7060 with -fPIC or -fPIE, GOT offsets are computed with 32 bits.
7061
7062 -minline-plt
7063 Enable inlining of PLT entries in function calls to functions that
7064 are not known to bind locally. It has no effect without -mfdpic.
7065 It's enabled by default if optimizing for speed and compiling for
7066 shared libraries (i.e., -fPIC or -fpic), or when an optimization
7067 option such as -O3 or above is present in the command line.
7068
7069 -mTLS
7070 Assume a large TLS segment when generating thread-local code.
7071
7072 -mtls
7073 Do not assume a large TLS segment when generating thread-local
7074 code.
7075
7076 -mgprel-ro
7077 Enable the use of "GPREL" relocations in the FDPIC ABI for data
7078 that is known to be in read-only sections. It's enabled by
7079 default, except for -fpic or -fpie: even though it may help make
7080 the global offset table smaller, it trades 1 instruction for 4.
7081 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
7082 may be shared by multiple symbols, and it avoids the need for a GOT
7083 entry for the referenced symbol, so it's more likely to be a win.
7084 If it is not, -mno-gprel-ro can be used to disable it.
7085
7086 -multilib-library-pic
7087 Link with the (library, not FD) pic libraries. It's implied by
7088 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
7089 should never have to use it explicitly.
7090
7091 -mlinked-fp
7092 Follow the EABI requirement of always creating a frame pointer
7093 whenever a stack frame is allocated. This option is enabled by
7094 default and can be disabled with -mno-linked-fp.
7095
7096 -mlong-calls
7097 Use indirect addressing to call functions outside the current com‐
7098 pilation unit. This allows the functions to be placed anywhere
7099 within the 32-bit address space.
7100
7101 -malign-labels
7102 Try to align labels to an 8-byte boundary by inserting nops into
7103 the previous packet. This option only has an effect when VLIW
7104 packing is enabled. It doesn't create new packets; it merely adds
7105 nops to existing ones.
7106
7107 -mlibrary-pic
7108 Generate position-independent EABI code.
7109
7110 -macc-4
7111 Use only the first four media accumulator registers.
7112
7113 -macc-8
7114 Use all eight media accumulator registers.
7115
7116 -mpack
7117 Pack VLIW instructions.
7118
7119 -mno-pack
7120 Do not pack VLIW instructions.
7121
7122 -mno-eflags
7123 Do not mark ABI switches in e_flags.
7124
7125 -mcond-move
7126 Enable the use of conditional-move instructions (default).
7127
7128 This switch is mainly for debugging the compiler and will likely be
7129 removed in a future version.
7130
7131 -mno-cond-move
7132 Disable the use of conditional-move instructions.
7133
7134 This switch is mainly for debugging the compiler and will likely be
7135 removed in a future version.
7136
7137 -mscc
7138 Enable the use of conditional set instructions (default).
7139
7140 This switch is mainly for debugging the compiler and will likely be
7141 removed in a future version.
7142
7143 -mno-scc
7144 Disable the use of conditional set instructions.
7145
7146 This switch is mainly for debugging the compiler and will likely be
7147 removed in a future version.
7148
7149 -mcond-exec
7150 Enable the use of conditional execution (default).
7151
7152 This switch is mainly for debugging the compiler and will likely be
7153 removed in a future version.
7154
7155 -mno-cond-exec
7156 Disable the use of conditional execution.
7157
7158 This switch is mainly for debugging the compiler and will likely be
7159 removed in a future version.
7160
7161 -mvliw-branch
7162 Run a pass to pack branches into VLIW instructions (default).
7163
7164 This switch is mainly for debugging the compiler and will likely be
7165 removed in a future version.
7166
7167 -mno-vliw-branch
7168 Do not run a pass to pack branches into VLIW instructions.
7169
7170 This switch is mainly for debugging the compiler and will likely be
7171 removed in a future version.
7172
7173 -mmulti-cond-exec
7174 Enable optimization of "&&" and "⎪⎪" in conditional execution
7175 (default).
7176
7177 This switch is mainly for debugging the compiler and will likely be
7178 removed in a future version.
7179
7180 -mno-multi-cond-exec
7181 Disable optimization of "&&" and "⎪⎪" in conditional execution.
7182
7183 This switch is mainly for debugging the compiler and will likely be
7184 removed in a future version.
7185
7186 -mnested-cond-exec
7187 Enable nested conditional execution optimizations (default).
7188
7189 This switch is mainly for debugging the compiler and will likely be
7190 removed in a future version.
7191
7192 -mno-nested-cond-exec
7193 Disable nested conditional execution optimizations.
7194
7195 This switch is mainly for debugging the compiler and will likely be
7196 removed in a future version.
7197
7198 -moptimize-membar
7199 This switch removes redundant "membar" instructions from the com‐
7200 piler generated code. It is enabled by default.
7201
7202 -mno-optimize-membar
7203 This switch disables the automatic removal of redundant "membar"
7204 instructions from the generated code.
7205
7206 -mtomcat-stats
7207 Cause gas to print out tomcat statistics.
7208
7209 -mcpu=cpu
7210 Select the processor type for which to generate code. Possible
7211 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
7212 and simple.
7213
7214 H8/300 Options
7215
7216 These -m options are defined for the H8/300 implementations:
7217
7218 -mrelax
7219 Shorten some address references at link time, when possible; uses
7220 the linker option -relax.
7221
7222 -mh Generate code for the H8/300H.
7223
7224 -ms Generate code for the H8S.
7225
7226 -mn Generate code for the H8S and H8/300H in the normal mode. This
7227 switch must be used either with -mh or -ms.
7228
7229 -ms2600
7230 Generate code for the H8S/2600. This switch must be used with -ms.
7231
7232 -mint32
7233 Make "int" data 32 bits by default.
7234
7235 -malign-300
7236 On the H8/300H and H8S, use the same alignment rules as for the
7237 H8/300. The default for the H8/300H and H8S is to align longs and
7238 floats on 4 byte boundaries. -malign-300 causes them to be aligned
7239 on 2 byte boundaries. This option has no effect on the H8/300.
7240
7241 HPPA Options
7242
7243 These -m options are defined for the HPPA family of computers:
7244
7245 -march=architecture-type
7246 Generate code for the specified architecture. The choices for
7247 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
7248 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX sys‐
7249 tem to determine the proper architecture option for your machine.
7250 Code compiled for lower numbered architectures will run on higher
7251 numbered architectures, but not the other way around.
7252
7253 -mpa-risc-1-0
7254 -mpa-risc-1-1
7255 -mpa-risc-2-0
7256 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
7257
7258 -mbig-switch
7259 Generate code suitable for big switch tables. Use this option only
7260 if the assembler/linker complain about out of range branches within
7261 a switch table.
7262
7263 -mjump-in-delay
7264 Fill delay slots of function calls with unconditional jump instruc‐
7265 tions by modifying the return pointer for the function call to be
7266 the target of the conditional jump.
7267
7268 -mdisable-fpregs
7269 Prevent floating point registers from being used in any manner.
7270 This is necessary for compiling kernels which perform lazy context
7271 switching of floating point registers. If you use this option and
7272 attempt to perform floating point operations, the compiler will
7273 abort.
7274
7275 -mdisable-indexing
7276 Prevent the compiler from using indexing address modes. This
7277 avoids some rather obscure problems when compiling MIG generated
7278 code under MACH.
7279
7280 -mno-space-regs
7281 Generate code that assumes the target has no space registers. This
7282 allows GCC to generate faster indirect calls and use unscaled index
7283 address modes.
7284
7285 Such code is suitable for level 0 PA systems and kernels.
7286
7287 -mfast-indirect-calls
7288 Generate code that assumes calls never cross space boundaries.
7289 This allows GCC to emit code which performs faster indirect calls.
7290
7291 This option will not work in the presence of shared libraries or
7292 nested functions.
7293
7294 -mfixed-range=register-range
7295 Generate code treating the given register range as fixed registers.
7296 A fixed register is one that the register allocator can not use.
7297 This is useful when compiling kernel code. A register range is
7298 specified as two registers separated by a dash. Multiple register
7299 ranges can be specified separated by a comma.
7300
7301 -mlong-load-store
7302 Generate 3-instruction load and store sequences as sometimes
7303 required by the HP-UX 10 linker. This is equivalent to the +k
7304 option to the HP compilers.
7305
7306 -mportable-runtime
7307 Use the portable calling conventions proposed by HP for ELF sys‐
7308 tems.
7309
7310 -mgas
7311 Enable the use of assembler directives only GAS understands.
7312
7313 -mschedule=cpu-type
7314 Schedule code according to the constraints for the machine type
7315 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
7316 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
7317 to determine the proper scheduling option for your machine. The
7318 default scheduling is 8000.
7319
7320 -mlinker-opt
7321 Enable the optimization pass in the HP-UX linker. Note this makes
7322 symbolic debugging impossible. It also triggers a bug in the HP-UX
7323 8 and HP-UX 9 linkers in which they give bogus error messages when
7324 linking some programs.
7325
7326 -msoft-float
7327 Generate output containing library calls for floating point. Warn‐
7328 ing: the requisite libraries are not available for all HPPA tar‐
7329 gets. Normally the facilities of the machine's usual C compiler
7330 are used, but this cannot be done directly in cross-compilation.
7331 You must make your own arrangements to provide suitable library
7332 functions for cross-compilation. The embedded target hppa1.1-*-pro
7333 does provide software floating point support.
7334
7335 -msoft-float changes the calling convention in the output file;
7336 therefore, it is only useful if you compile all of a program with
7337 this option. In particular, you need to compile libgcc.a, the
7338 library that comes with GCC, with -msoft-float in order for this to
7339 work.
7340
7341 -msio
7342 Generate the predefine, "_SIO", for server IO. The default is
7343 -mwsio. This generates the predefines, "__hp9000s700",
7344 "__hp9000s700__" and "_WSIO", for workstation IO. These options
7345 are available under HP-UX and HI-UX.
7346
7347 -mgnu-ld
7348 Use GNU ld specific options. This passes -shared to ld when build‐
7349 ing a shared library. It is the default when GCC is configured,
7350 explicitly or implicitly, with the GNU linker. This option does
7351 not have any affect on which ld is called, it only changes what
7352 parameters are passed to that ld. The ld that is called is deter‐
7353 mined by the --with-ld configure option, GCC's program search path,
7354 and finally by the user's PATH. The linker used by GCC can be
7355 printed using which `gcc -print-prog-name=ld`. This option is only
7356 available on the 64 bit HP-UX GCC, i.e. configured with
7357 hppa*64*-*-hpux*.
7358
7359 -mhp-ld
7360 Use HP ld specific options. This passes -b to ld when building a
7361 shared library and passes +Accept TypeMismatch to ld on all links.
7362 It is the default when GCC is configured, explicitly or implicitly,
7363 with the HP linker. This option does not have any affect on which
7364 ld is called, it only changes what parameters are passed to that
7365 ld. The ld that is called is determined by the --with-ld configure
7366 option, GCC's program search path, and finally by the user's PATH.
7367 The linker used by GCC can be printed using which `gcc
7368 -print-prog-name=ld`. This option is only available on the 64 bit
7369 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
7370
7371 -mlong-calls
7372 Generate code that uses long call sequences. This ensures that a
7373 call is always able to reach linker generated stubs. The default
7374 is to generate long calls only when the distance from the call site
7375 to the beginning of the function or translation unit, as the case
7376 may be, exceeds a predefined limit set by the branch type being
7377 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
7378 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
7379 always limited at 240,000 bytes.
7380
7381 Distances are measured from the beginning of functions when using
7382 the -ffunction-sections option, or when using the -mgas and
7383 -mno-portable-runtime options together under HP-UX with the SOM
7384 linker.
7385
7386 It is normally not desirable to use this option as it will degrade
7387 performance. However, it may be useful in large applications, par‐
7388 ticularly when partial linking is used to build the application.
7389
7390 The types of long calls used depends on the capabilities of the
7391 assembler and linker, and the type of code being generated. The
7392 impact on systems that support long absolute calls, and long pic
7393 symbol-difference or pc-relative calls should be relatively small.
7394 However, an indirect call is used on 32-bit ELF systems in pic code
7395 and it is quite long.
7396
7397 -munix=unix-std
7398 Generate compiler predefines and select a startfile for the speci‐
7399 fied UNIX standard. The choices for unix-std are 93, 95 and 98.
7400 93 is supported on all HP-UX versions. 95 is available on HP-UX
7401 10.10 and later. 98 is available on HP-UX 11.11 and later. The
7402 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
7403 11.00, and 98 for HP-UX 11.11 and later.
7404
7405 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
7406 -munix=95 provides additional predefines for "XOPEN_UNIX" and
7407 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
7408 provides additional predefines for "_XOPEN_UNIX",
7409 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
7410 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
7411
7412 It is important to note that this option changes the interfaces for
7413 various library routines. It also affects the operational behavior
7414 of the C library. Thus, extreme care is needed in using this
7415 option.
7416
7417 Library code that is intended to operate with more than one UNIX
7418 standard must test, set and restore the variable
7419 __xpg4_extended_mask as appropriate. Most GNU software doesn't
7420 provide this capability.
7421
7422 -nolibdld
7423 Suppress the generation of link options to search libdld.sl when
7424 the -static option is specified on HP-UX 10 and later.
7425
7426 -static
7427 The HP-UX implementation of setlocale in libc has a dependency on
7428 libdld.sl. There isn't an archive version of libdld.sl. Thus,
7429 when the -static option is specified, special link options are
7430 needed to resolve this dependency.
7431
7432 On HP-UX 10 and later, the GCC driver adds the necessary options to
7433 link with libdld.sl when the -static option is specified. This
7434 causes the resulting binary to be dynamic. On the 64-bit port, the
7435 linkers generate dynamic binaries by default in any case. The
7436 -nolibdld option can be used to prevent the GCC driver from adding
7437 these link options.
7438
7439 -threads
7440 Add support for multithreading with the dce thread library under
7441 HP-UX. This option sets flags for both the preprocessor and
7442 linker.
7443
7444 Intel 386 and AMD x86-64 Options
7445
7446 These -m options are defined for the i386 and x86-64 family of comput‐
7447 ers:
7448
7449 -mtune=cpu-type
7450 Tune to cpu-type everything applicable about the generated code,
7451 except for the ABI and the set of available instructions. The
7452 choices for cpu-type are:
7453
7454 generic
7455 Produce code optimized for the most common IA32/AMD64/EM64T
7456 processors. If you know the CPU on which your code will run,
7457 then you should use the corresponding -mtune option instead of
7458 -mtune=generic. But, if you do not know exactly what CPU users
7459 of your application will have, then you should use this option.
7460
7461 As new processors are deployed in the marketplace, the behavior
7462 of this option will change. Therefore, if you upgrade to a
7463 newer version of GCC, the code generated option will change to
7464 reflect the processors that were most common when that version
7465 of GCC was released.
7466
7467 There is no -march=generic option because -march indicates the
7468 instruction set the compiler can use, and there is no generic
7469 instruction set applicable to all processors. In contrast,
7470 -mtune indicates the processor (or, in this case, collection of
7471 processors) for which the code is optimized.
7472
7473 i386
7474 Original Intel's i386 CPU.
7475
7476 i486
7477 Intel's i486 CPU. (No scheduling is implemented for this
7478 chip.)
7479
7480 i586, pentium
7481 Intel Pentium CPU with no MMX support.
7482
7483 pentium-mmx
7484 Intel PentiumMMX CPU based on Pentium core with MMX instruction
7485 set support.
7486
7487 pentiumpro
7488 Intel PentiumPro CPU.
7489
7490 i686
7491 Same as "generic", but when used as "march" option, PentiumPro
7492 instruction set will be used, so the code will run on all i686
7493 familly chips.
7494
7495 pentium2
7496 Intel Pentium2 CPU based on PentiumPro core with MMX instruc‐
7497 tion set support.
7498
7499 pentium3, pentium3m
7500 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE
7501 instruction set support.
7502
7503 pentium-m
7504 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2
7505 instruction set support. Used by Centrino notebooks.
7506
7507 pentium4, pentium4m
7508 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set sup‐
7509 port.
7510
7511 prescott
7512 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and
7513 SSE3 instruction set support.
7514
7515 nocona
7516 Improved version of Intel Pentium4 CPU with 64-bit extensions,
7517 MMX, SSE, SSE2 and SSE3 instruction set support.
7518
7519 core2
7520 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
7521 and SSSE3 instruction set support.
7522
7523 k6 AMD K6 CPU with MMX instruction set support.
7524
7525 k6-2, k6-3
7526 Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction
7527 set support.
7528
7529 athlon, athlon-tbird
7530 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE
7531 prefetch instructions support.
7532
7533 athlon-4, athlon-xp, athlon-mp
7534 Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and
7535 full SSE instruction set support.
7536
7537 k8, opteron, athlon64, athlon-fx
7538 AMD K8 core based CPUs with x86-64 instruction set support.
7539 (This supersets MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and
7540 64-bit instruction set extensions.)
7541
7542 amdfam10
7543 AMD Family 10 core based CPUs with x86-64 instruction set sup‐
7544 port. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!,
7545 enhanced 3dNOW!, ABM and 64-bit instruction set extensions.)
7546
7547 winchip-c6
7548 IDT Winchip C6 CPU, dealt in same way as i486 with additional
7549 MMX instruction set support.
7550
7551 winchip2
7552 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX
7553 and 3dNOW! instruction set support.
7554
7555 c3 Via C3 CPU with MMX and 3dNOW! instruction set support. (No
7556 scheduling is implemented for this chip.)
7557
7558 c3-2
7559 Via C3-2 CPU with MMX and SSE instruction set support. (No
7560 scheduling is implemented for this chip.)
7561
7562 While picking a specific cpu-type will schedule things appropri‐
7563 ately for that particular chip, the compiler will not generate any
7564 code that does not run on the i386 without the -march=cpu-type
7565 option being used.
7566
7567 -march=cpu-type
7568 Generate instructions for the machine type cpu-type. The choices
7569 for cpu-type are the same as for -mtune. Moreover, specifying
7570 -march=cpu-type implies -mtune=cpu-type.
7571
7572 -mcpu=cpu-type
7573 A deprecated synonym for -mtune.
7574
7575 -m386
7576 -m486
7577 -mpentium
7578 -mpentiumpro
7579 These options are synonyms for -mtune=i386, -mtune=i486,
7580 -mtune=pentium, and -mtune=pentiumpro respectively. These synonyms
7581 are deprecated.
7582
7583 -mfpmath=unit
7584 Generate floating point arithmetics for selected unit unit. The
7585 choices for unit are:
7586
7587 387 Use the standard 387 floating point coprocessor present major‐
7588 ity of chips and emulated otherwise. Code compiled with this
7589 option will run almost everywhere. The temporary results are
7590 computed in 80bit precision instead of precision specified by
7591 the type resulting in slightly different results compared to
7592 most of other chips. See -ffloat-store for more detailed
7593 description.
7594
7595 This is the default choice for i386 compiler.
7596
7597 sse Use scalar floating point instructions present in the SSE
7598 instruction set. This instruction set is supported by Pentium3
7599 and newer chips, in the AMD line by Athlon-4, Athlon-xp and
7600 Athlon-mp chips. The earlier version of SSE instruction set
7601 supports only single precision arithmetics, thus the double and
7602 extended precision arithmetics is still done using 387. Later
7603 version, present only in Pentium4 and the future AMD x86-64
7604 chips supports double precision arithmetics too.
7605
7606 For the i386 compiler, you need to use -march=cpu-type, -msse
7607 or -msse2 switches to enable SSE extensions and make this
7608 option effective. For the x86-64 compiler, these extensions
7609 are enabled by default.
7610
7611 The resulting code should be considerably faster in the major‐
7612 ity of cases and avoid the numerical instability problems of
7613 387 code, but may break some existing code that expects tempo‐
7614 raries to be 80bit.
7615
7616 This is the default choice for the x86-64 compiler.
7617
7618 sse,387
7619 Attempt to utilize both instruction sets at once. This effec‐
7620 tively double the amount of available registers and on chips
7621 with separate execution units for 387 and SSE the execution
7622 resources too. Use this option with care, as it is still
7623 experimental, because the GCC register allocator does not model
7624 separate functional units well resulting in instable perfor‐
7625 mance.
7626
7627 -masm=dialect
7628 Output asm instructions using selected dialect. Supported choices
7629 are intel or att (the default one). Darwin does not support intel.
7630
7631 -mieee-fp
7632 -mno-ieee-fp
7633 Control whether or not the compiler uses IEEE floating point com‐
7634 parisons. These handle correctly the case where the result of a
7635 comparison is unordered.
7636
7637 -msoft-float
7638 Generate output containing library calls for floating point. Warn‐
7639 ing: the requisite libraries are not part of GCC. Normally the
7640 facilities of the machine's usual C compiler are used, but this
7641 can't be done directly in cross-compilation. You must make your
7642 own arrangements to provide suitable library functions for
7643 cross-compilation.
7644
7645 On machines where a function returns floating point results in the
7646 80387 register stack, some floating point opcodes may be emitted
7647 even if -msoft-float is used.
7648
7649 -mno-fp-ret-in-387
7650 Do not use the FPU registers for return values of functions.
7651
7652 The usual calling convention has functions return values of types
7653 "float" and "double" in an FPU register, even if there is no FPU.
7654 The idea is that the operating system should emulate an FPU.
7655
7656 The option -mno-fp-ret-in-387 causes such values to be returned in
7657 ordinary CPU registers instead.
7658
7659 -mno-fancy-math-387
7660 Some 387 emulators do not support the "sin", "cos" and "sqrt"
7661 instructions for the 387. Specify this option to avoid generating
7662 those instructions. This option is the default on FreeBSD, OpenBSD
7663 and NetBSD. This option is overridden when -march indicates that
7664 the target cpu will always have an FPU and so the instruction will
7665 not need emulation. As of revision 2.6.1, these instructions are
7666 not generated unless you also use the -funsafe-math-optimizations
7667 switch.
7668
7669 -malign-double
7670 -mno-align-double
7671 Control whether GCC aligns "double", "long double", and "long long"
7672 variables on a two word boundary or a one word boundary. Aligning
7673 "double" variables on a two word boundary will produce code that
7674 runs somewhat faster on a Pentium at the expense of more memory.
7675
7676 On x86-64, -malign-double is enabled by default.
7677
7678 Warning: if you use the -malign-double switch, structures contain‐
7679 ing the above types will be aligned differently than the published
7680 application binary interface specifications for the 386 and will
7681 not be binary compatible with structures in code compiled without
7682 that switch.
7683
7684 -m96bit-long-double
7685 -m128bit-long-double
7686 These switches control the size of "long double" type. The i386
7687 application binary interface specifies the size to be 96 bits, so
7688 -m96bit-long-double is the default in 32 bit mode.
7689
7690 Modern architectures (Pentium and newer) would prefer "long double"
7691 to be aligned to an 8 or 16 byte boundary. In arrays or structures
7692 conforming to the ABI, this would not be possible. So specifying a
7693 -m128bit-long-double will align "long double" to a 16 byte boundary
7694 by padding the "long double" with an additional 32 bit zero.
7695
7696 In the x86-64 compiler, -m128bit-long-double is the default choice
7697 as its ABI specifies that "long double" is to be aligned on 16 byte
7698 boundary.
7699
7700 Notice that neither of these options enable any extra precision
7701 over the x87 standard of 80 bits for a "long double".
7702
7703 Warning: if you override the default value for your target ABI, the
7704 structures and arrays containing "long double" variables will
7705 change their size as well as function calling convention for func‐
7706 tion taking "long double" will be modified. Hence they will not be
7707 binary compatible with arrays or structures in code compiled with‐
7708 out that switch.
7709
7710 -mmlarge-data-threshold=number
7711 When -mcmodel=medium is specified, the data greater than threshold
7712 are placed in large data section. This value must be the same
7713 across all object linked into the binary and defaults to 65535.
7714
7715 -msvr3-shlib
7716 -mno-svr3-shlib
7717 Control whether GCC places uninitialized local variables into the
7718 "bss" or "data" segments. -msvr3-shlib places them into "bss".
7719 These options are meaningful only on System V Release 3.
7720
7721 -mrtd
7722 Use a different function-calling convention, in which functions
7723 that take a fixed number of arguments return with the "ret" num
7724 instruction, which pops their arguments while returning. This
7725 saves one instruction in the caller since there is no need to pop
7726 the arguments there.
7727
7728 You can specify that an individual function is called with this
7729 calling sequence with the function attribute stdcall. You can also
7730 override the -mrtd option by using the function attribute cdecl.
7731
7732 Warning: this calling convention is incompatible with the one nor‐
7733 mally used on Unix, so you cannot use it if you need to call
7734 libraries compiled with the Unix compiler.
7735
7736 Also, you must provide function prototypes for all functions that
7737 take variable numbers of arguments (including "printf"); otherwise
7738 incorrect code will be generated for calls to those functions.
7739
7740 In addition, seriously incorrect code will result if you call a
7741 function with too many arguments. (Normally, extra arguments are
7742 harmlessly ignored.)
7743
7744 -mregparm=num
7745 Control how many registers are used to pass integer arguments. By
7746 default, no registers are used to pass arguments, and at most 3
7747 registers can be used. You can control this behavior for a spe‐
7748 cific function by using the function attribute regparm.
7749
7750 Warning: if you use this switch, and num is nonzero, then you must
7751 build all modules with the same value, including any libraries.
7752 This includes the system libraries and startup modules.
7753
7754 -msseregparm
7755 Use SSE register passing conventions for float and double arguments
7756 and return values. You can control this behavior for a specific
7757 function by using the function attribute sseregparm.
7758
7759 Warning: if you use this switch then you must build all modules
7760 with the same value, including any libraries. This includes the
7761 system libraries and startup modules.
7762
7763 -mpreferred-stack-boundary=num
7764 Attempt to keep the stack boundary aligned to a 2 raised to num
7765 byte boundary. If -mpreferred-stack-boundary is not specified, the
7766 default is 4 (16 bytes or 128 bits).
7767
7768 On Pentium and PentiumPro, "double" and "long double" values should
7769 be aligned to an 8 byte boundary (see -malign-double) or suffer
7770 significant run time performance penalties. On Pentium III, the
7771 Streaming SIMD Extension (SSE) data type "__m128" may not work
7772 properly if it is not 16 byte aligned.
7773
7774 To ensure proper alignment of this values on the stack, the stack
7775 boundary must be as aligned as that required by any value stored on
7776 the stack. Further, every function must be generated such that it
7777 keeps the stack aligned. Thus calling a function compiled with a
7778 higher preferred stack boundary from a function compiled with a
7779 lower preferred stack boundary will most likely misalign the stack.
7780 It is recommended that libraries that use callbacks always use the
7781 default setting.
7782
7783 This extra alignment does consume extra stack space, and generally
7784 increases code size. Code that is sensitive to stack space usage,
7785 such as embedded systems and operating system kernels, may want to
7786 reduce the preferred alignment to -mpreferred-stack-boundary=2.
7787
7788 -mmmx
7789 -mno-mmx
7790 -msse
7791 -mno-sse
7792 -msse2
7793 -mno-sse2
7794 -msse3
7795 -mno-sse3
7796 -mssse3
7797 -mno-ssse3
7798 -msse4a
7799 -mno-sse4a
7800 -m3dnow
7801 -mno-3dnow
7802 -mpopcnt
7803 -mno-popcnt
7804 -mabm
7805 -mno-abm
7806 These switches enable or disable the use of instructions in the
7807 MMX, SSE, SSE2 or 3DNow! extended instruction sets. These exten‐
7808 sions are also available as built-in functions: see X86 Built-in
7809 Functions, for details of the functions enabled and disabled by
7810 these switches.
7811
7812 To have SSE/SSE2 instructions generated automatically from float‐
7813 ing-point code (as opposed to 387 instructions), see -mfpmath=sse.
7814
7815 These options will enable GCC to use these extended instructions in
7816 generated code, even without -mfpmath=sse. Applications which per‐
7817 form runtime CPU detection must compile separate files for each
7818 supported architecture, using the appropriate flags. In particu‐
7819 lar, the file containing the CPU detection code should be compiled
7820 without these options.
7821
7822 -mpush-args
7823 -mno-push-args
7824 Use PUSH operations to store outgoing parameters. This method is
7825 shorter and usually equally fast as method using SUB/MOV operations
7826 and is enabled by default. In some cases disabling it may improve
7827 performance because of improved scheduling and reduced dependen‐
7828 cies.
7829
7830 -maccumulate-outgoing-args
7831 If enabled, the maximum amount of space required for outgoing argu‐
7832 ments will be computed in the function prologue. This is faster on
7833 most modern CPUs because of reduced dependencies, improved schedul‐
7834 ing and reduced stack usage when preferred stack boundary is not
7835 equal to 2. The drawback is a notable increase in code size. This
7836 switch implies -mno-push-args.
7837
7838 -mthreads
7839 Support thread-safe exception handling on Mingw32. Code that
7840 relies on thread-safe exception handling must compile and link all
7841 code with the -mthreads option. When compiling, -mthreads defines
7842 -D_MT; when linking, it links in a special thread helper library
7843 -lmingwthrd which cleans up per thread exception handling data.
7844
7845 -mno-align-stringops
7846 Do not align destination of inlined string operations. This switch
7847 reduces code size and improves performance in case the destination
7848 is already aligned, but GCC doesn't know about it.
7849
7850 -minline-all-stringops
7851 By default GCC inlines string operations only when destination is
7852 known to be aligned at least to 4 byte boundary. This enables more
7853 inlining, increase code size, but may improve performance of code
7854 that depends on fast memcpy, strlen and memset for short lengths.
7855
7856 -momit-leaf-frame-pointer
7857 Don't keep the frame pointer in a register for leaf functions.
7858 This avoids the instructions to save, set up and restore frame
7859 pointers and makes an extra register available in leaf functions.
7860 The option -fomit-frame-pointer removes the frame pointer for all
7861 functions which might make debugging harder.
7862
7863 -mtls-direct-seg-refs
7864 -mno-tls-direct-seg-refs
7865 Controls whether TLS variables may be accessed with offsets from
7866 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
7867 whether the thread base pointer must be added. Whether or not this
7868 is legal depends on the operating system, and whether it maps the
7869 segment to cover the entire TLS area.
7870
7871 For systems that use GNU libc, the default is on.
7872
7873 These -m switches are supported in addition to the above on AMD x86-64
7874 processors in 64-bit environments.
7875
7876 -m32
7877 -m64
7878 Generate code for a 32-bit or 64-bit environment. The 32-bit envi‐
7879 ronment sets int, long and pointer to 32 bits and generates code
7880 that runs on any i386 system. The 64-bit environment sets int to
7881 32 bits and long and pointer to 64 bits and generates code for
7882 AMD's x86-64 architecture.
7883
7884 -mno-red-zone
7885 Do not use a so called red zone for x86-64 code. The red zone is
7886 mandated by the x86-64 ABI, it is a 128-byte area beyond the loca‐
7887 tion of the stack pointer that will not be modified by signal or
7888 interrupt handlers and therefore can be used for temporary data
7889 without adjusting the stack pointer. The flag -mno-red-zone dis‐
7890 ables this red zone.
7891
7892 -mcmodel=small
7893 Generate code for the small code model: the program and its symbols
7894 must be linked in the lower 2 GB of the address space. Pointers
7895 are 64 bits. Programs can be statically or dynamically linked.
7896 This is the default code model.
7897
7898 -mcmodel=kernel
7899 Generate code for the kernel code model. The kernel runs in the
7900 negative 2 GB of the address space. This model has to be used for
7901 Linux kernel code.
7902
7903 -mcmodel=medium
7904 Generate code for the medium model: The program is linked in the
7905 lower 2 GB of the address space but symbols can be located anywhere
7906 in the address space. Programs can be statically or dynamically
7907 linked, but building of shared libraries are not supported with the
7908 medium model.
7909
7910 -mcmodel=large
7911 Generate code for the large model: This model makes no assumptions
7912 about addresses and sizes of sections. Currently GCC does not
7913 implement this model.
7914
7915 IA-64 Options
7916
7917 These are the -m options defined for the Intel IA-64 architecture.
7918
7919 -mbig-endian
7920 Generate code for a big endian target. This is the default for
7921 HP-UX.
7922
7923 -mlittle-endian
7924 Generate code for a little endian target. This is the default for
7925 AIX5 and GNU/Linux.
7926
7927 -mgnu-as
7928 -mno-gnu-as
7929 Generate (or don't) code for the GNU assembler. This is the
7930 default.
7931
7932 -mgnu-ld
7933 -mno-gnu-ld
7934 Generate (or don't) code for the GNU linker. This is the default.
7935
7936 -mno-pic
7937 Generate code that does not use a global pointer register. The
7938 result is not position independent code, and violates the IA-64
7939 ABI.
7940
7941 -mvolatile-asm-stop
7942 -mno-volatile-asm-stop
7943 Generate (or don't) a stop bit immediately before and after
7944 volatile asm statements.
7945
7946 -mregister-names
7947 -mno-register-names
7948 Generate (or don't) in, loc, and out register names for the stacked
7949 registers. This may make assembler output more readable.
7950
7951 -mno-sdata
7952 -msdata
7953 Disable (or enable) optimizations that use the small data section.
7954 This may be useful for working around optimizer bugs.
7955
7956 -mconstant-gp
7957 Generate code that uses a single constant global pointer value.
7958 This is useful when compiling kernel code.
7959
7960 -mauto-pic
7961 Generate code that is self-relocatable. This implies -mcon‐
7962 stant-gp. This is useful when compiling firmware code.
7963
7964 -minline-float-divide-min-latency
7965 Generate code for inline divides of floating point values using the
7966 minimum latency algorithm.
7967
7968 -minline-float-divide-max-throughput
7969 Generate code for inline divides of floating point values using the
7970 maximum throughput algorithm.
7971
7972 -minline-int-divide-min-latency
7973 Generate code for inline divides of integer values using the mini‐
7974 mum latency algorithm.
7975
7976 -minline-int-divide-max-throughput
7977 Generate code for inline divides of integer values using the maxi‐
7978 mum throughput algorithm.
7979
7980 -minline-sqrt-min-latency
7981 Generate code for inline square roots using the minimum latency
7982 algorithm.
7983
7984 -minline-sqrt-max-throughput
7985 Generate code for inline square roots using the maximum throughput
7986 algorithm.
7987
7988 -mno-dwarf2-asm
7989 -mdwarf2-asm
7990 Don't (or do) generate assembler code for the DWARF2 line number
7991 debugging info. This may be useful when not using the GNU assem‐
7992 bler.
7993
7994 -mearly-stop-bits
7995 -mno-early-stop-bits
7996 Allow stop bits to be placed earlier than immediately preceding the
7997 instruction that triggered the stop bit. This can improve instruc‐
7998 tion scheduling, but does not always do so.
7999
8000 -mfixed-range=register-range
8001 Generate code treating the given register range as fixed registers.
8002 A fixed register is one that the register allocator can not use.
8003 This is useful when compiling kernel code. A register range is
8004 specified as two registers separated by a dash. Multiple register
8005 ranges can be specified separated by a comma.
8006
8007 -mtls-size=tls-size
8008 Specify bit size of immediate TLS offsets. Valid values are 14,
8009 22, and 64.
8010
8011 -mtune=cpu-type
8012 Tune the instruction scheduling for a particular CPU, Valid values
8013 are itanium, itanium1, merced, itanium2, and mckinley.
8014
8015 -mt
8016 -pthread
8017 Add support for multithreading using the POSIX threads library.
8018 This option sets flags for both the preprocessor and linker. It
8019 does not affect the thread safety of object code produced by the
8020 compiler or that of libraries supplied with it. These are HP-UX
8021 specific flags.
8022
8023 -milp32
8024 -mlp64
8025 Generate code for a 32-bit or 64-bit environment. The 32-bit envi‐
8026 ronment sets int, long and pointer to 32 bits. The 64-bit environ‐
8027 ment sets int to 32 bits and long and pointer to 64 bits. These
8028 are HP-UX specific flags.
8029
8030 M32C Options
8031
8032 -mcpu=name
8033 Select the CPU for which code is generated. name may be one of r8c
8034 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
8035 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
8036
8037 -msim
8038 Specifies that the program will be run on the simulator. This
8039 causes an alternate runtime library to be linked in which supports,
8040 for example, file I/O. You must not use this option when generat‐
8041 ing programs that will run on real hardware; you must provide your
8042 own runtime library for whatever I/O functions are needed.
8043
8044 -memregs=number
8045 Specifies the number of memory-based pseudo-registers GCC will use
8046 during code generation. These pseudo-registers will be used like
8047 real registers, so there is a tradeoff between GCC's ability to fit
8048 the code into available registers, and the performance penalty of
8049 using memory instead of registers. Note that all modules in a pro‐
8050 gram must be compiled with the same value for this option. Because
8051 of that, you must not use this option with the default runtime
8052 libraries gcc builds.
8053
8054 M32R/D Options
8055
8056 These -m options are defined for Renesas M32R/D architectures:
8057
8058 -m32r2
8059 Generate code for the M32R/2.
8060
8061 -m32rx
8062 Generate code for the M32R/X.
8063
8064 -m32r
8065 Generate code for the M32R. This is the default.
8066
8067 -mmodel=small
8068 Assume all objects live in the lower 16MB of memory (so that their
8069 addresses can be loaded with the "ld24" instruction), and assume
8070 all subroutines are reachable with the "bl" instruction. This is
8071 the default.
8072
8073 The addressability of a particular object can be set with the
8074 "model" attribute.
8075
8076 -mmodel=medium
8077 Assume objects may be anywhere in the 32-bit address space (the
8078 compiler will generate "seth/add3" instructions to load their
8079 addresses), and assume all subroutines are reachable with the "bl"
8080 instruction.
8081
8082 -mmodel=large
8083 Assume objects may be anywhere in the 32-bit address space (the
8084 compiler will generate "seth/add3" instructions to load their
8085 addresses), and assume subroutines may not be reachable with the
8086 "bl" instruction (the compiler will generate the much slower
8087 "seth/add3/jl" instruction sequence).
8088
8089 -msdata=none
8090 Disable use of the small data area. Variables will be put into one
8091 of .data, bss, or .rodata (unless the "section" attribute has been
8092 specified). This is the default.
8093
8094 The small data area consists of sections .sdata and .sbss. Objects
8095 may be explicitly put in the small data area with the "section"
8096 attribute using one of these sections.
8097
8098 -msdata=sdata
8099 Put small global and static data in the small data area, but do not
8100 generate special code to reference them.
8101
8102 -msdata=use
8103 Put small global and static data in the small data area, and gener‐
8104 ate special instructions to reference them.
8105
8106 -G num
8107 Put global and static objects less than or equal to num bytes into
8108 the small data or bss sections instead of the normal data or bss
8109 sections. The default value of num is 8. The -msdata option must
8110 be set to one of sdata or use for this option to have any effect.
8111
8112 All modules should be compiled with the same -G num value. Compil‐
8113 ing with different values of num may or may not work; if it doesn't
8114 the linker will give an error message---incorrect code will not be
8115 generated.
8116
8117 -mdebug
8118 Makes the M32R specific code in the compiler display some statis‐
8119 tics that might help in debugging programs.
8120
8121 -malign-loops
8122 Align all loops to a 32-byte boundary.
8123
8124 -mno-align-loops
8125 Do not enforce a 32-byte alignment for loops. This is the default.
8126
8127 -missue-rate=number
8128 Issue number instructions per cycle. number can only be 1 or 2.
8129
8130 -mbranch-cost=number
8131 number can only be 1 or 2. If it is 1 then branches will be pre‐
8132 ferred over conditional code, if it is 2, then the opposite will
8133 apply.
8134
8135 -mflush-trap=number
8136 Specifies the trap number to use to flush the cache. The default
8137 is 12. Valid numbers are between 0 and 15 inclusive.
8138
8139 -mno-flush-trap
8140 Specifies that the cache cannot be flushed by using a trap.
8141
8142 -mflush-func=name
8143 Specifies the name of the operating system function to call to
8144 flush the cache. The default is _flush_cache, but a function call
8145 will only be used if a trap is not available.
8146
8147 -mno-flush-func
8148 Indicates that there is no OS function for flushing the cache.
8149
8150 M680x0 Options
8151
8152 These are the -m options defined for the 68000 series. The default
8153 values for these options depends on which style of 68000 was selected
8154 when the compiler was configured; the defaults for the most common
8155 choices are given below.
8156
8157 -m68000
8158 -mc68000
8159 Generate output for a 68000. This is the default when the compiler
8160 is configured for 68000-based systems.
8161
8162 Use this option for microcontrollers with a 68000 or EC000 core,
8163 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
8164
8165 -m68020
8166 -mc68020
8167 Generate output for a 68020. This is the default when the compiler
8168 is configured for 68020-based systems.
8169
8170 -m68881
8171 Generate output containing 68881 instructions for floating point.
8172 This is the default for most 68020 systems unless --nfp was speci‐
8173 fied when the compiler was configured.
8174
8175 -m68030
8176 Generate output for a 68030. This is the default when the compiler
8177 is configured for 68030-based systems.
8178
8179 -m68040
8180 Generate output for a 68040. This is the default when the compiler
8181 is configured for 68040-based systems.
8182
8183 This option inhibits the use of 68881/68882 instructions that have
8184 to be emulated by software on the 68040. Use this option if your
8185 68040 does not have code to emulate those instructions.
8186
8187 -m68060
8188 Generate output for a 68060. This is the default when the compiler
8189 is configured for 68060-based systems.
8190
8191 This option inhibits the use of 68020 and 68881/68882 instructions
8192 that have to be emulated by software on the 68060. Use this option
8193 if your 68060 does not have code to emulate those instructions.
8194
8195 -mcpu32
8196 Generate output for a CPU32. This is the default when the compiler
8197 is configured for CPU32-based systems.
8198
8199 Use this option for microcontrollers with a CPU32 or CPU32+ core,
8200 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
8201 68341, 68349 and 68360.
8202
8203 -m5200
8204 Generate output for a 520X "coldfire" family cpu. This is the
8205 default when the compiler is configured for 520X-based systems.
8206
8207 Use this option for microcontroller with a 5200 core, including the
8208 MCF5202, MCF5203, MCF5204 and MCF5202.
8209
8210 -m68020-40
8211 Generate output for a 68040, without using any of the new instruc‐
8212 tions. This results in code which can run relatively efficiently
8213 on either a 68020/68881 or a 68030 or a 68040. The generated code
8214 does use the 68881 instructions that are emulated on the 68040.
8215
8216 -m68020-60
8217 Generate output for a 68060, without using any of the new instruc‐
8218 tions. This results in code which can run relatively efficiently
8219 on either a 68020/68881 or a 68030 or a 68040. The generated code
8220 does use the 68881 instructions that are emulated on the 68060.
8221
8222 -msoft-float
8223 Generate output containing library calls for floating point. Warn‐
8224 ing: the requisite libraries are not available for all m68k tar‐
8225 gets. Normally the facilities of the machine's usual C compiler
8226 are used, but this can't be done directly in cross-compilation.
8227 You must make your own arrangements to provide suitable library
8228 functions for cross-compilation. The embedded targets m68k-*-aout
8229 and m68k-*-coff do provide software floating point support.
8230
8231 -mshort
8232 Consider type "int" to be 16 bits wide, like "short int". Addi‐
8233 tionally, parameters passed on the stack are also aligned to a
8234 16-bit boundary even on targets whose API mandates promotion to
8235 32-bit.
8236
8237 -mnobitfield
8238 Do not use the bit-field instructions. The -m68000, -mcpu32 and
8239 -m5200 options imply -mnobitfield.
8240
8241 -mbitfield
8242 Do use the bit-field instructions. The -m68020 option implies
8243 -mbitfield. This is the default if you use a configuration
8244 designed for a 68020.
8245
8246 -mrtd
8247 Use a different function-calling convention, in which functions
8248 that take a fixed number of arguments return with the "rtd"
8249 instruction, which pops their arguments while returning. This
8250 saves one instruction in the caller since there is no need to pop
8251 the arguments there.
8252
8253 This calling convention is incompatible with the one normally used
8254 on Unix, so you cannot use it if you need to call libraries com‐
8255 piled with the Unix compiler.
8256
8257 Also, you must provide function prototypes for all functions that
8258 take variable numbers of arguments (including "printf"); otherwise
8259 incorrect code will be generated for calls to those functions.
8260
8261 In addition, seriously incorrect code will result if you call a
8262 function with too many arguments. (Normally, extra arguments are
8263 harmlessly ignored.)
8264
8265 The "rtd" instruction is supported by the 68010, 68020, 68030,
8266 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
8267
8268 -malign-int
8269 -mno-align-int
8270 Control whether GCC aligns "int", "long", "long long", "float",
8271 "double", and "long double" variables on a 32-bit boundary
8272 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
8273 variables on 32-bit boundaries produces code that runs somewhat
8274 faster on processors with 32-bit busses at the expense of more mem‐
8275 ory.
8276
8277 Warning: if you use the -malign-int switch, GCC will align struc‐
8278 tures containing the above types differently than most published
8279 application binary interface specifications for the m68k.
8280
8281 -mpcrel
8282 Use the pc-relative addressing mode of the 68000 directly, instead
8283 of using a global offset table. At present, this option implies
8284 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
8285 -fPIC is not presently supported with -mpcrel, though this could be
8286 supported for 68020 and higher processors.
8287
8288 -mno-strict-align
8289 -mstrict-align
8290 Do not (do) assume that unaligned memory references will be handled
8291 by the system.
8292
8293 -msep-data
8294 Generate code that allows the data segment to be located in a dif‐
8295 ferent area of memory from the text segment. This allows for exe‐
8296 cute in place in an environment without virtual memory management.
8297 This option implies -fPIC.
8298
8299 -mno-sep-data
8300 Generate code that assumes that the data segment follows the text
8301 segment. This is the default.
8302
8303 -mid-shared-library
8304 Generate code that supports shared libraries via the library ID
8305 method. This allows for execute in place and shared libraries in
8306 an environment without virtual memory management. This option
8307 implies -fPIC.
8308
8309 -mno-id-shared-library
8310 Generate code that doesn't assume ID based shared libraries are
8311 being used. This is the default.
8312
8313 -mshared-library-id=n
8314 Specified the identification number of the ID based shared library
8315 being compiled. Specifying a value of 0 will generate more compact
8316 code, specifying other values will force the allocation of that
8317 number to the current library but is no more space or time effi‐
8318 cient than omitting this option.
8319
8320 M68hc1x Options
8321
8322 These are the -m options defined for the 68hc11 and 68hc12 microcon‐
8323 trollers. The default values for these options depends on which style
8324 of microcontroller was selected when the compiler was configured; the
8325 defaults for the most common choices are given below.
8326
8327 -m6811
8328 -m68hc11
8329 Generate output for a 68HC11. This is the default when the com‐
8330 piler is configured for 68HC11-based systems.
8331
8332 -m6812
8333 -m68hc12
8334 Generate output for a 68HC12. This is the default when the com‐
8335 piler is configured for 68HC12-based systems.
8336
8337 -m68S12
8338 -m68hcs12
8339 Generate output for a 68HCS12.
8340
8341 -mauto-incdec
8342 Enable the use of 68HC12 pre and post auto-increment and auto-
8343 decrement addressing modes.
8344
8345 -minmax
8346 -nominmax
8347 Enable the use of 68HC12 min and max instructions.
8348
8349 -mlong-calls
8350 -mno-long-calls
8351 Treat all calls as being far away (near). If calls are assumed to
8352 be far away, the compiler will use the "call" instruction to call a
8353 function and the "rtc" instruction for returning.
8354
8355 -mshort
8356 Consider type "int" to be 16 bits wide, like "short int".
8357
8358 -msoft-reg-count=count
8359 Specify the number of pseudo-soft registers which are used for the
8360 code generation. The maximum number is 32. Using more pseudo-soft
8361 register may or may not result in better code depending on the pro‐
8362 gram. The default is 4 for 68HC11 and 2 for 68HC12.
8363
8364 MCore Options
8365
8366 These are the -m options defined for the Motorola M*Core processors.
8367
8368 -mhardlit
8369 -mno-hardlit
8370 Inline constants into the code stream if it can be done in two
8371 instructions or less.
8372
8373 -mdiv
8374 -mno-div
8375 Use the divide instruction. (Enabled by default).
8376
8377 -mrelax-immediate
8378 -mno-relax-immediate
8379 Allow arbitrary sized immediates in bit operations.
8380
8381 -mwide-bitfields
8382 -mno-wide-bitfields
8383 Always treat bit-fields as int-sized.
8384
8385 -m4byte-functions
8386 -mno-4byte-functions
8387 Force all functions to be aligned to a four byte boundary.
8388
8389 -mcallgraph-data
8390 -mno-callgraph-data
8391 Emit callgraph information.
8392
8393 -mslow-bytes
8394 -mno-slow-bytes
8395 Prefer word access when reading byte quantities.
8396
8397 -mlittle-endian
8398 -mbig-endian
8399 Generate code for a little endian target.
8400
8401 -m210
8402 -m340
8403 Generate code for the 210 processor.
8404
8405 MIPS Options
8406
8407 -EB Generate big-endian code.
8408
8409 -EL Generate little-endian code. This is the default for mips*el-*-*
8410 configurations.
8411
8412 -march=arch
8413 Generate code that will run on arch, which can be the name of a
8414 generic MIPS ISA, or the name of a particular processor. The ISA
8415 names are: mips1, mips2, mips3, mips4, mips32, mips32r2, and
8416 mips64. The processor names are: 4kc, 4km, 4kp, 5kc, 5kf, 20kc,
8417 24k, 24kc, 24kf, 24kx, m4k, orion, r2000, r3000, r3900, r4000,
8418 r4400, r4600, r4650, r6000, r8000, rm7000, rm9000, sb1, sr71000,
8419 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400 and vr5500.
8420 The special value from-abi selects the most compatible architecture
8421 for the selected ABI (that is, mips1 for 32-bit ABIs and mips3 for
8422 64-bit ABIs).
8423
8424 In processor names, a final 000 can be abbreviated as k (for exam‐
8425 ple, -march=r2k). Prefixes are optional, and vr may be written r.
8426
8427 GCC defines two macros based on the value of this option. The
8428 first is _MIPS_ARCH, which gives the name of target architecture,
8429 as a string. The second has the form _MIPS_ARCH_foo, where foo is
8430 the capitalized value of _MIPS_ARCH. For example, -march=r2000
8431 will set _MIPS_ARCH to "r2000" and define the macro
8432 _MIPS_ARCH_R2000.
8433
8434 Note that the _MIPS_ARCH macro uses the processor names given
8435 above. In other words, it will have the full prefix and will not
8436 abbreviate 000 as k. In the case of from-abi, the macro names the
8437 resolved architecture (either "mips1" or "mips3"). It names the
8438 default architecture when no -march option is given.
8439
8440 -mtune=arch
8441 Optimize for arch. Among other things, this option controls the
8442 way instructions are scheduled, and the perceived cost of arith‐
8443 metic operations. The list of arch values is the same as for
8444 -march.
8445
8446 When this option is not used, GCC will optimize for the processor
8447 specified by -march. By using -march and -mtune together, it is
8448 possible to generate code that will run on a family of processors,
8449 but optimize the code for one particular member of that family.
8450
8451 -mtune defines the macros _MIPS_TUNE and _MIPS_TUNE_foo, which work
8452 in the same way as the -march ones described above.
8453
8454 -mips1
8455 Equivalent to -march=mips1.
8456
8457 -mips2
8458 Equivalent to -march=mips2.
8459
8460 -mips3
8461 Equivalent to -march=mips3.
8462
8463 -mips4
8464 Equivalent to -march=mips4.
8465
8466 -mips32
8467 Equivalent to -march=mips32.
8468
8469 -mips32r2
8470 Equivalent to -march=mips32r2.
8471
8472 -mips64
8473 Equivalent to -march=mips64.
8474
8475 -mips16
8476 -mno-mips16
8477 Generate (do not generate) MIPS16 code. If GCC is targetting a
8478 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE.
8479
8480 -mabi=32
8481 -mabi=o64
8482 -mabi=n32
8483 -mabi=64
8484 -mabi=eabi
8485 Generate code for the given ABI.
8486
8487 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
8488 generates 64-bit code when you select a 64-bit architecture, but
8489 you can use -mgp32 to get 32-bit code instead.
8490
8491 For information about the O64 ABI, see
8492 <http://gcc.gnu.org/projects/mipso64-abi.html>.
8493
8494 -mabicalls
8495 -mno-abicalls
8496 Generate (do not generate) SVR4-style position-independent code.
8497 -mabicalls is the default for SVR4-based systems.
8498
8499 -mxgot
8500 -mno-xgot
8501 Lift (do not lift) the usual restrictions on the size of the global
8502 offset table.
8503
8504 GCC normally uses a single instruction to load values from the GOT.
8505 While this is relatively efficient, it will only work if the GOT is
8506 smaller than about 64k. Anything larger will cause the linker to
8507 report an error such as:
8508
8509 relocation truncated to fit: R_MIPS_GOT16 foobar
8510
8511 If this happens, you should recompile your code with -mxgot. It
8512 should then work with very large GOTs, although it will also be
8513 less efficient, since it will take three instructions to fetch the
8514 value of a global symbol.
8515
8516 Note that some linkers can create multiple GOTs. If you have such
8517 a linker, you should only need to use -mxgot when a single object
8518 file accesses more than 64k's worth of GOT entries. Very few do.
8519
8520 These options have no effect unless GCC is generating position
8521 independent code.
8522
8523 -mgp32
8524 Assume that general-purpose registers are 32 bits wide.
8525
8526 -mgp64
8527 Assume that general-purpose registers are 64 bits wide.
8528
8529 -mfp32
8530 Assume that floating-point registers are 32 bits wide.
8531
8532 -mfp64
8533 Assume that floating-point registers are 64 bits wide.
8534
8535 -mhard-float
8536 Use floating-point coprocessor instructions.
8537
8538 -msoft-float
8539 Do not use floating-point coprocessor instructions. Implement
8540 floating-point calculations using library calls instead.
8541
8542 -msingle-float
8543 Assume that the floating-point coprocessor only supports single-
8544 precision operations.
8545
8546 -mdouble-float
8547 Assume that the floating-point coprocessor supports double-preci‐
8548 sion operations. This is the default.
8549
8550 -mdsp
8551 -mno-dsp
8552 Use (do not use) the MIPS DSP ASE.
8553
8554 -mpaired-single
8555 -mno-paired-single
8556 Use (do not use) paired-single floating-point instructions.
8557 This option can only be used when generating 64-bit code and
8558 requires hardware floating-point support to be enabled.
8559
8560 -mips3d
8561 -mno-mips3d
8562 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
8563 -mpaired-single.
8564
8565 -mlong64
8566 Force "long" types to be 64 bits wide. See -mlong32 for an expla‐
8567 nation of the default and the way that the pointer size is deter‐
8568 mined.
8569
8570 -mlong32
8571 Force "long", "int", and pointer types to be 32 bits wide.
8572
8573 The default size of "int"s, "long"s and pointers depends on the
8574 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
8575 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
8576 "long"s. Pointers are the same size as "long"s, or the same size
8577 as integer registers, whichever is smaller.
8578
8579 -msym32
8580 -mno-sym32
8581 Assume (do not assume) that all symbols have 32-bit values, regard‐
8582 less of the selected ABI. This option is useful in combination
8583 with -mabi=64 and -mno-abicalls because it allows GCC to generate
8584 shorter and faster references to symbolic addresses.
8585
8586 -G num
8587 Put global and static items less than or equal to num bytes into
8588 the small data or bss section instead of the normal data or bss
8589 section. This allows the data to be accessed using a single
8590 instruction.
8591
8592 All modules should be compiled with the same -G num value.
8593
8594 -membedded-data
8595 -mno-embedded-data
8596 Allocate variables to the read-only data section first if possible,
8597 then next in the small data section if possible, otherwise in data.
8598 This gives slightly slower code than the default, but reduces the
8599 amount of RAM required when executing, and thus may be preferred
8600 for some embedded systems.
8601
8602 -muninit-const-in-rodata
8603 -mno-uninit-const-in-rodata
8604 Put uninitialized "const" variables in the read-only data section.
8605 This option is only meaningful in conjunction with -membedded-data.
8606
8607 -msplit-addresses
8608 -mno-split-addresses
8609 Enable (disable) use of the "%hi()" and "%lo()" assembler reloca‐
8610 tion operators. This option has been superseded by -mex‐
8611 plicit-relocs but is retained for backwards compatibility.
8612
8613 -mexplicit-relocs
8614 -mno-explicit-relocs
8615 Use (do not use) assembler relocation operators when dealing with
8616 symbolic addresses. The alternative, selected by
8617 -mno-explicit-relocs, is to use assembler macros instead.
8618
8619 -mexplicit-relocs is the default if GCC was configured to use an
8620 assembler that supports relocation operators.
8621
8622 -mcheck-zero-division
8623 -mno-check-zero-division
8624 Trap (do not trap) on integer division by zero. The default is
8625 -mcheck-zero-division.
8626
8627 -mdivide-traps
8628 -mdivide-breaks
8629 MIPS systems check for division by zero by generating either a con‐
8630 ditional trap or a break instruction. Using traps results in
8631 smaller code, but is only supported on MIPS II and later. Also,
8632 some versions of the Linux kernel have a bug that prevents trap
8633 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
8634 to allow conditional traps on architectures that support them and
8635 -mdivide-breaks to force the use of breaks.
8636
8637 The default is usually -mdivide-traps, but this can be overridden
8638 at configure time using --with-divide=breaks. Divide-by-zero
8639 checks can be completely disabled using -mno-check-zero-division.
8640
8641 -mmemcpy
8642 -mno-memcpy
8643 Force (do not force) the use of "memcpy()" for non-trivial block
8644 moves. The default is -mno-memcpy, which allows GCC to inline most
8645 constant-sized copies.
8646
8647 -mlong-calls
8648 -mno-long-calls
8649 Disable (do not disable) use of the "jal" instruction. Calling
8650 functions using "jal" is more efficient but requires the caller and
8651 callee to be in the same 256 megabyte segment.
8652
8653 This option has no effect on abicalls code. The default is
8654 -mno-long-calls.
8655
8656 -mmad
8657 -mno-mad
8658 Enable (disable) use of the "mad", "madu" and "mul" instructions,
8659 as provided by the R4650 ISA.
8660
8661 -mfused-madd
8662 -mno-fused-madd
8663 Enable (disable) use of the floating point multiply-accumulate
8664 instructions, when they are available. The default is
8665 -mfused-madd.
8666
8667 When multiply-accumulate instructions are used, the intermediate
8668 product is calculated to infinite precision and is not subject to
8669 the FCSR Flush to Zero bit. This may be undesirable in some cir‐
8670 cumstances.
8671
8672 -nocpp
8673 Tell the MIPS assembler to not run its preprocessor over user
8674 assembler files (with a .s suffix) when assembling them.
8675
8676 -mfix-r4000
8677 -mno-fix-r4000
8678 Work around certain R4000 CPU errata:
8679
8680 - A double-word or a variable shift may give an incorrect result
8681 if executed immediately after starting an integer division.
8682
8683 - A double-word or a variable shift may give an incorrect result
8684 if executed while an integer multiplication is in progress.
8685
8686 - An integer division may give an incorrect result if started in
8687 a delay slot of a taken branch or a jump.
8688
8689 -mfix-r4400
8690 -mno-fix-r4400
8691 Work around certain R4400 CPU errata:
8692
8693 - A double-word or a variable shift may give an incorrect result
8694 if executed immediately after starting an integer division.
8695
8696 -mfix-vr4120
8697 -mno-fix-vr4120
8698 Work around certain VR4120 errata:
8699
8700 - "dmultu" does not always produce the correct result.
8701
8702 - "div" and "ddiv" do not always produce the correct result if
8703 one of the operands is negative.
8704
8705 The workarounds for the division errata rely on special functions
8706 in libgcc.a. At present, these functions are only provided by the
8707 "mips64vr*-elf" configurations.
8708
8709 Other VR4120 errata require a nop to be inserted between certain
8710 pairs of instructions. These errata are handled by the assembler,
8711 not by GCC itself.
8712
8713 -mfix-vr4130
8714 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
8715 implemented by the assembler rather than by GCC, although GCC will
8716 avoid using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
8717 "dmacc" and "dmacchi" instructions are available instead.
8718
8719 -mfix-sb1
8720 -mno-fix-sb1
8721 Work around certain SB-1 CPU core errata. (This flag currently
8722 works around the SB-1 revision 2 "F1" and "F2" floating point
8723 errata.)
8724
8725 -mflush-func=func
8726 -mno-flush-func
8727 Specifies the function to call to flush the I and D caches, or to
8728 not call any such function. If called, the function must take the
8729 same arguments as the common "_flush_func()", that is, the address
8730 of the memory range for which the cache is being flushed, the size
8731 of the memory range, and the number 3 (to flush both caches). The
8732 default depends on the target GCC was configured for, but commonly
8733 is either _flush_func or __cpu_flush.
8734
8735 -mbranch-likely
8736 -mno-branch-likely
8737 Enable or disable use of Branch Likely instructions, regardless of
8738 the default for the selected architecture. By default, Branch
8739 Likely instructions may be generated if they are supported by the
8740 selected architecture. An exception is for the MIPS32 and MIPS64
8741 architectures and processors which implement those architectures;
8742 for those, Branch Likely instructions will not be generated by
8743 default because the MIPS32 and MIPS64 architectures specifically
8744 deprecate their use.
8745
8746 -mfp-exceptions
8747 -mno-fp-exceptions
8748 Specifies whether FP exceptions are enabled. This affects how we
8749 schedule FP instructions for some processors. The default is that
8750 FP exceptions are enabled.
8751
8752 For instance, on the SB-1, if FP exceptions are disabled, and we
8753 are emitting 64-bit code, then we can use both FP pipes. Other‐
8754 wise, we can only use one FP pipe.
8755
8756 -mvr4130-align
8757 -mno-vr4130-align
8758 The VR4130 pipeline is two-way superscalar, but can only issue two
8759 instructions together if the first one is 8-byte aligned. When
8760 this option is enabled, GCC will align pairs of instructions that
8761 it thinks should execute in parallel.
8762
8763 This option only has an effect when optimizing for the VR4130. It
8764 normally makes code faster, but at the expense of making it bigger.
8765 It is enabled by default at optimization level -O3.
8766
8767 MMIX Options
8768
8769 These options are defined for the MMIX:
8770
8771 -mlibfuncs
8772 -mno-libfuncs
8773 Specify that intrinsic library functions are being compiled, pass‐
8774 ing all values in registers, no matter the size.
8775
8776 -mepsilon
8777 -mno-epsilon
8778 Generate floating-point comparison instructions that compare with
8779 respect to the "rE" epsilon register.
8780
8781 -mabi=mmixware
8782 -mabi=gnu
8783 Generate code that passes function parameters and return values
8784 that (in the called function) are seen as registers $0 and up, as
8785 opposed to the GNU ABI which uses global registers $231 and up.
8786
8787 -mzero-extend
8788 -mno-zero-extend
8789 When reading data from memory in sizes shorter than 64 bits, use
8790 (do not use) zero-extending load instructions by default, rather
8791 than sign-extending ones.
8792
8793 -mknuthdiv
8794 -mno-knuthdiv
8795 Make the result of a division yielding a remainder have the same
8796 sign as the divisor. With the default, -mno-knuthdiv, the sign of
8797 the remainder follows the sign of the dividend. Both methods are
8798 arithmetically valid, the latter being almost exclusively used.
8799
8800 -mtoplevel-symbols
8801 -mno-toplevel-symbols
8802 Prepend (do not prepend) a : to all global symbols, so the assembly
8803 code can be used with the "PREFIX" assembly directive.
8804
8805 -melf
8806 Generate an executable in the ELF format, rather than the default
8807 mmo format used by the mmix simulator.
8808
8809 -mbranch-predict
8810 -mno-branch-predict
8811 Use (do not use) the probable-branch instructions, when static
8812 branch prediction indicates a probable branch.
8813
8814 -mbase-addresses
8815 -mno-base-addresses
8816 Generate (do not generate) code that uses base addresses. Using a
8817 base address automatically generates a request (handled by the
8818 assembler and the linker) for a constant to be set up in a global
8819 register. The register is used for one or more base address
8820 requests within the range 0 to 255 from the value held in the reg‐
8821 ister. The generally leads to short and fast code, but the number
8822 of different data items that can be addressed is limited. This
8823 means that a program that uses lots of static data may require
8824 -mno-base-addresses.
8825
8826 -msingle-exit
8827 -mno-single-exit
8828 Force (do not force) generated code to have a single exit point in
8829 each function.
8830
8831 MN10300 Options
8832
8833 These -m options are defined for Matsushita MN10300 architectures:
8834
8835 -mmult-bug
8836 Generate code to avoid bugs in the multiply instructions for the
8837 MN10300 processors. This is the default.
8838
8839 -mno-mult-bug
8840 Do not generate code to avoid bugs in the multiply instructions for
8841 the MN10300 processors.
8842
8843 -mam33
8844 Generate code which uses features specific to the AM33 processor.
8845
8846 -mno-am33
8847 Do not generate code which uses features specific to the AM33 pro‐
8848 cessor. This is the default.
8849
8850 -mreturn-pointer-on-d0
8851 When generating a function which returns a pointer, return the
8852 pointer in both "a0" and "d0". Otherwise, the pointer is returned
8853 only in a0, and attempts to call such functions without a prototype
8854 would result in errors. Note that this option is on by default;
8855 use -mno-return-pointer-on-d0 to disable it.
8856
8857 -mno-crt0
8858 Do not link in the C run-time initialization object file.
8859
8860 -mrelax
8861 Indicate to the linker that it should perform a relaxation opti‐
8862 mization pass to shorten branches, calls and absolute memory
8863 addresses. This option only has an effect when used on the command
8864 line for the final link step.
8865
8866 This option makes symbolic debugging impossible.
8867
8868 MT Options
8869
8870 These -m options are defined for Morpho MT architectures:
8871
8872 -march=cpu-type
8873 Generate code that will run on cpu-type, which is the name of a
8874 system representing a certain processor type. Possible values for
8875 cpu-type are ms1-64-001, ms1-16-002, ms1-16-003 and ms2.
8876
8877 When this option is not used, the default is -march=ms1-16-002.
8878
8879 -mbacc
8880 Use byte loads and stores when generating code.
8881
8882 -mno-bacc
8883 Do not use byte loads and stores when generating code.
8884
8885 -msim
8886 Use simulator runtime
8887
8888 -mno-crt0
8889 Do not link in the C run-time initialization object file crti.o.
8890 Other run-time initialization and termination files such as
8891 startup.o and exit.o are still included on the linker command line.
8892
8893 PDP-11 Options
8894
8895 These options are defined for the PDP-11:
8896
8897 -mfpu
8898 Use hardware FPP floating point. This is the default. (FIS float‐
8899 ing point on the PDP-11/40 is not supported.)
8900
8901 -msoft-float
8902 Do not use hardware floating point.
8903
8904 -mac0
8905 Return floating-point results in ac0 (fr0 in Unix assembler syn‐
8906 tax).
8907
8908 -mno-ac0
8909 Return floating-point results in memory. This is the default.
8910
8911 -m40
8912 Generate code for a PDP-11/40.
8913
8914 -m45
8915 Generate code for a PDP-11/45. This is the default.
8916
8917 -m10
8918 Generate code for a PDP-11/10.
8919
8920 -mbcopy-builtin
8921 Use inline "movmemhi" patterns for copying memory. This is the
8922 default.
8923
8924 -mbcopy
8925 Do not use inline "movmemhi" patterns for copying memory.
8926
8927 -mint16
8928 -mno-int32
8929 Use 16-bit "int". This is the default.
8930
8931 -mint32
8932 -mno-int16
8933 Use 32-bit "int".
8934
8935 -mfloat64
8936 -mno-float32
8937 Use 64-bit "float". This is the default.
8938
8939 -mfloat32
8940 -mno-float64
8941 Use 32-bit "float".
8942
8943 -mabshi
8944 Use "abshi2" pattern. This is the default.
8945
8946 -mno-abshi
8947 Do not use "abshi2" pattern.
8948
8949 -mbranch-expensive
8950 Pretend that branches are expensive. This is for experimenting
8951 with code generation only.
8952
8953 -mbranch-cheap
8954 Do not pretend that branches are expensive. This is the default.
8955
8956 -msplit
8957 Generate code for a system with split I&D.
8958
8959 -mno-split
8960 Generate code for a system without split I&D. This is the default.
8961
8962 -munix-asm
8963 Use Unix assembler syntax. This is the default when configured for
8964 pdp11-*-bsd.
8965
8966 -mdec-asm
8967 Use DEC assembler syntax. This is the default when configured for
8968 any PDP-11 target other than pdp11-*-bsd.
8969
8970 PowerPC Options
8971
8972 These are listed under
8973
8974 IBM RS/6000 and PowerPC Options
8975
8976 These -m options are defined for the IBM RS/6000 and PowerPC:
8977
8978 -mpower
8979 -mno-power
8980 -mpower2
8981 -mno-power2
8982 -mpowerpc
8983 -mno-powerpc
8984 -mpowerpc-gpopt
8985 -mno-powerpc-gpopt
8986 -mpowerpc-gfxopt
8987 -mno-powerpc-gfxopt
8988 -mpowerpc64
8989 -mno-powerpc64
8990 -mmfcrf
8991 -mno-mfcrf
8992 -mpopcntb
8993 -mno-popcntb
8994 -mfprnd
8995 -mno-fprnd
8996 -mmfpgpr
8997 -mno-mfpgpr
8998 GCC supports two related instruction set architectures for the
8999 RS/6000 and PowerPC. The POWER instruction set are those instruc‐
9000 tions supported by the rios chip set used in the original RS/6000
9001 systems and the PowerPC instruction set is the architecture of the
9002 Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and the IBM 4xx,
9003 6xx, and follow-on microprocessors.
9004
9005 Neither architecture is a subset of the other. However there is a
9006 large common subset of instructions supported by both. An MQ reg‐
9007 ister is included in processors supporting the POWER architecture.
9008
9009 You use these options to specify which instructions are available
9010 on the processor you are using. The default value of these options
9011 is determined when configuring GCC. Specifying the -mcpu=cpu_type
9012 overrides the specification of these options. We recommend you use
9013 the -mcpu=cpu_type option rather than the options listed above.
9014
9015 The -mpower option allows GCC to generate instructions that are
9016 found only in the POWER architecture and to use the MQ register.
9017 Specifying -mpower2 implies -power and also allows GCC to generate
9018 instructions that are present in the POWER2 architecture but not
9019 the original POWER architecture.
9020
9021 The -mpowerpc option allows GCC to generate instructions that are
9022 found only in the 32-bit subset of the PowerPC architecture. Spec‐
9023 ifying -mpowerpc-gpopt implies -mpowerpc and also allows GCC to use
9024 the optional PowerPC architecture instructions in the General Pur‐
9025 pose group, including floating-point square root. Specifying
9026 -mpowerpc-gfxopt implies -mpowerpc and also allows GCC to use the
9027 optional PowerPC architecture instructions in the Graphics group,
9028 including floating-point select.
9029
9030 The -mmfcrf option allows GCC to generate the move from condition
9031 register field instruction implemented on the POWER4 processor and
9032 other processors that support the PowerPC V2.01 architecture. The
9033 -mpopcntb option allows GCC to generate the popcount and double
9034 precision FP reciprocal estimate instruction implemented on the
9035 POWER5 processor and other processors that support the PowerPC
9036 V2.02 architecture. The -mfprnd option allows GCC to generate the
9037 FP round to integer instructions implemented on the POWER5+ proces‐
9038 sor and other processors that support the PowerPC V2.03 architec‐
9039 ture. The -mmfpgpr option allows GCC to generate the FP move
9040 to/from general purpose register instructions implemented on the
9041 POWER6X processor and other processors that support the extended
9042 PowerPC V2.05 architecture.
9043
9044 The -mpowerpc64 option allows GCC to generate the additional 64-bit
9045 instructions that are found in the full PowerPC64 architecture and
9046 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
9047 -mno-powerpc64.
9048
9049 If you specify both -mno-power and -mno-powerpc, GCC will use only
9050 the instructions in the common subset of both architectures plus
9051 some special AIX common-mode calls, and will not use the MQ regis‐
9052 ter. Specifying both -mpower and -mpowerpc permits GCC to use any
9053 instruction from either architecture and to allow use of the MQ
9054 register; specify this for the Motorola MPC601.
9055
9056 -mnew-mnemonics
9057 -mold-mnemonics
9058 Select which mnemonics to use in the generated assembler code.
9059 With -mnew-mnemonics, GCC uses the assembler mnemonics defined for
9060 the PowerPC architecture. With -mold-mnemonics it uses the assem‐
9061 bler mnemonics defined for the POWER architecture. Instructions
9062 defined in only one architecture have only one mnemonic; GCC uses
9063 that mnemonic irrespective of which of these options is specified.
9064
9065 GCC defaults to the mnemonics appropriate for the architecture in
9066 use. Specifying -mcpu=cpu_type sometimes overrides the value of
9067 these option. Unless you are building a cross-compiler, you should
9068 normally not specify either -mnew-mnemonics or -mold-mnemonics, but
9069 should instead accept the default.
9070
9071 -mcpu=cpu_type
9072 Set architecture type, register usage, choice of mnemonics, and
9073 instruction scheduling parameters for machine type cpu_type. Sup‐
9074 ported values for cpu_type are 401, 403, 405, 405fp, 440, 440fp,
9075 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400, 7450,
9076 750, 801, 821, 823, 860, 970, 8540, ec603e, G3, G4, G5, power,
9077 power2, power3, power4, power5, power5+, power6, power6x, common,
9078 powerpc, powerpc64, rios, rios1, rios2, rsc, and rs64.
9079
9080 -mcpu=common selects a completely generic processor. Code gener‐
9081 ated under this option will run on any POWER or PowerPC processor.
9082 GCC will use only the instructions in the common subset of both
9083 architectures, and will not use the MQ register. GCC assumes a
9084 generic processor model for scheduling purposes.
9085
9086 -mcpu=power, -mcpu=power2, -mcpu=powerpc, and -mcpu=powerpc64 spec‐
9087 ify generic POWER, POWER2, pure 32-bit PowerPC (i.e., not MPC601),
9088 and 64-bit PowerPC architecture machine types, with an appropriate,
9089 generic processor model assumed for scheduling purposes.
9090
9091 The other options specify a specific processor. Code generated
9092 under those options will run best on that processor, and may not
9093 run at all on others.
9094
9095 The -mcpu options automatically enable or disable the following
9096 options: -maltivec, -mfprnd, -mhard-float, -mmfcrf, -mmultiple,
9097 -mnew-mnemonics, -mpopcntb, -mpower, -mpower2, -mpowerpc64, -mpow‐
9098 erpc-gpopt, -mpowerpc-gfxopt, -mstring, -mmfpgpr. The particular
9099 options set for any particular CPU will vary between compiler ver‐
9100 sions, depending on what setting seems to produce optimal code for
9101 that CPU; it doesn't necessarily reflect the actual hardware's
9102 capabilities. If you wish to set an individual option to a partic‐
9103 ular value, you may specify it after the -mcpu option, like
9104 -mcpu=970 -mno-altivec.
9105
9106 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
9107 disabled by the -mcpu option at present because AIX does not have
9108 full support for these options. You may still enable or disable
9109 them individually if you're sure it'll work in your environment.
9110
9111 -mtune=cpu_type
9112 Set the instruction scheduling parameters for machine type
9113 cpu_type, but do not set the architecture type, register usage, or
9114 choice of mnemonics, as -mcpu=cpu_type would. The same values for
9115 cpu_type are used for -mtune as for -mcpu. If both are specified,
9116 the code generated will use the architecture, registers, and
9117 mnemonics set by -mcpu, but the scheduling parameters set by
9118 -mtune.
9119
9120 -mswdiv
9121 -mno-swdiv
9122 Generate code to compute division as reciprocal estimate and itera‐
9123 tive refinement, creating opportunities for increased throughput.
9124 This feature requires: optional PowerPC Graphics instruction set
9125 for single precision and FRE instruction for double precision,
9126 assuming divides cannot generate user-visible traps, and the domain
9127 values not include Infinities, denormals or zero denominator.
9128
9129 -maltivec
9130 -mno-altivec
9131 Generate code that uses (does not use) AltiVec instructions, and
9132 also enable the use of built-in functions that allow more direct
9133 access to the AltiVec instruction set. You may also need to set
9134 -mabi=altivec to adjust the current ABI with AltiVec ABI enhance‐
9135 ments.
9136
9137 -mvrsave
9138 -mno-vrsave
9139 Generate VRSAVE instructions when generating AltiVec code.
9140
9141 -msecure-plt
9142 Generate code that allows ld and ld.so to build executables and
9143 shared libraries with non-exec .plt and .got sections. This is a
9144 PowerPC 32-bit SYSV ABI option.
9145
9146 -mbss-plt
9147 Generate code that uses a BSS .plt section that ld.so fills in, and
9148 requires .plt and .got sections that are both writable and exe‐
9149 cutable. This is a PowerPC 32-bit SYSV ABI option.
9150
9151 -misel
9152 -mno-isel
9153 This switch enables or disables the generation of ISEL instruc‐
9154 tions.
9155
9156 -misel=yes/no
9157 This switch has been deprecated. Use -misel and -mno-isel instead.
9158
9159 -mspe
9160 -mno-isel
9161 This switch enables or disables the generation of SPE simd instruc‐
9162 tions.
9163
9164 -mspe=yes/no
9165 This option has been deprecated. Use -mspe and -mno-spe instead.
9166
9167 -mfloat-gprs=yes/single/double/no
9168 -mfloat-gprs
9169 This switch enables or disables the generation of floating point
9170 operations on the general purpose registers for architectures that
9171 support it.
9172
9173 The argument yes or single enables the use of single-precision
9174 floating point operations.
9175
9176 The argument double enables the use of single and double-precision
9177 floating point operations.
9178
9179 The argument no disables floating point operations on the general
9180 purpose registers.
9181
9182 This option is currently only available on the MPC854x.
9183
9184 -m32
9185 -m64
9186 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
9187 targets (including GNU/Linux). The 32-bit environment sets int,
9188 long and pointer to 32 bits and generates code that runs on any
9189 PowerPC variant. The 64-bit environment sets int to 32 bits and
9190 long and pointer to 64 bits, and generates code for PowerPC64, as
9191 for -mpowerpc64.
9192
9193 -mfull-toc
9194 -mno-fp-in-toc
9195 -mno-sum-in-toc
9196 -mminimal-toc
9197 Modify generation of the TOC (Table Of Contents), which is created
9198 for every executable file. The -mfull-toc option is selected by
9199 default. In that case, GCC will allocate at least one TOC entry
9200 for each unique non-automatic variable reference in your program.
9201 GCC will also place floating-point constants in the TOC. However,
9202 only 16,384 entries are available in the TOC.
9203
9204 If you receive a linker error message that saying you have over‐
9205 flowed the available TOC space, you can reduce the amount of TOC
9206 space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
9207 -mno-fp-in-toc prevents GCC from putting floating-point constants
9208 in the TOC and -mno-sum-in-toc forces GCC to generate code to cal‐
9209 culate the sum of an address and a constant at run-time instead of
9210 putting that sum into the TOC. You may specify one or both of
9211 these options. Each causes GCC to produce very slightly slower and
9212 larger code at the expense of conserving TOC space.
9213
9214 If you still run out of space in the TOC even when you specify both
9215 of these options, specify -mminimal-toc instead. This option
9216 causes GCC to make only one TOC entry for every file. When you
9217 specify this option, GCC will produce code that is slower and
9218 larger but which uses extremely little TOC space. You may wish to
9219 use this option only on files that contain less frequently executed
9220 code.
9221
9222 -maix64
9223 -maix32
9224 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
9225 64-bit "long" type, and the infrastructure needed to support them.
9226 Specifying -maix64 implies -mpowerpc64 and -mpowerpc, while -maix32
9227 disables the 64-bit ABI and implies -mno-powerpc64. GCC defaults
9228 to -maix32.
9229
9230 -mxl-compat
9231 -mno-xl-compat
9232 Produce code that conforms more closely to IBM XL compiler seman‐
9233 tics when using AIX-compatible ABI. Pass floating-point arguments
9234 to prototyped functions beyond the register save area (RSA) on the
9235 stack in addition to argument FPRs. Do not assume that most sig‐
9236 nificant double in 128-bit long double value is properly rounded
9237 when comparing values and converting to double. Use XL symbol
9238 names for long double support routines.
9239
9240 The AIX calling convention was extended but not initially docu‐
9241 mented to handle an obscure K&R C case of calling a function that
9242 takes the address of its arguments with fewer arguments than
9243 declared. IBM XL compilers access floating point arguments which
9244 do not fit in the RSA from the stack when a subroutine is compiled
9245 without optimization. Because always storing floating-point argu‐
9246 ments on the stack is inefficient and rarely needed, this option is
9247 not enabled by default and only is necessary when calling subrou‐
9248 tines compiled by IBM XL compilers without optimization.
9249
9250 -mpe
9251 Support IBM RS/6000 SP Parallel Environment (PE). Link an applica‐
9252 tion written to use message passing with special startup code to
9253 enable the application to run. The system must have PE installed
9254 in the standard location (/usr/lpp/ppe.poe/), or the specs file
9255 must be overridden with the -specs= option to specify the appropri‐
9256 ate directory location. The Parallel Environment does not support
9257 threads, so the -mpe option and the -pthread option are incompati‐
9258 ble.
9259
9260 -malign-natural
9261 -malign-power
9262 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
9263 -malign-natural overrides the ABI-defined alignment of larger
9264 types, such as floating-point doubles, on their natural size-based
9265 boundary. The option -malign-power instructs GCC to follow the
9266 ABI-specified alignment rules. GCC defaults to the standard align‐
9267 ment defined in the ABI.
9268
9269 On 64-bit Darwin, natural alignment is the default, and
9270 -malign-power is not supported.
9271
9272 -msoft-float
9273 -mhard-float
9274 Generate code that does not use (uses) the floating-point register
9275 set. Software floating point emulation is provided if you use the
9276 -msoft-float option, and pass the option to GCC when linking.
9277
9278 -mmultiple
9279 -mno-multiple
9280 Generate code that uses (does not use) the load multiple word
9281 instructions and the store multiple word instructions. These
9282 instructions are generated by default on POWER systems, and not
9283 generated on PowerPC systems. Do not use -mmultiple on little
9284 endian PowerPC systems, since those instructions do not work when
9285 the processor is in little endian mode. The exceptions are PPC740
9286 and PPC750 which permit the instructions usage in little endian
9287 mode.
9288
9289 -mstring
9290 -mno-string
9291 Generate code that uses (does not use) the load string instructions
9292 and the store string word instructions to save multiple registers
9293 and do small block moves. These instructions are generated by
9294 default on POWER systems, and not generated on PowerPC systems. Do
9295 not use -mstring on little endian PowerPC systems, since those
9296 instructions do not work when the processor is in little endian
9297 mode. The exceptions are PPC740 and PPC750 which permit the
9298 instructions usage in little endian mode.
9299
9300 -mupdate
9301 -mno-update
9302 Generate code that uses (does not use) the load or store instruc‐
9303 tions that update the base register to the address of the calcu‐
9304 lated memory location. These instructions are generated by
9305 default. If you use -mno-update, there is a small window between
9306 the time that the stack pointer is updated and the address of the
9307 previous frame is stored, which means code that walks the stack
9308 frame across interrupts or signals may get corrupted data.
9309
9310 -mfused-madd
9311 -mno-fused-madd
9312 Generate code that uses (does not use) the floating point multiply
9313 and accumulate instructions. These instructions are generated by
9314 default if hardware floating is used.
9315
9316 -mno-bit-align
9317 -mbit-align
9318 On System V.4 and embedded PowerPC systems do not (do) force struc‐
9319 tures and unions that contain bit-fields to be aligned to the base
9320 type of the bit-field.
9321
9322 For example, by default a structure containing nothing but 8
9323 "unsigned" bit-fields of length 1 would be aligned to a 4 byte
9324 boundary and have a size of 4 bytes. By using -mno-bit-align, the
9325 structure would be aligned to a 1 byte boundary and be one byte in
9326 size.
9327
9328 -mno-strict-align
9329 -mstrict-align
9330 On System V.4 and embedded PowerPC systems do not (do) assume that
9331 unaligned memory references will be handled by the system.
9332
9333 -mrelocatable
9334 -mno-relocatable
9335 On embedded PowerPC systems generate code that allows (does not
9336 allow) the program to be relocated to a different address at run‐
9337 time. If you use -mrelocatable on any module, all objects linked
9338 together must be compiled with -mrelocatable or -mrelocatable-lib.
9339
9340 -mrelocatable-lib
9341 -mno-relocatable-lib
9342 On embedded PowerPC systems generate code that allows (does not
9343 allow) the program to be relocated to a different address at run‐
9344 time. Modules compiled with -mrelocatable-lib can be linked with
9345 either modules compiled without -mrelocatable and -mrelocatable-lib
9346 or with modules compiled with the -mrelocatable options.
9347
9348 -mno-toc
9349 -mtoc
9350 On System V.4 and embedded PowerPC systems do not (do) assume that
9351 register 2 contains a pointer to a global area pointing to the
9352 addresses used in the program.
9353
9354 -mlittle
9355 -mlittle-endian
9356 On System V.4 and embedded PowerPC systems compile code for the
9357 processor in little endian mode. The -mlittle-endian option is the
9358 same as -mlittle.
9359
9360 -mbig
9361 -mbig-endian
9362 On System V.4 and embedded PowerPC systems compile code for the
9363 processor in big endian mode. The -mbig-endian option is the same
9364 as -mbig.
9365
9366 -mdynamic-no-pic
9367 On Darwin and Mac OS X systems, compile code so that it is not
9368 relocatable, but that its external references are relocatable. The
9369 resulting code is suitable for applications, but not shared
9370 libraries.
9371
9372 -mprioritize-restricted-insns=priority
9373 This option controls the priority that is assigned to dispatch-slot
9374 restricted instructions during the second scheduling pass. The
9375 argument priority takes the value 0/1/2 to assign no/highest/sec‐
9376 ond-highest priority to dispatch slot restricted instructions.
9377
9378 -msched-costly-dep=dependence_type
9379 This option controls which dependences are considered costly by the
9380 target during instruction scheduling. The argument dependence_type
9381 takes one of the following values: no: no dependence is costly,
9382 all: all dependences are costly, true_store_to_load: a true depen‐
9383 dence from store to load is costly, store_to_load: any dependence
9384 from store to load is costly, number: any dependence which latency
9385 >= number is costly.
9386
9387 -minsert-sched-nops=scheme
9388 This option controls which nop insertion scheme will be used during
9389 the second scheduling pass. The argument scheme takes one of the
9390 following values: no: Don't insert nops. pad: Pad with nops any
9391 dispatch group which has vacant issue slots, according to the
9392 scheduler's grouping. regroup_exact: Insert nops to force costly
9393 dependent insns into separate groups. Insert exactly as many nops
9394 as needed to force an insn to a new group, according to the esti‐
9395 mated processor grouping. number: Insert nops to force costly
9396 dependent insns into separate groups. Insert number nops to force
9397 an insn to a new group.
9398
9399 -mcall-sysv
9400 On System V.4 and embedded PowerPC systems compile code using call‐
9401 ing conventions that adheres to the March 1995 draft of the System
9402 V Application Binary Interface, PowerPC processor supplement. This
9403 is the default unless you configured GCC using powerpc-*-eabiaix.
9404
9405 -mcall-sysv-eabi
9406 Specify both -mcall-sysv and -meabi options.
9407
9408 -mcall-sysv-noeabi
9409 Specify both -mcall-sysv and -mno-eabi options.
9410
9411 -mcall-solaris
9412 On System V.4 and embedded PowerPC systems compile code for the
9413 Solaris operating system.
9414
9415 -mcall-linux
9416 On System V.4 and embedded PowerPC systems compile code for the
9417 Linux-based GNU system.
9418
9419 -mcall-gnu
9420 On System V.4 and embedded PowerPC systems compile code for the
9421 Hurd-based GNU system.
9422
9423 -mcall-netbsd
9424 On System V.4 and embedded PowerPC systems compile code for the
9425 NetBSD operating system.
9426
9427 -maix-struct-return
9428 Return all structures in memory (as specified by the AIX ABI).
9429
9430 -msvr4-struct-return
9431 Return structures smaller than 8 bytes in registers (as specified
9432 by the SVR4 ABI).
9433
9434 -mabi=abi-type
9435 Extend the current ABI with a particular extension, or remove such
9436 extension. Valid values are altivec, no-altivec, spe, no-spe, ibm‐
9437 longdouble, ieeelongdouble.
9438
9439 -mabi=spe
9440 Extend the current ABI with SPE ABI extensions. This does not
9441 change the default ABI, instead it adds the SPE ABI extensions to
9442 the current ABI.
9443
9444 -mabi=no-spe
9445 Disable Booke SPE ABI extensions for the current ABI.
9446
9447 -mabi=ibmlongdouble
9448 Change the current ABI to use IBM extended precision long double.
9449 This is a PowerPC 32-bit SYSV ABI option.
9450
9451 -mabi=ieeelongdouble
9452 Change the current ABI to use IEEE extended precision long double.
9453 This is a PowerPC 32-bit Linux ABI option.
9454
9455 -mprototype
9456 -mno-prototype
9457 On System V.4 and embedded PowerPC systems assume that all calls to
9458 variable argument functions are properly prototyped. Otherwise,
9459 the compiler must insert an instruction before every non prototyped
9460 call to set or clear bit 6 of the condition code register (CR) to
9461 indicate whether floating point values were passed in the floating
9462 point registers in case the function takes a variable arguments.
9463 With -mprototype, only calls to prototyped variable argument func‐
9464 tions will set or clear the bit.
9465
9466 -msim
9467 On embedded PowerPC systems, assume that the startup module is
9468 called sim-crt0.o and that the standard C libraries are libsim.a
9469 and libc.a. This is the default for powerpc-*-eabisim. configura‐
9470 tions.
9471
9472 -mmvme
9473 On embedded PowerPC systems, assume that the startup module is
9474 called crt0.o and the standard C libraries are libmvme.a and
9475 libc.a.
9476
9477 -mads
9478 On embedded PowerPC systems, assume that the startup module is
9479 called crt0.o and the standard C libraries are libads.a and libc.a.
9480
9481 -myellowknife
9482 On embedded PowerPC systems, assume that the startup module is
9483 called crt0.o and the standard C libraries are libyk.a and libc.a.
9484
9485 -mvxworks
9486 On System V.4 and embedded PowerPC systems, specify that you are
9487 compiling for a VxWorks system.
9488
9489 -mwindiss
9490 Specify that you are compiling for the WindISS simulation environ‐
9491 ment.
9492
9493 -memb
9494 On embedded PowerPC systems, set the PPC_EMB bit in the ELF flags
9495 header to indicate that eabi extended relocations are used.
9496
9497 -meabi
9498 -mno-eabi
9499 On System V.4 and embedded PowerPC systems do (do not) adhere to
9500 the Embedded Applications Binary Interface (eabi) which is a set of
9501 modifications to the System V.4 specifications. Selecting -meabi
9502 means that the stack is aligned to an 8 byte boundary, a function
9503 "__eabi" is called to from "main" to set up the eabi environment,
9504 and the -msdata option can use both "r2" and "r13" to point to two
9505 separate small data areas. Selecting -mno-eabi means that the
9506 stack is aligned to a 16 byte boundary, do not call an initializa‐
9507 tion function from "main", and the -msdata option will only use
9508 "r13" to point to a single small data area. The -meabi option is
9509 on by default if you configured GCC using one of the pow‐
9510 erpc*-*-eabi* options.
9511
9512 -msdata=eabi
9513 On System V.4 and embedded PowerPC systems, put small initialized
9514 "const" global and static data in the .sdata2 section, which is
9515 pointed to by register "r2". Put small initialized non-"const"
9516 global and static data in the .sdata section, which is pointed to
9517 by register "r13". Put small uninitialized global and static data
9518 in the .sbss section, which is adjacent to the .sdata section. The
9519 -msdata=eabi option is incompatible with the -mrelocatable option.
9520 The -msdata=eabi option also sets the -memb option.
9521
9522 -msdata=sysv
9523 On System V.4 and embedded PowerPC systems, put small global and
9524 static data in the .sdata section, which is pointed to by register
9525 "r13". Put small uninitialized global and static data in the .sbss
9526 section, which is adjacent to the .sdata section. The -msdata=sysv
9527 option is incompatible with the -mrelocatable option.
9528
9529 -msdata=default
9530 -msdata
9531 On System V.4 and embedded PowerPC systems, if -meabi is used, com‐
9532 pile code the same as -msdata=eabi, otherwise compile code the same
9533 as -msdata=sysv.
9534
9535 -msdata-data
9536 On System V.4 and embedded PowerPC systems, put small global and
9537 static data in the .sdata section. Put small uninitialized global
9538 and static data in the .sbss section. Do not use register "r13" to
9539 address small data however. This is the default behavior unless
9540 other -msdata options are used.
9541
9542 -msdata=none
9543 -mno-sdata
9544 On embedded PowerPC systems, put all initialized global and static
9545 data in the .data section, and all uninitialized data in the .bss
9546 section.
9547
9548 -G num
9549 On embedded PowerPC systems, put global and static items less than
9550 or equal to num bytes into the small data or bss sections instead
9551 of the normal data or bss section. By default, num is 8. The -G
9552 num switch is also passed to the linker. All modules should be
9553 compiled with the same -G num value.
9554
9555 -mregnames
9556 -mno-regnames
9557 On System V.4 and embedded PowerPC systems do (do not) emit regis‐
9558 ter names in the assembly language output using symbolic forms.
9559
9560 -mlongcall
9561 -mno-longcall
9562 Default to making all function calls indirectly, using a register,
9563 so that functions which reside further than 32 megabytes
9564 (33,554,432 bytes) from the current location can be called. This
9565 setting can be overridden by the "shortcall" function attribute, or
9566 by "#pragma longcall(0)".
9567
9568 Some linkers are capable of detecting out-of-range calls and gener‐
9569 ating glue code on the fly. On these systems, long calls are
9570 unnecessary and generate slower code. As of this writing, the AIX
9571 linker can do this, as can the GNU linker for PowerPC/64. It is
9572 planned to add this feature to the GNU linker for 32-bit PowerPC
9573 systems as well.
9574
9575 On Darwin/PPC systems, "#pragma longcall" will generate "jbsr
9576 callee, L42", plus a "branch island" (glue code). The two target
9577 addresses represent the callee and the "branch island". The Dar‐
9578 win/PPC linker will prefer the first address and generate a "bl
9579 callee" if the PPC "bl" instruction will reach the callee directly;
9580 otherwise, the linker will generate "bl L42" to call the "branch
9581 island". The "branch island" is appended to the body of the call‐
9582 ing function; it computes the full 32-bit address of the callee and
9583 jumps to it.
9584
9585 On Mach-O (Darwin) systems, this option directs the compiler emit
9586 to the glue for every direct call, and the Darwin linker decides
9587 whether to use or discard it.
9588
9589 In the future, we may cause GCC to ignore all longcall specifica‐
9590 tions when the linker is known to generate glue.
9591
9592 -pthread
9593 Adds support for multithreading with the pthreads library. This
9594 option sets flags for both the preprocessor and linker.
9595
9596 S/390 and zSeries Options
9597
9598 These are the -m options defined for the S/390 and zSeries architec‐
9599 ture.
9600
9601 -mhard-float
9602 -msoft-float
9603 Use (do not use) the hardware floating-point instructions and reg‐
9604 isters for floating-point operations. When -msoft-float is speci‐
9605 fied, functions in libgcc.a will be used to perform floating-point
9606 operations. When -mhard-float is specified, the compiler generates
9607 IEEE floating-point instructions. This is the default.
9608
9609 -mlong-double-64
9610 -mlong-double-128
9611 These switches control the size of "long double" type. A size of
9612 64bit makes the "long double" type equivalent to the "double" type.
9613 This is the default.
9614
9615 -mbackchain
9616 -mno-backchain
9617 Store (do not store) the address of the caller's frame as backchain
9618 pointer into the callee's stack frame. A backchain may be needed
9619 to allow debugging using tools that do not understand DWARF-2 call
9620 frame information. When -mno-packed-stack is in effect, the
9621 backchain pointer is stored at the bottom of the stack frame; when
9622 -mpacked-stack is in effect, the backchain is placed into the top‐
9623 most word of the 96/160 byte register save area.
9624
9625 In general, code compiled with -mbackchain is call-compatible with
9626 code compiled with -mmo-backchain; however, use of the backchain
9627 for debugging purposes usually requires that the whole binary is
9628 built with -mbackchain. Note that the combination of -mbackchain,
9629 -mpacked-stack and -mhard-float is not supported. In order to
9630 build a linux kernel use -msoft-float.
9631
9632 The default is to not maintain the backchain.
9633
9634 -mpacked-stack
9635 -mno-packed-stack
9636 Use (do not use) the packed stack layout. When -mno-packed-stack
9637 is specified, the compiler uses the all fields of the 96/160 byte
9638 register save area only for their default purpose; unused fields
9639 still take up stack space. When -mpacked-stack is specified, reg‐
9640 ister save slots are densely packed at the top of the register save
9641 area; unused space is reused for other purposes, allowing for more
9642 efficient use of the available stack space. However, when
9643 -mbackchain is also in effect, the topmost word of the save area is
9644 always used to store the backchain, and the return address register
9645 is always saved two words below the backchain.
9646
9647 As long as the stack frame backchain is not used, code generated
9648 with -mpacked-stack is call-compatible with code generated with
9649 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
9650 S/390 or zSeries generated code that uses the stack frame backchain
9651 at run time, not just for debugging purposes. Such code is not
9652 call-compatible with code compiled with -mpacked-stack. Also, note
9653 that the combination of -mbackchain, -mpacked-stack and
9654 -mhard-float is not supported. In order to build a linux kernel
9655 use -msoft-float.
9656
9657 The default is to not use the packed stack layout.
9658
9659 -msmall-exec
9660 -mno-small-exec
9661 Generate (or do not generate) code using the "bras" instruction to
9662 do subroutine calls. This only works reliably if the total exe‐
9663 cutable size does not exceed 64k. The default is to use the "basr"
9664 instruction instead, which does not have this limitation.
9665
9666 -m64
9667 -m31
9668 When -m31 is specified, generate code compliant to the GNU/Linux
9669 for S/390 ABI. When -m64 is specified, generate code compliant to
9670 the GNU/Linux for zSeries ABI. This allows GCC in particular to
9671 generate 64-bit instructions. For the s390 targets, the default is
9672 -m31, while the s390x targets default to -m64.
9673
9674 -mzarch
9675 -mesa
9676 When -mzarch is specified, generate code using the instructions
9677 available on z/Architecture. When -mesa is specified, generate
9678 code using the instructions available on ESA/390. Note that -mesa
9679 is not possible with -m64. When generating code compliant to the
9680 GNU/Linux for S/390 ABI, the default is -mesa. When generating
9681 code compliant to the GNU/Linux for zSeries ABI, the default is
9682 -mzarch.
9683
9684 -mmvcle
9685 -mno-mvcle
9686 Generate (or do not generate) code using the "mvcle" instruction to
9687 perform block moves. When -mno-mvcle is specified, use a "mvc"
9688 loop instead. This is the default unless optimizing for size.
9689
9690 -mdebug
9691 -mno-debug
9692 Print (or do not print) additional debug information when compil‐
9693 ing. The default is to not print debug information.
9694
9695 -march=cpu-type
9696 Generate code that will run on cpu-type, which is the name of a
9697 system representing a certain processor type. Possible values for
9698 cpu-type are g5, g6, z900, and z990. When generating code using
9699 the instructions available on z/Architecture, the default is
9700 -march=z900. Otherwise, the default is -march=g5.
9701
9702 -mtune=cpu-type
9703 Tune to cpu-type everything applicable about the generated code,
9704 except for the ABI and the set of available instructions. The list
9705 of cpu-type values is the same as for -march. The default is the
9706 value used for -march.
9707
9708 -mtpf-trace
9709 -mno-tpf-trace
9710 Generate code that adds (does not add) in TPF OS specific branches
9711 to trace routines in the operating system. This option is off by
9712 default, even when compiling for the TPF OS.
9713
9714 -mfused-madd
9715 -mno-fused-madd
9716 Generate code that uses (does not use) the floating point multiply
9717 and accumulate instructions. These instructions are generated by
9718 default if hardware floating point is used.
9719
9720 -mwarn-framesize=framesize
9721 Emit a warning if the current function exceeds the given frame
9722 size. Because this is a compile time check it doesn't need to be a
9723 real problem when the program runs. It is intended to identify
9724 functions which most probably cause a stack overflow. It is useful
9725 to be used in an environment with limited stack size e.g. the linux
9726 kernel.
9727
9728 -mwarn-dynamicstack
9729 Emit a warning if the function calls alloca or uses dynamically
9730 sized arrays. This is generally a bad idea with a limited stack
9731 size.
9732
9733 -mstack-guard=stack-guard
9734 -mstack-size=stack-size
9735 These arguments always have to be used in conjunction. If they are
9736 present the s390 back end emits additional instructions in the
9737 function prologue which trigger a trap if the stack size is stack-
9738 guard bytes above the stack-size (remember that the stack on s390
9739 grows downward). These options are intended to be used to help
9740 debugging stack overflow problems. The additionally emitted code
9741 causes only little overhead and hence can also be used in produc‐
9742 tion like systems without greater performance degradation. The
9743 given values have to be exact powers of 2 and stack-size has to be
9744 greater than stack-guard without exceeding 64k. In order to be
9745 efficient the extra code makes the assumption that the stack starts
9746 at an address aligned to the value given by stack-size.
9747
9748 SH Options
9749
9750 These -m options are defined for the SH implementations:
9751
9752 -m1 Generate code for the SH1.
9753
9754 -m2 Generate code for the SH2.
9755
9756 -m2e
9757 Generate code for the SH2e.
9758
9759 -m3 Generate code for the SH3.
9760
9761 -m3e
9762 Generate code for the SH3e.
9763
9764 -m4-nofpu
9765 Generate code for the SH4 without a floating-point unit.
9766
9767 -m4-single-only
9768 Generate code for the SH4 with a floating-point unit that only sup‐
9769 ports single-precision arithmetic.
9770
9771 -m4-single
9772 Generate code for the SH4 assuming the floating-point unit is in
9773 single-precision mode by default.
9774
9775 -m4 Generate code for the SH4.
9776
9777 -m4a-nofpu
9778 Generate code for the SH4al-dsp, or for a SH4a in such a way that
9779 the floating-point unit is not used.
9780
9781 -m4a-single-only
9782 Generate code for the SH4a, in such a way that no double-precision
9783 floating point operations are used.
9784
9785 -m4a-single
9786 Generate code for the SH4a assuming the floating-point unit is in
9787 single-precision mode by default.
9788
9789 -m4a
9790 Generate code for the SH4a.
9791
9792 -m4al
9793 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
9794 assembler. GCC doesn't generate any DSP instructions at the
9795 moment.
9796
9797 -mb Compile code for the processor in big endian mode.
9798
9799 -ml Compile code for the processor in little endian mode.
9800
9801 -mdalign
9802 Align doubles at 64-bit boundaries. Note that this changes the
9803 calling conventions, and thus some functions from the standard C
9804 library will not work unless you recompile it first with -mdalign.
9805
9806 -mrelax
9807 Shorten some address references at link time, when possible; uses
9808 the linker option -relax.
9809
9810 -mbigtable
9811 Use 32-bit offsets in "switch" tables. The default is to use
9812 16-bit offsets.
9813
9814 -mfmovd
9815 Enable the use of the instruction "fmovd".
9816
9817 -mhitachi
9818 Comply with the calling conventions defined by Renesas.
9819
9820 -mrenesas
9821 Comply with the calling conventions defined by Renesas.
9822
9823 -mno-renesas
9824 Comply with the calling conventions defined for GCC before the
9825 Renesas conventions were available. This option is the default for
9826 all targets of the SH toolchain except for sh-symbianelf.
9827
9828 -mnomacsave
9829 Mark the "MAC" register as call-clobbered, even if -mhitachi is
9830 given.
9831
9832 -mieee
9833 Increase IEEE-compliance of floating-point code. At the moment,
9834 this is equivalent to -fno-finite-math-only. When generating 16
9835 bit SH opcodes, getting IEEE-conforming results for comparisons of
9836 NANs / infinities incurs extra overhead in every floating point
9837 comparison, therefore the default is set to -ffinite-math-only.
9838
9839 -misize
9840 Dump instruction size and location in the assembly code.
9841
9842 -mpadstruct
9843 This option is deprecated. It pads structures to multiple of 4
9844 bytes, which is incompatible with the SH ABI.
9845
9846 -mspace
9847 Optimize for space instead of speed. Implied by -Os.
9848
9849 -mprefergot
9850 When generating position-independent code, emit function calls
9851 using the Global Offset Table instead of the Procedure Linkage Ta‐
9852 ble.
9853
9854 -musermode
9855 Generate a library function call to invalidate instruction cache
9856 entries, after fixing up a trampoline. This library function call
9857 doesn't assume it can write to the whole memory address space.
9858 This is the default when the target is "sh-*-linux*".
9859
9860 -multcost=number
9861 Set the cost to assume for a multiply insn.
9862
9863 -mdiv=strategy
9864 Set the division strategy to use for SHmedia code. strategy must
9865 be one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l,
9866 inv:call, inv:call2, inv:fp . "fp" performs the operation in
9867 floating point. This has a very high latency, but needs only a few
9868 instructions, so it might be a good choice if your code has enough
9869 easily exploitable ILP to allow the compiler to schedule the float‐
9870 ing point instructions together with other instructions. Division
9871 by zero causes a floating point exception. "inv" uses integer
9872 operations to calculate the inverse of the divisor, and then multi‐
9873 plies the dividend with the inverse. This strategy allows cse and
9874 hoisting of the inverse calculation. Division by zero calculates
9875 an unspecified result, but does not trap. "inv:minlat" is a vari‐
9876 ant of "inv" where if no cse / hoisting opportunities have been
9877 found, or if the entire operation has been hoisted to the same
9878 place, the last stages of the inverse calculation are intertwined
9879 with the final multiply to reduce the overall latency, at the
9880 expense of using a few more instructions, and thus offering fewer
9881 scheduling opportunities with other code. "call" calls a library
9882 function that usually implements the inv:minlat strategy. This
9883 gives high code density for m5-*media-nofpu compilations. "call2"
9884 uses a different entry point of the same library function, where it
9885 assumes that a pointer to a lookup table has already been set up,
9886 which exposes the pointer load to cse / code hoisting optimiza‐
9887 tions. "inv:call", "inv:call2" and "inv:fp" all use the "inv"
9888 algorithm for initial code generation, but if the code stays unop‐
9889 timized, revert to the "call", "call2", or "fp" strategies, respec‐
9890 tively. Note that the potentially-trapping side effect of division
9891 by zero is carried by a separate instruction, so it is possible
9892 that all the integer instructions are hoisted out, but the marker
9893 for the side effect stays where it is. A recombination to fp oper‐
9894 ations or a call is not possible in that case. "inv20u" and
9895 "inv20l" are variants of the "inv:minlat" strategy. In the case
9896 that the inverse calculation was nor separated from the multiply,
9897 they speed up division where the dividend fits into 20 bits (plus
9898 sign where applicable), by inserting a test to skip a number of
9899 operations in this case; this test slows down the case of larger
9900 dividends. inv20u assumes the case of a such a small dividend to
9901 be unlikely, and inv20l assumes it to be likely.
9902
9903 -mdivsi3_libfunc=name
9904 Set the name of the library function used for 32 bit signed divi‐
9905 sion to name. This only affect the name used in the call and
9906 inv:call division strategies, and the compiler will still expect
9907 the same sets of input/output/clobbered registers as if this option
9908 was not present.
9909
9910 -madjust-unroll
9911 Throttle unrolling to avoid thrashing target registers. This
9912 option only has an effect if the gcc code base supports the TAR‐
9913 GET_ADJUST_UNROLL_MAX target hook.
9914
9915 -mindexed-addressing
9916 Enable the use of the indexed addressing mode for SHmedia32/SHcom‐
9917 pact. This is only safe if the hardware and/or OS implement 32 bit
9918 wrap-around semantics for the indexed addressing mode. The archi‐
9919 tecture allows the implementation of processors with 64 bit MMU,
9920 which the OS could use to get 32 bit addressing, but since no cur‐
9921 rent hardware implementation supports this or any other way to make
9922 the indexed addressing mode safe to use in the 32 bit ABI, the
9923 default is -mno-indexed-addressing.
9924
9925 -mgettrcost=number
9926 Set the cost assumed for the gettr instruction to number. The
9927 default is 2 if -mpt-fixed is in effect, 100 otherwise.
9928
9929 -mpt-fixed
9930 Assume pt* instructions won't trap. This will generally generate
9931 better scheduled code, but is unsafe on current hardware. The cur‐
9932 rent architecture definition says that ptabs and ptrel trap when
9933 the target anded with 3 is 3. This has the unintentional effect of
9934 making it unsafe to schedule ptabs / ptrel before a branch, or
9935 hoist it out of a loop. For example, __do_global_ctors, a part of
9936 libgcc that runs constructors at program startup, calls functions
9937 in a list which is delimited by -1. With the -mpt-fixed option,
9938 the ptabs will be done before testing against -1. That means that
9939 all the constructors will be run a bit quicker, but when the loop
9940 comes to the end of the list, the program crashes because ptabs
9941 loads -1 into a target register. Since this option is unsafe for
9942 any hardware implementing the current architecture specification,
9943 the default is -mno-pt-fixed. Unless the user specifies a specific
9944 cost with -mgettrcost, -mno-pt-fixed also implies -mgettrcost=100;
9945 this deters register allocation using target registers for storing
9946 ordinary integers.
9947
9948 -minvalid-symbols
9949 Assume symbols might be invalid. Ordinary function symbols gener‐
9950 ated by the compiler will always be valid to load with
9951 movi/shori/ptabs or movi/shori/ptrel, but with assembler and/or
9952 linker tricks it is possible to generate symbols that will cause
9953 ptabs / ptrel to trap. This option is only meaningful when
9954 -mno-pt-fixed is in effect. It will then prevent cross-basic-block
9955 cse, hoisting and most scheduling of symbol loads. The default is
9956 -mno-invalid-symbols.
9957
9958 SPARC Options
9959
9960 These -m options are supported on the SPARC:
9961
9962 -mno-app-regs
9963 -mapp-regs
9964 Specify -mapp-regs to generate output using the global registers 2
9965 through 4, which the SPARC SVR4 ABI reserves for applications.
9966 This is the default.
9967
9968 To be fully SVR4 ABI compliant at the cost of some performance
9969 loss, specify -mno-app-regs. You should compile libraries and sys‐
9970 tem software with this option.
9971
9972 -mfpu
9973 -mhard-float
9974 Generate output containing floating point instructions. This is
9975 the default.
9976
9977 -mno-fpu
9978 -msoft-float
9979 Generate output containing library calls for floating point. Warn‐
9980 ing: the requisite libraries are not available for all SPARC tar‐
9981 gets. Normally the facilities of the machine's usual C compiler
9982 are used, but this cannot be done directly in cross-compilation.
9983 You must make your own arrangements to provide suitable library
9984 functions for cross-compilation. The embedded targets sparc-*-aout
9985 and sparclite-*-* do provide software floating point support.
9986
9987 -msoft-float changes the calling convention in the output file;
9988 therefore, it is only useful if you compile all of a program with
9989 this option. In particular, you need to compile libgcc.a, the
9990 library that comes with GCC, with -msoft-float in order for this to
9991 work.
9992
9993 -mhard-quad-float
9994 Generate output containing quad-word (long double) floating point
9995 instructions.
9996
9997 -msoft-quad-float
9998 Generate output containing library calls for quad-word (long dou‐
9999 ble) floating point instructions. The functions called are those
10000 specified in the SPARC ABI. This is the default.
10001
10002 As of this writing, there are no SPARC implementations that have
10003 hardware support for the quad-word floating point instructions.
10004 They all invoke a trap handler for one of these instructions, and
10005 then the trap handler emulates the effect of the instruction.
10006 Because of the trap handler overhead, this is much slower than
10007 calling the ABI library routines. Thus the -msoft-quad-float
10008 option is the default.
10009
10010 -mno-unaligned-doubles
10011 -munaligned-doubles
10012 Assume that doubles have 8 byte alignment. This is the default.
10013
10014 With -munaligned-doubles, GCC assumes that doubles have 8 byte
10015 alignment only if they are contained in another type, or if they
10016 have an absolute address. Otherwise, it assumes they have 4 byte
10017 alignment. Specifying this option avoids some rare compatibility
10018 problems with code generated by other compilers. It is not the
10019 default because it results in a performance loss, especially for
10020 floating point code.
10021
10022 -mno-faster-structs
10023 -mfaster-structs
10024 With -mfaster-structs, the compiler assumes that structures should
10025 have 8 byte alignment. This enables the use of pairs of "ldd" and
10026 "std" instructions for copies in structure assignment, in place of
10027 twice as many "ld" and "st" pairs. However, the use of this
10028 changed alignment directly violates the SPARC ABI. Thus, it's
10029 intended only for use on targets where the developer acknowledges
10030 that their resulting code will not be directly in line with the
10031 rules of the ABI.
10032
10033 -mimpure-text
10034 -mimpure-text, used in addition to -shared, tells the compiler to
10035 not pass -z text to the linker when linking a shared object. Using
10036 this option, you can link position-dependent code into a shared
10037 object.
10038
10039 -mimpure-text suppresses the "relocations remain against allocat‐
10040 able but non-writable sections" linker error message. However, the
10041 necessary relocations will trigger copy-on-write, and the shared
10042 object is not actually shared across processes. Instead of using
10043 -mimpure-text, you should compile all source code with -fpic or
10044 -fPIC.
10045
10046 This option is only available on SunOS and Solaris.
10047
10048 -mcpu=cpu_type
10049 Set the instruction set, register set, and instruction scheduling
10050 parameters for machine type cpu_type. Supported values for
10051 cpu_type are v7, cypress, v8, supersparc, sparclite, f930, f934,
10052 hypersparc, sparclite86x, sparclet, tsc701, v9, ultrasparc, ultra‐
10053 sparc3, and niagara.
10054
10055 Default instruction scheduling parameters are used for values that
10056 select an architecture and not an implementation. These are v7,
10057 v8, sparclite, sparclet, v9.
10058
10059 Here is a list of each supported architecture and their supported
10060 implementations.
10061
10062 v7: cypress
10063 v8: supersparc, hypersparc
10064 sparclite: f930, f934, sparclite86x
10065 sparclet: tsc701
10066 v9: ultrasparc, ultrasparc3, niagara
10067
10068 By default (unless configured otherwise), GCC generates code for
10069 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
10070 compiler additionally optimizes it for the Cypress CY7C602 chip, as
10071 used in the SPARCStation/SPARCServer 3xx series. This is also
10072 appropriate for the older SPARCStation 1, 2, IPX etc.
10073
10074 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
10075 architecture. The only difference from V7 code is that the com‐
10076 piler emits the integer multiply and integer divide instructions
10077 which exist in SPARC-V8 but not in SPARC-V7. With -mcpu=super‐
10078 sparc, the compiler additionally optimizes it for the SuperSPARC
10079 chip, as used in the SPARCStation 10, 1000 and 2000 series.
10080
10081 With -mcpu=sparclite, GCC generates code for the SPARClite variant
10082 of the SPARC architecture. This adds the integer multiply, integer
10083 divide step and scan ("ffs") instructions which exist in SPARClite
10084 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
10085 optimizes it for the Fujitsu MB86930 chip, which is the original
10086 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
10087 optimizes it for the Fujitsu MB86934 chip, which is the more recent
10088 SPARClite with FPU.
10089
10090 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
10091 the SPARC architecture. This adds the integer multiply, multi‐
10092 ply/accumulate, integer divide step and scan ("ffs") instructions
10093 which exist in SPARClet but not in SPARC-V7. With -mcpu=tsc701,
10094 the compiler additionally optimizes it for the TEMIC SPARClet chip.
10095
10096 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
10097 architecture. This adds 64-bit integer and floating-point move
10098 instructions, 3 additional floating-point condition code registers
10099 and conditional move instructions. With -mcpu=ultrasparc, the com‐
10100 piler additionally optimizes it for the Sun UltraSPARC I/II/IIi
10101 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
10102 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
10103 -mcpu=niagara, the compiler additionally optimizes it for Sun
10104 UltraSPARC T1 chips.
10105
10106 -mtune=cpu_type
10107 Set the instruction scheduling parameters for machine type
10108 cpu_type, but do not set the instruction set or register set that
10109 the option -mcpu=cpu_type would.
10110
10111 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
10112 but the only useful values are those that select a particular cpu
10113 implementation. Those are cypress, supersparc, hypersparc, f930,
10114 f934, sparclite86x, tsc701, ultrasparc, ultrasparc3, and niagara.
10115
10116 -mv8plus
10117 -mno-v8plus
10118 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The dif‐
10119 ference from the V8 ABI is that the global and out registers are
10120 considered 64-bit wide. This is enabled by default on Solaris in
10121 32-bit mode for all SPARC-V9 processors.
10122
10123 -mvis
10124 -mno-vis
10125 With -mvis, GCC generates code that takes advantage of the Ultra‐
10126 SPARC Visual Instruction Set extensions. The default is -mno-vis.
10127
10128 These -m options are supported in addition to the above on SPARC-V9
10129 processors in 64-bit environments:
10130
10131 -mlittle-endian
10132 Generate code for a processor running in little-endian mode. It is
10133 only available for a few configurations and most notably not on
10134 Solaris and Linux.
10135
10136 -m32
10137 -m64
10138 Generate code for a 32-bit or 64-bit environment. The 32-bit envi‐
10139 ronment sets int, long and pointer to 32 bits. The 64-bit environ‐
10140 ment sets int to 32 bits and long and pointer to 64 bits.
10141
10142 -mcmodel=medlow
10143 Generate code for the Medium/Low code model: 64-bit addresses, pro‐
10144 grams must be linked in the low 32 bits of memory. Programs can be
10145 statically or dynamically linked.
10146
10147 -mcmodel=medmid
10148 Generate code for the Medium/Middle code model: 64-bit addresses,
10149 programs must be linked in the low 44 bits of memory, the text and
10150 data segments must be less than 2GB in size and the data segment
10151 must be located within 2GB of the text segment.
10152
10153 -mcmodel=medany
10154 Generate code for the Medium/Anywhere code model: 64-bit addresses,
10155 programs may be linked anywhere in memory, the text and data seg‐
10156 ments must be less than 2GB in size and the data segment must be
10157 located within 2GB of the text segment.
10158
10159 -mcmodel=embmedany
10160 Generate code for the Medium/Anywhere code model for embedded sys‐
10161 tems: 64-bit addresses, the text and data segments must be less
10162 than 2GB in size, both starting anywhere in memory (determined at
10163 link time). The global register %g4 points to the base of the data
10164 segment. Programs are statically linked and PIC is not supported.
10165
10166 -mstack-bias
10167 -mno-stack-bias
10168 With -mstack-bias, GCC assumes that the stack pointer, and frame
10169 pointer if present, are offset by -2047 which must be added back
10170 when making stack frame references. This is the default in 64-bit
10171 mode. Otherwise, assume no such offset is present.
10172
10173 These switches are supported in addition to the above on Solaris:
10174
10175 -threads
10176 Add support for multithreading using the Solaris threads library.
10177 This option sets flags for both the preprocessor and linker. This
10178 option does not affect the thread safety of object code produced by
10179 the compiler or that of libraries supplied with it.
10180
10181 -pthreads
10182 Add support for multithreading using the POSIX threads library.
10183 This option sets flags for both the preprocessor and linker. This
10184 option does not affect the thread safety of object code produced
10185 by the compiler or that of libraries supplied with it.
10186
10187 -pthread
10188 This is a synonym for -pthreads.
10189
10190 Options for System V
10191
10192 These additional options are available on System V Release 4 for com‐
10193 patibility with other compilers on those systems:
10194
10195 -G Create a shared object. It is recommended that -symbolic or
10196 -shared be used instead.
10197
10198 -Qy Identify the versions of each tool used by the compiler, in a
10199 ".ident" assembler directive in the output.
10200
10201 -Qn Refrain from adding ".ident" directives to the output file (this is
10202 the default).
10203
10204 -YP,dirs
10205 Search the directories dirs, and no others, for libraries specified
10206 with -l.
10207
10208 -Ym,dir
10209 Look in the directory dir to find the M4 preprocessor. The assem‐
10210 bler uses this option.
10211
10212 TMS320C3x/C4x Options
10213
10214 These -m options are defined for TMS320C3x/C4x implementations:
10215
10216 -mcpu=cpu_type
10217 Set the instruction set, register set, and instruction scheduling
10218 parameters for machine type cpu_type. Supported values for
10219 cpu_type are c30, c31, c32, c40, and c44. The default is c40 to
10220 generate code for the TMS320C40.
10221
10222 -mbig-memory
10223 -mbig
10224 -msmall-memory
10225 -msmall
10226 Generates code for the big or small memory model. The small memory
10227 model assumed that all data fits into one 64K word page. At run-
10228 time the data page (DP) register must be set to point to the 64K
10229 page containing the .bss and .data program sections. The big mem‐
10230 ory model is the default and requires reloading of the DP register
10231 for every direct memory access.
10232
10233 -mbk
10234 -mno-bk
10235 Allow (disallow) allocation of general integer operands into the
10236 block count register BK.
10237
10238 -mdb
10239 -mno-db
10240 Enable (disable) generation of code using decrement and branch,
10241 DBcond(D), instructions. This is enabled by default for the C4x.
10242 To be on the safe side, this is disabled for the C3x, since the
10243 maximum iteration count on the C3x is 2^{23 + 1} (but who iterates
10244 loops more than 2^{23} times on the C3x?). Note that GCC will try
10245 to reverse a loop so that it can utilize the decrement and branch
10246 instruction, but will give up if there is more than one memory ref‐
10247 erence in the loop. Thus a loop where the loop counter is decre‐
10248 mented can generate slightly more efficient code, in cases where
10249 the RPTB instruction cannot be utilized.
10250
10251 -mdp-isr-reload
10252 -mparanoid
10253 Force the DP register to be saved on entry to an interrupt service
10254 routine (ISR), reloaded to point to the data section, and restored
10255 on exit from the ISR. This should not be required unless someone
10256 has violated the small memory model by modifying the DP register,
10257 say within an object library.
10258
10259 -mmpyi
10260 -mno-mpyi
10261 For the C3x use the 24-bit MPYI instruction for integer multiplies
10262 instead of a library call to guarantee 32-bit results. Note that
10263 if one of the operands is a constant, then the multiplication will
10264 be performed using shifts and adds. If the -mmpyi option is not
10265 specified for the C3x, then squaring operations are performed
10266 inline instead of a library call.
10267
10268 -mfast-fix
10269 -mno-fast-fix
10270 The C3x/C4x FIX instruction to convert a floating point value to an
10271 integer value chooses the nearest integer less than or equal to the
10272 floating point value rather than to the nearest integer. Thus if
10273 the floating point number is negative, the result will be incor‐
10274 rectly truncated an additional code is necessary to detect and cor‐
10275 rect this case. This option can be used to disable generation of
10276 the additional code required to correct the result.
10277
10278 -mrptb
10279 -mno-rptb
10280 Enable (disable) generation of repeat block sequences using the
10281 RPTB instruction for zero overhead looping. The RPTB construct is
10282 only used for innermost loops that do not call functions or jump
10283 across the loop boundaries. There is no advantage having nested
10284 RPTB loops due to the overhead required to save and restore the RC,
10285 RS, and RE registers. This is enabled by default with -O2.
10286
10287 -mrpts=count
10288 -mno-rpts
10289 Enable (disable) the use of the single instruction repeat instruc‐
10290 tion RPTS. If a repeat block contains a single instruction, and
10291 the loop count can be guaranteed to be less than the value count,
10292 GCC will emit a RPTS instruction instead of a RPTB. If no value is
10293 specified, then a RPTS will be emitted even if the loop count can‐
10294 not be determined at compile time. Note that the repeated instruc‐
10295 tion following RPTS does not have to be reloaded from memory each
10296 iteration, thus freeing up the CPU buses for operands. However,
10297 since interrupts are blocked by this instruction, it is disabled by
10298 default.
10299
10300 -mloop-unsigned
10301 -mno-loop-unsigned
10302 The maximum iteration count when using RPTS and RPTB (and DB on the
10303 C40) is 2^{31 + 1} since these instructions test if the iteration
10304 count is negative to terminate the loop. If the iteration count is
10305 unsigned there is a possibility than the 2^{31 + 1} maximum itera‐
10306 tion count may be exceeded. This switch allows an unsigned itera‐
10307 tion count.
10308
10309 -mti
10310 Try to emit an assembler syntax that the TI assembler (asm30) is
10311 happy with. This also enforces compatibility with the API employed
10312 by the TI C3x C compiler. For example, long doubles are passed as
10313 structures rather than in floating point registers.
10314
10315 -mregparm
10316 -mmemparm
10317 Generate code that uses registers (stack) for passing arguments to
10318 functions. By default, arguments are passed in registers where
10319 possible rather than by pushing arguments on to the stack.
10320
10321 -mparallel-insns
10322 -mno-parallel-insns
10323 Allow the generation of parallel instructions. This is enabled by
10324 default with -O2.
10325
10326 -mparallel-mpy
10327 -mno-parallel-mpy
10328 Allow the generation of MPY⎪⎪ADD and MPY⎪⎪SUB parallel instruc‐
10329 tions, provided -mparallel-insns is also specified. These instruc‐
10330 tions have tight register constraints which can pessimize the code
10331 generation of large functions.
10332
10333 V850 Options
10334
10335 These -m options are defined for V850 implementations:
10336
10337 -mlong-calls
10338 -mno-long-calls
10339 Treat all calls as being far away (near). If calls are assumed to
10340 be far away, the compiler will always load the functions address up
10341 into a register, and call indirect through the pointer.
10342
10343 -mno-ep
10344 -mep
10345 Do not optimize (do optimize) basic blocks that use the same index
10346 pointer 4 or more times to copy pointer into the "ep" register, and
10347 use the shorter "sld" and "sst" instructions. The -mep option is
10348 on by default if you optimize.
10349
10350 -mno-prolog-function
10351 -mprolog-function
10352 Do not use (do use) external functions to save and restore regis‐
10353 ters at the prologue and epilogue of a function. The external
10354 functions are slower, but use less code space if more than one
10355 function saves the same number of registers. The -mprolog-function
10356 option is on by default if you optimize.
10357
10358 -mspace
10359 Try to make the code as small as possible. At present, this just
10360 turns on the -mep and -mprolog-function options.
10361
10362 -mtda=n
10363 Put static or global variables whose size is n bytes or less into
10364 the tiny data area that register "ep" points to. The tiny data
10365 area can hold up to 256 bytes in total (128 bytes for byte refer‐
10366 ences).
10367
10368 -msda=n
10369 Put static or global variables whose size is n bytes or less into
10370 the small data area that register "gp" points to. The small data
10371 area can hold up to 64 kilobytes.
10372
10373 -mzda=n
10374 Put static or global variables whose size is n bytes or less into
10375 the first 32 kilobytes of memory.
10376
10377 -mv850
10378 Specify that the target processor is the V850.
10379
10380 -mbig-switch
10381 Generate code suitable for big switch tables. Use this option only
10382 if the assembler/linker complain about out of range branches within
10383 a switch table.
10384
10385 -mapp-regs
10386 This option will cause r2 and r5 to be used in the code generated
10387 by the compiler. This setting is the default.
10388
10389 -mno-app-regs
10390 This option will cause r2 and r5 to be treated as fixed registers.
10391
10392 -mv850e1
10393 Specify that the target processor is the V850E1. The preprocessor
10394 constants __v850e1__ and __v850e__ will be defined if this option
10395 is used.
10396
10397 -mv850e
10398 Specify that the target processor is the V850E. The preprocessor
10399 constant __v850e__ will be defined if this option is used.
10400
10401 If neither -mv850 nor -mv850e nor -mv850e1 are defined then a
10402 default target processor will be chosen and the relevant __v850*__
10403 preprocessor constant will be defined.
10404
10405 The preprocessor constants __v850 and __v851__ are always defined,
10406 regardless of which processor variant is the target.
10407
10408 -mdisable-callt
10409 This option will suppress generation of the CALLT instruction for
10410 the v850e and v850e1 flavors of the v850 architecture. The default
10411 is -mno-disable-callt which allows the CALLT instruction to be
10412 used.
10413
10414 VAX Options
10415
10416 These -m options are defined for the VAX:
10417
10418 -munix
10419 Do not output certain jump instructions ("aobleq" and so on) that
10420 the Unix assembler for the VAX cannot handle across long ranges.
10421
10422 -mgnu
10423 Do output those jump instructions, on the assumption that you will
10424 assemble with the GNU assembler.
10425
10426 -mg Output code for g-format floating point numbers instead of d-for‐
10427 mat.
10428
10429 x86-64 Options
10430
10431 These are listed under
10432
10433 Xstormy16 Options
10434
10435 These options are defined for Xstormy16:
10436
10437 -msim
10438 Choose startup files and linker script suitable for the simulator.
10439
10440 Xtensa Options
10441
10442 These options are supported for Xtensa targets:
10443
10444 -mconst16
10445 -mno-const16
10446 Enable or disable use of "CONST16" instructions for loading con‐
10447 stant values. The "CONST16" instruction is currently not a stan‐
10448 dard option from Tensilica. When enabled, "CONST16" instructions
10449 are always used in place of the standard "L32R" instructions. The
10450 use of "CONST16" is enabled by default only if the "L32R" instruc‐
10451 tion is not available.
10452
10453 -mfused-madd
10454 -mno-fused-madd
10455 Enable or disable use of fused multiply/add and multiply/subtract
10456 instructions in the floating-point option. This has no effect if
10457 the floating-point option is not also enabled. Disabling fused
10458 multiply/add and multiply/subtract instructions forces the compiler
10459 to use separate instructions for the multiply and add/subtract
10460 operations. This may be desirable in some cases where strict IEEE
10461 754-compliant results are required: the fused multiply add/subtract
10462 instructions do not round the intermediate result, thereby produc‐
10463 ing results with more bits of precision than specified by the IEEE
10464 standard. Disabling fused multiply add/subtract instructions also
10465 ensures that the program output is not sensitive to the compiler's
10466 ability to combine multiply and add/subtract operations.
10467
10468 -mtext-section-literals
10469 -mno-text-section-literals
10470 Control the treatment of literal pools. The default is
10471 -mno-text-section-literals, which places literals in a separate
10472 section in the output file. This allows the literal pool to be
10473 placed in a data RAM/ROM, and it also allows the linker to combine
10474 literal pools from separate object files to remove redundant liter‐
10475 als and improve code size. With -mtext-section-literals, the lit‐
10476 erals are interspersed in the text section in order to keep them as
10477 close as possible to their references. This may be necessary for
10478 large assembly files.
10479
10480 -mtarget-align
10481 -mno-target-align
10482 When this option is enabled, GCC instructs the assembler to auto‐
10483 matically align instructions to reduce branch penalties at the
10484 expense of some code density. The assembler attempts to widen den‐
10485 sity instructions to align branch targets and the instructions fol‐
10486 lowing call instructions. If there are not enough preceding safe
10487 density instructions to align a target, no widening will be per‐
10488 formed. The default is -mtarget-align. These options do not
10489 affect the treatment of auto-aligned instructions like "LOOP",
10490 which the assembler will always align, either by widening density
10491 instructions or by inserting no-op instructions.
10492
10493 -mlongcalls
10494 -mno-longcalls
10495 When this option is enabled, GCC instructs the assembler to trans‐
10496 late direct calls to indirect calls unless it can determine that
10497 the target of a direct call is in the range allowed by the call
10498 instruction. This translation typically occurs for calls to func‐
10499 tions in other source files. Specifically, the assembler trans‐
10500 lates a direct "CALL" instruction into an "L32R" followed by a
10501 "CALLX" instruction. The default is -mno-longcalls. This option
10502 should be used in programs where the call target can potentially be
10503 out of range. This option is implemented in the assembler, not the
10504 compiler, so the assembly code generated by GCC will still show
10505 direct call instructions---look at the disassembled object code to
10506 see the actual instructions. Note that the assembler will use an
10507 indirect call for every cross-file call, not just those that really
10508 will be out of range.
10509
10510 zSeries Options
10511
10512 These are listed under
10513
10514 Options for Code Generation Conventions
10515
10516 These machine-independent options control the interface conventions
10517 used in code generation.
10518
10519 Most of them have both positive and negative forms; the negative form
10520 of -ffoo would be -fno-foo. In the table below, only one of the forms
10521 is listed---the one which is not the default. You can figure out the
10522 other form by either removing no- or adding it.
10523
10524 -fbounds-check
10525 For front-ends that support it, generate additional code to check
10526 that indices used to access arrays are within the declared range.
10527 This is currently only supported by the Java and Fortran
10528 front-ends, where this option defaults to true and false respec‐
10529 tively.
10530
10531 -ftrapv
10532 This option generates traps for signed overflow on addition, sub‐
10533 traction, multiplication operations.
10534
10535 -fwrapv
10536 This option instructs the compiler to assume that signed arithmetic
10537 overflow of addition, subtraction and multiplication wraps around
10538 using twos-complement representation. This flag enables some opti‐
10539 mizations and disables others. This option is enabled by default
10540 for the Java front-end, as required by the Java language specifica‐
10541 tion.
10542
10543 -fexceptions
10544 Enable exception handling. Generates extra code needed to propa‐
10545 gate exceptions. For some targets, this implies GCC will generate
10546 frame unwind information for all functions, which can produce sig‐
10547 nificant data size overhead, although it does not affect execution.
10548 If you do not specify this option, GCC will enable it by default
10549 for languages like C++ which normally require exception handling,
10550 and disable it for languages like C that do not normally require
10551 it. However, you may need to enable this option when compiling C
10552 code that needs to interoperate properly with exception handlers
10553 written in C++. You may also wish to disable this option if you
10554 are compiling older C++ programs that don't use exception handling.
10555
10556 -fnon-call-exceptions
10557 Generate code that allows trapping instructions to throw excep‐
10558 tions. Note that this requires platform-specific runtime support
10559 that does not exist everywhere. Moreover, it only allows trapping
10560 instructions to throw exceptions, i.e. memory references or float‐
10561 ing point instructions. It does not allow exceptions to be thrown
10562 from arbitrary signal handlers such as "SIGALRM".
10563
10564 -funwind-tables
10565 Similar to -fexceptions, except that it will just generate any
10566 needed static data, but will not affect the generated code in any
10567 other way. You will normally not enable this option; instead, a
10568 language processor that needs this handling would enable it on your
10569 behalf.
10570
10571 -fasynchronous-unwind-tables
10572 Generate unwind table in dwarf2 format, if supported by target
10573 machine. The table is exact at each instruction boundary, so it
10574 can be used for stack unwinding from asynchronous events (such as
10575 debugger or garbage collector).
10576
10577 -fpcc-struct-return
10578 Return "short" "struct" and "union" values in memory like longer
10579 ones, rather than in registers. This convention is less efficient,
10580 but it has the advantage of allowing intercallability between GCC-
10581 compiled files and files compiled with other compilers, particu‐
10582 larly the Portable C Compiler (pcc).
10583
10584 The precise convention for returning structures in memory depends
10585 on the target configuration macros.
10586
10587 Short structures and unions are those whose size and alignment
10588 match that of some integer type.
10589
10590 Warning: code compiled with the -fpcc-struct-return switch is not
10591 binary compatible with code compiled with the -freg-struct-return
10592 switch. Use it to conform to a non-default application binary
10593 interface.
10594
10595 -freg-struct-return
10596 Return "struct" and "union" values in registers when possible.
10597 This is more efficient for small structures than
10598 -fpcc-struct-return.
10599
10600 If you specify neither -fpcc-struct-return nor -freg-struct-return,
10601 GCC defaults to whichever convention is standard for the target.
10602 If there is no standard convention, GCC defaults to
10603 -fpcc-struct-return, except on targets where GCC is the principal
10604 compiler. In those cases, we can choose the standard, and we chose
10605 the more efficient register return alternative.
10606
10607 Warning: code compiled with the -freg-struct-return switch is not
10608 binary compatible with code compiled with the -fpcc-struct-return
10609 switch. Use it to conform to a non-default application binary
10610 interface.
10611
10612 -fshort-enums
10613 Allocate to an "enum" type only as many bytes as it needs for the
10614 declared range of possible values. Specifically, the "enum" type
10615 will be equivalent to the smallest integer type which has enough
10616 room.
10617
10618 Warning: the -fshort-enums switch causes GCC to generate code that
10619 is not binary compatible with code generated without that switch.
10620 Use it to conform to a non-default application binary interface.
10621
10622 -fshort-double
10623 Use the same size for "double" as for "float".
10624
10625 Warning: the -fshort-double switch causes GCC to generate code that
10626 is not binary compatible with code generated without that switch.
10627 Use it to conform to a non-default application binary interface.
10628
10629 -fshort-wchar
10630 Override the underlying type for wchar_t to be short unsigned int
10631 instead of the default for the target. This option is useful for
10632 building programs to run under WINE.
10633
10634 Warning: the -fshort-wchar switch causes GCC to generate code that
10635 is not binary compatible with code generated without that switch.
10636 Use it to conform to a non-default application binary interface.
10637
10638 -fshared-data
10639 Requests that the data and non-"const" variables of this compila‐
10640 tion be shared data rather than private data. The distinction
10641 makes sense only on certain operating systems, where shared data is
10642 shared between processes running the same program, while private
10643 data exists in one copy per process.
10644
10645 -fno-common
10646 In C, allocate even uninitialized global variables in the data sec‐
10647 tion of the object file, rather than generating them as common
10648 blocks. This has the effect that if the same variable is declared
10649 (without "extern") in two different compilations, you will get an
10650 error when you link them. The only reason this might be useful is
10651 if you wish to verify that the program will work on other systems
10652 which always work this way.
10653
10654 -fno-ident
10655 Ignore the #ident directive.
10656
10657 -finhibit-size-directive
10658 Don't output a ".size" assembler directive, or anything else that
10659 would cause trouble if the function is split in the middle, and the
10660 two halves are placed at locations far apart in memory. This
10661 option is used when compiling crtstuff.c; you should not need to
10662 use it for anything else.
10663
10664 -fverbose-asm
10665 Put extra commentary information in the generated assembly code to
10666 make it more readable. This option is generally only of use to
10667 those who actually need to read the generated assembly code (per‐
10668 haps while debugging the compiler itself).
10669
10670 -fno-verbose-asm, the default, causes the extra information to be
10671 omitted and is useful when comparing two assembler files.
10672
10673 -fpic
10674 Generate position-independent code (PIC) suitable for use in a
10675 shared library, if supported for the target machine. Such code
10676 accesses all constant addresses through a global offset table
10677 (GOT). The dynamic loader resolves the GOT entries when the pro‐
10678 gram starts (the dynamic loader is not part of GCC; it is part of
10679 the operating system). If the GOT size for the linked executable
10680 exceeds a machine-specific maximum size, you get an error message
10681 from the linker indicating that -fpic does not work; in that case,
10682 recompile with -fPIC instead. (These maximums are 8k on the SPARC
10683 and 32k on the m68k and RS/6000. The 386 has no such limit.)
10684
10685 Position-independent code requires special support, and therefore
10686 works only on certain machines. For the 386, GCC supports PIC for
10687 System V but not for the Sun 386i. Code generated for the IBM
10688 RS/6000 is always position-independent.
10689
10690 -fPIC
10691 If supported for the target machine, emit position-independent
10692 code, suitable for dynamic linking and avoiding any limit on the
10693 size of the global offset table. This option makes a difference on
10694 the m68k, PowerPC and SPARC.
10695
10696 Position-independent code requires special support, and therefore
10697 works only on certain machines.
10698
10699 -fpie
10700 -fPIE
10701 These options are similar to -fpic and -fPIC, but generated posi‐
10702 tion independent code can be only linked into executables. Usually
10703 these options are used when -pie GCC option will be used during
10704 linking.
10705
10706 -fno-jump-tables
10707 Do not use jump tables for switch statements even where it would be
10708 more efficient than other code generation strategies. This option
10709 is of use in conjunction with -fpic or -fPIC for building code
10710 which forms part of a dynamic linker and cannot reference the
10711 address of a jump table. On some targets, jump tables do not
10712 require a GOT and this option is not needed.
10713
10714 -ffixed-reg
10715 Treat the register named reg as a fixed register; generated code
10716 should never refer to it (except perhaps as a stack pointer, frame
10717 pointer or in some other fixed role).
10718
10719 reg must be the name of a register. The register names accepted
10720 are machine-specific and are defined in the "REGISTER_NAMES" macro
10721 in the machine description macro file.
10722
10723 This flag does not have a negative form, because it specifies a
10724 three-way choice.
10725
10726 -fcall-used-reg
10727 Treat the register named reg as an allocable register that is clob‐
10728 bered by function calls. It may be allocated for temporaries or
10729 variables that do not live across a call. Functions compiled this
10730 way will not save and restore the register reg.
10731
10732 It is an error to used this flag with the frame pointer or stack
10733 pointer. Use of this flag for other registers that have fixed per‐
10734 vasive roles in the machine's execution model will produce disas‐
10735 trous results.
10736
10737 This flag does not have a negative form, because it specifies a
10738 three-way choice.
10739
10740 -fcall-saved-reg
10741 Treat the register named reg as an allocable register saved by
10742 functions. It may be allocated even for temporaries or variables
10743 that live across a call. Functions compiled this way will save and
10744 restore the register reg if they use it.
10745
10746 It is an error to used this flag with the frame pointer or stack
10747 pointer. Use of this flag for other registers that have fixed per‐
10748 vasive roles in the machine's execution model will produce disas‐
10749 trous results.
10750
10751 A different sort of disaster will result from the use of this flag
10752 for a register in which function values may be returned.
10753
10754 This flag does not have a negative form, because it specifies a
10755 three-way choice.
10756
10757 -fpack-struct[=n]
10758 Without a value specified, pack all structure members together
10759 without holes. When a value is specified (which must be a small
10760 power of two), pack structure members according to this value, rep‐
10761 resenting the maximum alignment (that is, objects with default
10762 alignment requirements larger than this will be output potentially
10763 unaligned at the next fitting location.
10764
10765 Warning: the -fpack-struct switch causes GCC to generate code that
10766 is not binary compatible with code generated without that switch.
10767 Additionally, it makes the code suboptimal. Use it to conform to a
10768 non-default application binary interface.
10769
10770 -finstrument-functions
10771 Generate instrumentation calls for entry and exit to functions.
10772 Just after function entry and just before function exit, the fol‐
10773 lowing profiling functions will be called with the address of the
10774 current function and its call site. (On some platforms,
10775 "__builtin_return_address" does not work beyond the current func‐
10776 tion, so the call site information may not be available to the pro‐
10777 filing functions otherwise.)
10778
10779 void __cyg_profile_func_enter (void *this_fn,
10780 void *call_site);
10781 void __cyg_profile_func_exit (void *this_fn,
10782 void *call_site);
10783
10784 The first argument is the address of the start of the current func‐
10785 tion, which may be looked up exactly in the symbol table.
10786
10787 This instrumentation is also done for functions expanded inline in
10788 other functions. The profiling calls will indicate where, concep‐
10789 tually, the inline function is entered and exited. This means that
10790 addressable versions of such functions must be available. If all
10791 your uses of a function are expanded inline, this may mean an addi‐
10792 tional expansion of code size. If you use extern inline in your C
10793 code, an addressable version of such functions must be provided.
10794 (This is normally the case anyways, but if you get lucky and the
10795 optimizer always expands the functions inline, you might have got‐
10796 ten away without providing static copies.)
10797
10798 A function may be given the attribute "no_instrument_function", in
10799 which case this instrumentation will not be done. This can be
10800 used, for example, for the profiling functions listed above, high-
10801 priority interrupt routines, and any functions from which the pro‐
10802 filing functions cannot safely be called (perhaps signal handlers,
10803 if the profiling routines generate output or allocate memory).
10804
10805 -fstack-check
10806 Generate code to verify that you do not go beyond the boundary of
10807 the stack. You should specify this flag if you are running in an
10808 environment with multiple threads, but only rarely need to specify
10809 it in a single-threaded environment since stack overflow is auto‐
10810 matically detected on nearly all systems if there is only one
10811 stack.
10812
10813 Note that this switch does not actually cause checking to be done;
10814 the operating system must do that. The switch causes generation of
10815 code to ensure that the operating system sees the stack being
10816 extended.
10817
10818 -fstack-limit-register=reg
10819 -fstack-limit-symbol=sym
10820 -fno-stack-limit
10821 Generate code to ensure that the stack does not grow beyond a cer‐
10822 tain value, either the value of a register or the address of a sym‐
10823 bol. If the stack would grow beyond the value, a signal is raised.
10824 For most targets, the signal is raised before the stack overruns
10825 the boundary, so it is possible to catch the signal without taking
10826 special precautions.
10827
10828 For instance, if the stack starts at absolute address 0x80000000
10829 and grows downwards, you can use the flags -fstack-limit-sym‐
10830 bol=__stack_limit and -Wl,--defsym,__stack_limit=0x7ffe0000 to
10831 enforce a stack limit of 128KB. Note that this may only work with
10832 the GNU linker.
10833
10834 -fargument-alias
10835 -fargument-noalias
10836 -fargument-noalias-global
10837 Specify the possible relationships among parameters and between
10838 parameters and global data.
10839
10840 -fargument-alias specifies that arguments (parameters) may alias
10841 each other and may alias global storage.-fargument-noalias speci‐
10842 fies that arguments do not alias each other, but may alias global
10843 storage.-fargument-noalias-global specifies that arguments do not
10844 alias each other and do not alias global storage.
10845
10846 Each language will automatically use whatever option is required by
10847 the language standard. You should not need to use these options
10848 yourself.
10849
10850 -fleading-underscore
10851 This option and its counterpart, -fno-leading-underscore, forcibly
10852 change the way C symbols are represented in the object file. One
10853 use is to help link with legacy assembly code.
10854
10855 Warning: the -fleading-underscore switch causes GCC to generate
10856 code that is not binary compatible with code generated without that
10857 switch. Use it to conform to a non-default application binary
10858 interface. Not all targets provide complete support for this
10859 switch.
10860
10861 -ftls-model=model
10862 Alter the thread-local storage model to be used. The model argu‐
10863 ment should be one of "global-dynamic", "local-dynamic", "ini‐
10864 tial-exec" or "local-exec".
10865
10866 The default without -fpic is "initial-exec"; with -fpic the default
10867 is "global-dynamic".
10868
10869 -fvisibility=default⎪internal⎪hidden⎪protected
10870 Set the default ELF image symbol visibility to the specified
10871 option---all symbols will be marked with this unless overridden
10872 within the code. Using this feature can very substantially improve
10873 linking and load times of shared object libraries, produce more
10874 optimized code, provide near-perfect API export and prevent symbol
10875 clashes. It is strongly recommended that you use this in any
10876 shared objects you distribute.
10877
10878 Despite the nomenclature, "default" always means public ie; avail‐
10879 able to be linked against from outside the shared object. "pro‐
10880 tected" and "internal" are pretty useless in real-world usage so
10881 the only other commonly used option will be "hidden". The default
10882 if -fvisibility isn't specified is "default", i.e., make every sym‐
10883 bol public---this causes the same behavior as previous versions of
10884 GCC.
10885
10886 A good explanation of the benefits offered by ensuring ELF symbols
10887 have the correct visibility is given by "How To Write Shared
10888 Libraries" by Ulrich Drepper (which can be found at <http://peo‐
10889 ple.redhat.com/~drepper/>)---however a superior solution made pos‐
10890 sible by this option to marking things hidden when the default is
10891 public is to make the default hidden and mark things public. This
10892 is the norm with DLL's on Windows and with -fvisibility=hidden and
10893 "__attribute__ ((visibility("default")))" instead of
10894 "__declspec(dllexport)" you get almost identical semantics with
10895 identical syntax. This is a great boon to those working with
10896 cross-platform projects.
10897
10898 For those adding visibility support to existing code, you may find
10899 #pragma GCC visibility of use. This works by you enclosing the
10900 declarations you wish to set visibility for with (for example)
10901 #pragma GCC visibility push(hidden) and #pragma GCC visibility pop.
10902 Bear in mind that symbol visibility should be viewed as part of the
10903 API interface contract and thus all new code should always specify
10904 visibility when it is not the default ie; declarations only for use
10905 within the local DSO should always be marked explicitly as hidden
10906 as so to avoid PLT indirection overheads---making this abundantly
10907 clear also aids readability and self-documentation of the code.
10908 Note that due to ISO C++ specification requirements, operator new
10909 and operator delete must always be of default visibility.
10910
10911 extern declarations are not affected by -fvisibility, so a lot of
10912 code can be recompiled with -fvisibility=hidden with no modifica‐
10913 tions. However, this means that calls to extern functions with no
10914 explicit visibility will use the PLT, so it is more effective to
10915 use __attribute ((visibility)) and/or #pragma GCC visibility to
10916 tell the compiler which extern declarations should be treated as
10917 hidden.
10918
10919 Note that -fvisibility does affect C++ vague linkage entities. This
10920 means that, for instance, an exception class that will be thrown
10921 between DSOs must be explicitly marked with default visibility so
10922 that the type_info nodes will be unified between the DSOs.
10923
10924 An overview of these techniques, their benefits and how to use them
10925 is at <http://gcc.gnu.org/wiki/Visibility>.
10926
10927 -fopenmp
10928 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
10929 "!$omp" in Fortran. When -fopenmp is specified, the compiler gen‐
10930 erates parallel code according to the OpenMP Application Program
10931 Interface v2.5 <http://www.openmp.org/>.
10932
10934 This section describes several environment variables that affect how
10935 GCC operates. Some of them work by specifying directories or prefixes
10936 to use when searching for various kinds of files. Some are used to
10937 specify other aspects of the compilation environment.
10938
10939 Note that you can also specify places to search using options such as
10940 -B, -I and -L. These take precedence over places specified using envi‐
10941 ronment variables, which in turn take precedence over those specified
10942 by the configuration of GCC.
10943
10944 LANG
10945 LC_CTYPE
10946 LC_MESSAGES
10947 LC_ALL
10948 These environment variables control the way that GCC uses localiza‐
10949 tion information that allow GCC to work with different national
10950 conventions. GCC inspects the locale categories LC_CTYPE and
10951 LC_MESSAGES if it has been configured to do so. These locale cate‐
10952 gories can be set to any value supported by your installation. A
10953 typical value is en_GB.UTF-8 for English in the United Kingdom
10954 encoded in UTF-8.
10955
10956 The LC_CTYPE environment variable specifies character classifica‐
10957 tion. GCC uses it to determine the character boundaries in a
10958 string; this is needed for some multibyte encodings that contain
10959 quote and escape characters that would otherwise be interpreted as
10960 a string end or escape.
10961
10962 The LC_MESSAGES environment variable specifies the language to use
10963 in diagnostic messages.
10964
10965 If the LC_ALL environment variable is set, it overrides the value
10966 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
10967 default to the value of the LANG environment variable. If none of
10968 these variables are set, GCC defaults to traditional C English
10969 behavior.
10970
10971 TMPDIR
10972 If TMPDIR is set, it specifies the directory to use for temporary
10973 files. GCC uses temporary files to hold the output of one stage of
10974 compilation which is to be used as input to the next stage: for
10975 example, the output of the preprocessor, which is the input to the
10976 compiler proper.
10977
10978 GCC_EXEC_PREFIX
10979 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
10980 names of the subprograms executed by the compiler. No slash is
10981 added when this prefix is combined with the name of a subprogram,
10982 but you can specify a prefix that ends with a slash if you wish.
10983
10984 If GCC_EXEC_PREFIX is not set, GCC will attempt to figure out an
10985 appropriate prefix to use based on the pathname it was invoked
10986 with.
10987
10988 If GCC cannot find the subprogram using the specified prefix, it
10989 tries looking in the usual places for the subprogram.
10990
10991 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where pre‐
10992 fix is the value of "prefix" when you ran the configure script.
10993
10994 Other prefixes specified with -B take precedence over this prefix.
10995
10996 This prefix is also used for finding files such as crt0.o that are
10997 used for linking.
10998
10999 In addition, the prefix is used in an unusual way in finding the
11000 directories to search for header files. For each of the standard
11001 directories whose name normally begins with /usr/local/lib/gcc
11002 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
11003 replacing that beginning with the specified prefix to produce an
11004 alternate directory name. Thus, with -Bfoo/, GCC will search
11005 foo/bar where it would normally search /usr/local/lib/bar. These
11006 alternate directories are searched first; the standard directories
11007 come next.
11008
11009 COMPILER_PATH
11010 The value of COMPILER_PATH is a colon-separated list of directo‐
11011 ries, much like PATH. GCC tries the directories thus specified
11012 when searching for subprograms, if it can't find the subprograms
11013 using GCC_EXEC_PREFIX.
11014
11015 LIBRARY_PATH
11016 The value of LIBRARY_PATH is a colon-separated list of directories,
11017 much like PATH. When configured as a native compiler, GCC tries
11018 the directories thus specified when searching for special linker
11019 files, if it can't find them using GCC_EXEC_PREFIX. Linking using
11020 GCC also uses these directories when searching for ordinary
11021 libraries for the -l option (but directories specified with -L come
11022 first).
11023
11024 LANG
11025 This variable is used to pass locale information to the compiler.
11026 One way in which this information is used is to determine the char‐
11027 acter set to be used when character literals, string literals and
11028 comments are parsed in C and C++. When the compiler is configured
11029 to allow multibyte characters, the following values for LANG are
11030 recognized:
11031
11032 C-JIS
11033 Recognize JIS characters.
11034
11035 C-SJIS
11036 Recognize SJIS characters.
11037
11038 C-EUCJP
11039 Recognize EUCJP characters.
11040
11041 If LANG is not defined, or if it has some other value, then the
11042 compiler will use mblen and mbtowc as defined by the default locale
11043 to recognize and translate multibyte characters.
11044
11045 Some additional environments variables affect the behavior of the pre‐
11046 processor.
11047
11048 CPATH
11049 C_INCLUDE_PATH
11050 CPLUS_INCLUDE_PATH
11051 OBJC_INCLUDE_PATH
11052 Each variable's value is a list of directories separated by a spe‐
11053 cial character, much like PATH, in which to look for header files.
11054 The special character, "PATH_SEPARATOR", is target-dependent and
11055 determined at GCC build time. For Microsoft Windows-based targets
11056 it is a semicolon, and for almost all other targets it is a colon.
11057
11058 CPATH specifies a list of directories to be searched as if speci‐
11059 fied with -I, but after any paths given with -I options on the com‐
11060 mand line. This environment variable is used regardless of which
11061 language is being preprocessed.
11062
11063 The remaining environment variables apply only when preprocessing
11064 the particular language indicated. Each specifies a list of direc‐
11065 tories to be searched as if specified with -isystem, but after any
11066 paths given with -isystem options on the command line.
11067
11068 In all these variables, an empty element instructs the compiler to
11069 search its current working directory. Empty elements can appear at
11070 the beginning or end of a path. For instance, if the value of
11071 CPATH is ":/special/include", that has the same effect as
11072 -I. -I/special/include.
11073
11074 DEPENDENCIES_OUTPUT
11075 If this variable is set, its value specifies how to output depen‐
11076 dencies for Make based on the non-system header files processed by
11077 the compiler. System header files are ignored in the dependency
11078 output.
11079
11080 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
11081 case the Make rules are written to that file, guessing the target
11082 name from the source file name. Or the value can have the form
11083 file target, in which case the rules are written to file file using
11084 target as the target name.
11085
11086 In other words, this environment variable is equivalent to combin‐
11087 ing the options -MM and -MF, with an optional -MT switch too.
11088
11089 SUNPRO_DEPENDENCIES
11090 This variable is the same as DEPENDENCIES_OUTPUT (see above),
11091 except that system header files are not ignored, so it implies -M
11092 rather than -MM. However, the dependence on the main input file is
11093 omitted.
11094
11096 For instructions on reporting bugs, see <http://gcc.gnu.org/bugs.html>.
11097
11099 1. On some systems, gcc -shared needs to build supplementary stub code
11100 for constructors to work. On multi-libbed systems, gcc -shared
11101 must select the correct support libraries to link against. Failing
11102 to supply the correct flags may lead to subtle defects. Supplying
11103 them in cases where they are not necessary is innocuous.
11104
11106 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
11107 adb(1), dbx(1), sdb(1) and the Info entries for gcc, cpp, as, ld, binu‐
11108 tils and gdb.
11109
11111 See the Info entry for gcc, or <http://gcc.gnu.org/onlinedocs/gcc/Con‐
11112 tributors.html>, for contributors to GCC.
11113
11115 Copyright (c) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
11116 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
11117
11118 Permission is granted to copy, distribute and/or modify this document
11119 under the terms of the GNU Free Documentation License, Version 1.2 or
11120 any later version published by the Free Software Foundation; with the
11121 Invariant Sections being "GNU General Public License" and "Funding Free
11122 Software", the Front-Cover texts being (a) (see below), and with the
11123 Back-Cover Texts being (b) (see below). A copy of the license is
11124 included in the gfdl(7) man page.
11125
11126 (a) The FSF's Front-Cover Text is:
11127
11128 A GNU Manual
11129
11130 (b) The FSF's Back-Cover Text is:
11131
11132 You have freedom to copy and modify this GNU Manual, like GNU
11133 software. Copies published by the Free Software Foundation raise
11134 funds for GNU development.
11135
11136
11137
11138gcc-4.1.2 2007-09-25 GCC(1)