]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. index:: developer options, debugging GCC, debug dump options, dump options, compilation statistics | |
7 | ||
8 | .. _developer-options: | |
9 | ||
10 | GCC Developer Options | |
11 | ********************* | |
12 | ||
13 | This section describes command-line options that are primarily of | |
14 | interest to GCC developers, including options to support compiler | |
15 | testing and investigation of compiler bugs and compile-time | |
16 | performance problems. This includes options that produce debug dumps | |
17 | at various points in the compilation; that print statistics such as | |
18 | memory use and execution time; and that print information about GCC's | |
19 | configuration, such as where it searches for libraries. You should | |
20 | rarely need to use any of these options for ordinary compilation and | |
21 | linking tasks. | |
22 | ||
23 | Many developer options that cause GCC to dump output to a file take an | |
24 | optional :samp:`={filename}` suffix. You can specify :samp:`stdout` | |
25 | or :samp:`-` to dump to standard output, and :samp:`stderr` for standard | |
26 | error. | |
27 | ||
28 | If :samp:`={filename}` is omitted, a default dump file name is | |
29 | constructed by concatenating the base dump file name, a pass number, | |
30 | phase letter, and pass name. The base dump file name is the name of | |
31 | output file produced by the compiler if explicitly specified and not | |
32 | an executable; otherwise it is the source file name. | |
33 | The pass number is determined by the order passes are registered with | |
34 | the compiler's pass manager. | |
35 | This is generally the same as the order of execution, but passes | |
36 | registered by plugins, target-specific passes, or passes that are | |
37 | otherwise registered late are numbered higher than the pass named | |
38 | :samp:`final`, even if they are executed earlier. The phase letter is | |
39 | one of :samp:`i` (inter-procedural analysis), :samp:`l` | |
40 | (language-specific), :samp:`r` (RTL), or :samp:`t` (tree). | |
41 | The files are created in the directory of the output file. | |
42 | ||
43 | .. option:: -fcallgraph-info, -fcallgraph-info={MARKERS} | |
44 | ||
45 | Makes the compiler output callgraph information for the program, on a | |
46 | per-object-file basis. The information is generated in the common VCG | |
47 | format. It can be decorated with additional, per-node and/or per-edge | |
48 | information, if a list of comma-separated markers is additionally | |
49 | specified. When the ``su`` marker is specified, the callgraph is | |
50 | decorated with stack usage information; it is equivalent to | |
51 | :option:`-fstack-usage`. When the ``da`` marker is specified, the | |
52 | callgraph is decorated with information about dynamically allocated | |
53 | objects. | |
54 | ||
55 | When compiling with :option:`-flto`, no callgraph information is output | |
56 | along with the object file. At LTO link time, :option:`-fcallgraph-info` | |
57 | may generate multiple callgraph information files next to intermediate | |
58 | LTO output files. | |
59 | ||
60 | .. index:: fdump-rtl-pass | |
61 | ||
62 | .. option:: -dletters, -fdump-rtl-pass, -fdump-rtl-pass={filename} | |
63 | ||
64 | Says to make debugging dumps during compilation at times specified by | |
65 | :samp:`{letters}`. This is used for debugging the RTL-based passes of the | |
66 | compiler. | |
67 | ||
68 | Some :option:`-dletters` switches have different meaning when | |
69 | :option:`-E` is used for preprocessing. See :ref:`preprocessor-options`, | |
70 | for information about preprocessor-specific dump options. | |
71 | ||
72 | Debug dumps can be enabled with a :option:`-fdump-rtl` switch or some | |
73 | :option:`-d` option :samp:`{letters}`. Here are the possible | |
74 | letters for use in :samp:`{pass}` and :samp:`{letters}`, and their meanings: | |
75 | ||
76 | .. option:: -fdump-rtl-alignments | |
77 | ||
78 | Dump after branch alignments have been computed. | |
79 | ||
80 | .. option:: -fdump-rtl-asmcons | |
81 | ||
82 | Dump after fixing rtl statements that have unsatisfied in/out constraints. | |
83 | ||
84 | .. option:: -fdump-rtl-auto_inc_dec | |
85 | ||
86 | Dump after auto-inc-dec discovery. This pass is only run on | |
87 | architectures that have auto inc or auto dec instructions. | |
88 | ||
89 | .. option:: -fdump-rtl-barriers | |
90 | ||
91 | Dump after cleaning up the barrier instructions. | |
92 | ||
93 | .. option:: -fdump-rtl-bbpart | |
94 | ||
95 | Dump after partitioning hot and cold basic blocks. | |
96 | ||
97 | .. option:: -fdump-rtl-bbro | |
98 | ||
99 | Dump after block reordering. | |
100 | ||
101 | .. option:: -fdump-rtl-btl1, -fdump-rtl-btl2 | |
102 | ||
103 | :option:`-fdump-rtl-btl1` and :option:`-fdump-rtl-btl2` enable dumping | |
104 | after the two branch | |
105 | target load optimization passes. | |
106 | ||
107 | .. option:: -fdump-rtl-bypass | |
108 | ||
109 | Dump after jump bypassing and control flow optimizations. | |
110 | ||
111 | .. option:: -fdump-rtl-combine | |
112 | ||
113 | Dump after the RTL instruction combination pass. | |
114 | ||
115 | .. option:: -fdump-rtl-compgotos | |
116 | ||
117 | Dump after duplicating the computed gotos. | |
118 | ||
119 | .. option:: -fdump-rtl-ce1, -fdump-rtl-ce2, -fdump-rtl-ce3 | |
120 | ||
121 | :option:`-fdump-rtl-ce1`, :option:`-fdump-rtl-ce2`, and | |
122 | :option:`-fdump-rtl-ce3` enable dumping after the three | |
123 | if conversion passes. | |
124 | ||
125 | .. option:: -fdump-rtl-cprop_hardreg | |
126 | ||
127 | Dump after hard register copy propagation. | |
128 | ||
129 | .. option:: -fdump-rtl-csa | |
130 | ||
131 | Dump after combining stack adjustments. | |
132 | ||
133 | .. option:: -fdump-rtl-cse1, -fdump-rtl-cse2 | |
134 | ||
135 | :option:`-fdump-rtl-cse1` and :option:`-fdump-rtl-cse2` enable dumping after | |
136 | the two common subexpression elimination passes. | |
137 | ||
138 | .. option:: -fdump-rtl-dce | |
139 | ||
140 | Dump after the standalone dead code elimination passes. | |
141 | ||
142 | .. option:: -fdump-rtl-dbr | |
143 | ||
144 | Dump after delayed branch scheduling. | |
145 | ||
146 | .. option:: -fdump-rtl-dce1, -fdump-rtl-dce2 | |
147 | ||
148 | :option:`-fdump-rtl-dce1` and :option:`-fdump-rtl-dce2` enable dumping after | |
149 | the two dead store elimination passes. | |
150 | ||
151 | .. option:: -fdump-rtl-eh | |
152 | ||
153 | Dump after finalization of EH handling code. | |
154 | ||
155 | .. option:: -fdump-rtl-eh_ranges | |
156 | ||
157 | Dump after conversion of EH handling range regions. | |
158 | ||
159 | .. option:: -fdump-rtl-expand | |
160 | ||
161 | Dump after RTL generation. | |
162 | ||
163 | .. option:: -fdump-rtl-fwprop1, -fdump-rtl-fwprop2 | |
164 | ||
165 | :option:`-fdump-rtl-fwprop1` and :option:`-fdump-rtl-fwprop2` enable | |
166 | dumping after the two forward propagation passes. | |
167 | ||
168 | .. option:: -fdump-rtl-gcse1, -fdump-rtl-gcse2 | |
169 | ||
170 | :option:`-fdump-rtl-gcse1` and :option:`-fdump-rtl-gcse2` enable dumping | |
171 | after global common subexpression elimination. | |
172 | ||
173 | .. option:: -fdump-rtl-init-regs | |
174 | ||
175 | Dump after the initialization of the registers. | |
176 | ||
177 | .. option:: -fdump-rtl-initvals | |
178 | ||
179 | Dump after the computation of the initial value sets. | |
180 | ||
181 | .. option:: -fdump-rtl-into_cfglayout | |
182 | ||
183 | Dump after converting to cfglayout mode. | |
184 | ||
185 | .. option:: -fdump-rtl-ira | |
186 | ||
187 | Dump after iterated register allocation. | |
188 | ||
189 | .. option:: -fdump-rtl-jump | |
190 | ||
191 | Dump after the second jump optimization. | |
192 | ||
193 | .. option:: -fdump-rtl-loop2 | |
194 | ||
195 | :option:`-fdump-rtl-loop2` enables dumping after the rtl | |
196 | loop optimization passes. | |
197 | ||
198 | .. option:: -fdump-rtl-mach | |
199 | ||
200 | Dump after performing the machine dependent reorganization pass, if that | |
201 | pass exists. | |
202 | ||
203 | .. option:: -fdump-rtl-mode_sw | |
204 | ||
205 | Dump after removing redundant mode switches. | |
206 | ||
207 | .. option:: -fdump-rtl-rnreg | |
208 | ||
209 | Dump after register renumbering. | |
210 | ||
211 | .. option:: -fdump-rtl-outof_cfglayout | |
212 | ||
213 | Dump after converting from cfglayout mode. | |
214 | ||
215 | .. option:: -fdump-rtl-peephole2 | |
216 | ||
217 | Dump after the peephole pass. | |
218 | ||
219 | .. option:: -fdump-rtl-postreload | |
220 | ||
221 | Dump after post-reload optimizations. | |
222 | ||
223 | .. option:: -fdump-rtl-pro_and_epilogue | |
224 | ||
225 | Dump after generating the function prologues and epilogues. | |
226 | ||
227 | .. option:: -fdump-rtl-sched1, -fdump-rtl-sched2 | |
228 | ||
229 | :option:`-fdump-rtl-sched1` and :option:`-fdump-rtl-sched2` enable dumping | |
230 | after the basic block scheduling passes. | |
231 | ||
232 | .. option:: -fdump-rtl-ree | |
233 | ||
234 | Dump after sign/zero extension elimination. | |
235 | ||
236 | .. option:: -fdump-rtl-seqabstr | |
237 | ||
238 | Dump after common sequence discovery. | |
239 | ||
240 | .. option:: -fdump-rtl-shorten | |
241 | ||
242 | Dump after shortening branches. | |
243 | ||
244 | .. option:: -fdump-rtl-sibling | |
245 | ||
246 | Dump after sibling call optimizations. | |
247 | ||
248 | .. option:: -fdump-rtl-split1, -fdump-rtl-split2, -fdump-rtl-split3, -fdump-rtl-split4, -fdump-rtl-split5 | |
249 | ||
250 | These options enable dumping after five rounds of | |
251 | instruction splitting. | |
252 | ||
253 | .. option:: -fdump-rtl-sms | |
254 | ||
255 | Dump after modulo scheduling. This pass is only run on some | |
256 | architectures. | |
257 | ||
258 | .. option:: -fdump-rtl-stack | |
259 | ||
260 | Dump after conversion from GCC's 'flat register file' registers to the | |
261 | x87's stack-like registers. This pass is only run on x86 variants. | |
262 | ||
263 | .. option:: -fdump-rtl-subreg1, -fdump-rtl-subreg2 | |
264 | ||
265 | :option:`-fdump-rtl-subreg1` and :option:`-fdump-rtl-subreg2` enable dumping after | |
266 | the two subreg expansion passes. | |
267 | ||
268 | .. option:: -fdump-rtl-unshare | |
269 | ||
270 | Dump after all rtl has been unshared. | |
271 | ||
272 | .. option:: -fdump-rtl-vartrack | |
273 | ||
274 | Dump after variable tracking. | |
275 | ||
276 | .. option:: -fdump-rtl-vregs | |
277 | ||
278 | Dump after converting virtual registers to hard registers. | |
279 | ||
280 | .. option:: -fdump-rtl-web | |
281 | ||
282 | Dump after live range splitting. | |
283 | ||
284 | .. option:: -fdump-rtl-regclass, -fdump-rtl-subregs_of_mode_init, -fdump-rtl-subregs_of_mode_finish, -fdump-rtl-dfinit, -fdump-rtl-dfinish | |
285 | ||
286 | These dumps are defined but always produce empty files. | |
287 | ||
288 | .. option:: -da, -fdump-rtl-all | |
289 | ||
290 | Produce all the dumps listed above. | |
291 | ||
292 | .. option:: -dA | |
293 | ||
294 | Annotate the assembler output with miscellaneous debugging information. | |
295 | ||
296 | .. option:: -dD | |
297 | ||
298 | Dump all macro definitions, at the end of preprocessing, in addition to | |
299 | normal output. | |
300 | ||
301 | .. option:: -dH | |
302 | ||
303 | Produce a core dump whenever an error occurs. | |
304 | ||
305 | .. option:: -dp | |
306 | ||
307 | Annotate the assembler output with a comment indicating which | |
308 | pattern and alternative is used. The length and cost of each instruction are | |
309 | also printed. | |
310 | ||
311 | .. option:: -dP | |
312 | ||
313 | Dump the RTL in the assembler output as a comment before each instruction. | |
314 | Also turns on :option:`-dp` annotation. | |
315 | ||
316 | .. option:: -dx | |
317 | ||
318 | Just generate RTL for a function instead of compiling it. Usually used | |
319 | with :option:`-fdump-rtl-expand`. | |
320 | ||
321 | .. option:: -fdump-debug | |
322 | ||
323 | Dump debugging information generated during the debug | |
324 | generation phase. | |
325 | ||
326 | .. option:: -fdump-earlydebug | |
327 | ||
328 | Dump debugging information generated during the early debug | |
329 | generation phase. | |
330 | ||
331 | .. option:: -fdump-noaddr | |
332 | ||
333 | When doing debugging dumps, suppress address output. This makes it more | |
334 | feasible to use diff on debugging dumps for compiler invocations with | |
335 | different compiler binaries and/or different | |
336 | text / bss / data / heap / stack / dso start locations. | |
337 | ||
338 | .. option:: -freport-bug | |
339 | ||
340 | Collect and dump debug information into a temporary file if an | |
341 | internal compiler error (ICE) occurs. | |
342 | ||
343 | .. option:: -fdump-unnumbered | |
344 | ||
345 | When doing debugging dumps, suppress instruction numbers and address output. | |
346 | This makes it more feasible to use diff on debugging dumps for compiler | |
347 | invocations with different options, in particular with and without | |
348 | :option:`-g`. | |
349 | ||
350 | .. option:: -fdump-unnumbered-links | |
351 | ||
352 | When doing debugging dumps (see :option:`-d` option above), suppress | |
353 | instruction numbers for the links to the previous and next instructions | |
354 | in a sequence. | |
355 | ||
356 | .. option:: -fdump-ipa-switch, -fdump-ipa-switch-options | |
357 | ||
358 | Control the dumping at various stages of inter-procedural analysis | |
359 | language tree to a file. The file name is generated by appending a | |
360 | switch specific suffix to the source file name, and the file is created | |
361 | in the same directory as the output file. The following dumps are | |
362 | possible: | |
363 | ||
364 | :samp:`all` | |
365 | Enables all inter-procedural analysis dumps. | |
366 | ||
367 | :samp:`cgraph` | |
368 | Dumps information about call-graph optimization, unused function removal, | |
369 | and inlining decisions. | |
370 | ||
371 | :samp:`inline` | |
372 | Dump after function inlining. | |
373 | ||
374 | Additionally, the options :option:`-optimized`, :option:`-missed`, | |
375 | :option:`-note`, and :option:`-all` can be provided, with the same meaning | |
376 | as for :option:`-fopt-info`, defaulting to :option:`-optimized`. | |
377 | ||
378 | For example, :option:`-fdump-ipa-inline-optimized-missed` will emit | |
379 | information on callsites that were inlined, along with callsites | |
380 | that were not inlined. | |
381 | ||
382 | By default, the dump will contain messages about successful | |
383 | optimizations (equivalent to :option:`-optimized`) together with | |
384 | low-level details about the analysis. | |
385 | ||
386 | .. option:: -fdump-lang | |
387 | ||
388 | Dump language-specific information. The file name is made by appending | |
389 | :samp:`.lang` to the source file name. | |
390 | ||
391 | .. option:: -fdump-lang-all, -fdump-lang-switch, -fdump-lang-switch-options, -fdump-lang-switch-options={filename} | |
392 | ||
393 | Control the dumping of language-specific information. The :samp:`{options}` | |
394 | and :samp:`{filename}` portions behave as described in the | |
395 | :option:`-fdump-tree` option. The following :samp:`{switch}` values are | |
396 | accepted: | |
397 | ||
398 | :samp:`all` | |
399 | Enable all language-specific dumps. | |
400 | ||
401 | :samp:`class` | |
402 | Dump class hierarchy information. Virtual table information is emitted | |
403 | unless ' slim ' is specified. This option is applicable to C++ only. | |
404 | ||
405 | :samp:`module` | |
406 | Dump module information. Options lineno (locations), | |
407 | graph (reachability), blocks (clusters), | |
408 | uid (serialization), alias (mergeable), | |
409 | asmname (Elrond), eh (mapper) & vops | |
410 | (macros) may provide additional information. This option is | |
411 | applicable to C++ only. | |
412 | ||
413 | :samp:`raw` | |
414 | Dump the raw internal tree data. This option is applicable to C++ only. | |
415 | ||
416 | .. option:: -fdump-passes | |
417 | ||
418 | Print on :samp:`stderr` the list of optimization passes that are turned | |
419 | on and off by the current command-line options. | |
420 | ||
421 | .. option:: -fdump-statistics-option | |
422 | ||
423 | Enable and control dumping of pass statistics in a separate file. The | |
424 | file name is generated by appending a suffix ending in | |
425 | :samp:`.statistics` to the source file name, and the file is created in | |
426 | the same directory as the output file. If the :samp:`-{option}` | |
427 | form is used, :samp:`-stats` causes counters to be summed over the | |
428 | whole compilation unit while :samp:`-details` dumps every event as | |
429 | the passes generate them. The default with no option is to sum | |
430 | counters for each function compiled. | |
431 | ||
432 | .. option:: -fdump-tree-all, -fdump-tree-switch, -fdump-tree-switch-options, -fdump-tree-switch-options={filename} | |
433 | ||
434 | Control the dumping at various stages of processing the intermediate | |
435 | language tree to a file. If the :samp:`-{options}` | |
436 | form is used, :samp:`{options}` is a list of :samp:`-` separated options | |
437 | which control the details of the dump. Not all options are applicable | |
438 | to all dumps; those that are not meaningful are ignored. The | |
439 | following options are available | |
440 | ||
441 | :samp:`address` | |
442 | Print the address of each node. Usually this is not meaningful as it | |
443 | changes according to the environment and source file. Its primary use | |
444 | is for tying up a dump file with a debug environment. | |
445 | ||
446 | :samp:`asmname` | |
447 | If ``DECL_ASSEMBLER_NAME`` has been set for a given decl, use that | |
448 | in the dump instead of ``DECL_NAME``. Its primary use is ease of | |
449 | use working backward from mangled names in the assembly file. | |
450 | ||
451 | :samp:`slim` | |
452 | When dumping front-end intermediate representations, inhibit dumping | |
453 | of members of a scope or body of a function merely because that scope | |
454 | has been reached. Only dump such items when they are directly reachable | |
455 | by some other path. | |
456 | ||
457 | When dumping pretty-printed trees, this option inhibits dumping the | |
458 | bodies of control structures. | |
459 | ||
460 | When dumping RTL, print the RTL in slim (condensed) form instead of | |
461 | the default LISP-like representation. | |
462 | ||
463 | :samp:`raw` | |
464 | Print a raw representation of the tree. By default, trees are | |
465 | pretty-printed into a C-like representation. | |
466 | ||
467 | :samp:`details` | |
468 | Enable more detailed dumps (not honored by every dump option). Also | |
469 | include information from the optimization passes. | |
470 | ||
471 | :samp:`stats` | |
472 | Enable dumping various statistics about the pass (not honored by every dump | |
473 | option). | |
474 | ||
475 | :samp:`blocks` | |
476 | Enable showing basic block boundaries (disabled in raw dumps). | |
477 | ||
478 | :samp:`graph` | |
479 | For each of the other indicated dump files (:option:`-fdump-rtl-pass`), | |
480 | dump a representation of the control flow graph suitable for viewing with | |
481 | GraphViz to :samp:`{file}.{passid}.{pass}.dot`. Each function in | |
482 | the file is pretty-printed as a subgraph, so that GraphViz can render them | |
483 | all in a single plot. | |
484 | ||
485 | This option currently only works for RTL dumps, and the RTL is always | |
486 | dumped in slim form. | |
487 | ||
488 | :samp:`vops` | |
489 | Enable showing virtual operands for every statement. | |
490 | ||
491 | :samp:`lineno` | |
492 | Enable showing line numbers for statements. | |
493 | ||
494 | :samp:`uid` | |
495 | Enable showing the unique ID (``DECL_UID``) for each variable. | |
496 | ||
497 | :samp:`verbose` | |
498 | Enable showing the tree dump for each statement. | |
499 | ||
500 | :samp:`eh` | |
501 | Enable showing the EH region number holding each statement. | |
502 | ||
503 | :samp:`scev` | |
504 | Enable showing scalar evolution analysis details. | |
505 | ||
506 | :samp:`optimized` | |
507 | Enable showing optimization information (only available in certain | |
508 | passes). | |
509 | ||
510 | :samp:`missed` | |
511 | Enable showing missed optimization information (only available in certain | |
512 | passes). | |
513 | ||
514 | :samp:`note` | |
515 | Enable other detailed optimization information (only available in | |
516 | certain passes). | |
517 | ||
518 | :samp:`all` | |
519 | Turn on all options, except raw, slim, verbose | |
520 | and lineno. | |
521 | ||
522 | :samp:`optall` | |
523 | Turn on all optimization options, i.e., optimized, | |
524 | missed, and note. | |
525 | ||
526 | To determine what tree dumps are available or find the dump for a pass | |
527 | of interest follow the steps below. | |
528 | ||
529 | * Invoke GCC with :option:`-fdump-passes` and in the :samp:`stderr` output | |
530 | look for a code that corresponds to the pass you are interested in. | |
531 | For example, the codes ``tree-evrp``, ``tree-vrp1``, and | |
532 | ``tree-vrp2`` correspond to the three Value Range Propagation passes. | |
533 | The number at the end distinguishes distinct invocations of the same pass. | |
534 | ||
535 | * To enable the creation of the dump file, append the pass code to | |
536 | the :option:`-fdump-` option prefix and invoke GCC with it. For example, | |
537 | to enable the dump from the Early Value Range Propagation pass, invoke | |
538 | GCC with the :option:`-fdump-tree-evrp` option. Optionally, you may | |
539 | specify the name of the dump file. If you don't specify one, GCC | |
540 | creates as described below. | |
541 | ||
542 | * Find the pass dump in a file whose name is composed of three components | |
543 | separated by a period: the name of the source file GCC was invoked to | |
544 | compile, a numeric suffix indicating the pass number followed by the | |
545 | letter :samp:`t` for tree passes (and the letter :samp:`r` for RTL passes), | |
546 | and finally the pass code. For example, the Early VRP pass dump might | |
547 | be in a file named :samp:`myfile.c.038t.evrp` in the current working | |
548 | directory. Note that the numeric codes are not stable and may change | |
549 | from one version of GCC to another. | |
550 | ||
551 | .. option:: -fopt-info, -fopt-info-options, -fopt-info-options={filename} | |
552 | ||
553 | Controls optimization dumps from various optimization passes. If the | |
554 | :samp:`-{options}` form is used, :samp:`{options}` is a list of | |
555 | :samp:`-` separated option keywords to select the dump details and | |
556 | optimizations. | |
557 | ||
558 | The :samp:`{options}` can be divided into three groups: | |
559 | ||
560 | * options describing what kinds of messages should be emitted, | |
561 | ||
562 | * options describing the verbosity of the dump, and | |
563 | ||
564 | * options describing which optimizations should be included. | |
565 | ||
566 | The options from each group can be freely mixed as they are | |
567 | non-overlapping. However, in case of any conflicts, | |
568 | the later options override the earlier options on the command | |
569 | line. | |
570 | ||
571 | The following options control which kinds of messages should be emitted: | |
572 | ||
573 | :samp:`optimized` | |
574 | Print information when an optimization is successfully applied. It is | |
575 | up to a pass to decide which information is relevant. For example, the | |
576 | vectorizer passes print the source location of loops which are | |
577 | successfully vectorized. | |
578 | ||
579 | :samp:`missed` | |
580 | Print information about missed optimizations. Individual passes | |
581 | control which information to include in the output. | |
582 | ||
583 | :samp:`note` | |
584 | Print verbose information about optimizations, such as certain | |
585 | transformations, more detailed messages about decisions etc. | |
586 | ||
587 | :samp:`all` | |
588 | Print detailed optimization information. This includes | |
589 | :samp:`optimized`, :samp:`missed`, and :samp:`note`. | |
590 | ||
591 | The following option controls the dump verbosity: | |
592 | ||
593 | :samp:`internals` | |
594 | By default, only 'high-level' messages are emitted. This option enables | |
595 | additional, more detailed, messages, which are likely to only be of interest | |
596 | to GCC developers. | |
597 | ||
598 | One or more of the following option keywords can be used to describe a | |
599 | group of optimizations: | |
600 | ||
601 | :samp:`ipa` | |
602 | Enable dumps from all interprocedural optimizations. | |
603 | ||
604 | :samp:`loop` | |
605 | Enable dumps from all loop optimizations. | |
606 | ||
607 | :samp:`inline` | |
608 | Enable dumps from all inlining optimizations. | |
609 | ||
610 | :samp:`omp` | |
611 | Enable dumps from all OMP (Offloading and Multi Processing) optimizations. | |
612 | ||
613 | :samp:`vec` | |
614 | Enable dumps from all vectorization optimizations. | |
615 | ||
616 | :samp:`optall` | |
617 | Enable dumps from all optimizations. This is a superset of | |
618 | the optimization groups listed above. | |
619 | ||
620 | If :samp:`{options}` is | |
621 | omitted, it defaults to :samp:`optimized-optall`, which means to dump messages | |
622 | about successful optimizations from all the passes, omitting messages | |
623 | that are treated as 'internals'. | |
624 | ||
625 | If the :samp:`{filename}` is provided, then the dumps from all the | |
626 | applicable optimizations are concatenated into the :samp:`{filename}`. | |
627 | Otherwise the dump is output onto :samp:`stderr`. Though multiple | |
628 | :option:`-fopt-info` options are accepted, only one of them can include | |
629 | a :samp:`{filename}`. If other filenames are provided then all but the | |
630 | first such option are ignored. | |
631 | ||
632 | Note that the output :samp:`{filename}` is overwritten | |
633 | in case of multiple translation units. If a combined output from | |
634 | multiple translation units is desired, :samp:`stderr` should be used | |
635 | instead. | |
636 | ||
637 | In the following example, the optimization info is output to | |
638 | :samp:`stderr`: | |
639 | ||
640 | .. code-block:: shell | |
641 | ||
642 | gcc -O3 -fopt-info | |
643 | ||
644 | This example: | |
645 | ||
646 | .. code-block:: shell | |
647 | ||
648 | gcc -O3 -fopt-info-missed=missed.all | |
649 | ||
650 | outputs missed optimization report from all the passes into | |
651 | :samp:`missed.all`, and this one: | |
652 | ||
653 | .. code-block:: shell | |
654 | ||
655 | gcc -O2 -ftree-vectorize -fopt-info-vec-missed | |
656 | ||
657 | prints information about missed optimization opportunities from | |
658 | vectorization passes on :samp:`stderr`. | |
659 | Note that :option:`-fopt-info-vec-missed` is equivalent to | |
660 | :option:`-fopt-info-missed-vec`. The order of the optimization group | |
661 | names and message types listed after :option:`-fopt-info` does not matter. | |
662 | ||
663 | As another example, | |
664 | ||
665 | .. code-block:: shell | |
666 | ||
667 | gcc -O3 -fopt-info-inline-optimized-missed=inline.txt | |
668 | ||
669 | outputs information about missed optimizations as well as | |
670 | optimized locations from all the inlining passes into | |
671 | :samp:`inline.txt`. | |
672 | ||
673 | Finally, consider: | |
674 | ||
675 | .. code-block:: shell | |
676 | ||
677 | gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt | |
678 | ||
679 | Here the two output filenames :samp:`vec.miss` and :samp:`loop.opt` are | |
680 | in conflict since only one output file is allowed. In this case, only | |
681 | the first option takes effect and the subsequent options are | |
682 | ignored. Thus only :samp:`vec.miss` is produced which contains | |
683 | dumps from the vectorizer about missed opportunities. | |
684 | ||
685 | .. option:: -fsave-optimization-record | |
686 | ||
687 | Write a SRCFILE.opt-record.json.gz file detailing what optimizations | |
688 | were performed, for those optimizations that support :option:`-fopt-info`. | |
689 | ||
690 | This option is experimental and the format of the data within the | |
691 | compressed JSON file is subject to change. | |
692 | ||
693 | It is roughly equivalent to a machine-readable version of | |
694 | :option:`-fopt-info-all`, as a collection of messages with source file, | |
695 | line number and column number, with the following additional data for | |
696 | each message: | |
697 | ||
698 | * the execution count of the code being optimized, along with metadata about | |
699 | whether this was from actual profile data, or just an estimate, allowing | |
700 | consumers to prioritize messages by code hotness, | |
701 | ||
702 | * the function name of the code being optimized, where applicable, | |
703 | ||
704 | * the 'inlining chain' for the code being optimized, so that when | |
705 | a function is inlined into several different places (which might | |
706 | themselves be inlined), the reader can distinguish between the copies, | |
707 | ||
708 | * objects identifying those parts of the message that refer to expressions, | |
709 | statements or symbol-table nodes, which of these categories they are, and, | |
710 | when available, their source code location, | |
711 | ||
712 | * the GCC pass that emitted the message, and | |
713 | ||
714 | * the location in GCC's own code from which the message was emitted | |
715 | ||
716 | Additionally, some messages are logically nested within other | |
717 | messages, reflecting implementation details of the optimization | |
718 | passes. | |
719 | ||
720 | .. option:: -fsched-verbose={n} | |
721 | ||
722 | On targets that use instruction scheduling, this option controls the | |
723 | amount of debugging output the scheduler prints to the dump files. | |
724 | ||
725 | For :samp:`{n}` greater than zero, :option:`-fsched-verbose` outputs the | |
726 | same information as :option:`-fdump-rtl-sched1` and :option:`-fdump-rtl-sched2`. | |
727 | For :samp:`{n}` greater than one, it also output basic block probabilities, | |
728 | detailed ready list information and unit/insn info. For :samp:`{n}` greater | |
729 | than two, it includes RTL at abort point, control-flow and regions info. | |
730 | And for :samp:`{n}` over four, :option:`-fsched-verbose` also includes | |
731 | dependence info. | |
732 | ||
733 | .. option:: -fenable-kind-pass, -fdisable-kind-pass={range-list} | |
734 | ||
735 | This is a set of options that are used to explicitly disable/enable | |
736 | optimization passes. These options are intended for use for debugging GCC. | |
737 | Compiler users should use regular options for enabling/disabling | |
738 | passes instead. | |
739 | ||
740 | :samp:`-fdisable-ipa-{pass}` | |
741 | Disable IPA pass :samp:`{pass}`. :samp:`{pass}` is the pass name. If the same pass is | |
742 | statically invoked in the compiler multiple times, the pass name should be | |
743 | appended with a sequential number starting from 1. | |
744 | ||
745 | :samp:`-fdisable-rtl-{pass}` :samp:`-fdisable-rtl-{pass}={range-list}` | |
746 | Disable RTL pass :samp:`{pass}`. :samp:`{pass}` is the pass name. If the same pass is | |
747 | statically invoked in the compiler multiple times, the pass name should be | |
748 | appended with a sequential number starting from 1. :samp:`{range-list}` is a | |
749 | comma-separated list of function ranges or assembler names. Each range is a number | |
750 | pair separated by a colon. The range is inclusive in both ends. If the range | |
751 | is trivial, the number pair can be simplified as a single number. If the | |
752 | function's call graph node's :samp:`{uid}` falls within one of the specified ranges, | |
753 | the :samp:`{pass}` is disabled for that function. The :samp:`{uid}` is shown in the | |
754 | function header of a dump file, and the pass names can be dumped by using | |
755 | option :option:`-fdump-passes`. | |
756 | ||
757 | :samp:`-fdisable-tree-{pass}` :samp:`-fdisable-tree-{pass}={range-list}` | |
758 | Disable tree pass :samp:`{pass}`. See :option:`-fdisable-rtl` for the description of | |
759 | option arguments. | |
760 | ||
761 | :samp:`-fenable-ipa-{pass}` | |
762 | Enable IPA pass :samp:`{pass}`. :samp:`{pass}` is the pass name. If the same pass is | |
763 | statically invoked in the compiler multiple times, the pass name should be | |
764 | appended with a sequential number starting from 1. | |
765 | ||
766 | :samp:`-fenable-rtl-{pass}` :samp:`-fenable-rtl-{pass}={range-list}` | |
767 | Enable RTL pass :samp:`{pass}`. See :option:`-fdisable-rtl` for option argument | |
768 | description and examples. | |
769 | ||
770 | :samp:`-fenable-tree-{pass}` :samp:`-fenable-tree-{pass}={range-list}` | |
771 | Enable tree pass :samp:`{pass}`. See :option:`-fdisable-rtl` for the description | |
772 | of option arguments. | |
773 | ||
774 | Here are some examples showing uses of these options. | |
775 | ||
776 | .. code-block:: c++ | |
777 | ||
778 | # disable ccp1 for all functions | |
779 | -fdisable-tree-ccp1 | |
780 | # disable complete unroll for function whose cgraph node uid is 1 | |
781 | -fenable-tree-cunroll=1 | |
782 | # disable gcse2 for functions at the following ranges [1,1], | |
783 | # [300,400], and [400,1000] | |
784 | # disable gcse2 for functions foo and foo2 | |
785 | -fdisable-rtl-gcse2=foo,foo2 | |
786 | # disable early inlining | |
787 | -fdisable-tree-einline | |
788 | # disable ipa inlining | |
789 | -fdisable-ipa-inline | |
790 | # enable tree full unroll | |
791 | -fenable-tree-unroll | |
792 | ||
793 | .. option:: -fchecking, -fchecking={n} | |
794 | ||
795 | Enable internal consistency checking. The default depends on | |
796 | the compiler configuration. :option:`-fchecking=2` enables further | |
797 | internal consistency checking that might affect code generation. | |
798 | ||
799 | .. option:: -fno-checking | |
800 | ||
801 | Default setting; overrides :option:`-fchecking`. | |
802 | ||
803 | .. option:: -frandom-seed={string} | |
804 | ||
805 | This option provides a seed that GCC uses in place of | |
806 | random numbers in generating certain symbol names | |
807 | that have to be different in every compiled file. It is also used to | |
808 | place unique stamps in coverage data files and the object files that | |
809 | produce them. You can use the :option:`-frandom-seed` option to produce | |
810 | reproducibly identical object files. | |
811 | ||
812 | The :samp:`{string}` can either be a number (decimal, octal or hex) or an | |
813 | arbitrary string (in which case it's converted to a number by | |
814 | computing CRC32). | |
815 | ||
816 | The :samp:`{string}` should be different for every file you compile. | |
817 | ||
818 | .. option:: -save-temps | |
819 | ||
820 | Store the usual 'temporary' intermediate files permanently; name them | |
821 | as auxiliary output files, as specified described under | |
822 | :option:`-dumpbase` and :option:`-dumpdir`. | |
823 | ||
824 | When used in combination with the :option:`-x` command-line option, | |
825 | :option:`-save-temps` is sensible enough to avoid overwriting an | |
826 | input source file with the same extension as an intermediate file. | |
827 | The corresponding intermediate file may be obtained by renaming the | |
828 | source file before using :option:`-save-temps`. | |
829 | ||
830 | .. option:: -save-temps=cwd | |
831 | ||
832 | Equivalent to :option:`-save-temps -dumpdir ./`. | |
833 | ||
834 | .. option:: -save-temps=obj | |
835 | ||
836 | Equivalent to :option:`-save-temps -dumpdir outdir/`, where | |
837 | :samp:`outdir/` is the directory of the output file specified after the | |
838 | :option:`-o` option, including any directory separators. If the | |
839 | :option:`-o` option is not used, the :option:`-save-temps=obj` switch | |
840 | behaves like :option:`-save-temps=cwd`. | |
841 | ||
842 | .. option:: -time[={file}] | |
843 | ||
844 | Report the CPU time taken by each subprocess in the compilation | |
845 | sequence. For C source files, this is the compiler proper and assembler | |
846 | (plus the linker if linking is done). | |
847 | ||
848 | Without the specification of an output file, the output looks like this: | |
849 | ||
850 | .. code-block:: c++ | |
851 | ||
852 | # cc1 0.12 0.01 | |
853 | # as 0.00 0.01 | |
854 | ||
855 | The first number on each line is the 'user time', that is time spent | |
856 | executing the program itself. The second number is 'system time', | |
857 | time spent executing operating system routines on behalf of the program. | |
858 | Both numbers are in seconds. | |
859 | ||
860 | With the specification of an output file, the output is appended to the | |
861 | named file, and it looks like this: | |
862 | ||
863 | .. code-block:: c++ | |
864 | ||
865 | 0.12 0.01 cc1 options | |
866 | 0.00 0.01 as options | |
867 | ||
868 | The 'user time' and the 'system time' are moved before the program | |
869 | name, and the options passed to the program are displayed, so that one | |
870 | can later tell what file was being compiled, and with which options. | |
871 | ||
872 | .. option:: -fdump-final-insns[={file}] | |
873 | ||
874 | Dump the final internal representation (RTL) to :samp:`{file}`. If the | |
875 | optional argument is omitted (or if :samp:`{file}` is ``.``), the name | |
876 | of the dump file is determined by appending ``.gkd`` to the | |
877 | dump base name, see :option:`-dumpbase`. | |
878 | ||
879 | .. option:: -fcompare-debug[={opts}] | |
880 | ||
881 | If no error occurs during compilation, run the compiler a second time, | |
882 | adding :samp:`{opts}` and :option:`-fcompare-debug-second` to the arguments | |
883 | passed to the second compilation. Dump the final internal | |
884 | representation in both compilations, and print an error if they differ. | |
885 | ||
886 | If the equal sign is omitted, the default :option:`-gtoggle` is used. | |
887 | ||
888 | The environment variable :envvar:`GCC_COMPARE_DEBUG`, if defined, non-empty | |
889 | and nonzero, implicitly enables :option:`-fcompare-debug`. If | |
890 | :envvar:`GCC_COMPARE_DEBUG` is defined to a string starting with a dash, | |
891 | then it is used for :samp:`{opts}`, otherwise the default :option:`-gtoggle` | |
892 | is used. | |
893 | ||
894 | :option:`-fcompare-debug=`, with the equal sign but without :samp:`{opts}`, | |
895 | is equivalent to :option:`-fno-compare-debug`, which disables the dumping | |
896 | of the final representation and the second compilation, preventing even | |
897 | :envvar:`GCC_COMPARE_DEBUG` from taking effect. | |
898 | ||
899 | To verify full coverage during :option:`-fcompare-debug` testing, set | |
900 | :envvar:`GCC_COMPARE_DEBUG` to say :option:`-fcompare-debug-not-overridden`, | |
901 | which GCC rejects as an invalid option in any actual compilation | |
902 | (rather than preprocessing, assembly or linking). To get just a | |
903 | warning, setting :envvar:`GCC_COMPARE_DEBUG` to :samp:`-w%n-fcompare-debug | |
904 | not overridden` will do. | |
905 | ||
906 | .. option:: -fcompare-debug-second | |
907 | ||
908 | This option is implicitly passed to the compiler for the second | |
909 | compilation requested by :option:`-fcompare-debug`, along with options to | |
910 | silence warnings, and omitting other options that would cause the compiler | |
911 | to produce output to files or to standard output as a side effect. Dump | |
912 | files and preserved temporary files are renamed so as to contain the | |
913 | ``.gk`` additional extension during the second compilation, to avoid | |
914 | overwriting those generated by the first. | |
915 | ||
916 | When this option is passed to the compiler driver, it causes the | |
917 | *first* compilation to be skipped, which makes it useful for little | |
918 | other than debugging the compiler proper. | |
919 | ||
920 | .. option:: -gtoggle | |
921 | ||
922 | Turn off generation of debug info, if leaving out this option | |
923 | generates it, or turn it on at level 2 otherwise. The position of this | |
924 | argument in the command line does not matter; it takes effect after all | |
925 | other options are processed, and it does so only once, no matter how | |
926 | many times it is given. This is mainly intended to be used with | |
927 | :option:`-fcompare-debug`. | |
928 | ||
929 | .. option:: -fvar-tracking-assignments-toggle | |
930 | ||
931 | Toggle :option:`-fvar-tracking-assignments`, in the same way that | |
932 | :option:`-gtoggle` toggles :option:`-g`. | |
933 | ||
934 | .. option:: -fno-var-tracking-assignments-toggle | |
935 | ||
936 | Default setting; overrides :option:`-fvar-tracking-assignments-toggle`. | |
937 | ||
938 | .. option:: -Q | |
939 | ||
940 | Makes the compiler print out each function name as it is compiled, and | |
941 | print some statistics about each pass when it finishes. | |
942 | ||
943 | .. option:: -ftime-report | |
944 | ||
945 | Makes the compiler print some statistics about the time consumed by each | |
946 | pass when it finishes. | |
947 | ||
948 | .. option:: -ftime-report-details | |
949 | ||
950 | Record the time consumed by infrastructure parts separately for each pass. | |
951 | ||
952 | .. option:: -fira-verbose={n} | |
953 | ||
954 | Control the verbosity of the dump file for the integrated register allocator. | |
955 | The default value is 5. If the value :samp:`{n}` is greater or equal to 10, | |
956 | the dump output is sent to stderr using the same format as :samp:`{n}` minus 10. | |
957 | ||
958 | .. option:: -flto-report | |
959 | ||
960 | Prints a report with internal details on the workings of the link-time | |
961 | optimizer. The contents of this report vary from version to version. | |
962 | It is meant to be useful to GCC developers when processing object | |
963 | files in LTO mode (via :option:`-flto`). | |
964 | ||
965 | Disabled by default. | |
966 | ||
967 | .. option:: -flto-report-wpa | |
968 | ||
969 | Like :option:`-flto-report`, but only print for the WPA phase of link-time | |
970 | optimization. | |
971 | ||
972 | .. option:: -fmem-report | |
973 | ||
974 | Makes the compiler print some statistics about permanent memory | |
975 | allocation when it finishes. | |
976 | ||
977 | .. option:: -fmem-report-wpa | |
978 | ||
979 | Makes the compiler print some statistics about permanent memory | |
980 | allocation for the WPA phase only. | |
981 | ||
982 | .. option:: -fpre-ipa-mem-report | |
983 | ||
984 | .. option:: -fpost-ipa-mem-report | |
985 | ||
986 | Makes the compiler print some statistics about permanent memory | |
987 | allocation before or after interprocedural optimization. | |
988 | ||
989 | .. option:: -fmultiflags | |
990 | ||
991 | This option enables multilib-aware ``TFLAGS`` to be used to build | |
992 | target libraries with options different from those the compiler is | |
993 | configured to use by default, through the use of specs (See :ref:`spec-files`) set up by compiler internals, by the target, or by builders at | |
994 | configure time. | |
995 | ||
996 | Like ``TFLAGS``, this allows the target libraries to be built for | |
997 | portable baseline environments, while the compiler defaults to more | |
998 | demanding ones. That's useful because users can easily override the | |
999 | defaults the compiler is configured to use to build their own programs, | |
1000 | if the defaults are not ideal for their target environment, whereas | |
1001 | rebuilding the runtime libraries is usually not as easy or desirable. | |
1002 | ||
1003 | Unlike ``TFLAGS``, the use of specs enables different flags to be | |
1004 | selected for different multilibs. The way to accomplish that is to | |
1005 | build with :samp:`make TFLAGS=-fmultiflags`, after configuring | |
1006 | :samp:`--with-specs=%{fmultiflags:...}`. | |
1007 | ||
1008 | This option is discarded by the driver once it's done processing driver | |
1009 | self spec. | |
1010 | ||
1011 | It is also useful to check that ``TFLAGS`` are being used to build | |
1012 | all target libraries, by configuring a non-bootstrap compiler | |
1013 | :samp:`--with-specs='%{!fmultiflags:%emissing TFLAGS}'` and building | |
1014 | the compiler and target libraries. | |
1015 | ||
1016 | .. option:: -fprofile-report | |
1017 | ||
1018 | Makes the compiler print some statistics about consistency of the | |
1019 | (estimated) profile and effect of individual passes. | |
1020 | ||
1021 | .. option:: -fstack-usage | |
1022 | ||
1023 | Makes the compiler output stack usage information for the program, on a | |
1024 | per-function basis. The filename for the dump is made by appending | |
1025 | :samp:`.su` to the :samp:`{auxname}`. :samp:`{auxname}` is generated from the name of | |
1026 | the output file, if explicitly specified and it is not an executable, | |
1027 | otherwise it is the basename of the source file. An entry is made up | |
1028 | of three fields: | |
1029 | ||
1030 | * The name of the function. | |
1031 | ||
1032 | * A number of bytes. | |
1033 | ||
1034 | * One or more qualifiers: ``static``, ``dynamic``, ``bounded``. | |
1035 | ||
1036 | The qualifier ``static`` means that the function manipulates the stack | |
1037 | statically: a fixed number of bytes are allocated for the frame on function | |
1038 | entry and released on function exit; no stack adjustments are otherwise made | |
1039 | in the function. The second field is this fixed number of bytes. | |
1040 | ||
1041 | The qualifier ``dynamic`` means that the function manipulates the stack | |
1042 | dynamically: in addition to the static allocation described above, stack | |
1043 | adjustments are made in the body of the function, for example to push/pop | |
1044 | arguments around function calls. If the qualifier ``bounded`` is also | |
1045 | present, the amount of these adjustments is bounded at compile time and | |
1046 | the second field is an upper bound of the total amount of stack used by | |
1047 | the function. If it is not present, the amount of these adjustments is | |
1048 | not bounded at compile time and the second field only represents the | |
1049 | bounded part. | |
1050 | ||
1051 | .. option:: -fstats | |
1052 | ||
1053 | Emit statistics about front-end processing at the end of the compilation. | |
1054 | This option is supported only by the C++ front end, and | |
1055 | the information is generally only useful to the G++ development team. | |
1056 | ||
1057 | .. option:: -fdbg-cnt-list | |
1058 | ||
1059 | Print the name and the counter upper bound for all debug counters. | |
1060 | ||
1061 | .. option:: -fdbg-cnt={counter-value-list} | |
1062 | ||
1063 | Set the internal debug counter lower and upper bound. :samp:`{counter-value-list}` | |
1064 | is a comma-separated list of :samp:`{name}:{lower_bound1}-{upper_bound1}` | |
1065 | :samp:`[:{lower_bound2}-{upper_bound2}...]` tuples which sets | |
1066 | the name of the counter and list of closed intervals. | |
1067 | The :samp:`{lower_bound}` is optional and is zero | |
1068 | initialized if not set. | |
1069 | For example, with :option:`-fdbg-cnt=dce:2-4:10-11,tail_call:10`, | |
1070 | ``dbg_cnt(dce)`` returns true only for second, third, fourth, tenth and | |
1071 | eleventh invocation. | |
1072 | For ``dbg_cnt(tail_call)`` true is returned for first 10 invocations. | |
1073 | ||
1074 | .. option:: -print-file-name={library} | |
1075 | ||
1076 | Print the full absolute name of the library file :samp:`{library}` that | |
1077 | would be used when linking---and don't do anything else. With this | |
1078 | option, GCC does not compile or link anything; it just prints the | |
1079 | file name. | |
1080 | ||
1081 | .. option:: -print-multi-directory | |
1082 | ||
1083 | Print the directory name corresponding to the multilib selected by any | |
1084 | other switches present in the command line. This directory is supposed | |
1085 | to exist in :envvar:`GCC_EXEC_PREFIX`. | |
1086 | ||
1087 | .. option:: -print-multi-lib | |
1088 | ||
1089 | Print the mapping from multilib directory names to compiler switches | |
1090 | that enable them. The directory name is separated from the switches by | |
1091 | :samp:`;`, and each switch starts with an :samp:`@` instead of the | |
1092 | :samp:`-`, without spaces between multiple switches. This is supposed to | |
1093 | ease shell processing. | |
1094 | ||
1095 | .. option:: -print-multi-os-directory | |
1096 | ||
1097 | Print the path to OS libraries for the selected | |
1098 | multilib, relative to some :samp:`lib` subdirectory. If OS libraries are | |
1099 | present in the :samp:`lib` subdirectory and no multilibs are used, this is | |
1100 | usually just :samp:`.`, if OS libraries are present in :samp:`lib{suffix}` | |
1101 | sibling directories this prints e.g. :samp:`../lib64`, :samp:`../lib` or | |
1102 | :samp:`../lib32`, or if OS libraries are present in :samp:`lib/{subdir}` | |
1103 | subdirectories it prints e.g. :samp:`amd64`, :samp:`sparcv9` or :samp:`ev6`. | |
1104 | ||
1105 | .. option:: -print-multiarch | |
1106 | ||
1107 | Print the path to OS libraries for the selected multiarch, | |
1108 | relative to some :samp:`lib` subdirectory. | |
1109 | ||
1110 | .. option:: -print-prog-name={program} | |
1111 | ||
1112 | Like :option:`-print-file-name`, but searches for a program such as :command:`cpp`. | |
1113 | ||
1114 | .. option:: -print-libgcc-file-name | |
1115 | ||
1116 | Same as :option:`-print-file-name=libgcc.a`. | |
1117 | ||
1118 | This is useful when you use :option:`-nostdlib` or :option:`-nodefaultlibs` | |
1119 | but you do want to link with :samp:`libgcc.a`. You can do: | |
1120 | ||
1121 | .. code-block:: shell | |
1122 | ||
1123 | gcc -nostdlib files... `gcc -print-libgcc-file-name` | |
1124 | ||
1125 | .. option:: -print-search-dirs | |
1126 | ||
1127 | Print the name of the configured installation directory and a list of | |
1128 | program and library directories :command:`gcc` searches---and don't do anything else. | |
1129 | ||
1130 | This is useful when :command:`gcc` prints the error message | |
1131 | :samp:`installation problem, cannot exec cpp0: No such file or directory`. | |
1132 | To resolve this you either need to put :samp:`cpp0` and the other compiler | |
1133 | components where :command:`gcc` expects to find them, or you can set the environment | |
1134 | variable :envvar:`GCC_EXEC_PREFIX` to the directory where you installed them. | |
1135 | Don't forget the trailing :samp:`/`. | |
1136 | See :ref:`environment-variables`. | |
1137 | ||
1138 | .. option:: -print-sysroot | |
1139 | ||
1140 | Print the target sysroot directory that is used during | |
1141 | compilation. This is the target sysroot specified either at configure | |
1142 | time or using the :option:`--sysroot` option, possibly with an extra | |
1143 | suffix that depends on compilation options. If no target sysroot is | |
1144 | specified, the option prints nothing. | |
1145 | ||
1146 | .. option:: -print-sysroot-headers-suffix | |
1147 | ||
1148 | Print the suffix added to the target sysroot when searching for | |
1149 | headers, or give an error if the compiler is not configured with such | |
1150 | a suffix---and don't do anything else. | |
1151 | ||
1152 | .. option:: -dumpmachine | |
1153 | ||
1154 | Print the compiler's target machine (for example, | |
1155 | :samp:`i686-pc-linux-gnu`)---and don't do anything else. | |
1156 | ||
1157 | .. option:: -dumpversion | |
1158 | ||
1159 | Print the compiler version (for example, ``3.0``, ``6.3.0`` or ``7``)---and don't do | |
1160 | anything else. This is the compiler version used in filesystem paths and | |
1161 | specs. Depending on how the compiler has been configured it can be just | |
1162 | a single number (major version), two numbers separated by a dot (major and | |
1163 | minor version) or three numbers separated by dots (major, minor and patchlevel | |
1164 | version). | |
1165 | ||
1166 | .. option:: -dumpfullversion | |
1167 | ||
1168 | Print the full compiler version---and don't do anything else. The output is | |
1169 | always three numbers separated by dots, major, minor and patchlevel version. | |
1170 | ||
1171 | .. option:: -dumpspecs | |
1172 | ||
1173 | Print the compiler's built-in specs---and don't do anything else. (This | |
3ed1b4ce | 1174 | is used when GCC itself is being built.) See :ref:`spec-files`. |