1 This is gcc.info, produced by makeinfo version 5.2 from gcc.texi. 2 3 Copyright (C) 1988-2013 Free Software Foundation, Inc. 4 5 Permission is granted to copy, distribute and/or modify this document 6 under the terms of the GNU Free Documentation License, Version 1.3 or 7 any later version published by the Free Software Foundation; with the 8 Invariant Sections being "Funding Free Software", the Front-Cover Texts 9 being (a) (see below), and with the Back-Cover Texts being (b) (see 10 below). A copy of the license is included in the section entitled "GNU 11 Free Documentation License". 12 13 (a) The FSF's Front-Cover Text is: 14 15 A GNU Manual 16 17 (b) The FSF's Back-Cover Text is: 18 19 You have freedom to copy and modify this GNU Manual, like GNU software. 20 Copies published by the Free Software Foundation raise funds for GNU 21 development. 22 INFO-DIR-SECTION Software development 23 START-INFO-DIR-ENTRY 24 * gcc: (gcc). The GNU Compiler Collection. 25 * g++: (gcc). The GNU C++ compiler. 26 * gcov: (gcc) Gcov. 'gcov'--a test coverage program. 27 END-INFO-DIR-ENTRY 28 29 This file documents the use of the GNU compilers. 30 31 Copyright (C) 1988-2013 Free Software Foundation, Inc. 32 33 Permission is granted to copy, distribute and/or modify this document 34 under the terms of the GNU Free Documentation License, Version 1.3 or 35 any later version published by the Free Software Foundation; with the 36 Invariant Sections being "Funding Free Software", the Front-Cover Texts 37 being (a) (see below), and with the Back-Cover Texts being (b) (see 38 below). A copy of the license is included in the section entitled "GNU 39 Free Documentation License". 40 41 (a) The FSF's Front-Cover Text is: 42 43 A GNU Manual 44 45 (b) The FSF's Back-Cover Text is: 46 47 You have freedom to copy and modify this GNU Manual, like GNU software. 48 Copies published by the Free Software Foundation raise funds for GNU 49 development. 50 51 52 File: gcc.info, Node: Top, Next: G++ and GCC, Up: (DIR) 53 54 Introduction 55 ************ 56 57 This manual documents how to use the GNU compilers, as well as their 58 features and incompatibilities, and how to report bugs. It corresponds 59 to the compilers (GCC) version 4.8.3. The internals of the GNU 60 compilers, including how to port them to new targets and some 61 information about how to write front ends for new languages, are 62 documented in a separate manual. *Note Introduction: (gccint)Top. 63 64 * Menu: 65 66 * G++ and GCC:: You can compile C or C++ programs. 67 * Standards:: Language standards supported by GCC. 68 * Invoking GCC:: Command options supported by 'gcc'. 69 * C Implementation:: How GCC implements the ISO C specification. 70 * C++ Implementation:: How GCC implements the ISO C++ specification. 71 * C Extensions:: GNU extensions to the C language family. 72 * C++ Extensions:: GNU extensions to the C++ language. 73 * Objective-C:: GNU Objective-C runtime features. 74 * Compatibility:: Binary Compatibility 75 * Gcov:: 'gcov'--a test coverage program. 76 * Trouble:: If you have trouble using GCC. 77 * Bugs:: How, why and where to report bugs. 78 * Service:: How to find suppliers of support for GCC. 79 * Contributing:: How to contribute to testing and developing GCC. 80 81 * Funding:: How to help assure funding for free software. 82 * GNU Project:: The GNU Project and GNU/Linux. 83 84 * Copying:: GNU General Public License says 85 how you can copy and share GCC. 86 * GNU Free Documentation License:: How you can copy and share this manual. 87 * Contributors:: People who have contributed to GCC. 88 89 * Option Index:: Index to command line options. 90 * Keyword Index:: Index of concepts and symbol names. 91 92 93 File: gcc.info, Node: G++ and GCC, Next: Standards, Up: Top 94 95 1 Programming Languages Supported by GCC 96 **************************************** 97 98 GCC stands for "GNU Compiler Collection". GCC is an integrated 99 distribution of compilers for several major programming languages. 100 These languages currently include C, C++, Objective-C, Objective-C++, 101 Java, Fortran, Ada, and Go. 102 103 The abbreviation "GCC" has multiple meanings in common use. The 104 current official meaning is "GNU Compiler Collection", which refers 105 generically to the complete suite of tools. The name historically stood 106 for "GNU C Compiler", and this usage is still common when the emphasis 107 is on compiling C programs. Finally, the name is also used when 108 speaking of the "language-independent" component of GCC: code shared 109 among the compilers for all supported languages. 110 111 The language-independent component of GCC includes the majority of the 112 optimizers, as well as the "back ends" that generate machine code for 113 various processors. 114 115 The part of a compiler that is specific to a particular language is 116 called the "front end". In addition to the front ends that are 117 integrated components of GCC, there are several other front ends that 118 are maintained separately. These support languages such as Pascal, 119 Mercury, and COBOL. To use these, they must be built together with GCC 120 proper. 121 122 Most of the compilers for languages other than C have their own names. 123 The C++ compiler is G++, the Ada compiler is GNAT, and so on. When we 124 talk about compiling one of those languages, we might refer to that 125 compiler by its own name, or as GCC. Either is correct. 126 127 Historically, compilers for many languages, including C++ and Fortran, 128 have been implemented as "preprocessors" which emit another high level 129 language such as C. None of the compilers included in GCC are 130 implemented this way; they all generate machine code directly. This 131 sort of preprocessor should not be confused with the "C preprocessor", 132 which is an integral feature of the C, C++, Objective-C and 133 Objective-C++ languages. 134 135 136 File: gcc.info, Node: Standards, Next: Invoking GCC, Prev: G++ and GCC, Up: Top 137 138 2 Language Standards Supported by GCC 139 ************************************* 140 141 For each language compiled by GCC for which there is a standard, GCC 142 attempts to follow one or more versions of that standard, possibly with 143 some exceptions, and possibly with some extensions. 144 145 2.1 C language 146 ============== 147 148 GCC supports three versions of the C standard, although support for the 149 most recent version is not yet complete. 150 151 The original ANSI C standard (X3.159-1989) was ratified in 1989 and 152 published in 1990. This standard was ratified as an ISO standard 153 (ISO/IEC 9899:1990) later in 1990. There were no technical differences 154 between these publications, although the sections of the ANSI standard 155 were renumbered and became clauses in the ISO standard. This standard, 156 in both its forms, is commonly known as "C89", or occasionally as "C90", 157 from the dates of ratification. The ANSI standard, but not the ISO 158 standard, also came with a Rationale document. To select this standard 159 in GCC, use one of the options '-ansi', '-std=c90' or 160 '-std=iso9899:1990'; to obtain all the diagnostics required by the 161 standard, you should also specify '-pedantic' (or '-pedantic-errors' if 162 you want them to be errors rather than warnings). *Note Options 163 Controlling C Dialect: C Dialect Options. 164 165 Errors in the 1990 ISO C standard were corrected in two Technical 166 Corrigenda published in 1994 and 1996. GCC does not support the 167 uncorrected version. 168 169 An amendment to the 1990 standard was published in 1995. This 170 amendment added digraphs and '__STDC_VERSION__' to the language, but 171 otherwise concerned the library. This amendment is commonly known as 172 "AMD1"; the amended standard is sometimes known as "C94" or "C95". To 173 select this standard in GCC, use the option '-std=iso9899:199409' (with, 174 as for other standard versions, '-pedantic' to receive all required 175 diagnostics). 176 177 A new edition of the ISO C standard was published in 1999 as ISO/IEC 178 9899:1999, and is commonly known as "C99". GCC has incomplete support 179 for this standard version; see <http://gcc.gnu.org/c99status.html> for 180 details. To select this standard, use '-std=c99' or 181 '-std=iso9899:1999'. (While in development, drafts of this standard 182 version were referred to as "C9X".) 183 184 Errors in the 1999 ISO C standard were corrected in three Technical 185 Corrigenda published in 2001, 2004 and 2007. GCC does not support the 186 uncorrected version. 187 188 A fourth version of the C standard, known as "C11", was published in 189 2011 as ISO/IEC 9899:2011. GCC has limited incomplete support for parts 190 of this standard, enabled with '-std=c11' or '-std=iso9899:2011'. 191 (While in development, drafts of this standard version were referred to 192 as "C1X".) 193 194 By default, GCC provides some extensions to the C language that on rare 195 occasions conflict with the C standard. *Note Extensions to the C 196 Language Family: C Extensions. Use of the '-std' options listed above 197 will disable these extensions where they conflict with the C standard 198 version selected. You may also select an extended version of the C 199 language explicitly with '-std=gnu90' (for C90 with GNU extensions), 200 '-std=gnu99' (for C99 with GNU extensions) or '-std=gnu11' (for C11 with 201 GNU extensions). The default, if no C language dialect options are 202 given, is '-std=gnu90'; this will change to '-std=gnu99' or '-std=gnu11' 203 in some future release when the C99 or C11 support is complete. Some 204 features that are part of the C99 standard are accepted as extensions in 205 C90 mode, and some features that are part of the C11 standard are 206 accepted as extensions in C90 and C99 modes. 207 208 The ISO C standard defines (in clause 4) two classes of conforming 209 implementation. A "conforming hosted implementation" supports the whole 210 standard including all the library facilities; a "conforming 211 freestanding implementation" is only required to provide certain library 212 facilities: those in '<float.h>', '<limits.h>', '<stdarg.h>', and 213 '<stddef.h>'; since AMD1, also those in '<iso646.h>'; since C99, also 214 those in '<stdbool.h>' and '<stdint.h>'; and since C11, also those in 215 '<stdalign.h>' and '<stdnoreturn.h>'. In addition, complex types, added 216 in C99, are not required for freestanding implementations. The standard 217 also defines two environments for programs, a "freestanding 218 environment", required of all implementations and which may not have 219 library facilities beyond those required of freestanding 220 implementations, where the handling of program startup and termination 221 are implementation-defined, and a "hosted environment", which is not 222 required, in which all the library facilities are provided and startup 223 is through a function 'int main (void)' or 'int main (int, char *[])'. 224 An OS kernel would be a freestanding environment; a program using the 225 facilities of an operating system would normally be in a hosted 226 implementation. 227 228 GCC aims towards being usable as a conforming freestanding 229 implementation, or as the compiler for a conforming hosted 230 implementation. By default, it will act as the compiler for a hosted 231 implementation, defining '__STDC_HOSTED__' as '1' and presuming that 232 when the names of ISO C functions are used, they have the semantics 233 defined in the standard. To make it act as a conforming freestanding 234 implementation for a freestanding environment, use the option 235 '-ffreestanding'; it will then define '__STDC_HOSTED__' to '0' and not 236 make assumptions about the meanings of function names from the standard 237 library, with exceptions noted below. To build an OS kernel, you may 238 well still need to make your own arrangements for linking and startup. 239 *Note Options Controlling C Dialect: C Dialect Options. 240 241 GCC does not provide the library facilities required only of hosted 242 implementations, nor yet all the facilities required by C99 of 243 freestanding implementations; to use the facilities of a hosted 244 environment, you will need to find them elsewhere (for example, in the 245 GNU C library). *Note Standard Libraries: Standard Libraries. 246 247 Most of the compiler support routines used by GCC are present in 248 'libgcc', but there are a few exceptions. GCC requires the freestanding 249 environment provide 'memcpy', 'memmove', 'memset' and 'memcmp'. 250 Finally, if '__builtin_trap' is used, and the target does not implement 251 the 'trap' pattern, then GCC will emit a call to 'abort'. 252 253 For references to Technical Corrigenda, Rationale documents and 254 information concerning the history of C that is available online, see 255 <http://gcc.gnu.org/readings.html> 256 257 2.2 C++ language 258 ================ 259 260 GCC supports the original ISO C++ standard (1998) and contains 261 experimental support for the second ISO C++ standard (2011). 262 263 The original ISO C++ standard was published as the ISO standard 264 (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 265 2003 (ISO/IEC 14882:2003). These standards are referred to as C++98 and 266 C++03, respectively. GCC implements the majority of C++98 ('export' is 267 a notable exception) and most of the changes in C++03. To select this 268 standard in GCC, use one of the options '-ansi', '-std=c++98', or 269 '-std=c++03'; to obtain all the diagnostics required by the standard, 270 you should also specify '-pedantic' (or '-pedantic-errors' if you want 271 them to be errors rather than warnings). 272 273 A revised ISO C++ standard was published in 2011 as ISO/IEC 14882:2011, 274 and is referred to as C++11; before its publication it was commonly 275 referred to as C++0x. C++11 contains several changes to the C++ 276 language, most of which have been implemented in an experimental C++11 277 mode in GCC. For information regarding the C++11 features available in 278 the experimental C++11 mode, see 279 <http://gcc.gnu.org/projects/cxx0x.html>. To select this standard in 280 GCC, use the option '-std=c++11'; to obtain all the diagnostics required 281 by the standard, you should also specify '-pedantic' (or 282 '-pedantic-errors' if you want them to be errors rather than warnings). 283 284 More information about the C++ standards is available on the ISO C++ 285 committee's web site at <http://www.open-std.org/jtc1/sc22/wg21/>. 286 287 By default, GCC provides some extensions to the C++ language; *Note 288 Options Controlling C++ Dialect: C++ Dialect Options. Use of the '-std' 289 option listed above will disable these extensions. You may also select 290 an extended version of the C++ language explicitly with '-std=gnu++98' 291 (for C++98 with GNU extensions) or '-std=gnu++11' (for C++11 with GNU 292 extensions). The default, if no C++ language dialect options are given, 293 is '-std=gnu++98'. 294 295 2.3 Objective-C and Objective-C++ languages 296 =========================================== 297 298 GCC supports "traditional" Objective-C (also known as "Objective-C 1.0") 299 and contains support for the Objective-C exception and synchronization 300 syntax. It has also support for a number of "Objective-C 2.0" language 301 extensions, including properties, fast enumeration (only for 302 Objective-C), method attributes and the @optional and @required keywords 303 in protocols. GCC supports Objective-C++ and features available in 304 Objective-C are also available in Objective-C++. 305 306 GCC by default uses the GNU Objective-C runtime library, which is part 307 of GCC and is not the same as the Apple/NeXT Objective-C runtime library 308 used on Apple systems. There are a number of differences documented in 309 this manual. The options '-fgnu-runtime' and '-fnext-runtime' allow you 310 to switch between producing output that works with the GNU Objective-C 311 runtime library and output that works with the Apple/NeXT Objective-C 312 runtime library. 313 314 There is no formal written standard for Objective-C or Objective-C++. 315 The authoritative manual on traditional Objective-C (1.0) is 316 "Object-Oriented Programming and the Objective-C Language", available at 317 a number of web sites: 318 * <http://www.gnustep.org/resources/documentation/ObjectivCBook.pdf> 319 is the original NeXTstep document; 320 * <http://objc.toodarkpark.net> is the same document in another 321 format; 322 * 323 <http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/> 324 has an updated version but make sure you search for "Object 325 Oriented Programming and the Objective-C Programming Language 1.0", 326 not documentation on the newer "Objective-C 2.0" language 327 328 The Objective-C exception and synchronization syntax (that is, the 329 keywords @try, @throw, @catch, @finally and @synchronized) is supported 330 by GCC and is enabled with the option '-fobjc-exceptions'. The syntax 331 is briefly documented in this manual and in the Objective-C 2.0 manuals 332 from Apple. 333 334 The Objective-C 2.0 language extensions and features are automatically 335 enabled; they include properties (via the @property, @synthesize and 336 @dynamic keywords), fast enumeration (not available in Objective-C++), 337 attributes for methods (such as deprecated, noreturn, sentinel, format), 338 the unused attribute for method arguments, the @package keyword for 339 instance variables and the @optional and @required keywords in 340 protocols. You can disable all these Objective-C 2.0 language 341 extensions with the option '-fobjc-std=objc1', which causes the compiler 342 to recognize the same Objective-C language syntax recognized by GCC 4.0, 343 and to produce an error if one of the new features is used. 344 345 GCC has currently no support for non-fragile instance variables. 346 347 The authoritative manual on Objective-C 2.0 is available from Apple: 348 * 349 <http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/> 350 351 For more information concerning the history of Objective-C that is 352 available online, see <http://gcc.gnu.org/readings.html> 353 354 2.4 Go language 355 =============== 356 357 As of the GCC 4.7.1 release, GCC supports the Go 1 language standard, 358 described at <http://golang.org/doc/go1.html>. 359 360 2.5 References for other languages 361 ================================== 362 363 *Note GNAT Reference Manual: (gnat_rm)Top, for information on standard 364 conformance and compatibility of the Ada compiler. 365 366 *Note Standards: (gfortran)Standards, for details of standards 367 supported by GNU Fortran. 368 369 *Note Compatibility with the Java Platform: (gcj)Compatibility, for 370 details of compatibility between 'gcj' and the Java Platform. 371 372 373 File: gcc.info, Node: Invoking GCC, Next: C Implementation, Prev: Standards, Up: Top 374 375 3 GCC Command Options 376 ********************* 377 378 When you invoke GCC, it normally does preprocessing, compilation, 379 assembly and linking. The "overall options" allow you to stop this 380 process at an intermediate stage. For example, the '-c' option says not 381 to run the linker. Then the output consists of object files output by 382 the assembler. 383 384 Other options are passed on to one stage of processing. Some options 385 control the preprocessor and others the compiler itself. Yet other 386 options control the assembler and linker; most of these are not 387 documented here, since you rarely need to use any of them. 388 389 Most of the command-line options that you can use with GCC are useful 390 for C programs; when an option is only useful with another language 391 (usually C++), the explanation says so explicitly. If the description 392 for a particular option does not mention a source language, you can use 393 that option with all supported languages. 394 395 *Note Compiling C++ Programs: Invoking G++, for a summary of special 396 options for compiling C++ programs. 397 398 The 'gcc' program accepts options and file names as operands. Many 399 options have multi-letter names; therefore multiple single-letter 400 options may _not_ be grouped: '-dv' is very different from '-d -v'. 401 402 You can mix options and other arguments. For the most part, the order 403 you use doesn't matter. Order does matter when you use several options 404 of the same kind; for example, if you specify '-L' more than once, the 405 directories are searched in the order specified. Also, the placement of 406 the '-l' option is significant. 407 408 Many options have long names starting with '-f' or with '-W'--for 409 example, '-fmove-loop-invariants', '-Wformat' and so on. Most of these 410 have both positive and negative forms; the negative form of '-ffoo' is 411 '-fno-foo'. This manual documents only one of these two forms, 412 whichever one is not the default. 413 414 *Note Option Index::, for an index to GCC's options. 415 416 * Menu: 417 418 * Option Summary:: Brief list of all options, without explanations. 419 * Overall Options:: Controlling the kind of output: 420 an executable, object files, assembler files, 421 or preprocessed source. 422 * Invoking G++:: Compiling C++ programs. 423 * C Dialect Options:: Controlling the variant of C language compiled. 424 * C++ Dialect Options:: Variations on C++. 425 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C 426 and Objective-C++. 427 * Language Independent Options:: Controlling how diagnostics should be 428 formatted. 429 * Warning Options:: How picky should the compiler be? 430 * Debugging Options:: Symbol tables, measurements, and debugging dumps. 431 * Optimize Options:: How much optimization? 432 * Preprocessor Options:: Controlling header files and macro definitions. 433 Also, getting dependency information for Make. 434 * Assembler Options:: Passing options to the assembler. 435 * Link Options:: Specifying libraries and so on. 436 * Directory Options:: Where to find header files and libraries. 437 Where to find the compiler executable files. 438 * Spec Files:: How to pass switches to sub-processes. 439 * Target Options:: Running a cross-compiler, or an old version of GCC. 440 * Submodel Options:: Specifying minor hardware or convention variations, 441 such as 68010 vs 68020. 442 * Code Gen Options:: Specifying conventions for function calls, data layout 443 and register usage. 444 * Environment Variables:: Env vars that affect GCC. 445 * Precompiled Headers:: Compiling a header once, and using it many times. 446 447 448 File: gcc.info, Node: Option Summary, Next: Overall Options, Up: Invoking GCC 449 450 3.1 Option Summary 451 ================== 452 453 Here is a summary of all the options, grouped by type. Explanations are 454 in the following sections. 455 456 _Overall Options_ 457 *Note Options Controlling the Kind of Output: Overall Options. 458 -c -S -E -o FILE -no-canonical-prefixes 459 -pipe -pass-exit-codes 460 -x LANGUAGE -v -### --help[=CLASS[,...]] --target-help 461 --version -wrapper @FILE -fplugin=FILE -fplugin-arg-NAME=ARG 462 -fdump-ada-spec[-slim] -fada-spec-parent=UNIT -fdump-go-spec=FILE 463 464 _C Language Options_ 465 *Note Options Controlling C Dialect: C Dialect Options. 466 -ansi -std=STANDARD -fgnu89-inline 467 -aux-info FILENAME -fallow-parameterless-variadic-functions 468 -fno-asm -fno-builtin -fno-builtin-FUNCTION 469 -fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions 470 -trigraphs -traditional -traditional-cpp 471 -fallow-single-precision -fcond-mismatch -flax-vector-conversions 472 -fsigned-bitfields -fsigned-char 473 -funsigned-bitfields -funsigned-char 474 475 _C++ Language Options_ 476 *Note Options Controlling C++ Dialect: C++ Dialect Options. 477 -fabi-version=N -fno-access-control -fcheck-new 478 -fconstexpr-depth=N -ffriend-injection 479 -fno-elide-constructors 480 -fno-enforce-eh-specs 481 -ffor-scope -fno-for-scope -fno-gnu-keywords 482 -fno-implicit-templates 483 -fno-implicit-inline-templates 484 -fno-implement-inlines -fms-extensions 485 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names 486 -fno-optional-diags -fpermissive 487 -fno-pretty-templates 488 -frepo -fno-rtti -fstats -ftemplate-backtrace-limit=N 489 -ftemplate-depth=N 490 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ 491 -fno-default-inline -fvisibility-inlines-hidden 492 -fvisibility-ms-compat 493 -fext-numeric-literals 494 -Wabi -Wconversion-null -Wctor-dtor-privacy 495 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing 496 -Wnoexcept -Wnon-virtual-dtor -Wreorder 497 -Weffc++ -Wstrict-null-sentinel 498 -Wno-non-template-friend -Wold-style-cast 499 -Woverloaded-virtual -Wno-pmf-conversions 500 -Wsign-promo 501 502 _Objective-C and Objective-C++ Language Options_ 503 *Note Options Controlling Objective-C and Objective-C++ Dialects: 504 Objective-C and Objective-C++ Dialect Options. 505 -fconstant-string-class=CLASS-NAME 506 -fgnu-runtime -fnext-runtime 507 -fno-nil-receivers 508 -fobjc-abi-version=N 509 -fobjc-call-cxx-cdtors 510 -fobjc-direct-dispatch 511 -fobjc-exceptions 512 -fobjc-gc 513 -fobjc-nilcheck 514 -fobjc-std=objc1 515 -freplace-objc-classes 516 -fzero-link 517 -gen-decls 518 -Wassign-intercept 519 -Wno-protocol -Wselector 520 -Wstrict-selector-match 521 -Wundeclared-selector 522 523 _Language Independent Options_ 524 *Note Options to Control Diagnostic Messages Formatting: Language 525 Independent Options. 526 -fmessage-length=N 527 -fdiagnostics-show-location=[once|every-line] 528 -fno-diagnostics-show-option -fno-diagnostics-show-caret 529 530 _Warning Options_ 531 *Note Options to Request or Suppress Warnings: Warning Options. 532 -fsyntax-only -fmax-errors=N -Wpedantic 533 -pedantic-errors 534 -w -Wextra -Wall -Waddress -Waggregate-return 535 -Waggressive-loop-optimizations -Warray-bounds 536 -Wno-attributes -Wno-builtin-macro-redefined 537 -Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual 538 -Wchar-subscripts -Wclobbered -Wcomment 539 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated 540 -Wno-deprecated-declarations -Wdisabled-optimization 541 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare 542 -Wno-endif-labels -Werror -Werror=* 543 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 544 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral 545 -Wformat-security -Wformat-y2k 546 -Wframe-larger-than=LEN -Wno-free-nonheap-object -Wjump-misses-init 547 -Wignored-qualifiers 548 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int 549 -Winit-self -Winline -Wmaybe-uninitialized 550 -Wno-int-to-pointer-cast -Wno-invalid-offsetof 551 -Winvalid-pch -Wlarger-than=LEN -Wunsafe-loop-optimizations 552 -Wlogical-op -Wlong-long 553 -Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-field-initializers 554 -Wmissing-include-dirs 555 -Wno-mudflap 556 -Wno-multichar -Wnonnull -Wno-overflow 557 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded 558 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format 559 -Wpointer-arith -Wno-pointer-to-int-cast 560 -Wredundant-decls -Wno-return-local-addr 561 -Wreturn-type -Wsequence-point -Wshadow 562 -Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess 563 -Wstack-protector -Wstack-usage=LEN -Wstrict-aliasing 564 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=N 565 -Wsuggest-attribute=[pure|const|noreturn|format] 566 -Wmissing-format-attribute 567 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand 568 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef 569 -Wuninitialized -Wunknown-pragmas -Wno-pragmas 570 -Wunsuffixed-float-constants -Wunused -Wunused-function 571 -Wunused-label -Wunused-local-typedefs -Wunused-parameter 572 -Wno-unused-result -Wunused-value -Wunused-variable 573 -Wunused-but-set-parameter -Wunused-but-set-variable 574 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance 575 -Wvla -Wvolatile-register-var -Wwrite-strings -Wzero-as-null-pointer-constant 576 577 _C and Objective-C-only Warning Options_ 578 -Wbad-function-cast -Wmissing-declarations 579 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs 580 -Wold-style-declaration -Wold-style-definition 581 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion 582 -Wdeclaration-after-statement -Wpointer-sign 583 584 _Debugging Options_ 585 *Note Options for Debugging Your Program or GCC: Debugging Options. 586 -dLETTERS -dumpspecs -dumpmachine -dumpversion 587 -fsanitize=STYLE 588 -fdbg-cnt-list -fdbg-cnt=COUNTER-VALUE-LIST 589 -fdisable-ipa-PASS_NAME 590 -fdisable-rtl-PASS_NAME 591 -fdisable-rtl-PASS-NAME=RANGE-LIST 592 -fdisable-tree-PASS_NAME 593 -fdisable-tree-PASS-NAME=RANGE-LIST 594 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links 595 -fdump-translation-unit[-N] 596 -fdump-class-hierarchy[-N] 597 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline 598 -fdump-passes 599 -fdump-statistics 600 -fdump-tree-all 601 -fdump-tree-original[-N] 602 -fdump-tree-optimized[-N] 603 -fdump-tree-cfg -fdump-tree-alias 604 -fdump-tree-ch 605 -fdump-tree-ssa[-N] -fdump-tree-pre[-N] 606 -fdump-tree-ccp[-N] -fdump-tree-dce[-N] 607 -fdump-tree-gimple[-raw] -fdump-tree-mudflap[-N] 608 -fdump-tree-dom[-N] 609 -fdump-tree-dse[-N] 610 -fdump-tree-phiprop[-N] 611 -fdump-tree-phiopt[-N] 612 -fdump-tree-forwprop[-N] 613 -fdump-tree-copyrename[-N] 614 -fdump-tree-nrv -fdump-tree-vect 615 -fdump-tree-sink 616 -fdump-tree-sra[-N] 617 -fdump-tree-forwprop[-N] 618 -fdump-tree-fre[-N] 619 -fdump-tree-vrp[-N] 620 -ftree-vectorizer-verbose=N 621 -fdump-tree-storeccp[-N] 622 -fdump-final-insns=FILE 623 -fcompare-debug[=OPTS] -fcompare-debug-second 624 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types 625 -feliminate-unused-debug-symbols -femit-class-debug-always 626 -fenable-KIND-PASS 627 -fenable-KIND-PASS=RANGE-LIST 628 -fdebug-types-section -fmem-report-wpa 629 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs 630 -fopt-info 631 -fopt-info-OPTIONS[=FILE] 632 -frandom-seed=STRING -fsched-verbose=N 633 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose 634 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking 635 -fvar-tracking-assignments -fvar-tracking-assignments-toggle 636 -g -gLEVEL -gtoggle -gcoff -gdwarf-VERSION 637 -ggdb -grecord-gcc-switches -gno-record-gcc-switches 638 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf 639 -gvms -gxcoff -gxcoff+ 640 -fno-merge-debug-strings -fno-dwarf2-cfi-asm 641 -fdebug-prefix-map=OLD=NEW 642 -femit-struct-debug-baseonly -femit-struct-debug-reduced 643 -femit-struct-debug-detailed[=SPEC-LIST] 644 -p -pg -print-file-name=LIBRARY -print-libgcc-file-name 645 -print-multi-directory -print-multi-lib -print-multi-os-directory 646 -print-prog-name=PROGRAM -print-search-dirs -Q 647 -print-sysroot -print-sysroot-headers-suffix 648 -save-temps -save-temps=cwd -save-temps=obj -time[=FILE] 649 650 _Optimization Options_ 651 *Note Options that Control Optimization: Optimize Options. 652 -faggressive-loop-optimizations -falign-functions[=N] 653 -falign-jumps[=N] 654 -falign-labels[=N] -falign-loops[=N] 655 -fassociative-math -fauto-inc-dec -fbranch-probabilities 656 -fbranch-target-load-optimize -fbranch-target-load-optimize2 657 -fbtr-bb-exclusive -fcaller-saves 658 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack 659 -fcompare-elim -fcprop-registers -fcrossjumping 660 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules 661 -fcx-limited-range 662 -fdata-sections -fdce -fdelayed-branch 663 -fdelete-null-pointer-checks -fdevirtualize -fdse 664 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects 665 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=STYLE 666 -fforward-propagate -ffp-contract=STYLE -ffunction-sections 667 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity 668 -fgcse-sm -fhoist-adjacent-loads -fif-conversion 669 -fif-conversion2 -findirect-inlining 670 -finline-functions -finline-functions-called-once -finline-limit=N 671 -finline-small-functions -fipa-cp -fipa-cp-clone 672 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference 673 -fira-algorithm=ALGORITHM 674 -fira-region=REGION -fira-hoist-pressure 675 -fira-loop-pressure -fno-ira-share-save-slots 676 -fno-ira-share-spill-slots -fira-verbose=N 677 -fivopts -fkeep-inline-functions -fkeep-static-consts 678 -floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize 679 -floop-parallelize-all -flto -flto-compression-level 680 -flto-partition=ALG -flto-report -fmerge-all-constants 681 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves 682 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg 683 -fno-default-inline 684 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability 685 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 686 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros 687 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss 688 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls 689 -fpartial-inlining -fpeel-loops -fpredictive-commoning 690 -fprefetch-loop-arrays -fprofile-report 691 -fprofile-correction -fprofile-dir=PATH -fprofile-generate 692 -fprofile-generate=PATH 693 -fprofile-use -fprofile-use=PATH -fprofile-values 694 -freciprocal-math -free -fregmove -frename-registers -freorder-blocks 695 -freorder-blocks-and-partition -freorder-functions 696 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops 697 -frounding-math -fsched2-use-superblocks -fsched-pressure 698 -fsched-spec-load -fsched-spec-load-dangerous 699 -fsched-stalled-insns-dep[=N] -fsched-stalled-insns[=N] 700 -fsched-group-heuristic -fsched-critical-path-heuristic 701 -fsched-spec-insn-heuristic -fsched-rank-heuristic 702 -fsched-last-insn-heuristic -fsched-dep-count-heuristic 703 -fschedule-insns -fschedule-insns2 -fsection-anchors 704 -fselective-scheduling -fselective-scheduling2 705 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops 706 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant 707 -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector 708 -fstack-protector-all -fstrict-aliasing -fstrict-overflow 709 -fthread-jumps -ftracer -ftree-bit-ccp 710 -ftree-builtin-call-dce -ftree-ccp -ftree-ch 711 -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop 712 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse 713 -ftree-forwprop -ftree-fre -ftree-loop-if-convert 714 -ftree-loop-if-convert-stores -ftree-loop-im 715 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns 716 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize 717 -ftree-parallelize-loops=N -ftree-pre -ftree-partial-pre -ftree-pta 718 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra 719 -ftree-switch-conversion -ftree-tail-merge 720 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp 721 -funit-at-a-time -funroll-all-loops -funroll-loops 722 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops 723 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb 724 -fwhole-program -fwpa -fuse-ld=LINKER -fuse-linker-plugin 725 --param NAME=VALUE 726 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og 727 728 _Preprocessor Options_ 729 *Note Options Controlling the Preprocessor: Preprocessor Options. 730 -AQUESTION=ANSWER 731 -A-QUESTION[=ANSWER] 732 -C -dD -dI -dM -dN 733 -DMACRO[=DEFN] -E -H 734 -idirafter DIR 735 -include FILE -imacros FILE 736 -iprefix FILE -iwithprefix DIR 737 -iwithprefixbefore DIR -isystem DIR 738 -imultilib DIR -isysroot DIR 739 -M -MM -MF -MG -MP -MQ -MT -nostdinc 740 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory 741 -remap -trigraphs -undef -UMACRO 742 -Wp,OPTION -Xpreprocessor OPTION -no-integrated-cpp 743 744 _Assembler Option_ 745 *Note Passing Options to the Assembler: Assembler Options. 746 -Wa,OPTION -Xassembler OPTION 747 748 _Linker Options_ 749 *Note Options for Linking: Link Options. 750 OBJECT-FILE-NAME -lLIBRARY 751 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic 752 -s -static -static-libgcc -static-libstdc++ 753 -static-libasan -static-libtsan 754 -shared -shared-libgcc -symbolic 755 -T SCRIPT -Wl,OPTION -Xlinker OPTION 756 -u SYMBOL 757 758 _Directory Options_ 759 *Note Options for Directory Search: Directory Options. 760 -BPREFIX -IDIR -iplugindir=DIR 761 -iquoteDIR -LDIR -specs=FILE -I- 762 --sysroot=DIR --no-sysroot-suffix 763 764 _Machine Dependent Options_ 765 *Note Hardware Models and Configurations: Submodel Options. 766 767 _AArch64 Options_ 768 -mbig-endian -mlittle-endian 769 -mgeneral-regs-only 770 -mcmodel=tiny -mcmodel=small -mcmodel=large 771 -mstrict-align 772 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer 773 -mtls-dialect=desc -mtls-dialect=traditional 774 -march=NAME -mcpu=NAME -mtune=NAME 775 776 _Adapteva Epiphany Options_ 777 -mhalf-reg-file -mprefer-short-insn-regs 778 -mbranch-cost=NUM -mcmove -mnops=NUM -msoft-cmpsf 779 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=NUM 780 -mround-nearest -mlong-calls -mshort-calls -msmall16 781 -mfp-mode=MODE -mvect-double -max-vect-align=NUM 782 -msplit-vecmove-early -m1reg-REG 783 784 _ARM Options_ 785 -mapcs-frame -mno-apcs-frame 786 -mabi=NAME 787 -mapcs-stack-check -mno-apcs-stack-check 788 -mapcs-float -mno-apcs-float 789 -mapcs-reentrant -mno-apcs-reentrant 790 -msched-prolog -mno-sched-prolog 791 -mlittle-endian -mbig-endian -mwords-little-endian 792 -mfloat-abi=NAME 793 -mfp16-format=NAME 794 -mthumb-interwork -mno-thumb-interwork 795 -mcpu=NAME -march=NAME -mfpu=NAME 796 -mstructure-size-boundary=N 797 -mabort-on-noreturn 798 -mlong-calls -mno-long-calls 799 -msingle-pic-base -mno-single-pic-base 800 -mpic-register=REG 801 -mnop-fun-dllimport 802 -mpoke-function-name 803 -mthumb -marm 804 -mtpcs-frame -mtpcs-leaf-frame 805 -mcaller-super-interworking -mcallee-super-interworking 806 -mtp=NAME -mtls-dialect=DIALECT 807 -mword-relocations 808 -mfix-cortex-m3-ldrd 809 -munaligned-access 810 811 _AVR Options_ 812 -mmcu=MCU -maccumulate-args -mbranch-cost=COST 813 -mcall-prologues -mint8 -mno-interrupts -mrelax 814 -mstrict-X -mtiny-stack -Waddr-space-convert 815 816 _Blackfin Options_ 817 -mcpu=CPU[-SIREVISION] 818 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer 819 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly 820 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library 821 -mno-id-shared-library -mshared-library-id=N 822 -mleaf-id-shared-library -mno-leaf-id-shared-library 823 -msep-data -mno-sep-data -mlong-calls -mno-long-calls 824 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram 825 -micplb 826 827 _C6X Options_ 828 -mbig-endian -mlittle-endian -march=CPU 829 -msim -msdata=SDATA-TYPE 830 831 _CRIS Options_ 832 -mcpu=CPU -march=CPU -mtune=CPU 833 -mmax-stack-frame=N -melinux-stacksize=N 834 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects 835 -mstack-align -mdata-align -mconst-align 836 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt 837 -melf -maout -melinux -mlinux -sim -sim2 838 -mmul-bug-workaround -mno-mul-bug-workaround 839 840 _CR16 Options_ 841 -mmac 842 -mcr16cplus -mcr16c 843 -msim -mint32 -mbit-ops 844 -mdata-model=MODEL 845 846 _Darwin Options_ 847 -all_load -allowable_client -arch -arch_errors_fatal 848 -arch_only -bind_at_load -bundle -bundle_loader 849 -client_name -compatibility_version -current_version 850 -dead_strip 851 -dependency-file -dylib_file -dylinker_install_name 852 -dynamic -dynamiclib -exported_symbols_list 853 -filelist -flat_namespace -force_cpusubtype_ALL 854 -force_flat_namespace -headerpad_max_install_names 855 -iframework 856 -image_base -init -install_name -keep_private_externs 857 -multi_module -multiply_defined -multiply_defined_unused 858 -noall_load -no_dead_strip_inits_and_terms 859 -nofixprebinding -nomultidefs -noprebind -noseglinkedit 860 -pagezero_size -prebind -prebind_all_twolevel_modules 861 -private_bundle -read_only_relocs -sectalign 862 -sectobjectsymbols -whyload -seg1addr 863 -sectcreate -sectobjectsymbols -sectorder 864 -segaddr -segs_read_only_addr -segs_read_write_addr 865 -seg_addr_table -seg_addr_table_filename -seglinkedit 866 -segprot -segs_read_only_addr -segs_read_write_addr 867 -single_module -static -sub_library -sub_umbrella 868 -twolevel_namespace -umbrella -undefined 869 -unexported_symbols_list -weak_reference_mismatches 870 -whatsloaded -F -gused -gfull -mmacosx-version-min=VERSION 871 -mkernel -mone-byte-bool 872 873 _DEC Alpha Options_ 874 -mno-fp-regs -msoft-float 875 -mieee -mieee-with-inexact -mieee-conformant 876 -mfp-trap-mode=MODE -mfp-rounding-mode=MODE 877 -mtrap-precision=MODE -mbuild-constants 878 -mcpu=CPU-TYPE -mtune=CPU-TYPE 879 -mbwx -mmax -mfix -mcix 880 -mfloat-vax -mfloat-ieee 881 -mexplicit-relocs -msmall-data -mlarge-data 882 -msmall-text -mlarge-text 883 -mmemory-latency=TIME 884 885 _FR30 Options_ 886 -msmall-model -mno-lsim 887 888 _FRV Options_ 889 -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 890 -mhard-float -msoft-float 891 -malloc-cc -mfixed-cc -mdword -mno-dword 892 -mdouble -mno-double 893 -mmedia -mno-media -mmuladd -mno-muladd 894 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic 895 -mlinked-fp -mlong-calls -malign-labels 896 -mlibrary-pic -macc-4 -macc-8 897 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move 898 -moptimize-membar -mno-optimize-membar 899 -mscc -mno-scc -mcond-exec -mno-cond-exec 900 -mvliw-branch -mno-vliw-branch 901 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec 902 -mno-nested-cond-exec -mtomcat-stats 903 -mTLS -mtls 904 -mcpu=CPU 905 906 _GNU/Linux Options_ 907 -mglibc -muclibc -mbionic -mandroid 908 -tno-android-cc -tno-android-ld 909 910 _H8/300 Options_ 911 -mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300 912 913 _HPPA Options_ 914 -march=ARCHITECTURE-TYPE 915 -mbig-switch -mdisable-fpregs -mdisable-indexing 916 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld 917 -mfixed-range=REGISTER-RANGE 918 -mjump-in-delay -mlinker-opt -mlong-calls 919 -mlong-load-store -mno-big-switch -mno-disable-fpregs 920 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas 921 -mno-jump-in-delay -mno-long-load-store 922 -mno-portable-runtime -mno-soft-float 923 -mno-space-regs -msoft-float -mpa-risc-1-0 924 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime 925 -mschedule=CPU-TYPE -mspace-regs -msio -mwsio 926 -munix=UNIX-STD -nolibdld -static -threads 927 928 _i386 and x86-64 Options_ 929 -mtune=CPU-TYPE -march=CPU-TYPE 930 -mfpmath=UNIT 931 -masm=DIALECT -mno-fancy-math-387 932 -mno-fp-ret-in-387 -msoft-float 933 -mno-wide-multiply -mrtd -malign-double 934 -mpreferred-stack-boundary=NUM 935 -mincoming-stack-boundary=NUM 936 -mcld -mcx16 -msahf -mmovbe -mcrc32 937 -mrecip -mrecip=OPT 938 -mvzeroupper -mprefer-avx128 939 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx 940 -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma 941 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt 942 -mbmi2 -mrtm -mlwp -mthreads 943 -mno-align-stringops -minline-all-stringops 944 -minline-stringops-dynamically -mstringop-strategy=ALG 945 -mpush-args -maccumulate-outgoing-args -m128bit-long-double 946 -m96bit-long-double -mlong-double-64 -mlong-double-80 947 -mregparm=NUM -msseregparm 948 -mveclibabi=TYPE -mvect8-ret-in-mem 949 -mpc32 -mpc64 -mpc80 -mstackrealign 950 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs 951 -mcmodel=CODE-MODEL -mabi=NAME -maddress-mode=MODE 952 -m32 -m64 -mx32 -mlarge-data-threshold=NUM 953 -msse2avx -mfentry -m8bit-idiv 954 -mavx256-split-unaligned-load -mavx256-split-unaligned-store 955 956 _i386 and x86-64 Windows Options_ 957 -mconsole -mcygwin -mno-cygwin -mdll 958 -mnop-fun-dllimport -mthread 959 -municode -mwin32 -mwindows -fno-set-stack-executable 960 961 _IA-64 Options_ 962 -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic 963 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata 964 -mconstant-gp -mauto-pic -mfused-madd 965 -minline-float-divide-min-latency 966 -minline-float-divide-max-throughput 967 -mno-inline-float-divide 968 -minline-int-divide-min-latency 969 -minline-int-divide-max-throughput 970 -mno-inline-int-divide 971 -minline-sqrt-min-latency -minline-sqrt-max-throughput 972 -mno-inline-sqrt 973 -mdwarf2-asm -mearly-stop-bits 974 -mfixed-range=REGISTER-RANGE -mtls-size=TLS-SIZE 975 -mtune=CPU-TYPE -milp32 -mlp64 976 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec 977 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec 978 -msched-spec-ldc -msched-spec-control-ldc 979 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns 980 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path 981 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost 982 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=MAX-INSNS 983 984 _LM32 Options_ 985 -mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled 986 -msign-extend-enabled -muser-enabled 987 988 _M32R/D Options_ 989 -m32r2 -m32rx -m32r 990 -mdebug 991 -malign-loops -mno-align-loops 992 -missue-rate=NUMBER 993 -mbranch-cost=NUMBER 994 -mmodel=CODE-SIZE-MODEL-TYPE 995 -msdata=SDATA-TYPE 996 -mno-flush-func -mflush-func=NAME 997 -mno-flush-trap -mflush-trap=NUMBER 998 -G NUM 999 1000 _M32C Options_ 1001 -mcpu=CPU -msim -memregs=NUMBER 1002 1003 _M680x0 Options_ 1004 -march=ARCH -mcpu=CPU -mtune=TUNE 1005 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 1006 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 1007 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 1008 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort 1009 -mno-short -mhard-float -m68881 -msoft-float -mpcrel 1010 -malign-int -mstrict-align -msep-data -mno-sep-data 1011 -mshared-library-id=n -mid-shared-library -mno-id-shared-library 1012 -mxgot -mno-xgot 1013 1014 _MCore Options_ 1015 -mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates 1016 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields 1017 -m4byte-functions -mno-4byte-functions -mcallgraph-data 1018 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim 1019 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment 1020 1021 _MeP Options_ 1022 -mabsdiff -mall-opts -maverage -mbased=N -mbitops 1023 -mc=N -mclip -mconfig=NAME -mcop -mcop32 -mcop64 -mivc2 1024 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax 1025 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf 1026 -mtiny=N 1027 1028 _MicroBlaze Options_ 1029 -msoft-float -mhard-float -msmall-divides -mcpu=CPU 1030 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift 1031 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss 1032 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt 1033 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-APP-MODEL 1034 1035 _MIPS Options_ 1036 -EL -EB -march=ARCH -mtune=ARCH 1037 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 1038 -mips64 -mips64r2 1039 -mips16 -mno-mips16 -mflip-mips16 1040 -minterlink-mips16 -mno-interlink-mips16 1041 -mabi=ABI -mabicalls -mno-abicalls 1042 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot 1043 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float 1044 -mno-float -msingle-float -mdouble-float 1045 -mdsp -mno-dsp -mdspr2 -mno-dspr2 1046 -mmcu -mmno-mcu 1047 -mfpu=FPU-TYPE 1048 -msmartmips -mno-smartmips 1049 -mpaired-single -mno-paired-single -mdmx -mno-mdmx 1050 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc 1051 -mlong64 -mlong32 -msym32 -mno-sym32 1052 -GNUM -mlocal-sdata -mno-local-sdata 1053 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt 1054 -membedded-data -mno-embedded-data 1055 -muninit-const-in-rodata -mno-uninit-const-in-rodata 1056 -mcode-readable=SETTING 1057 -msplit-addresses -mno-split-addresses 1058 -mexplicit-relocs -mno-explicit-relocs 1059 -mcheck-zero-division -mno-check-zero-division 1060 -mdivide-traps -mdivide-breaks 1061 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls 1062 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp 1063 -mfix-24k -mno-fix-24k 1064 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 1065 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 1066 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 1067 -mflush-func=FUNC -mno-flush-func 1068 -mbranch-cost=NUM -mbranch-likely -mno-branch-likely 1069 -mfp-exceptions -mno-fp-exceptions 1070 -mvr4130-align -mno-vr4130-align -msynci -mno-synci 1071 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address 1072 1073 _MMIX Options_ 1074 -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu 1075 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols 1076 -melf -mbranch-predict -mno-branch-predict -mbase-addresses 1077 -mno-base-addresses -msingle-exit -mno-single-exit 1078 1079 _MN10300 Options_ 1080 -mmult-bug -mno-mult-bug 1081 -mno-am33 -mam33 -mam33-2 -mam34 1082 -mtune=CPU-TYPE 1083 -mreturn-pointer-on-d0 1084 -mno-crt0 -mrelax -mliw -msetlb 1085 1086 _Moxie Options_ 1087 -meb -mel -mno-crt0 1088 1089 _PDP-11 Options_ 1090 -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 1091 -mbcopy -mbcopy-builtin -mint32 -mno-int16 1092 -mint16 -mno-int32 -mfloat32 -mno-float64 1093 -mfloat64 -mno-float32 -mabshi -mno-abshi 1094 -mbranch-expensive -mbranch-cheap 1095 -munix-asm -mdec-asm 1096 1097 _picoChip Options_ 1098 -mae=AE_TYPE -mvliw-lookahead=N 1099 -msymbol-as-address -mno-inefficient-warnings 1100 1101 _PowerPC Options_ See RS/6000 and PowerPC Options. 1102 1103 _RL78 Options_ 1104 -msim -mmul=none -mmul=g13 -mmul=rl78 1105 1106 _RS/6000 and PowerPC Options_ 1107 -mcpu=CPU-TYPE 1108 -mtune=CPU-TYPE 1109 -mcmodel=CODE-MODEL 1110 -mpowerpc64 1111 -maltivec -mno-altivec 1112 -mpowerpc-gpopt -mno-powerpc-gpopt 1113 -mpowerpc-gfxopt -mno-powerpc-gfxopt 1114 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd 1115 -mfprnd -mno-fprnd 1116 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp 1117 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc 1118 -m64 -m32 -mxl-compat -mno-xl-compat -mpe 1119 -malign-power -malign-natural 1120 -msoft-float -mhard-float -mmultiple -mno-multiple 1121 -msingle-float -mdouble-float -msimple-fpu 1122 -mstring -mno-string -mupdate -mno-update 1123 -mavoid-indexed-addresses -mno-avoid-indexed-addresses 1124 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align 1125 -mstrict-align -mno-strict-align -mrelocatable 1126 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib 1127 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian 1128 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base 1129 -mprioritize-restricted-insns=PRIORITY 1130 -msched-costly-dep=DEPENDENCE_TYPE 1131 -minsert-sched-nops=SCHEME 1132 -mcall-sysv -mcall-netbsd 1133 -maix-struct-return -msvr4-struct-return 1134 -mabi=ABI-TYPE -msecure-plt -mbss-plt 1135 -mblock-move-inline-limit=NUM 1136 -misel -mno-isel 1137 -misel=yes -misel=no 1138 -mspe -mno-spe 1139 -mspe=yes -mspe=no 1140 -mpaired 1141 -mgen-cell-microcode -mwarn-cell-microcode 1142 -mvrsave -mno-vrsave 1143 -mmulhw -mno-mulhw 1144 -mdlmzb -mno-dlmzb 1145 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double 1146 -mprototype -mno-prototype 1147 -msim -mmvme -mads -myellowknife -memb -msdata 1148 -msdata=OPT -mvxworks -G NUM -pthread 1149 -mrecip -mrecip=OPT -mno-recip -mrecip-precision 1150 -mno-recip-precision 1151 -mveclibabi=TYPE -mfriz -mno-friz 1152 -mpointers-to-nested-functions -mno-pointers-to-nested-functions 1153 -msave-toc-indirect -mno-save-toc-indirect 1154 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector 1155 -mcrypto -mno-crypto -mdirect-move -mno-direct-move 1156 -mquad-memory -mno-quad-memory 1157 -mquad-memory-atomic -mno-quad-memory-atomic 1158 -mcompat-align-parm -mno-compat-align-parm 1159 1160 _RX Options_ 1161 -m64bit-doubles -m32bit-doubles -fpu -nofpu 1162 -mcpu= 1163 -mbig-endian-data -mlittle-endian-data 1164 -msmall-data 1165 -msim -mno-sim 1166 -mas100-syntax -mno-as100-syntax 1167 -mrelax 1168 -mmax-constant-size= 1169 -mint-register= 1170 -mpid 1171 -mno-warn-multiple-fast-interrupts 1172 -msave-acc-in-interrupts 1173 1174 _S/390 and zSeries Options_ 1175 -mtune=CPU-TYPE -march=CPU-TYPE 1176 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp 1177 -mlong-double-64 -mlong-double-128 1178 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack 1179 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle 1180 -m64 -m31 -mdebug -mno-debug -mesa -mzarch 1181 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd 1182 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard 1183 -mhotpatch[=HALFWORDS] -mno-hotpatch 1184 1185 _Score Options_ 1186 -meb -mel 1187 -mnhwloop 1188 -muls 1189 -mmac 1190 -mscore5 -mscore5u -mscore7 -mscore7d 1191 1192 _SH Options_ 1193 -m1 -m2 -m2e 1194 -m2a-nofpu -m2a-single-only -m2a-single -m2a 1195 -m3 -m3e 1196 -m4-nofpu -m4-single-only -m4-single -m4 1197 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al 1198 -m5-64media -m5-64media-nofpu 1199 -m5-32media -m5-32media-nofpu 1200 -m5-compact -m5-compact-nofpu 1201 -mb -ml -mdalign -mrelax 1202 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave 1203 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct 1204 -mspace -mprefergot -musermode -multcost=NUMBER -mdiv=STRATEGY 1205 -mdivsi3_libfunc=NAME -mfixed-range=REGISTER-RANGE 1206 -mindexed-addressing -mgettrcost=NUMBER -mpt-fixed 1207 -maccumulate-outgoing-args -minvalid-symbols 1208 -matomic-model=ATOMIC-MODEL 1209 -mbranch-cost=NUM -mzdcbranch -mno-zdcbranch -mcbranchdi -mcmpeqdi 1210 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra 1211 -mpretend-cmove -mtas 1212 1213 _Solaris 2 Options_ 1214 -mimpure-text -mno-impure-text 1215 -pthreads -pthread 1216 1217 _SPARC Options_ 1218 -mcpu=CPU-TYPE 1219 -mtune=CPU-TYPE 1220 -mcmodel=CODE-MODEL 1221 -mmemory-model=MEM-MODEL 1222 -m32 -m64 -mapp-regs -mno-app-regs 1223 -mfaster-structs -mno-faster-structs -mflat -mno-flat 1224 -mfpu -mno-fpu -mhard-float -msoft-float 1225 -mhard-quad-float -msoft-quad-float 1226 -mstack-bias -mno-stack-bias 1227 -munaligned-doubles -mno-unaligned-doubles 1228 -muser-mode -mno-user-mode 1229 -mv8plus -mno-v8plus -mvis -mno-vis 1230 -mvis2 -mno-vis2 -mvis3 -mno-vis3 1231 -mcbcond -mno-cbcond 1232 -mfmaf -mno-fmaf -mpopc -mno-popc 1233 -mfix-at697f -mfix-ut699 1234 1235 _SPU Options_ 1236 -mwarn-reloc -merror-reloc 1237 -msafe-dma -munsafe-dma 1238 -mbranch-hints 1239 -msmall-mem -mlarge-mem -mstdmain 1240 -mfixed-range=REGISTER-RANGE 1241 -mea32 -mea64 1242 -maddress-space-conversion -mno-address-space-conversion 1243 -mcache-size=CACHE-SIZE 1244 -matomic-updates -mno-atomic-updates 1245 1246 _System V Options_ 1247 -Qy -Qn -YP,PATHS -Ym,DIR 1248 1249 _TILE-Gx Options_ 1250 -mcpu=CPU -m32 -m64 -mcmodel=CODE-MODEL 1251 1252 _TILEPro Options_ 1253 -mcpu=CPU -m32 1254 1255 _V850 Options_ 1256 -mlong-calls -mno-long-calls -mep -mno-ep 1257 -mprolog-function -mno-prolog-function -mspace 1258 -mtda=N -msda=N -mzda=N 1259 -mapp-regs -mno-app-regs 1260 -mdisable-callt -mno-disable-callt 1261 -mv850e2v3 -mv850e2 -mv850e1 -mv850es 1262 -mv850e -mv850 -mv850e3v5 1263 -mloop 1264 -mrelax 1265 -mlong-jumps 1266 -msoft-float 1267 -mhard-float 1268 -mgcc-abi 1269 -mrh850-abi 1270 -mbig-switch 1271 1272 _VAX Options_ 1273 -mg -mgnu -munix 1274 1275 _VMS Options_ 1276 -mvms-return-codes -mdebug-main=PREFIX -mmalloc64 1277 -mpointer-size=SIZE 1278 1279 _VxWorks Options_ 1280 -mrtp -non-static -Bstatic -Bdynamic 1281 -Xbind-lazy -Xbind-now 1282 1283 _x86-64 Options_ See i386 and x86-64 Options. 1284 1285 _Xstormy16 Options_ 1286 -msim 1287 1288 _Xtensa Options_ 1289 -mconst16 -mno-const16 1290 -mfused-madd -mno-fused-madd 1291 -mforce-no-pic 1292 -mserialize-volatile -mno-serialize-volatile 1293 -mtext-section-literals -mno-text-section-literals 1294 -mtarget-align -mno-target-align 1295 -mlongcalls -mno-longcalls 1296 1297 _zSeries Options_ See S/390 and zSeries Options. 1298 1299 _Code Generation Options_ 1300 *Note Options for Code Generation Conventions: Code Gen Options. 1301 -fcall-saved-REG -fcall-used-REG 1302 -ffixed-REG -fexceptions 1303 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables 1304 -fasynchronous-unwind-tables 1305 -finhibit-size-directive -finstrument-functions 1306 -finstrument-functions-exclude-function-list=SYM,SYM,... 1307 -finstrument-functions-exclude-file-list=FILE,FILE,... 1308 -fno-common -fno-ident 1309 -fpcc-struct-return -fpic -fPIC -fpie -fPIE 1310 -fno-jump-tables 1311 -frecord-gcc-switches 1312 -freg-struct-return -fshort-enums 1313 -fshort-double -fshort-wchar 1314 -fverbose-asm -fpack-struct[=N] -fstack-check 1315 -fstack-limit-register=REG -fstack-limit-symbol=SYM 1316 -fno-stack-limit -fsplit-stack 1317 -fleading-underscore -ftls-model=MODEL 1318 -fstack-reuse=REUSE_LEVEL 1319 -ftrapv -fwrapv -fbounds-check 1320 -fvisibility -fstrict-volatile-bitfields -fsync-libcalls 1321 1322 * Menu: 1323 1324 * Overall Options:: Controlling the kind of output: 1325 an executable, object files, assembler files, 1326 or preprocessed source. 1327 * C Dialect Options:: Controlling the variant of C language compiled. 1328 * C++ Dialect Options:: Variations on C++. 1329 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C 1330 and Objective-C++. 1331 * Language Independent Options:: Controlling how diagnostics should be 1332 formatted. 1333 * Warning Options:: How picky should the compiler be? 1334 * Debugging Options:: Symbol tables, measurements, and debugging dumps. 1335 * Optimize Options:: How much optimization? 1336 * Preprocessor Options:: Controlling header files and macro definitions. 1337 Also, getting dependency information for Make. 1338 * Assembler Options:: Passing options to the assembler. 1339 * Link Options:: Specifying libraries and so on. 1340 * Directory Options:: Where to find header files and libraries. 1341 Where to find the compiler executable files. 1342 * Spec Files:: How to pass switches to sub-processes. 1343 * Target Options:: Running a cross-compiler, or an old version of GCC. 1344 1345 1346 File: gcc.info, Node: Overall Options, Next: Invoking G++, Prev: Option Summary, Up: Invoking GCC 1347 1348 3.2 Options Controlling the Kind of Output 1349 ========================================== 1350 1351 Compilation can involve up to four stages: preprocessing, compilation 1352 proper, assembly and linking, always in that order. GCC is capable of 1353 preprocessing and compiling several files either into several assembler 1354 input files, or into one assembler input file; then each assembler input 1355 file produces an object file, and linking combines all the object files 1356 (those newly compiled, and those specified as input) into an executable 1357 file. 1358 1359 For any given input file, the file name suffix determines what kind of 1360 compilation is done: 1361 1362 'FILE.c' 1363 C source code that must be preprocessed. 1364 1365 'FILE.i' 1366 C source code that should not be preprocessed. 1367 1368 'FILE.ii' 1369 C++ source code that should not be preprocessed. 1370 1371 'FILE.m' 1372 Objective-C source code. Note that you must link with the 1373 'libobjc' library to make an Objective-C program work. 1374 1375 'FILE.mi' 1376 Objective-C source code that should not be preprocessed. 1377 1378 'FILE.mm' 1379 'FILE.M' 1380 Objective-C++ source code. Note that you must link with the 1381 'libobjc' library to make an Objective-C++ program work. Note that 1382 '.M' refers to a literal capital M. 1383 1384 'FILE.mii' 1385 Objective-C++ source code that should not be preprocessed. 1386 1387 'FILE.h' 1388 C, C++, Objective-C or Objective-C++ header file to be turned into 1389 a precompiled header (default), or C, C++ header file to be turned 1390 into an Ada spec (via the '-fdump-ada-spec' switch). 1391 1392 'FILE.cc' 1393 'FILE.cp' 1394 'FILE.cxx' 1395 'FILE.cpp' 1396 'FILE.CPP' 1397 'FILE.c++' 1398 'FILE.C' 1399 C++ source code that must be preprocessed. Note that in '.cxx', 1400 the last two letters must both be literally 'x'. Likewise, '.C' 1401 refers to a literal capital C. 1402 1403 'FILE.mm' 1404 'FILE.M' 1405 Objective-C++ source code that must be preprocessed. 1406 1407 'FILE.mii' 1408 Objective-C++ source code that should not be preprocessed. 1409 1410 'FILE.hh' 1411 'FILE.H' 1412 'FILE.hp' 1413 'FILE.hxx' 1414 'FILE.hpp' 1415 'FILE.HPP' 1416 'FILE.h++' 1417 'FILE.tcc' 1418 C++ header file to be turned into a precompiled header or Ada spec. 1419 1420 'FILE.f' 1421 'FILE.for' 1422 'FILE.ftn' 1423 Fixed form Fortran source code that should not be preprocessed. 1424 1425 'FILE.F' 1426 'FILE.FOR' 1427 'FILE.fpp' 1428 'FILE.FPP' 1429 'FILE.FTN' 1430 Fixed form Fortran source code that must be preprocessed (with the 1431 traditional preprocessor). 1432 1433 'FILE.f90' 1434 'FILE.f95' 1435 'FILE.f03' 1436 'FILE.f08' 1437 Free form Fortran source code that should not be preprocessed. 1438 1439 'FILE.F90' 1440 'FILE.F95' 1441 'FILE.F03' 1442 'FILE.F08' 1443 Free form Fortran source code that must be preprocessed (with the 1444 traditional preprocessor). 1445 1446 'FILE.go' 1447 Go source code. 1448 1449 'FILE.ads' 1450 Ada source code file that contains a library unit declaration (a 1451 declaration of a package, subprogram, or generic, or a generic 1452 instantiation), or a library unit renaming declaration (a package, 1453 generic, or subprogram renaming declaration). Such files are also 1454 called "specs". 1455 1456 'FILE.adb' 1457 Ada source code file containing a library unit body (a subprogram 1458 or package body). Such files are also called "bodies". 1459 1460 'FILE.s' 1461 Assembler code. 1462 1463 'FILE.S' 1464 'FILE.sx' 1465 Assembler code that must be preprocessed. 1466 1467 'OTHER' 1468 An object file to be fed straight into linking. Any file name with 1469 no recognized suffix is treated this way. 1470 1471 You can specify the input language explicitly with the '-x' option: 1472 1473 '-x LANGUAGE' 1474 Specify explicitly the LANGUAGE for the following input files 1475 (rather than letting the compiler choose a default based on the 1476 file name suffix). This option applies to all following input 1477 files until the next '-x' option. Possible values for LANGUAGE 1478 are: 1479 c c-header cpp-output 1480 c++ c++-header c++-cpp-output 1481 objective-c objective-c-header objective-c-cpp-output 1482 objective-c++ objective-c++-header objective-c++-cpp-output 1483 assembler assembler-with-cpp 1484 ada 1485 f77 f77-cpp-input f95 f95-cpp-input 1486 go 1487 java 1488 1489 '-x none' 1490 Turn off any specification of a language, so that subsequent files 1491 are handled according to their file name suffixes (as they are if 1492 '-x' has not been used at all). 1493 1494 '-pass-exit-codes' 1495 Normally the 'gcc' program exits with the code of 1 if any phase of 1496 the compiler returns a non-success return code. If you specify 1497 '-pass-exit-codes', the 'gcc' program instead returns with the 1498 numerically highest error produced by any phase returning an error 1499 indication. The C, C++, and Fortran front ends return 4 if an 1500 internal compiler error is encountered. 1501 1502 If you only want some of the stages of compilation, you can use '-x' 1503 (or filename suffixes) to tell 'gcc' where to start, and one of the 1504 options '-c', '-S', or '-E' to say where 'gcc' is to stop. Note that 1505 some combinations (for example, '-x cpp-output -E') instruct 'gcc' to do 1506 nothing at all. 1507 1508 '-c' 1509 Compile or assemble the source files, but do not link. The linking 1510 stage simply is not done. The ultimate output is in the form of an 1511 object file for each source file. 1512 1513 By default, the object file name for a source file is made by 1514 replacing the suffix '.c', '.i', '.s', etc., with '.o'. 1515 1516 Unrecognized input files, not requiring compilation or assembly, 1517 are ignored. 1518 1519 '-S' 1520 Stop after the stage of compilation proper; do not assemble. The 1521 output is in the form of an assembler code file for each 1522 non-assembler input file specified. 1523 1524 By default, the assembler file name for a source file is made by 1525 replacing the suffix '.c', '.i', etc., with '.s'. 1526 1527 Input files that don't require compilation are ignored. 1528 1529 '-E' 1530 Stop after the preprocessing stage; do not run the compiler proper. 1531 The output is in the form of preprocessed source code, which is 1532 sent to the standard output. 1533 1534 Input files that don't require preprocessing are ignored. 1535 1536 '-o FILE' 1537 Place output in file FILE. This applies to whatever sort of output 1538 is being produced, whether it be an executable file, an object 1539 file, an assembler file or preprocessed C code. 1540 1541 If '-o' is not specified, the default is to put an executable file 1542 in 'a.out', the object file for 'SOURCE.SUFFIX' in 'SOURCE.o', its 1543 assembler file in 'SOURCE.s', a precompiled header file in 1544 'SOURCE.SUFFIX.gch', and all preprocessed C source on standard 1545 output. 1546 1547 '-v' 1548 Print (on standard error output) the commands executed to run the 1549 stages of compilation. Also print the version number of the 1550 compiler driver program and of the preprocessor and the compiler 1551 proper. 1552 1553 '-###' 1554 Like '-v' except the commands are not executed and arguments are 1555 quoted unless they contain only alphanumeric characters or './-_'. 1556 This is useful for shell scripts to capture the driver-generated 1557 command lines. 1558 1559 '-pipe' 1560 Use pipes rather than temporary files for communication between the 1561 various stages of compilation. This fails to work on some systems 1562 where the assembler is unable to read from a pipe; but the GNU 1563 assembler has no trouble. 1564 1565 '--help' 1566 Print (on the standard output) a description of the command-line 1567 options understood by 'gcc'. If the '-v' option is also specified 1568 then '--help' is also passed on to the various processes invoked by 1569 'gcc', so that they can display the command-line options they 1570 accept. If the '-Wextra' option has also been specified (prior to 1571 the '--help' option), then command-line options that have no 1572 documentation associated with them are also displayed. 1573 1574 '--target-help' 1575 Print (on the standard output) a description of target-specific 1576 command-line options for each tool. For some targets extra 1577 target-specific information may also be printed. 1578 1579 '--help={CLASS|[^]QUALIFIER}[,...]' 1580 Print (on the standard output) a description of the command-line 1581 options understood by the compiler that fit into all specified 1582 classes and qualifiers. These are the supported classes: 1583 1584 'optimizers' 1585 Display all of the optimization options supported by the 1586 compiler. 1587 1588 'warnings' 1589 Display all of the options controlling warning messages 1590 produced by the compiler. 1591 1592 'target' 1593 Display target-specific options. Unlike the '--target-help' 1594 option however, target-specific options of the linker and 1595 assembler are not displayed. This is because those tools do 1596 not currently support the extended '--help=' syntax. 1597 1598 'params' 1599 Display the values recognized by the '--param' option. 1600 1601 LANGUAGE 1602 Display the options supported for LANGUAGE, where LANGUAGE is 1603 the name of one of the languages supported in this version of 1604 GCC. 1605 1606 'common' 1607 Display the options that are common to all languages. 1608 1609 These are the supported qualifiers: 1610 1611 'undocumented' 1612 Display only those options that are undocumented. 1613 1614 'joined' 1615 Display options taking an argument that appears after an equal 1616 sign in the same continuous piece of text, such as: 1617 '--help=target'. 1618 1619 'separate' 1620 Display options taking an argument that appears as a separate 1621 word following the original option, such as: '-o output-file'. 1622 1623 Thus for example to display all the undocumented target-specific 1624 switches supported by the compiler, use: 1625 1626 --help=target,undocumented 1627 1628 The sense of a qualifier can be inverted by prefixing it with the 1629 '^' character, so for example to display all binary warning options 1630 (i.e., ones that are either on or off and that do not take an 1631 argument) that have a description, use: 1632 1633 --help=warnings,^joined,^undocumented 1634 1635 The argument to '--help=' should not consist solely of inverted 1636 qualifiers. 1637 1638 Combining several classes is possible, although this usually 1639 restricts the output so much that there is nothing to display. One 1640 case where it does work, however, is when one of the classes is 1641 TARGET. For example, to display all the target-specific 1642 optimization options, use: 1643 1644 --help=target,optimizers 1645 1646 The '--help=' option can be repeated on the command line. Each 1647 successive use displays its requested class of options, skipping 1648 those that have already been displayed. 1649 1650 If the '-Q' option appears on the command line before the '--help=' 1651 option, then the descriptive text displayed by '--help=' is 1652 changed. Instead of describing the displayed options, an 1653 indication is given as to whether the option is enabled, disabled 1654 or set to a specific value (assuming that the compiler knows this 1655 at the point where the '--help=' option is used). 1656 1657 Here is a truncated example from the ARM port of 'gcc': 1658 1659 % gcc -Q -mabi=2 --help=target -c 1660 The following options are target specific: 1661 -mabi= 2 1662 -mabort-on-noreturn [disabled] 1663 -mapcs [disabled] 1664 1665 The output is sensitive to the effects of previous command-line 1666 options, so for example it is possible to find out which 1667 optimizations are enabled at '-O2' by using: 1668 1669 -Q -O2 --help=optimizers 1670 1671 Alternatively you can discover which binary optimizations are 1672 enabled by '-O3' by using: 1673 1674 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 1675 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 1676 diff /tmp/O2-opts /tmp/O3-opts | grep enabled 1677 1678 '-no-canonical-prefixes' 1679 Do not expand any symbolic links, resolve references to '/../' or 1680 '/./', or make the path absolute when generating a relative prefix. 1681 1682 '--version' 1683 Display the version number and copyrights of the invoked GCC. 1684 1685 '-wrapper' 1686 Invoke all subcommands under a wrapper program. The name of the 1687 wrapper program and its parameters are passed as a comma separated 1688 list. 1689 1690 gcc -c t.c -wrapper gdb,--args 1691 1692 This invokes all subprograms of 'gcc' under 'gdb --args', thus the 1693 invocation of 'cc1' is 'gdb --args cc1 ...'. 1694 1695 '-fplugin=NAME.so' 1696 Load the plugin code in file NAME.so, assumed to be a shared object 1697 to be dlopen'd by the compiler. The base name of the shared object 1698 file is used to identify the plugin for the purposes of argument 1699 parsing (See '-fplugin-arg-NAME-KEY=VALUE' below). Each plugin 1700 should define the callback functions specified in the Plugins API. 1701 1702 '-fplugin-arg-NAME-KEY=VALUE' 1703 Define an argument called KEY with a value of VALUE for the plugin 1704 called NAME. 1705 1706 '-fdump-ada-spec[-slim]' 1707 For C and C++ source and include files, generate corresponding Ada 1708 specs. *Note (gnat_ugn)Generating Ada Bindings for C and C++ 1709 headers::, which provides detailed documentation on this feature. 1710 1711 '-fada-spec-parent=UNIT' 1712 In conjunction with '-fdump-ada-spec[-slim]' above, generate Ada 1713 specs as child units of parent UNIT. 1714 1715 '-fdump-go-spec=FILE' 1716 For input files in any language, generate corresponding Go 1717 declarations in FILE. This generates Go 'const', 'type', 'var', 1718 and 'func' declarations which may be a useful way to start writing 1719 a Go interface to code written in some other language. 1720 1721 '@FILE' 1722 Read command-line options from FILE. The options read are inserted 1723 in place of the original @FILE option. If FILE does not exist, or 1724 cannot be read, then the option will be treated literally, and not 1725 removed. 1726 1727 Options in FILE are separated by whitespace. A whitespace 1728 character may be included in an option by surrounding the entire 1729 option in either single or double quotes. Any character (including 1730 a backslash) may be included by prefixing the character to be 1731 included with a backslash. The FILE may itself contain additional 1732 @FILE options; any such options will be processed recursively. 1733 1734 1735 File: gcc.info, Node: Invoking G++, Next: C Dialect Options, Prev: Overall Options, Up: Invoking GCC 1736 1737 3.3 Compiling C++ Programs 1738 ========================== 1739 1740 C++ source files conventionally use one of the suffixes '.C', '.cc', 1741 '.cpp', '.CPP', '.c++', '.cp', or '.cxx'; C++ header files often use 1742 '.hh', '.hpp', '.H', or (for shared template code) '.tcc'; and 1743 preprocessed C++ files use the suffix '.ii'. GCC recognizes files with 1744 these names and compiles them as C++ programs even if you call the 1745 compiler the same way as for compiling C programs (usually with the name 1746 'gcc'). 1747 1748 However, the use of 'gcc' does not add the C++ library. 'g++' is a 1749 program that calls GCC and automatically specifies linking against the 1750 C++ library. It treats '.c', '.h' and '.i' files as C++ source files 1751 instead of C source files unless '-x' is used. This program is also 1752 useful when precompiling a C header file with a '.h' extension for use 1753 in C++ compilations. On many systems, 'g++' is also installed with the 1754 name 'c++'. 1755 1756 When you compile C++ programs, you may specify many of the same 1757 command-line options that you use for compiling programs in any 1758 language; or command-line options meaningful for C and related 1759 languages; or options that are meaningful only for C++ programs. *Note 1760 Options Controlling C Dialect: C Dialect Options, for explanations of 1761 options for languages related to C. *Note Options Controlling C++ 1762 Dialect: C++ Dialect Options, for explanations of options that are 1763 meaningful only for C++ programs. 1764 1765 1766 File: gcc.info, Node: C Dialect Options, Next: C++ Dialect Options, Prev: Invoking G++, Up: Invoking GCC 1767 1768 3.4 Options Controlling C Dialect 1769 ================================= 1770 1771 The following options control the dialect of C (or languages derived 1772 from C, such as C++, Objective-C and Objective-C++) that the compiler 1773 accepts: 1774 1775 '-ansi' 1776 In C mode, this is equivalent to '-std=c90'. In C++ mode, it is 1777 equivalent to '-std=c++98'. 1778 1779 This turns off certain features of GCC that are incompatible with 1780 ISO C90 (when compiling C code), or of standard C++ (when compiling 1781 C++ code), such as the 'asm' and 'typeof' keywords, and predefined 1782 macros such as 'unix' and 'vax' that identify the type of system 1783 you are using. It also enables the undesirable and rarely used ISO 1784 trigraph feature. For the C compiler, it disables recognition of 1785 C++ style '//' comments as well as the 'inline' keyword. 1786 1787 The alternate keywords '__asm__', '__extension__', '__inline__' and 1788 '__typeof__' continue to work despite '-ansi'. You would not want 1789 to use them in an ISO C program, of course, but it is useful to put 1790 them in header files that might be included in compilations done 1791 with '-ansi'. Alternate predefined macros such as '__unix__' and 1792 '__vax__' are also available, with or without '-ansi'. 1793 1794 The '-ansi' option does not cause non-ISO programs to be rejected 1795 gratuitously. For that, '-Wpedantic' is required in addition to 1796 '-ansi'. *Note Warning Options::. 1797 1798 The macro '__STRICT_ANSI__' is predefined when the '-ansi' option 1799 is used. Some header files may notice this macro and refrain from 1800 declaring certain functions or defining certain macros that the ISO 1801 standard doesn't call for; this is to avoid interfering with any 1802 programs that might use these names for other things. 1803 1804 Functions that are normally built in but do not have semantics 1805 defined by ISO C (such as 'alloca' and 'ffs') are not built-in 1806 functions when '-ansi' is used. *Note Other built-in functions 1807 provided by GCC: Other Builtins, for details of the functions 1808 affected. 1809 1810 '-std=' 1811 Determine the language standard. *Note Language Standards 1812 Supported by GCC: Standards, for details of these standard 1813 versions. This option is currently only supported when compiling C 1814 or C++. 1815 1816 The compiler can accept several base standards, such as 'c90' or 1817 'c++98', and GNU dialects of those standards, such as 'gnu90' or 1818 'gnu++98'. When a base standard is specified, the compiler accepts 1819 all programs following that standard plus those using GNU 1820 extensions that do not contradict it. For example, '-std=c90' 1821 turns off certain features of GCC that are incompatible with ISO 1822 C90, such as the 'asm' and 'typeof' keywords, but not other GNU 1823 extensions that do not have a meaning in ISO C90, such as omitting 1824 the middle term of a '?:' expression. On the other hand, when a 1825 GNU dialect of a standard is specified, all features supported by 1826 the compiler are enabled, even when those features change the 1827 meaning of the base standard. As a result, some strict-conforming 1828 programs may be rejected. The particular standard is used by 1829 '-Wpedantic' to identify which features are GNU extensions given 1830 that version of the standard. For example '-std=gnu90 -Wpedantic' 1831 warns about C++ style '//' comments, while '-std=gnu99 -Wpedantic' 1832 does not. 1833 1834 A value for this option must be provided; possible values are 1835 1836 'c90' 1837 'c89' 1838 'iso9899:1990' 1839 Support all ISO C90 programs (certain GNU extensions that 1840 conflict with ISO C90 are disabled). Same as '-ansi' for C 1841 code. 1842 1843 'iso9899:199409' 1844 ISO C90 as modified in amendment 1. 1845 1846 'c99' 1847 'c9x' 1848 'iso9899:1999' 1849 'iso9899:199x' 1850 ISO C99. Note that this standard is not yet fully supported; 1851 see <http://gcc.gnu.org/c99status.html> for more information. 1852 The names 'c9x' and 'iso9899:199x' are deprecated. 1853 1854 'c11' 1855 'c1x' 1856 'iso9899:2011' 1857 ISO C11, the 2011 revision of the ISO C standard. Support is 1858 incomplete and experimental. The name 'c1x' is deprecated. 1859 1860 'gnu90' 1861 'gnu89' 1862 GNU dialect of ISO C90 (including some C99 features). This is 1863 the default for C code. 1864 1865 'gnu99' 1866 'gnu9x' 1867 GNU dialect of ISO C99. When ISO C99 is fully implemented in 1868 GCC, this will become the default. The name 'gnu9x' is 1869 deprecated. 1870 1871 'gnu11' 1872 'gnu1x' 1873 GNU dialect of ISO C11. Support is incomplete and 1874 experimental. The name 'gnu1x' is deprecated. 1875 1876 'c++98' 1877 'c++03' 1878 The 1998 ISO C++ standard plus the 2003 technical corrigendum 1879 and some additional defect reports. Same as '-ansi' for C++ 1880 code. 1881 1882 'gnu++98' 1883 'gnu++03' 1884 GNU dialect of '-std=c++98'. This is the default for C++ 1885 code. 1886 1887 'c++11' 1888 'c++0x' 1889 The 2011 ISO C++ standard plus amendments. Support for C++11 1890 is still experimental, and may change in incompatible ways in 1891 future releases. The name 'c++0x' is deprecated. 1892 1893 'gnu++11' 1894 'gnu++0x' 1895 GNU dialect of '-std=c++11'. Support for C++11 is still 1896 experimental, and may change in incompatible ways in future 1897 releases. The name 'gnu++0x' is deprecated. 1898 1899 'c++1y' 1900 The next revision of the ISO C++ standard, tentatively planned 1901 for 2017. Support is highly experimental, and will almost 1902 certainly change in incompatible ways in future releases. 1903 1904 'gnu++1y' 1905 GNU dialect of '-std=c++1y'. Support is highly experimental, 1906 and will almost certainly change in incompatible ways in 1907 future releases. 1908 1909 '-fgnu89-inline' 1910 The option '-fgnu89-inline' tells GCC to use the traditional GNU 1911 semantics for 'inline' functions when in C99 mode. *Note An Inline 1912 Function is As Fast As a Macro: Inline. This option is accepted 1913 and ignored by GCC versions 4.1.3 up to but not including 4.3. In 1914 GCC versions 4.3 and later it changes the behavior of GCC in C99 1915 mode. Using this option is roughly equivalent to adding the 1916 'gnu_inline' function attribute to all inline functions (*note 1917 Function Attributes::). 1918 1919 The option '-fno-gnu89-inline' explicitly tells GCC to use the C99 1920 semantics for 'inline' when in C99 or gnu99 mode (i.e., it 1921 specifies the default behavior). This option was first supported 1922 in GCC 4.3. This option is not supported in '-std=c90' or 1923 '-std=gnu90' mode. 1924 1925 The preprocessor macros '__GNUC_GNU_INLINE__' and 1926 '__GNUC_STDC_INLINE__' may be used to check which semantics are in 1927 effect for 'inline' functions. *Note (cpp)Common Predefined 1928 Macros::. 1929 1930 '-aux-info FILENAME' 1931 Output to the given filename prototyped declarations for all 1932 functions declared and/or defined in a translation unit, including 1933 those in header files. This option is silently ignored in any 1934 language other than C. 1935 1936 Besides declarations, the file indicates, in comments, the origin 1937 of each declaration (source file and line), whether the declaration 1938 was implicit, prototyped or unprototyped ('I', 'N' for new or 'O' 1939 for old, respectively, in the first character after the line number 1940 and the colon), and whether it came from a declaration or a 1941 definition ('C' or 'F', respectively, in the following character). 1942 In the case of function definitions, a K&R-style list of arguments 1943 followed by their declarations is also provided, inside comments, 1944 after the declaration. 1945 1946 '-fallow-parameterless-variadic-functions' 1947 Accept variadic functions without named parameters. 1948 1949 Although it is possible to define such a function, this is not very 1950 useful as it is not possible to read the arguments. This is only 1951 supported for C as this construct is allowed by C++. 1952 1953 '-fno-asm' 1954 Do not recognize 'asm', 'inline' or 'typeof' as a keyword, so that 1955 code can use these words as identifiers. You can use the keywords 1956 '__asm__', '__inline__' and '__typeof__' instead. '-ansi' implies 1957 '-fno-asm'. 1958 1959 In C++, this switch only affects the 'typeof' keyword, since 'asm' 1960 and 'inline' are standard keywords. You may want to use the 1961 '-fno-gnu-keywords' flag instead, which has the same effect. In 1962 C99 mode ('-std=c99' or '-std=gnu99'), this switch only affects the 1963 'asm' and 'typeof' keywords, since 'inline' is a standard keyword 1964 in ISO C99. 1965 1966 '-fno-builtin' 1967 '-fno-builtin-FUNCTION' 1968 Don't recognize built-in functions that do not begin with 1969 '__builtin_' as prefix. *Note Other built-in functions provided by 1970 GCC: Other Builtins, for details of the functions affected, 1971 including those which are not built-in functions when '-ansi' or 1972 '-std' options for strict ISO C conformance are used because they 1973 do not have an ISO standard meaning. 1974 1975 GCC normally generates special code to handle certain built-in 1976 functions more efficiently; for instance, calls to 'alloca' may 1977 become single instructions which adjust the stack directly, and 1978 calls to 'memcpy' may become inline copy loops. The resulting code 1979 is often both smaller and faster, but since the function calls no 1980 longer appear as such, you cannot set a breakpoint on those calls, 1981 nor can you change the behavior of the functions by linking with a 1982 different library. In addition, when a function is recognized as a 1983 built-in function, GCC may use information about that function to 1984 warn about problems with calls to that function, or to generate 1985 more efficient code, even if the resulting code still contains 1986 calls to that function. For example, warnings are given with 1987 '-Wformat' for bad calls to 'printf' when 'printf' is built in and 1988 'strlen' is known not to modify global memory. 1989 1990 With the '-fno-builtin-FUNCTION' option only the built-in function 1991 FUNCTION is disabled. FUNCTION must not begin with '__builtin_'. 1992 If a function is named that is not built-in in this version of GCC, 1993 this option is ignored. There is no corresponding 1994 '-fbuiltin-FUNCTION' option; if you wish to enable built-in 1995 functions selectively when using '-fno-builtin' or 1996 '-ffreestanding', you may define macros such as: 1997 1998 #define abs(n) __builtin_abs ((n)) 1999 #define strcpy(d, s) __builtin_strcpy ((d), (s)) 2000 2001 '-fhosted' 2002 2003 Assert that compilation targets a hosted environment. This implies 2004 '-fbuiltin'. A hosted environment is one in which the entire 2005 standard library is available, and in which 'main' has a return 2006 type of 'int'. Examples are nearly everything except a kernel. 2007 This is equivalent to '-fno-freestanding'. 2008 2009 '-ffreestanding' 2010 2011 Assert that compilation targets a freestanding environment. This 2012 implies '-fno-builtin'. A freestanding environment is one in which 2013 the standard library may not exist, and program startup may not 2014 necessarily be at 'main'. The most obvious example is an OS 2015 kernel. This is equivalent to '-fno-hosted'. 2016 2017 *Note Language Standards Supported by GCC: Standards, for details 2018 of freestanding and hosted environments. 2019 2020 '-fopenmp' 2021 Enable handling of OpenMP directives '#pragma omp' in C/C++ and 2022 '!$omp' in Fortran. When '-fopenmp' is specified, the compiler 2023 generates parallel code according to the OpenMP Application Program 2024 Interface v3.0 <http://www.openmp.org/>. This option implies 2025 '-pthread', and thus is only supported on targets that have support 2026 for '-pthread'. 2027 2028 '-fgnu-tm' 2029 When the option '-fgnu-tm' is specified, the compiler generates 2030 code for the Linux variant of Intel's current Transactional Memory 2031 ABI specification document (Revision 1.1, May 6 2009). This is an 2032 experimental feature whose interface may change in future versions 2033 of GCC, as the official specification changes. Please note that 2034 not all architectures are supported for this feature. 2035 2036 For more information on GCC's support for transactional memory, 2037 *Note The GNU Transactional Memory Library: (libitm)Enabling 2038 libitm. 2039 2040 Note that the transactional memory feature is not supported with 2041 non-call exceptions ('-fnon-call-exceptions'). 2042 2043 '-fms-extensions' 2044 Accept some non-standard constructs used in Microsoft header files. 2045 2046 In C++ code, this allows member names in structures to be similar 2047 to previous types declarations. 2048 2049 typedef int UOW; 2050 struct ABC { 2051 UOW UOW; 2052 }; 2053 2054 Some cases of unnamed fields in structures and unions are only 2055 accepted with this option. *Note Unnamed struct/union fields 2056 within structs/unions: Unnamed Fields, for details. 2057 2058 '-fplan9-extensions' 2059 Accept some non-standard constructs used in Plan 9 code. 2060 2061 This enables '-fms-extensions', permits passing pointers to 2062 structures with anonymous fields to functions that expect pointers 2063 to elements of the type of the field, and permits referring to 2064 anonymous fields declared using a typedef. *Note Unnamed 2065 struct/union fields within structs/unions: Unnamed Fields, for 2066 details. This is only supported for C, not C++. 2067 2068 '-trigraphs' 2069 Support ISO C trigraphs. The '-ansi' option (and '-std' options 2070 for strict ISO C conformance) implies '-trigraphs'. 2071 2072 '-traditional' 2073 '-traditional-cpp' 2074 Formerly, these options caused GCC to attempt to emulate a 2075 pre-standard C compiler. They are now only supported with the '-E' 2076 switch. The preprocessor continues to support a pre-standard mode. 2077 See the GNU CPP manual for details. 2078 2079 '-fcond-mismatch' 2080 Allow conditional expressions with mismatched types in the second 2081 and third arguments. The value of such an expression is void. 2082 This option is not supported for C++. 2083 2084 '-flax-vector-conversions' 2085 Allow implicit conversions between vectors with differing numbers 2086 of elements and/or incompatible element types. This option should 2087 not be used for new code. 2088 2089 '-funsigned-char' 2090 Let the type 'char' be unsigned, like 'unsigned char'. 2091 2092 Each kind of machine has a default for what 'char' should be. It 2093 is either like 'unsigned char' by default or like 'signed char' by 2094 default. 2095 2096 Ideally, a portable program should always use 'signed char' or 2097 'unsigned char' when it depends on the signedness of an object. 2098 But many programs have been written to use plain 'char' and expect 2099 it to be signed, or expect it to be unsigned, depending on the 2100 machines they were written for. This option, and its inverse, let 2101 you make such a program work with the opposite default. 2102 2103 The type 'char' is always a distinct type from each of 'signed 2104 char' or 'unsigned char', even though its behavior is always just 2105 like one of those two. 2106 2107 '-fsigned-char' 2108 Let the type 'char' be signed, like 'signed char'. 2109 2110 Note that this is equivalent to '-fno-unsigned-char', which is the 2111 negative form of '-funsigned-char'. Likewise, the option 2112 '-fno-signed-char' is equivalent to '-funsigned-char'. 2113 2114 '-fsigned-bitfields' 2115 '-funsigned-bitfields' 2116 '-fno-signed-bitfields' 2117 '-fno-unsigned-bitfields' 2118 These options control whether a bit-field is signed or unsigned, 2119 when the declaration does not use either 'signed' or 'unsigned'. 2120 By default, such a bit-field is signed, because this is consistent: 2121 the basic integer types such as 'int' are signed types. 2122 2123 2124 File: gcc.info, Node: C++ Dialect Options, Next: Objective-C and Objective-C++ Dialect Options, Prev: C Dialect Options, Up: Invoking GCC 2125 2126 3.5 Options Controlling C++ Dialect 2127 =================================== 2128 2129 This section describes the command-line options that are only meaningful 2130 for C++ programs. You can also use most of the GNU compiler options 2131 regardless of what language your program is in. For example, you might 2132 compile a file 'firstClass.C' like this: 2133 2134 g++ -g -frepo -O -c firstClass.C 2135 2136 In this example, only '-frepo' is an option meant only for C++ programs; 2137 you can use the other options with any language supported by GCC. 2138 2139 Here is a list of options that are _only_ for compiling C++ programs: 2140 2141 '-fabi-version=N' 2142 Use version N of the C++ ABI. The default is version 2. 2143 2144 Version 0 refers to the version conforming most closely to the C++ 2145 ABI specification. Therefore, the ABI obtained using version 0 2146 will change in different versions of G++ as ABI bugs are fixed. 2147 2148 Version 1 is the version of the C++ ABI that first appeared in G++ 2149 3.2. 2150 2151 Version 2 is the version of the C++ ABI that first appeared in G++ 2152 3.4. 2153 2154 Version 3 corrects an error in mangling a constant address as a 2155 template argument. 2156 2157 Version 4, which first appeared in G++ 4.5, implements a standard 2158 mangling for vector types. 2159 2160 Version 5, which first appeared in G++ 4.6, corrects the mangling 2161 of attribute const/volatile on function pointer types, decltype of 2162 a plain decl, and use of a function parameter in the declaration of 2163 another parameter. 2164 2165 Version 6, which first appeared in G++ 4.7, corrects the promotion 2166 behavior of C++11 scoped enums and the mangling of template 2167 argument packs, const/static_cast, prefix ++ and -, and a class 2168 scope function used as a template argument. 2169 2170 See also '-Wabi'. 2171 2172 '-fno-access-control' 2173 Turn off all access checking. This switch is mainly useful for 2174 working around bugs in the access control code. 2175 2176 '-fcheck-new' 2177 Check that the pointer returned by 'operator new' is non-null 2178 before attempting to modify the storage allocated. This check is 2179 normally unnecessary because the C++ standard specifies that 2180 'operator new' only returns '0' if it is declared 'throw()', in 2181 which case the compiler always checks the return value even without 2182 this option. In all other cases, when 'operator new' has a 2183 non-empty exception specification, memory exhaustion is signalled 2184 by throwing 'std::bad_alloc'. See also 'new (nothrow)'. 2185 2186 '-fconstexpr-depth=N' 2187 Set the maximum nested evaluation depth for C++11 constexpr 2188 functions to N. A limit is needed to detect endless recursion 2189 during constant expression evaluation. The minimum specified by 2190 the standard is 512. 2191 2192 '-fdeduce-init-list' 2193 Enable deduction of a template type parameter as 2194 'std::initializer_list' from a brace-enclosed initializer list, 2195 i.e. 2196 2197 template <class T> auto forward(T t) -> decltype (realfn (t)) 2198 { 2199 return realfn (t); 2200 } 2201 2202 void f() 2203 { 2204 forward({1,2}); // call forward<std::initializer_list<int>> 2205 } 2206 2207 This deduction was implemented as a possible extension to the 2208 originally proposed semantics for the C++11 standard, but was not 2209 part of the final standard, so it is disabled by default. This 2210 option is deprecated, and may be removed in a future version of 2211 G++. 2212 2213 '-ffriend-injection' 2214 Inject friend functions into the enclosing namespace, so that they 2215 are visible outside the scope of the class in which they are 2216 declared. Friend functions were documented to work this way in the 2217 old Annotated C++ Reference Manual, and versions of G++ before 4.1 2218 always worked that way. However, in ISO C++ a friend function that 2219 is not declared in an enclosing scope can only be found using 2220 argument dependent lookup. This option causes friends to be 2221 injected as they were in earlier releases. 2222 2223 This option is for compatibility, and may be removed in a future 2224 release of G++. 2225 2226 '-fno-elide-constructors' 2227 The C++ standard allows an implementation to omit creating a 2228 temporary that is only used to initialize another object of the 2229 same type. Specifying this option disables that optimization, and 2230 forces G++ to call the copy constructor in all cases. 2231 2232 '-fno-enforce-eh-specs' 2233 Don't generate code to check for violation of exception 2234 specifications at run time. This option violates the C++ standard, 2235 but may be useful for reducing code size in production builds, much 2236 like defining 'NDEBUG'. This does not give user code permission to 2237 throw exceptions in violation of the exception specifications; the 2238 compiler still optimizes based on the specifications, so throwing 2239 an unexpected exception results in undefined behavior at run time. 2240 2241 '-fextern-tls-init' 2242 '-fno-extern-tls-init' 2243 The C++11 and OpenMP standards allow 'thread_local' and 2244 'threadprivate' variables to have dynamic (runtime) initialization. 2245 To support this, any use of such a variable goes through a wrapper 2246 function that performs any necessary initialization. When the use 2247 and definition of the variable are in the same translation unit, 2248 this overhead can be optimized away, but when the use is in a 2249 different translation unit there is significant overhead even if 2250 the variable doesn't actually need dynamic initialization. If the 2251 programmer can be sure that no use of the variable in a 2252 non-defining TU needs to trigger dynamic initialization (either 2253 because the variable is statically initialized, or a use of the 2254 variable in the defining TU will be executed before any uses in 2255 another TU), they can avoid this overhead with the 2256 '-fno-extern-tls-init' option. 2257 2258 On targets that support symbol aliases, the default is 2259 '-fextern-tls-init'. On targets that do not support symbol 2260 aliases, the default is '-fno-extern-tls-init'. 2261 2262 '-ffor-scope' 2263 '-fno-for-scope' 2264 If '-ffor-scope' is specified, the scope of variables declared in a 2265 for-init-statement is limited to the 'for' loop itself, as 2266 specified by the C++ standard. If '-fno-for-scope' is specified, 2267 the scope of variables declared in a for-init-statement extends to 2268 the end of the enclosing scope, as was the case in old versions of 2269 G++, and other (traditional) implementations of C++. 2270 2271 If neither flag is given, the default is to follow the standard, 2272 but to allow and give a warning for old-style code that would 2273 otherwise be invalid, or have different behavior. 2274 2275 '-fno-gnu-keywords' 2276 Do not recognize 'typeof' as a keyword, so that code can use this 2277 word as an identifier. You can use the keyword '__typeof__' 2278 instead. '-ansi' implies '-fno-gnu-keywords'. 2279 2280 '-fno-implicit-templates' 2281 Never emit code for non-inline templates that are instantiated 2282 implicitly (i.e. by use); only emit code for explicit 2283 instantiations. *Note Template Instantiation::, for more 2284 information. 2285 2286 '-fno-implicit-inline-templates' 2287 Don't emit code for implicit instantiations of inline templates, 2288 either. The default is to handle inlines differently so that 2289 compiles with and without optimization need the same set of 2290 explicit instantiations. 2291 2292 '-fno-implement-inlines' 2293 To save space, do not emit out-of-line copies of inline functions 2294 controlled by '#pragma implementation'. This causes linker errors 2295 if these functions are not inlined everywhere they are called. 2296 2297 '-fms-extensions' 2298 Disable Wpedantic warnings about constructs used in MFC, such as 2299 implicit int and getting a pointer to member function via 2300 non-standard syntax. 2301 2302 '-fno-nonansi-builtins' 2303 Disable built-in declarations of functions that are not mandated by 2304 ANSI/ISO C. These include 'ffs', 'alloca', '_exit', 'index', 2305 'bzero', 'conjf', and other related functions. 2306 2307 '-fnothrow-opt' 2308 Treat a 'throw()' exception specification as if it were a 2309 'noexcept' specification to reduce or eliminate the text size 2310 overhead relative to a function with no exception specification. 2311 If the function has local variables of types with non-trivial 2312 destructors, the exception specification actually makes the 2313 function smaller because the EH cleanups for those variables can be 2314 optimized away. The semantic effect is that an exception thrown 2315 out of a function with such an exception specification results in a 2316 call to 'terminate' rather than 'unexpected'. 2317 2318 '-fno-operator-names' 2319 Do not treat the operator name keywords 'and', 'bitand', 'bitor', 2320 'compl', 'not', 'or' and 'xor' as synonyms as keywords. 2321 2322 '-fno-optional-diags' 2323 Disable diagnostics that the standard says a compiler does not need 2324 to issue. Currently, the only such diagnostic issued by G++ is the 2325 one for a name having multiple meanings within a class. 2326 2327 '-fpermissive' 2328 Downgrade some diagnostics about nonconformant code from errors to 2329 warnings. Thus, using '-fpermissive' allows some nonconforming 2330 code to compile. 2331 2332 '-fno-pretty-templates' 2333 When an error message refers to a specialization of a function 2334 template, the compiler normally prints the signature of the 2335 template followed by the template arguments and any typedefs or 2336 typenames in the signature (e.g. 'void f(T) [with T = int]' rather 2337 than 'void f(int)') so that it's clear which template is involved. 2338 When an error message refers to a specialization of a class 2339 template, the compiler omits any template arguments that match the 2340 default template arguments for that template. If either of these 2341 behaviors make it harder to understand the error message rather 2342 than easier, you can use '-fno-pretty-templates' to disable them. 2343 2344 '-frepo' 2345 Enable automatic template instantiation at link time. This option 2346 also implies '-fno-implicit-templates'. *Note Template 2347 Instantiation::, for more information. 2348 2349 '-fno-rtti' 2350 Disable generation of information about every class with virtual 2351 functions for use by the C++ run-time type identification features 2352 ('dynamic_cast' and 'typeid'). If you don't use those parts of the 2353 language, you can save some space by using this flag. Note that 2354 exception handling uses the same information, but G++ generates it 2355 as needed. The 'dynamic_cast' operator can still be used for casts 2356 that do not require run-time type information, i.e. casts to 'void 2357 *' or to unambiguous base classes. 2358 2359 '-fstats' 2360 Emit statistics about front-end processing at the end of the 2361 compilation. This information is generally only useful to the G++ 2362 development team. 2363 2364 '-fstrict-enums' 2365 Allow the compiler to optimize using the assumption that a value of 2366 enumerated type can only be one of the values of the enumeration 2367 (as defined in the C++ standard; basically, a value that can be 2368 represented in the minimum number of bits needed to represent all 2369 the enumerators). This assumption may not be valid if the program 2370 uses a cast to convert an arbitrary integer value to the enumerated 2371 type. 2372 2373 '-ftemplate-backtrace-limit=N' 2374 Set the maximum number of template instantiation notes for a single 2375 warning or error to N. The default value is 10. 2376 2377 '-ftemplate-depth=N' 2378 Set the maximum instantiation depth for template classes to N. A 2379 limit on the template instantiation depth is needed to detect 2380 endless recursions during template class instantiation. ANSI/ISO 2381 C++ conforming programs must not rely on a maximum depth greater 2382 than 17 (changed to 1024 in C++11). The default value is 900, as 2383 the compiler can run out of stack space before hitting 1024 in some 2384 situations. 2385 2386 '-fno-threadsafe-statics' 2387 Do not emit the extra code to use the routines specified in the C++ 2388 ABI for thread-safe initialization of local statics. You can use 2389 this option to reduce code size slightly in code that doesn't need 2390 to be thread-safe. 2391 2392 '-fuse-cxa-atexit' 2393 Register destructors for objects with static storage duration with 2394 the '__cxa_atexit' function rather than the 'atexit' function. 2395 This option is required for fully standards-compliant handling of 2396 static destructors, but only works if your C library supports 2397 '__cxa_atexit'. 2398 2399 '-fno-use-cxa-get-exception-ptr' 2400 Don't use the '__cxa_get_exception_ptr' runtime routine. This 2401 causes 'std::uncaught_exception' to be incorrect, but is necessary 2402 if the runtime routine is not available. 2403 2404 '-fvisibility-inlines-hidden' 2405 This switch declares that the user does not attempt to compare 2406 pointers to inline functions or methods where the addresses of the 2407 two functions are taken in different shared objects. 2408 2409 The effect of this is that GCC may, effectively, mark inline 2410 methods with '__attribute__ ((visibility ("hidden")))' so that they 2411 do not appear in the export table of a DSO and do not require a PLT 2412 indirection when used within the DSO. Enabling this option can 2413 have a dramatic effect on load and link times of a DSO as it 2414 massively reduces the size of the dynamic export table when the 2415 library makes heavy use of templates. 2416 2417 The behavior of this switch is not quite the same as marking the 2418 methods as hidden directly, because it does not affect static 2419 variables local to the function or cause the compiler to deduce 2420 that the function is defined in only one shared object. 2421 2422 You may mark a method as having a visibility explicitly to negate 2423 the effect of the switch for that method. For example, if you do 2424 want to compare pointers to a particular inline method, you might 2425 mark it as having default visibility. Marking the enclosing class 2426 with explicit visibility has no effect. 2427 2428 Explicitly instantiated inline methods are unaffected by this 2429 option as their linkage might otherwise cross a shared library 2430 boundary. *Note Template Instantiation::. 2431 2432 '-fvisibility-ms-compat' 2433 This flag attempts to use visibility settings to make GCC's C++ 2434 linkage model compatible with that of Microsoft Visual Studio. 2435 2436 The flag makes these changes to GCC's linkage model: 2437 2438 1. It sets the default visibility to 'hidden', like 2439 '-fvisibility=hidden'. 2440 2441 2. Types, but not their members, are not hidden by default. 2442 2443 3. The One Definition Rule is relaxed for types without explicit 2444 visibility specifications that are defined in more than one 2445 shared object: those declarations are permitted if they are 2446 permitted when this option is not used. 2447 2448 In new code it is better to use '-fvisibility=hidden' and export 2449 those classes that are intended to be externally visible. 2450 Unfortunately it is possible for code to rely, perhaps 2451 accidentally, on the Visual Studio behavior. 2452 2453 Among the consequences of these changes are that static data 2454 members of the same type with the same name but defined in 2455 different shared objects are different, so changing one does not 2456 change the other; and that pointers to function members defined in 2457 different shared objects may not compare equal. When this flag is 2458 given, it is a violation of the ODR to define types with the same 2459 name differently. 2460 2461 '-fno-weak' 2462 Do not use weak symbol support, even if it is provided by the 2463 linker. By default, G++ uses weak symbols if they are available. 2464 This option exists only for testing, and should not be used by 2465 end-users; it results in inferior code and has no benefits. This 2466 option may be removed in a future release of G++. 2467 2468 '-nostdinc++' 2469 Do not search for header files in the standard directories specific 2470 to C++, but do still search the other standard directories. (This 2471 option is used when building the C++ library.) 2472 2473 In addition, these optimization, warning, and code generation options 2474 have meanings only for C++ programs: 2475 2476 '-fno-default-inline' 2477 Do not assume 'inline' for functions defined inside a class scope. 2478 *Note Options That Control Optimization: Optimize Options. Note 2479 that these functions have linkage like inline functions; they just 2480 aren't inlined by default. 2481 2482 '-Wabi (C, Objective-C, C++ and Objective-C++ only)' 2483 Warn when G++ generates code that is probably not compatible with 2484 the vendor-neutral C++ ABI. Although an effort has been made to 2485 warn about all such cases, there are probably some cases that are 2486 not warned about, even though G++ is generating incompatible code. 2487 There may also be cases where warnings are emitted even though the 2488 code that is generated is compatible. 2489 2490 You should rewrite your code to avoid these warnings if you are 2491 concerned about the fact that code generated by G++ may not be 2492 binary compatible with code generated by other compilers. 2493 2494 The known incompatibilities in '-fabi-version=2' (the default) 2495 include: 2496 2497 * A template with a non-type template parameter of reference 2498 type is mangled incorrectly: 2499 extern int N; 2500 template <int &> struct S {}; 2501 void n (S<N>) {2} 2502 2503 This is fixed in '-fabi-version=3'. 2504 2505 * SIMD vector types declared using '__attribute ((vector_size))' 2506 are mangled in a non-standard way that does not allow for 2507 overloading of functions taking vectors of different sizes. 2508 2509 The mangling is changed in '-fabi-version=4'. 2510 2511 The known incompatibilities in '-fabi-version=1' include: 2512 2513 * Incorrect handling of tail-padding for bit-fields. G++ may 2514 attempt to pack data into the same byte as a base class. For 2515 example: 2516 2517 struct A { virtual void f(); int f1 : 1; }; 2518 struct B : public A { int f2 : 1; }; 2519 2520 In this case, G++ places 'B::f2' into the same byte as 2521 'A::f1'; other compilers do not. You can avoid this problem 2522 by explicitly padding 'A' so that its size is a multiple of 2523 the byte size on your platform; that causes G++ and other 2524 compilers to lay out 'B' identically. 2525 2526 * Incorrect handling of tail-padding for virtual bases. G++ 2527 does not use tail padding when laying out virtual bases. For 2528 example: 2529 2530 struct A { virtual void f(); char c1; }; 2531 struct B { B(); char c2; }; 2532 struct C : public A, public virtual B {}; 2533 2534 In this case, G++ does not place 'B' into the tail-padding for 2535 'A'; other compilers do. You can avoid this problem by 2536 explicitly padding 'A' so that its size is a multiple of its 2537 alignment (ignoring virtual base classes); that causes G++ and 2538 other compilers to lay out 'C' identically. 2539 2540 * Incorrect handling of bit-fields with declared widths greater 2541 than that of their underlying types, when the bit-fields 2542 appear in a union. For example: 2543 2544 union U { int i : 4096; }; 2545 2546 Assuming that an 'int' does not have 4096 bits, G++ makes the 2547 union too small by the number of bits in an 'int'. 2548 2549 * Empty classes can be placed at incorrect offsets. For 2550 example: 2551 2552 struct A {}; 2553 2554 struct B { 2555 A a; 2556 virtual void f (); 2557 }; 2558 2559 struct C : public B, public A {}; 2560 2561 G++ places the 'A' base class of 'C' at a nonzero offset; it 2562 should be placed at offset zero. G++ mistakenly believes that 2563 the 'A' data member of 'B' is already at offset zero. 2564 2565 * Names of template functions whose types involve 'typename' or 2566 template template parameters can be mangled incorrectly. 2567 2568 template <typename Q> 2569 void f(typename Q::X) {} 2570 2571 template <template <typename> class Q> 2572 void f(typename Q<int>::X) {} 2573 2574 Instantiations of these templates may be mangled incorrectly. 2575 2576 It also warns about psABI-related changes. The known psABI changes 2577 at this point include: 2578 2579 * For SysV/x86-64, unions with 'long double' members are passed 2580 in memory as specified in psABI. For example: 2581 2582 union U { 2583 long double ld; 2584 int i; 2585 }; 2586 2587 'union U' is always passed in memory. 2588 2589 '-Wctor-dtor-privacy (C++ and Objective-C++ only)' 2590 Warn when a class seems unusable because all the constructors or 2591 destructors in that class are private, and it has neither friends 2592 nor public static member functions. Also warn if there are no 2593 non-private methods, and there's at least one private member 2594 function that isn't a constructor or destructor. 2595 2596 '-Wdelete-non-virtual-dtor (C++ and Objective-C++ only)' 2597 Warn when 'delete' is used to destroy an instance of a class that 2598 has virtual functions and non-virtual destructor. It is unsafe to 2599 delete an instance of a derived class through a pointer to a base 2600 class if the base class does not have a virtual destructor. This 2601 warning is enabled by '-Wall'. 2602 2603 '-Wliteral-suffix (C++ and Objective-C++ only)' 2604 Warn when a string or character literal is followed by a ud-suffix 2605 which does not begin with an underscore. As a conforming 2606 extension, GCC treats such suffixes as separate preprocessing 2607 tokens in order to maintain backwards compatibility with code that 2608 uses formatting macros from '<inttypes.h>'. For example: 2609 2610 #define __STDC_FORMAT_MACROS 2611 #include <inttypes.h> 2612 #include <stdio.h> 2613 2614 int main() { 2615 int64_t i64 = 123; 2616 printf("My int64: %"PRId64"\n", i64); 2617 } 2618 2619 In this case, 'PRId64' is treated as a separate preprocessing 2620 token. 2621 2622 This warning is enabled by default. 2623 2624 '-Wnarrowing (C++ and Objective-C++ only)' 2625 Warn when a narrowing conversion prohibited by C++11 occurs within 2626 '{ }', e.g. 2627 2628 int i = { 2.2 }; // error: narrowing from double to int 2629 2630 This flag is included in '-Wall' and '-Wc++11-compat'. 2631 2632 With '-std=c++11', '-Wno-narrowing' suppresses the diagnostic 2633 required by the standard. Note that this does not affect the 2634 meaning of well-formed code; narrowing conversions are still 2635 considered ill-formed in SFINAE context. 2636 2637 '-Wnoexcept (C++ and Objective-C++ only)' 2638 Warn when a noexcept-expression evaluates to false because of a 2639 call to a function that does not have a non-throwing exception 2640 specification (i.e. 'throw()' or 'noexcept') but is known by the 2641 compiler to never throw an exception. 2642 2643 '-Wnon-virtual-dtor (C++ and Objective-C++ only)' 2644 Warn when a class has virtual functions and an accessible 2645 non-virtual destructor, in which case it is possible but unsafe to 2646 delete an instance of a derived class through a pointer to the base 2647 class. This warning is also enabled if '-Weffc++' is specified. 2648 2649 '-Wreorder (C++ and Objective-C++ only)' 2650 Warn when the order of member initializers given in the code does 2651 not match the order in which they must be executed. For instance: 2652 2653 struct A { 2654 int i; 2655 int j; 2656 A(): j (0), i (1) { } 2657 }; 2658 2659 The compiler rearranges the member initializers for 'i' and 'j' to 2660 match the declaration order of the members, emitting a warning to 2661 that effect. This warning is enabled by '-Wall'. 2662 2663 '-fext-numeric-literals (C++ and Objective-C++ only)' 2664 Accept imaginary, fixed-point, or machine-defined literal number 2665 suffixes as GNU extensions. When this option is turned off these 2666 suffixes are treated as C++11 user-defined literal numeric 2667 suffixes. This is on by default for all pre-C++11 dialects and all 2668 GNU dialects: '-std=c++98', '-std=gnu++98', '-std=gnu++11', 2669 '-std=gnu++1y'. This option is off by default for ISO C++11 2670 onwards ('-std=c++11', ...). 2671 2672 The following '-W...' options are not affected by '-Wall'. 2673 2674 '-Weffc++ (C++ and Objective-C++ only)' 2675 Warn about violations of the following style guidelines from Scott 2676 Meyers' 'Effective C++, Second Edition' book: 2677 2678 * Item 11: Define a copy constructor and an assignment operator 2679 for classes with dynamically-allocated memory. 2680 2681 * Item 12: Prefer initialization to assignment in constructors. 2682 2683 * Item 14: Make destructors virtual in base classes. 2684 2685 * Item 15: Have 'operator=' return a reference to '*this'. 2686 2687 * Item 23: Don't try to return a reference when you must return 2688 an object. 2689 2690 Also warn about violations of the following style guidelines from 2691 Scott Meyers' 'More Effective C++' book: 2692 2693 * Item 6: Distinguish between prefix and postfix forms of 2694 increment and decrement operators. 2695 2696 * Item 7: Never overload '&&', '||', or ','. 2697 2698 When selecting this option, be aware that the standard library 2699 headers do not obey all of these guidelines; use 'grep -v' to 2700 filter out those warnings. 2701 2702 '-Wstrict-null-sentinel (C++ and Objective-C++ only)' 2703 Warn about the use of an uncasted 'NULL' as sentinel. When 2704 compiling only with GCC this is a valid sentinel, as 'NULL' is 2705 defined to '__null'. Although it is a null pointer constant rather 2706 than a null pointer, it is guaranteed to be of the same size as a 2707 pointer. But this use is not portable across different compilers. 2708 2709 '-Wno-non-template-friend (C++ and Objective-C++ only)' 2710 Disable warnings when non-templatized friend functions are declared 2711 within a template. Since the advent of explicit template 2712 specification support in G++, if the name of the friend is an 2713 unqualified-id (i.e., 'friend foo(int)'), the C++ language 2714 specification demands that the friend declare or define an 2715 ordinary, nontemplate function. (Section 14.5.3). Before G++ 2716 implemented explicit specification, unqualified-ids could be 2717 interpreted as a particular specialization of a templatized 2718 function. Because this non-conforming behavior is no longer the 2719 default behavior for G++, '-Wnon-template-friend' allows the 2720 compiler to check existing code for potential trouble spots and is 2721 on by default. This new compiler behavior can be turned off with 2722 '-Wno-non-template-friend', which keeps the conformant compiler 2723 code but disables the helpful warning. 2724 2725 '-Wold-style-cast (C++ and Objective-C++ only)' 2726 Warn if an old-style (C-style) cast to a non-void type is used 2727 within a C++ program. The new-style casts ('dynamic_cast', 2728 'static_cast', 'reinterpret_cast', and 'const_cast') are less 2729 vulnerable to unintended effects and much easier to search for. 2730 2731 '-Woverloaded-virtual (C++ and Objective-C++ only)' 2732 Warn when a function declaration hides virtual functions from a 2733 base class. For example, in: 2734 2735 struct A { 2736 virtual void f(); 2737 }; 2738 2739 struct B: public A { 2740 void f(int); 2741 }; 2742 2743 the 'A' class version of 'f' is hidden in 'B', and code like: 2744 2745 B* b; 2746 b->f(); 2747 2748 fails to compile. 2749 2750 '-Wno-pmf-conversions (C++ and Objective-C++ only)' 2751 Disable the diagnostic for converting a bound pointer to member 2752 function to a plain pointer. 2753 2754 '-Wsign-promo (C++ and Objective-C++ only)' 2755 Warn when overload resolution chooses a promotion from unsigned or 2756 enumerated type to a signed type, over a conversion to an unsigned 2757 type of the same size. Previous versions of G++ tried to preserve 2758 unsignedness, but the standard mandates the current behavior. 2759 2760 2761 File: gcc.info, Node: Objective-C and Objective-C++ Dialect Options, Next: Language Independent Options, Prev: C++ Dialect Options, Up: Invoking GCC 2762 2763 3.6 Options Controlling Objective-C and Objective-C++ Dialects 2764 ============================================================== 2765 2766 (NOTE: This manual does not describe the Objective-C and Objective-C++ 2767 languages themselves. *Note Language Standards Supported by GCC: 2768 Standards, for references.) 2769 2770 This section describes the command-line options that are only 2771 meaningful for Objective-C and Objective-C++ programs. You can also use 2772 most of the language-independent GNU compiler options. For example, you 2773 might compile a file 'some_class.m' like this: 2774 2775 gcc -g -fgnu-runtime -O -c some_class.m 2776 2777 In this example, '-fgnu-runtime' is an option meant only for Objective-C 2778 and Objective-C++ programs; you can use the other options with any 2779 language supported by GCC. 2780 2781 Note that since Objective-C is an extension of the C language, 2782 Objective-C compilations may also use options specific to the C 2783 front-end (e.g., '-Wtraditional'). Similarly, Objective-C++ 2784 compilations may use C++-specific options (e.g., '-Wabi'). 2785 2786 Here is a list of options that are _only_ for compiling Objective-C and 2787 Objective-C++ programs: 2788 2789 '-fconstant-string-class=CLASS-NAME' 2790 Use CLASS-NAME as the name of the class to instantiate for each 2791 literal string specified with the syntax '@"..."'. The default 2792 class name is 'NXConstantString' if the GNU runtime is being used, 2793 and 'NSConstantString' if the NeXT runtime is being used (see 2794 below). The '-fconstant-cfstrings' option, if also present, 2795 overrides the '-fconstant-string-class' setting and cause '@"..."' 2796 literals to be laid out as constant CoreFoundation strings. 2797 2798 '-fgnu-runtime' 2799 Generate object code compatible with the standard GNU Objective-C 2800 runtime. This is the default for most types of systems. 2801 2802 '-fnext-runtime' 2803 Generate output compatible with the NeXT runtime. This is the 2804 default for NeXT-based systems, including Darwin and Mac OS X. The 2805 macro '__NEXT_RUNTIME__' is predefined if (and only if) this option 2806 is used. 2807 2808 '-fno-nil-receivers' 2809 Assume that all Objective-C message dispatches ('[receiver 2810 message:arg]') in this translation unit ensure that the receiver is 2811 not 'nil'. This allows for more efficient entry points in the 2812 runtime to be used. This option is only available in conjunction 2813 with the NeXT runtime and ABI version 0 or 1. 2814 2815 '-fobjc-abi-version=N' 2816 Use version N of the Objective-C ABI for the selected runtime. 2817 This option is currently supported only for the NeXT runtime. In 2818 that case, Version 0 is the traditional (32-bit) ABI without 2819 support for properties and other Objective-C 2.0 additions. 2820 Version 1 is the traditional (32-bit) ABI with support for 2821 properties and other Objective-C 2.0 additions. Version 2 is the 2822 modern (64-bit) ABI. If nothing is specified, the default is 2823 Version 0 on 32-bit target machines, and Version 2 on 64-bit target 2824 machines. 2825 2826 '-fobjc-call-cxx-cdtors' 2827 For each Objective-C class, check if any of its instance variables 2828 is a C++ object with a non-trivial default constructor. If so, 2829 synthesize a special '- (id) .cxx_construct' instance method which 2830 runs non-trivial default constructors on any such instance 2831 variables, in order, and then return 'self'. Similarly, check if 2832 any instance variable is a C++ object with a non-trivial 2833 destructor, and if so, synthesize a special '- (void) 2834 .cxx_destruct' method which runs all such default destructors, in 2835 reverse order. 2836 2837 The '- (id) .cxx_construct' and '- (void) .cxx_destruct' methods 2838 thusly generated only operate on instance variables declared in the 2839 current Objective-C class, and not those inherited from 2840 superclasses. It is the responsibility of the Objective-C runtime 2841 to invoke all such methods in an object's inheritance hierarchy. 2842 The '- (id) .cxx_construct' methods are invoked by the runtime 2843 immediately after a new object instance is allocated; the '- (void) 2844 .cxx_destruct' methods are invoked immediately before the runtime 2845 deallocates an object instance. 2846 2847 As of this writing, only the NeXT runtime on Mac OS X 10.4 and 2848 later has support for invoking the '- (id) .cxx_construct' and '- 2849 (void) .cxx_destruct' methods. 2850 2851 '-fobjc-direct-dispatch' 2852 Allow fast jumps to the message dispatcher. On Darwin this is 2853 accomplished via the comm page. 2854 2855 '-fobjc-exceptions' 2856 Enable syntactic support for structured exception handling in 2857 Objective-C, similar to what is offered by C++ and Java. This 2858 option is required to use the Objective-C keywords '@try', 2859 '@throw', '@catch', '@finally' and '@synchronized'. This option is 2860 available with both the GNU runtime and the NeXT runtime (but not 2861 available in conjunction with the NeXT runtime on Mac OS X 10.2 and 2862 earlier). 2863 2864 '-fobjc-gc' 2865 Enable garbage collection (GC) in Objective-C and Objective-C++ 2866 programs. This option is only available with the NeXT runtime; the 2867 GNU runtime has a different garbage collection implementation that 2868 does not require special compiler flags. 2869 2870 '-fobjc-nilcheck' 2871 For the NeXT runtime with version 2 of the ABI, check for a nil 2872 receiver in method invocations before doing the actual method call. 2873 This is the default and can be disabled using '-fno-objc-nilcheck'. 2874 Class methods and super calls are never checked for nil in this way 2875 no matter what this flag is set to. Currently this flag does 2876 nothing when the GNU runtime, or an older version of the NeXT 2877 runtime ABI, is used. 2878 2879 '-fobjc-std=objc1' 2880 Conform to the language syntax of Objective-C 1.0, the language 2881 recognized by GCC 4.0. This only affects the Objective-C additions 2882 to the C/C++ language; it does not affect conformance to C/C++ 2883 standards, which is controlled by the separate C/C++ dialect option 2884 flags. When this option is used with the Objective-C or 2885 Objective-C++ compiler, any Objective-C syntax that is not 2886 recognized by GCC 4.0 is rejected. This is useful if you need to 2887 make sure that your Objective-C code can be compiled with older 2888 versions of GCC. 2889 2890 '-freplace-objc-classes' 2891 Emit a special marker instructing 'ld(1)' not to statically link in 2892 the resulting object file, and allow 'dyld(1)' to load it in at run 2893 time instead. This is used in conjunction with the 2894 Fix-and-Continue debugging mode, where the object file in question 2895 may be recompiled and dynamically reloaded in the course of program 2896 execution, without the need to restart the program itself. 2897 Currently, Fix-and-Continue functionality is only available in 2898 conjunction with the NeXT runtime on Mac OS X 10.3 and later. 2899 2900 '-fzero-link' 2901 When compiling for the NeXT runtime, the compiler ordinarily 2902 replaces calls to 'objc_getClass("...")' (when the name of the 2903 class is known at compile time) with static class references that 2904 get initialized at load time, which improves run-time performance. 2905 Specifying the '-fzero-link' flag suppresses this behavior and 2906 causes calls to 'objc_getClass("...")' to be retained. This is 2907 useful in Zero-Link debugging mode, since it allows for individual 2908 class implementations to be modified during program execution. The 2909 GNU runtime currently always retains calls to 2910 'objc_get_class("...")' regardless of command-line options. 2911 2912 '-gen-decls' 2913 Dump interface declarations for all classes seen in the source file 2914 to a file named 'SOURCENAME.decl'. 2915 2916 '-Wassign-intercept (Objective-C and Objective-C++ only)' 2917 Warn whenever an Objective-C assignment is being intercepted by the 2918 garbage collector. 2919 2920 '-Wno-protocol (Objective-C and Objective-C++ only)' 2921 If a class is declared to implement a protocol, a warning is issued 2922 for every method in the protocol that is not implemented by the 2923 class. The default behavior is to issue a warning for every method 2924 not explicitly implemented in the class, even if a method 2925 implementation is inherited from the superclass. If you use the 2926 '-Wno-protocol' option, then methods inherited from the superclass 2927 are considered to be implemented, and no warning is issued for 2928 them. 2929 2930 '-Wselector (Objective-C and Objective-C++ only)' 2931 Warn if multiple methods of different types for the same selector 2932 are found during compilation. The check is performed on the list 2933 of methods in the final stage of compilation. Additionally, a 2934 check is performed for each selector appearing in a 2935 '@selector(...)' expression, and a corresponding method for that 2936 selector has been found during compilation. Because these checks 2937 scan the method table only at the end of compilation, these 2938 warnings are not produced if the final stage of compilation is not 2939 reached, for example because an error is found during compilation, 2940 or because the '-fsyntax-only' option is being used. 2941 2942 '-Wstrict-selector-match (Objective-C and Objective-C++ only)' 2943 Warn if multiple methods with differing argument and/or return 2944 types are found for a given selector when attempting to send a 2945 message using this selector to a receiver of type 'id' or 'Class'. 2946 When this flag is off (which is the default behavior), the compiler 2947 omits such warnings if any differences found are confined to types 2948 that share the same size and alignment. 2949 2950 '-Wundeclared-selector (Objective-C and Objective-C++ only)' 2951 Warn if a '@selector(...)' expression referring to an undeclared 2952 selector is found. A selector is considered undeclared if no 2953 method with that name has been declared before the '@selector(...)' 2954 expression, either explicitly in an '@interface' or '@protocol' 2955 declaration, or implicitly in an '@implementation' section. This 2956 option always performs its checks as soon as a '@selector(...)' 2957 expression is found, while '-Wselector' only performs its checks in 2958 the final stage of compilation. This also enforces the coding 2959 style convention that methods and selectors must be declared before 2960 being used. 2961 2962 '-print-objc-runtime-info' 2963 Generate C header describing the largest structure that is passed 2964 by value, if any. 2965 2966 2967 File: gcc.info, Node: Language Independent Options, Next: Warning Options, Prev: Objective-C and Objective-C++ Dialect Options, Up: Invoking GCC 2968 2969 3.7 Options to Control Diagnostic Messages Formatting 2970 ===================================================== 2971 2972 Traditionally, diagnostic messages have been formatted irrespective of 2973 the output device's aspect (e.g. its width, ...). You can use the 2974 options described below to control the formatting algorithm for 2975 diagnostic messages, e.g. how many characters per line, how often source 2976 location information should be reported. Note that some language front 2977 ends may not honor these options. 2978 2979 '-fmessage-length=N' 2980 Try to format error messages so that they fit on lines of about N 2981 characters. The default is 72 characters for 'g++' and 0 for the 2982 rest of the front ends supported by GCC. If N is zero, then no 2983 line-wrapping is done; each error message appears on a single line. 2984 2985 '-fdiagnostics-show-location=once' 2986 Only meaningful in line-wrapping mode. Instructs the diagnostic 2987 messages reporter to emit source location information _once_; that 2988 is, in case the message is too long to fit on a single physical 2989 line and has to be wrapped, the source location won't be emitted 2990 (as prefix) again, over and over, in subsequent continuation lines. 2991 This is the default behavior. 2992 2993 '-fdiagnostics-show-location=every-line' 2994 Only meaningful in line-wrapping mode. Instructs the diagnostic 2995 messages reporter to emit the same source location information (as 2996 prefix) for physical lines that result from the process of breaking 2997 a message which is too long to fit on a single line. 2998 2999 '-fno-diagnostics-show-option' 3000 By default, each diagnostic emitted includes text indicating the 3001 command-line option that directly controls the diagnostic (if such 3002 an option is known to the diagnostic machinery). Specifying the 3003 '-fno-diagnostics-show-option' flag suppresses that behavior. 3004 3005 '-fno-diagnostics-show-caret' 3006 By default, each diagnostic emitted includes the original source 3007 line and a caret '^' indicating the column. This option suppresses 3008 this information. 3009 3010 3011 File: gcc.info, Node: Warning Options, Next: Debugging Options, Prev: Language Independent Options, Up: Invoking GCC 3012 3013 3.8 Options to Request or Suppress Warnings 3014 =========================================== 3015 3016 Warnings are diagnostic messages that report constructions that are not 3017 inherently erroneous but that are risky or suggest there may have been 3018 an error. 3019 3020 The following language-independent options do not enable specific 3021 warnings but control the kinds of diagnostics produced by GCC. 3022 3023 '-fsyntax-only' 3024 Check the code for syntax errors, but don't do anything beyond 3025 that. 3026 3027 '-fmax-errors=N' 3028 Limits the maximum number of error messages to N, at which point 3029 GCC bails out rather than attempting to continue processing the 3030 source code. If N is 0 (the default), there is no limit on the 3031 number of error messages produced. If '-Wfatal-errors' is also 3032 specified, then '-Wfatal-errors' takes precedence over this option. 3033 3034 '-w' 3035 Inhibit all warning messages. 3036 3037 '-Werror' 3038 Make all warnings into errors. 3039 3040 '-Werror=' 3041 Make the specified warning into an error. The specifier for a 3042 warning is appended; for example '-Werror=switch' turns the 3043 warnings controlled by '-Wswitch' into errors. This switch takes a 3044 negative form, to be used to negate '-Werror' for specific 3045 warnings; for example '-Wno-error=switch' makes '-Wswitch' warnings 3046 not be errors, even when '-Werror' is in effect. 3047 3048 The warning message for each controllable warning includes the 3049 option that controls the warning. That option can then be used 3050 with '-Werror=' and '-Wno-error=' as described above. (Printing of 3051 the option in the warning message can be disabled using the 3052 '-fno-diagnostics-show-option' flag.) 3053 3054 Note that specifying '-Werror='FOO automatically implies '-W'FOO. 3055 However, '-Wno-error='FOO does not imply anything. 3056 3057 '-Wfatal-errors' 3058 This option causes the compiler to abort compilation on the first 3059 error occurred rather than trying to keep going and printing 3060 further error messages. 3061 3062 You can request many specific warnings with options beginning with 3063 '-W', for example '-Wimplicit' to request warnings on implicit 3064 declarations. Each of these specific warning options also has a 3065 negative form beginning '-Wno-' to turn off warnings; for example, 3066 '-Wno-implicit'. This manual lists only one of the two forms, whichever 3067 is not the default. For further language-specific options also refer to 3068 *note C++ Dialect Options:: and *note Objective-C and Objective-C++ 3069 Dialect Options::. 3070 3071 When an unrecognized warning option is requested (e.g., 3072 '-Wunknown-warning'), GCC emits a diagnostic stating that the option is 3073 not recognized. However, if the '-Wno-' form is used, the behavior is 3074 slightly different: no diagnostic is produced for '-Wno-unknown-warning' 3075 unless other diagnostics are being produced. This allows the use of new 3076 '-Wno-' options with old compilers, but if something goes wrong, the 3077 compiler warns that an unrecognized option is present. 3078 3079 '-Wpedantic' 3080 '-pedantic' 3081 Issue all the warnings demanded by strict ISO C and ISO C++; reject 3082 all programs that use forbidden extensions, and some other programs 3083 that do not follow ISO C and ISO C++. For ISO C, follows the 3084 version of the ISO C standard specified by any '-std' option used. 3085 3086 Valid ISO C and ISO C++ programs should compile properly with or 3087 without this option (though a rare few require '-ansi' or a '-std' 3088 option specifying the required version of ISO C). However, without 3089 this option, certain GNU extensions and traditional C and C++ 3090 features are supported as well. With this option, they are 3091 rejected. 3092 3093 '-Wpedantic' does not cause warning messages for use of the 3094 alternate keywords whose names begin and end with '__'. Pedantic 3095 warnings are also disabled in the expression that follows 3096 '__extension__'. However, only system header files should use 3097 these escape routes; application programs should avoid them. *Note 3098 Alternate Keywords::. 3099 3100 Some users try to use '-Wpedantic' to check programs for strict ISO 3101 C conformance. They soon find that it does not do quite what they 3102 want: it finds some non-ISO practices, but not all--only those for 3103 which ISO C _requires_ a diagnostic, and some others for which 3104 diagnostics have been added. 3105 3106 A feature to report any failure to conform to ISO C might be useful 3107 in some instances, but would require considerable additional work 3108 and would be quite different from '-Wpedantic'. We don't have 3109 plans to support such a feature in the near future. 3110 3111 Where the standard specified with '-std' represents a GNU extended 3112 dialect of C, such as 'gnu90' or 'gnu99', there is a corresponding 3113 "base standard", the version of ISO C on which the GNU extended 3114 dialect is based. Warnings from '-Wpedantic' are given where they 3115 are required by the base standard. (It does not make sense for 3116 such warnings to be given only for features not in the specified 3117 GNU C dialect, since by definition the GNU dialects of C include 3118 all features the compiler supports with the given option, and there 3119 would be nothing to warn about.) 3120 3121 '-pedantic-errors' 3122 Like '-Wpedantic', except that errors are produced rather than 3123 warnings. 3124 3125 '-Wall' 3126 This enables all the warnings about constructions that some users 3127 consider questionable, and that are easy to avoid (or modify to 3128 prevent the warning), even in conjunction with macros. This also 3129 enables some language-specific warnings described in *note C++ 3130 Dialect Options:: and *note Objective-C and Objective-C++ Dialect 3131 Options::. 3132 3133 '-Wall' turns on the following warning flags: 3134 3135 -Waddress 3136 -Warray-bounds (only with -O2) 3137 -Wc++11-compat 3138 -Wchar-subscripts 3139 -Wenum-compare (in C/ObjC; this is on by default in C++) 3140 -Wimplicit-int (C and Objective-C only) 3141 -Wimplicit-function-declaration (C and Objective-C only) 3142 -Wcomment 3143 -Wformat 3144 -Wmain (only for C/ObjC and unless -ffreestanding) 3145 -Wmaybe-uninitialized 3146 -Wmissing-braces (only for C/ObjC) 3147 -Wnonnull 3148 -Wparentheses 3149 -Wpointer-sign 3150 -Wreorder 3151 -Wreturn-type 3152 -Wsequence-point 3153 -Wsign-compare (only in C++) 3154 -Wstrict-aliasing 3155 -Wstrict-overflow=1 3156 -Wswitch 3157 -Wtrigraphs 3158 -Wuninitialized 3159 -Wunknown-pragmas 3160 -Wunused-function 3161 -Wunused-label 3162 -Wunused-value 3163 -Wunused-variable 3164 -Wvolatile-register-var 3165 3166 3167 Note that some warning flags are not implied by '-Wall'. Some of 3168 them warn about constructions that users generally do not consider 3169 questionable, but which occasionally you might wish to check for; 3170 others warn about constructions that are necessary or hard to avoid 3171 in some cases, and there is no simple way to modify the code to 3172 suppress the warning. Some of them are enabled by '-Wextra' but 3173 many of them must be enabled individually. 3174 3175 '-Wextra' 3176 This enables some extra warning flags that are not enabled by 3177 '-Wall'. (This option used to be called '-W'. The older name is 3178 still supported, but the newer name is more descriptive.) 3179 3180 -Wclobbered 3181 -Wempty-body 3182 -Wignored-qualifiers 3183 -Wmissing-field-initializers 3184 -Wmissing-parameter-type (C only) 3185 -Wold-style-declaration (C only) 3186 -Woverride-init 3187 -Wsign-compare 3188 -Wtype-limits 3189 -Wuninitialized 3190 -Wunused-parameter (only with -Wunused or -Wall) 3191 -Wunused-but-set-parameter (only with -Wunused or -Wall) 3192 3193 3194 The option '-Wextra' also prints warning messages for the following 3195 cases: 3196 3197 * A pointer is compared against integer zero with '<', '<=', 3198 '>', or '>='. 3199 3200 * (C++ only) An enumerator and a non-enumerator both appear in a 3201 conditional expression. 3202 3203 * (C++ only) Ambiguous virtual bases. 3204 3205 * (C++ only) Subscripting an array that has been declared 3206 'register'. 3207 3208 * (C++ only) Taking the address of a variable that has been 3209 declared 'register'. 3210 3211 * (C++ only) A base class is not initialized in a derived 3212 class's copy constructor. 3213 3214 '-Wchar-subscripts' 3215 Warn if an array subscript has type 'char'. This is a common cause 3216 of error, as programmers often forget that this type is signed on 3217 some machines. This warning is enabled by '-Wall'. 3218 3219 '-Wcomment' 3220 Warn whenever a comment-start sequence '/*' appears in a '/*' 3221 comment, or whenever a Backslash-Newline appears in a '//' comment. 3222 This warning is enabled by '-Wall'. 3223 3224 '-Wno-coverage-mismatch' 3225 Warn if feedback profiles do not match when using the 3226 '-fprofile-use' option. If a source file is changed between 3227 compiling with '-fprofile-gen' and with '-fprofile-use', the files 3228 with the profile feedback can fail to match the source file and GCC 3229 cannot use the profile feedback information. By default, this 3230 warning is enabled and is treated as an error. 3231 '-Wno-coverage-mismatch' can be used to disable the warning or 3232 '-Wno-error=coverage-mismatch' can be used to disable the error. 3233 Disabling the error for this warning can result in poorly optimized 3234 code and is useful only in the case of very minor changes such as 3235 bug fixes to an existing code-base. Completely disabling the 3236 warning is not recommended. 3237 3238 '-Wno-cpp' 3239 (C, Objective-C, C++, Objective-C++ and Fortran only) 3240 3241 Suppress warning messages emitted by '#warning' directives. 3242 3243 '-Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)' 3244 Give a warning when a value of type 'float' is implicitly promoted 3245 to 'double'. CPUs with a 32-bit "single-precision" floating-point 3246 unit implement 'float' in hardware, but emulate 'double' in 3247 software. On such a machine, doing computations using 'double' 3248 values is much more expensive because of the overhead required for 3249 software emulation. 3250 3251 It is easy to accidentally do computations with 'double' because 3252 floating-point literals are implicitly of type 'double'. For 3253 example, in: 3254 float area(float radius) 3255 { 3256 return 3.14159 * radius * radius; 3257 } 3258 the compiler performs the entire computation with 'double' because 3259 the floating-point literal is a 'double'. 3260 3261 '-Wformat' 3262 '-Wformat=N' 3263 Check calls to 'printf' and 'scanf', etc., to make sure that the 3264 arguments supplied have types appropriate to the format string 3265 specified, and that the conversions specified in the format string 3266 make sense. This includes standard functions, and others specified 3267 by format attributes (*note Function Attributes::), in the 3268 'printf', 'scanf', 'strftime' and 'strfmon' (an X/Open extension, 3269 not in the C standard) families (or other target-specific 3270 families). Which functions are checked without format attributes 3271 having been specified depends on the standard version selected, and 3272 such checks of functions without the attribute specified are 3273 disabled by '-ffreestanding' or '-fno-builtin'. 3274 3275 The formats are checked against the format features supported by 3276 GNU libc version 2.2. These include all ISO C90 and C99 features, 3277 as well as features from the Single Unix Specification and some BSD 3278 and GNU extensions. Other library implementations may not support 3279 all these features; GCC does not support warning about features 3280 that go beyond a particular library's limitations. However, if 3281 '-Wpedantic' is used with '-Wformat', warnings are given about 3282 format features not in the selected standard version (but not for 3283 'strfmon' formats, since those are not in any version of the C 3284 standard). *Note Options Controlling C Dialect: C Dialect Options. 3285 3286 '-Wformat=1' 3287 '-Wformat' 3288 Option '-Wformat' is equivalent to '-Wformat=1', and 3289 '-Wno-format' is equivalent to '-Wformat=0'. Since '-Wformat' 3290 also checks for null format arguments for several functions, 3291 '-Wformat' also implies '-Wnonnull'. Some aspects of this 3292 level of format checking can be disabled by the options: 3293 '-Wno-format-contains-nul', '-Wno-format-extra-args', and 3294 '-Wno-format-zero-length'. '-Wformat' is enabled by '-Wall'. 3295 3296 '-Wno-format-contains-nul' 3297 If '-Wformat' is specified, do not warn about format strings 3298 that contain NUL bytes. 3299 3300 '-Wno-format-extra-args' 3301 If '-Wformat' is specified, do not warn about excess arguments 3302 to a 'printf' or 'scanf' format function. The C standard 3303 specifies that such arguments are ignored. 3304 3305 Where the unused arguments lie between used arguments that are 3306 specified with '$' operand number specifications, normally 3307 warnings are still given, since the implementation could not 3308 know what type to pass to 'va_arg' to skip the unused 3309 arguments. However, in the case of 'scanf' formats, this 3310 option suppresses the warning if the unused arguments are all 3311 pointers, since the Single Unix Specification says that such 3312 unused arguments are allowed. 3313 3314 '-Wno-format-zero-length' 3315 If '-Wformat' is specified, do not warn about zero-length 3316 formats. The C standard specifies that zero-length formats 3317 are allowed. 3318 3319 '-Wformat=2' 3320 Enable '-Wformat' plus additional format checks. Currently 3321 equivalent to '-Wformat -Wformat-nonliteral -Wformat-security 3322 -Wformat-y2k'. 3323 3324 '-Wformat-nonliteral' 3325 If '-Wformat' is specified, also warn if the format string is 3326 not a string literal and so cannot be checked, unless the 3327 format function takes its format arguments as a 'va_list'. 3328 3329 '-Wformat-security' 3330 If '-Wformat' is specified, also warn about uses of format 3331 functions that represent possible security problems. At 3332 present, this warns about calls to 'printf' and 'scanf' 3333 functions where the format string is not a string literal and 3334 there are no format arguments, as in 'printf (foo);'. This 3335 may be a security hole if the format string came from 3336 untrusted input and contains '%n'. (This is currently a 3337 subset of what '-Wformat-nonliteral' warns about, but in 3338 future warnings may be added to '-Wformat-security' that are 3339 not included in '-Wformat-nonliteral'.) 3340 3341 '-Wformat-y2k' 3342 If '-Wformat' is specified, also warn about 'strftime' formats 3343 that may yield only a two-digit year. 3344 3345 '-Wnonnull' 3346 Warn about passing a null pointer for arguments marked as requiring 3347 a non-null value by the 'nonnull' function attribute. 3348 3349 '-Wnonnull' is included in '-Wall' and '-Wformat'. It can be 3350 disabled with the '-Wno-nonnull' option. 3351 3352 '-Winit-self (C, C++, Objective-C and Objective-C++ only)' 3353 Warn about uninitialized variables that are initialized with 3354 themselves. Note this option can only be used with the 3355 '-Wuninitialized' option. 3356 3357 For example, GCC warns about 'i' being uninitialized in the 3358 following snippet only when '-Winit-self' has been specified: 3359 int f() 3360 { 3361 int i = i; 3362 return i; 3363 } 3364 3365 This warning is enabled by '-Wall' in C++. 3366 3367 '-Wimplicit-int (C and Objective-C only)' 3368 Warn when a declaration does not specify a type. This warning is 3369 enabled by '-Wall'. 3370 3371 '-Wimplicit-function-declaration (C and Objective-C only)' 3372 Give a warning whenever a function is used before being declared. 3373 In C99 mode ('-std=c99' or '-std=gnu99'), this warning is enabled 3374 by default and it is made into an error by '-pedantic-errors'. 3375 This warning is also enabled by '-Wall'. 3376 3377 '-Wimplicit (C and Objective-C only)' 3378 Same as '-Wimplicit-int' and '-Wimplicit-function-declaration'. 3379 This warning is enabled by '-Wall'. 3380 3381 '-Wignored-qualifiers (C and C++ only)' 3382 Warn if the return type of a function has a type qualifier such as 3383 'const'. For ISO C such a type qualifier has no effect, since the 3384 value returned by a function is not an lvalue. For C++, the 3385 warning is only emitted for scalar types or 'void'. ISO C 3386 prohibits qualified 'void' return types on function definitions, so 3387 such return types always receive a warning even without this 3388 option. 3389 3390 This warning is also enabled by '-Wextra'. 3391 3392 '-Wmain' 3393 Warn if the type of 'main' is suspicious. 'main' should be a 3394 function with external linkage, returning int, taking either zero 3395 arguments, two, or three arguments of appropriate types. This 3396 warning is enabled by default in C++ and is enabled by either 3397 '-Wall' or '-Wpedantic'. 3398 3399 '-Wmissing-braces' 3400 Warn if an aggregate or union initializer is not fully bracketed. 3401 In the following example, the initializer for 'a' is not fully 3402 bracketed, but that for 'b' is fully bracketed. This warning is 3403 enabled by '-Wall' in C. 3404 3405 int a[2][2] = { 0, 1, 2, 3 }; 3406 int b[2][2] = { { 0, 1 }, { 2, 3 } }; 3407 3408 This warning is enabled by '-Wall'. 3409 3410 '-Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)' 3411 Warn if a user-supplied include directory does not exist. 3412 3413 '-Wparentheses' 3414 Warn if parentheses are omitted in certain contexts, such as when 3415 there is an assignment in a context where a truth value is 3416 expected, or when operators are nested whose precedence people 3417 often get confused about. 3418 3419 Also warn if a comparison like 'x<=y<=z' appears; this is 3420 equivalent to '(x<=y ? 1 : 0) <= z', which is a different 3421 interpretation from that of ordinary mathematical notation. 3422 3423 Also warn about constructions where there may be confusion to which 3424 'if' statement an 'else' branch belongs. Here is an example of 3425 such a case: 3426 3427 { 3428 if (a) 3429 if (b) 3430 foo (); 3431 else 3432 bar (); 3433 } 3434 3435 In C/C++, every 'else' branch belongs to the innermost possible 3436 'if' statement, which in this example is 'if (b)'. This is often 3437 not what the programmer expected, as illustrated in the above 3438 example by indentation the programmer chose. When there is the 3439 potential for this confusion, GCC issues a warning when this flag 3440 is specified. To eliminate the warning, add explicit braces around 3441 the innermost 'if' statement so there is no way the 'else' can 3442 belong to the enclosing 'if'. The resulting code looks like this: 3443 3444 { 3445 if (a) 3446 { 3447 if (b) 3448 foo (); 3449 else 3450 bar (); 3451 } 3452 } 3453 3454 Also warn for dangerous uses of the GNU extension to '?:' with 3455 omitted middle operand. When the condition in the '?': operator is 3456 a boolean expression, the omitted value is always 1. Often 3457 programmers expect it to be a value computed inside the conditional 3458 expression instead. 3459 3460 This warning is enabled by '-Wall'. 3461 3462 '-Wsequence-point' 3463 Warn about code that may have undefined semantics because of 3464 violations of sequence point rules in the C and C++ standards. 3465 3466 The C and C++ standards define the order in which expressions in a 3467 C/C++ program are evaluated in terms of "sequence points", which 3468 represent a partial ordering between the execution of parts of the 3469 program: those executed before the sequence point, and those 3470 executed after it. These occur after the evaluation of a full 3471 expression (one which is not part of a larger expression), after 3472 the evaluation of the first operand of a '&&', '||', '? :' or ',' 3473 (comma) operator, before a function is called (but after the 3474 evaluation of its arguments and the expression denoting the called 3475 function), and in certain other places. Other than as expressed by 3476 the sequence point rules, the order of evaluation of subexpressions 3477 of an expression is not specified. All these rules describe only a 3478 partial order rather than a total order, since, for example, if two 3479 functions are called within one expression with no sequence point 3480 between them, the order in which the functions are called is not 3481 specified. However, the standards committee have ruled that 3482 function calls do not overlap. 3483 3484 It is not specified when between sequence points modifications to 3485 the values of objects take effect. Programs whose behavior depends 3486 on this have undefined behavior; the C and C++ standards specify 3487 that "Between the previous and next sequence point an object shall 3488 have its stored value modified at most once by the evaluation of an 3489 expression. Furthermore, the prior value shall be read only to 3490 determine the value to be stored.". If a program breaks these 3491 rules, the results on any particular implementation are entirely 3492 unpredictable. 3493 3494 Examples of code with undefined behavior are 'a = a++;', 'a[n] = 3495 b[n++]' and 'a[i++] = i;'. Some more complicated cases are not 3496 diagnosed by this option, and it may give an occasional false 3497 positive result, but in general it has been found fairly effective 3498 at detecting this sort of problem in programs. 3499 3500 The standard is worded confusingly, therefore there is some debate 3501 over the precise meaning of the sequence point rules in subtle 3502 cases. Links to discussions of the problem, including proposed 3503 formal definitions, may be found on the GCC readings page, at 3504 <http://gcc.gnu.org/readings.html>. 3505 3506 This warning is enabled by '-Wall' for C and C++. 3507 3508 '-Wno-return-local-addr' 3509 Do not warn about returning a pointer (or in C++, a reference) to a 3510 variable that goes out of scope after the function returns. 3511 3512 '-Wreturn-type' 3513 Warn whenever a function is defined with a return type that 3514 defaults to 'int'. Also warn about any 'return' statement with no 3515 return value in a function whose return type is not 'void' (falling 3516 off the end of the function body is considered returning without a 3517 value), and about a 'return' statement with an expression in a 3518 function whose return type is 'void'. 3519 3520 For C++, a function without return type always produces a 3521 diagnostic message, even when '-Wno-return-type' is specified. The 3522 only exceptions are 'main' and functions defined in system headers. 3523 3524 This warning is enabled by '-Wall'. 3525 3526 '-Wswitch' 3527 Warn whenever a 'switch' statement has an index of enumerated type 3528 and lacks a 'case' for one or more of the named codes of that 3529 enumeration. (The presence of a 'default' label prevents this 3530 warning.) 'case' labels outside the enumeration range also provoke 3531 warnings when this option is used (even if there is a 'default' 3532 label). This warning is enabled by '-Wall'. 3533 3534 '-Wswitch-default' 3535 Warn whenever a 'switch' statement does not have a 'default' case. 3536 3537 '-Wswitch-enum' 3538 Warn whenever a 'switch' statement has an index of enumerated type 3539 and lacks a 'case' for one or more of the named codes of that 3540 enumeration. 'case' labels outside the enumeration range also 3541 provoke warnings when this option is used. The only difference 3542 between '-Wswitch' and this option is that this option gives a 3543 warning about an omitted enumeration code even if there is a 3544 'default' label. 3545 3546 '-Wsync-nand (C and C++ only)' 3547 Warn when '__sync_fetch_and_nand' and '__sync_nand_and_fetch' 3548 built-in functions are used. These functions changed semantics in 3549 GCC 4.4. 3550 3551 '-Wtrigraphs' 3552 Warn if any trigraphs are encountered that might change the meaning 3553 of the program (trigraphs within comments are not warned about). 3554 This warning is enabled by '-Wall'. 3555 3556 '-Wunused-but-set-parameter' 3557 Warn whenever a function parameter is assigned to, but otherwise 3558 unused (aside from its declaration). 3559 3560 To suppress this warning use the 'unused' attribute (*note Variable 3561 Attributes::). 3562 3563 This warning is also enabled by '-Wunused' together with '-Wextra'. 3564 3565 '-Wunused-but-set-variable' 3566 Warn whenever a local variable is assigned to, but otherwise unused 3567 (aside from its declaration). This warning is enabled by '-Wall'. 3568 3569 To suppress this warning use the 'unused' attribute (*note Variable 3570 Attributes::). 3571 3572 This warning is also enabled by '-Wunused', which is enabled by 3573 '-Wall'. 3574 3575 '-Wunused-function' 3576 Warn whenever a static function is declared but not defined or a 3577 non-inline static function is unused. This warning is enabled by 3578 '-Wall'. 3579 3580 '-Wunused-label' 3581 Warn whenever a label is declared but not used. This warning is 3582 enabled by '-Wall'. 3583 3584 To suppress this warning use the 'unused' attribute (*note Variable 3585 Attributes::). 3586 3587 '-Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)' 3588 Warn when a typedef locally defined in a function is not used. 3589 This warning is enabled by '-Wall'. 3590 3591 '-Wunused-parameter' 3592 Warn whenever a function parameter is unused aside from its 3593 declaration. 3594 3595 To suppress this warning use the 'unused' attribute (*note Variable 3596 Attributes::). 3597 3598 '-Wno-unused-result' 3599 Do not warn if a caller of a function marked with attribute 3600 'warn_unused_result' (*note Function Attributes::) does not use its 3601 return value. The default is '-Wunused-result'. 3602 3603 '-Wunused-variable' 3604 Warn whenever a local variable or non-constant static variable is 3605 unused aside from its declaration. This warning is enabled by 3606 '-Wall'. 3607 3608 To suppress this warning use the 'unused' attribute (*note Variable 3609 Attributes::). 3610 3611 '-Wunused-value' 3612 Warn whenever a statement computes a result that is explicitly not 3613 used. To suppress this warning cast the unused expression to 3614 'void'. This includes an expression-statement or the left-hand 3615 side of a comma expression that contains no side effects. For 3616 example, an expression such as 'x[i,j]' causes a warning, while 3617 'x[(void)i,j]' does not. 3618 3619 This warning is enabled by '-Wall'. 3620 3621 '-Wunused' 3622 All the above '-Wunused' options combined. 3623 3624 In order to get a warning about an unused function parameter, you 3625 must either specify '-Wextra -Wunused' (note that '-Wall' implies 3626 '-Wunused'), or separately specify '-Wunused-parameter'. 3627 3628 '-Wuninitialized' 3629 Warn if an automatic variable is used without first being 3630 initialized or if a variable may be clobbered by a 'setjmp' call. 3631 In C++, warn if a non-static reference or non-static 'const' member 3632 appears in a class without constructors. 3633 3634 If you want to warn about code that uses the uninitialized value of 3635 the variable in its own initializer, use the '-Winit-self' option. 3636 3637 These warnings occur for individual uninitialized or clobbered 3638 elements of structure, union or array variables as well as for 3639 variables that are uninitialized or clobbered as a whole. They do 3640 not occur for variables or elements declared 'volatile'. Because 3641 these warnings depend on optimization, the exact variables or 3642 elements for which there are warnings depends on the precise 3643 optimization options and version of GCC used. 3644 3645 Note that there may be no warning about a variable that is used 3646 only to compute a value that itself is never used, because such 3647 computations may be deleted by data flow analysis before the 3648 warnings are printed. 3649 3650 '-Wmaybe-uninitialized' 3651 For an automatic variable, if there exists a path from the function 3652 entry to a use of the variable that is initialized, but there exist 3653 some other paths for which the variable is not initialized, the 3654 compiler emits a warning if it cannot prove the uninitialized paths 3655 are not executed at run time. These warnings are made optional 3656 because GCC is not smart enough to see all the reasons why the code 3657 might be correct in spite of appearing to have an error. Here is 3658 one example of how this can happen: 3659 3660 { 3661 int x; 3662 switch (y) 3663 { 3664 case 1: x = 1; 3665 break; 3666 case 2: x = 4; 3667 break; 3668 case 3: x = 5; 3669 } 3670 foo (x); 3671 } 3672 3673 If the value of 'y' is always 1, 2 or 3, then 'x' is always 3674 initialized, but GCC doesn't know this. To suppress the warning, 3675 you need to provide a default case with assert(0) or similar code. 3676 3677 This option also warns when a non-volatile automatic variable might 3678 be changed by a call to 'longjmp'. These warnings as well are 3679 possible only in optimizing compilation. 3680 3681 The compiler sees only the calls to 'setjmp'. It cannot know where 3682 'longjmp' will be called; in fact, a signal handler could call it 3683 at any point in the code. As a result, you may get a warning even 3684 when there is in fact no problem because 'longjmp' cannot in fact 3685 be called at the place that would cause a problem. 3686 3687 Some spurious warnings can be avoided if you declare all the 3688 functions you use that never return as 'noreturn'. *Note Function 3689 Attributes::. 3690 3691 This warning is enabled by '-Wall' or '-Wextra'. 3692 3693 '-Wunknown-pragmas' 3694 Warn when a '#pragma' directive is encountered that is not 3695 understood by GCC. If this command-line option is used, warnings 3696 are even issued for unknown pragmas in system header files. This 3697 is not the case if the warnings are only enabled by the '-Wall' 3698 command-line option. 3699 3700 '-Wno-pragmas' 3701 Do not warn about misuses of pragmas, such as incorrect parameters, 3702 invalid syntax, or conflicts between pragmas. See also 3703 '-Wunknown-pragmas'. 3704 3705 '-Wstrict-aliasing' 3706 This option is only active when '-fstrict-aliasing' is active. It 3707 warns about code that might break the strict aliasing rules that 3708 the compiler is using for optimization. The warning does not catch 3709 all cases, but does attempt to catch the more common pitfalls. It 3710 is included in '-Wall'. It is equivalent to '-Wstrict-aliasing=3' 3711 3712 '-Wstrict-aliasing=n' 3713 This option is only active when '-fstrict-aliasing' is active. It 3714 warns about code that might break the strict aliasing rules that 3715 the compiler is using for optimization. Higher levels correspond 3716 to higher accuracy (fewer false positives). Higher levels also 3717 correspond to more effort, similar to the way '-O' works. 3718 '-Wstrict-aliasing' is equivalent to '-Wstrict-aliasing=3'. 3719 3720 Level 1: Most aggressive, quick, least accurate. Possibly useful 3721 when higher levels do not warn but '-fstrict-aliasing' still breaks 3722 the code, as it has very few false negatives. However, it has many 3723 false positives. Warns for all pointer conversions between 3724 possibly incompatible types, even if never dereferenced. Runs in 3725 the front end only. 3726 3727 Level 2: Aggressive, quick, not too precise. May still have many 3728 false positives (not as many as level 1 though), and few false 3729 negatives (but possibly more than level 1). Unlike level 1, it 3730 only warns when an address is taken. Warns about incomplete types. 3731 Runs in the front end only. 3732 3733 Level 3 (default for '-Wstrict-aliasing'): Should have very few 3734 false positives and few false negatives. Slightly slower than 3735 levels 1 or 2 when optimization is enabled. Takes care of the 3736 common pun+dereference pattern in the front end: 3737 '*(int*)&some_float'. If optimization is enabled, it also runs in 3738 the back end, where it deals with multiple statement cases using 3739 flow-sensitive points-to information. Only warns when the 3740 converted pointer is dereferenced. Does not warn about incomplete 3741 types. 3742 3743 '-Wstrict-overflow' 3744 '-Wstrict-overflow=N' 3745 This option is only active when '-fstrict-overflow' is active. It 3746 warns about cases where the compiler optimizes based on the 3747 assumption that signed overflow does not occur. Note that it does 3748 not warn about all cases where the code might overflow: it only 3749 warns about cases where the compiler implements some optimization. 3750 Thus this warning depends on the optimization level. 3751 3752 An optimization that assumes that signed overflow does not occur is 3753 perfectly safe if the values of the variables involved are such 3754 that overflow never does, in fact, occur. Therefore this warning 3755 can easily give a false positive: a warning about code that is not 3756 actually a problem. To help focus on important issues, several 3757 warning levels are defined. No warnings are issued for the use of 3758 undefined signed overflow when estimating how many iterations a 3759 loop requires, in particular when determining whether a loop will 3760 be executed at all. 3761 3762 '-Wstrict-overflow=1' 3763 Warn about cases that are both questionable and easy to avoid. 3764 For example, with '-fstrict-overflow', the compiler simplifies 3765 'x + 1 > x' to '1'. This level of '-Wstrict-overflow' is 3766 enabled by '-Wall'; higher levels are not, and must be 3767 explicitly requested. 3768 3769 '-Wstrict-overflow=2' 3770 Also warn about other cases where a comparison is simplified 3771 to a constant. For example: 'abs (x) >= 0'. This can only be 3772 simplified when '-fstrict-overflow' is in effect, because 'abs 3773 (INT_MIN)' overflows to 'INT_MIN', which is less than zero. 3774 '-Wstrict-overflow' (with no level) is the same as 3775 '-Wstrict-overflow=2'. 3776 3777 '-Wstrict-overflow=3' 3778 Also warn about other cases where a comparison is simplified. 3779 For example: 'x + 1 > 1' is simplified to 'x > 0'. 3780 3781 '-Wstrict-overflow=4' 3782 Also warn about other simplifications not covered by the above 3783 cases. For example: '(x * 10) / 5' is simplified to 'x * 2'. 3784 3785 '-Wstrict-overflow=5' 3786 Also warn about cases where the compiler reduces the magnitude 3787 of a constant involved in a comparison. For example: 'x + 2 > 3788 y' is simplified to 'x + 1 >= y'. This is reported only at 3789 the highest warning level because this simplification applies 3790 to many comparisons, so this warning level gives a very large 3791 number of false positives. 3792 3793 '-Wsuggest-attribute=[pure|const|noreturn|format]' 3794 Warn for cases where adding an attribute may be beneficial. The 3795 attributes currently supported are listed below. 3796 3797 '-Wsuggest-attribute=pure' 3798 '-Wsuggest-attribute=const' 3799 '-Wsuggest-attribute=noreturn' 3800 3801 Warn about functions that might be candidates for attributes 3802 'pure', 'const' or 'noreturn'. The compiler only warns for 3803 functions visible in other compilation units or (in the case 3804 of 'pure' and 'const') if it cannot prove that the function 3805 returns normally. A function returns normally if it doesn't 3806 contain an infinite loop or return abnormally by throwing, 3807 calling 'abort()' or trapping. This analysis requires option 3808 '-fipa-pure-const', which is enabled by default at '-O' and 3809 higher. Higher optimization levels improve the accuracy of 3810 the analysis. 3811 3812 '-Wsuggest-attribute=format' 3813 '-Wmissing-format-attribute' 3814 3815 Warn about function pointers that might be candidates for 3816 'format' attributes. Note these are only possible candidates, 3817 not absolute ones. GCC guesses that function pointers with 3818 'format' attributes that are used in assignment, 3819 initialization, parameter passing or return statements should 3820 have a corresponding 'format' attribute in the resulting type. 3821 I.e. the left-hand side of the assignment or initialization, 3822 the type of the parameter variable, or the return type of the 3823 containing function respectively should also have a 'format' 3824 attribute to avoid the warning. 3825 3826 GCC also warns about function definitions that might be 3827 candidates for 'format' attributes. Again, these are only 3828 possible candidates. GCC guesses that 'format' attributes 3829 might be appropriate for any function that calls a function 3830 like 'vprintf' or 'vscanf', but this might not always be the 3831 case, and some functions for which 'format' attributes are 3832 appropriate may not be detected. 3833 3834 '-Warray-bounds' 3835 This option is only active when '-ftree-vrp' is active (default for 3836 '-O2' and above). It warns about subscripts to arrays that are 3837 always out of bounds. This warning is enabled by '-Wall'. 3838 3839 '-Wno-div-by-zero' 3840 Do not warn about compile-time integer division by zero. 3841 Floating-point division by zero is not warned about, as it can be a 3842 legitimate way of obtaining infinities and NaNs. 3843 3844 '-Wsystem-headers' 3845 Print warning messages for constructs found in system header files. 3846 Warnings from system headers are normally suppressed, on the 3847 assumption that they usually do not indicate real problems and 3848 would only make the compiler output harder to read. Using this 3849 command-line option tells GCC to emit warnings from system headers 3850 as if they occurred in user code. However, note that using '-Wall' 3851 in conjunction with this option does _not_ warn about unknown 3852 pragmas in system headers--for that, '-Wunknown-pragmas' must also 3853 be used. 3854 3855 '-Wtrampolines' 3856 Warn about trampolines generated for pointers to nested functions. 3857 3858 A trampoline is a small piece of data or code that is created at 3859 run time on the stack when the address of a nested function is 3860 taken, and is used to call the nested function indirectly. For 3861 some targets, it is made up of data only and thus requires no 3862 special treatment. But, for most targets, it is made up of code 3863 and thus requires the stack to be made executable in order for the 3864 program to work properly. 3865 3866 '-Wfloat-equal' 3867 Warn if floating-point values are used in equality comparisons. 3868 3869 The idea behind this is that sometimes it is convenient (for the 3870 programmer) to consider floating-point values as approximations to 3871 infinitely precise real numbers. If you are doing this, then you 3872 need to compute (by analyzing the code, or in some other way) the 3873 maximum or likely maximum error that the computation introduces, 3874 and allow for it when performing comparisons (and when producing 3875 output, but that's a different problem). In particular, instead of 3876 testing for equality, you should check to see whether the two 3877 values have ranges that overlap; and this is done with the 3878 relational operators, so equality comparisons are probably 3879 mistaken. 3880 3881 '-Wtraditional (C and Objective-C only)' 3882 Warn about certain constructs that behave differently in 3883 traditional and ISO C. Also warn about ISO C constructs that have 3884 no traditional C equivalent, and/or problematic constructs that 3885 should be avoided. 3886 3887 * Macro parameters that appear within string literals in the 3888 macro body. In traditional C macro replacement takes place 3889 within string literals, but in ISO C it does not. 3890 3891 * In traditional C, some preprocessor directives did not exist. 3892 Traditional preprocessors only considered a line to be a 3893 directive if the '#' appeared in column 1 on the line. 3894 Therefore '-Wtraditional' warns about directives that 3895 traditional C understands but ignores because the '#' does not 3896 appear as the first character on the line. It also suggests 3897 you hide directives like '#pragma' not understood by 3898 traditional C by indenting them. Some traditional 3899 implementations do not recognize '#elif', so this option 3900 suggests avoiding it altogether. 3901 3902 * A function-like macro that appears without arguments. 3903 3904 * The unary plus operator. 3905 3906 * The 'U' integer constant suffix, or the 'F' or 'L' 3907 floating-point constant suffixes. (Traditional C does support 3908 the 'L' suffix on integer constants.) Note, these suffixes 3909 appear in macros defined in the system headers of most modern 3910 systems, e.g. the '_MIN'/'_MAX' macros in '<limits.h>'. Use 3911 of these macros in user code might normally lead to spurious 3912 warnings, however GCC's integrated preprocessor has enough 3913 context to avoid warning in these cases. 3914 3915 * A function declared external in one block and then used after 3916 the end of the block. 3917 3918 * A 'switch' statement has an operand of type 'long'. 3919 3920 * A non-'static' function declaration follows a 'static' one. 3921 This construct is not accepted by some traditional C 3922 compilers. 3923 3924 * The ISO type of an integer constant has a different width or 3925 signedness from its traditional type. This warning is only 3926 issued if the base of the constant is ten. I.e. hexadecimal 3927 or octal values, which typically represent bit patterns, are 3928 not warned about. 3929 3930 * Usage of ISO string concatenation is detected. 3931 3932 * Initialization of automatic aggregates. 3933 3934 * Identifier conflicts with labels. Traditional C lacks a 3935 separate namespace for labels. 3936 3937 * Initialization of unions. If the initializer is zero, the 3938 warning is omitted. This is done under the assumption that 3939 the zero initializer in user code appears conditioned on e.g. 3940 '__STDC__' to avoid missing initializer warnings and relies on 3941 default initialization to zero in the traditional C case. 3942 3943 * Conversions by prototypes between fixed/floating-point values 3944 and vice versa. The absence of these prototypes when 3945 compiling with traditional C causes serious problems. This is 3946 a subset of the possible conversion warnings; for the full set 3947 use '-Wtraditional-conversion'. 3948 3949 * Use of ISO C style function definitions. This warning 3950 intentionally is _not_ issued for prototype declarations or 3951 variadic functions because these ISO C features appear in your 3952 code when using libiberty's traditional C compatibility 3953 macros, 'PARAMS' and 'VPARAMS'. This warning is also bypassed 3954 for nested functions because that feature is already a GCC 3955 extension and thus not relevant to traditional C 3956 compatibility. 3957 3958 '-Wtraditional-conversion (C and Objective-C only)' 3959 Warn if a prototype causes a type conversion that is different from 3960 what would happen to the same argument in the absence of a 3961 prototype. This includes conversions of fixed point to floating 3962 and vice versa, and conversions changing the width or signedness of 3963 a fixed-point argument except when the same as the default 3964 promotion. 3965 3966 '-Wdeclaration-after-statement (C and Objective-C only)' 3967 Warn when a declaration is found after a statement in a block. 3968 This construct, known from C++, was introduced with ISO C99 and is 3969 by default allowed in GCC. It is not supported by ISO C90 and was 3970 not supported by GCC versions before GCC 3.0. *Note Mixed 3971 Declarations::. 3972 3973 '-Wundef' 3974 Warn if an undefined identifier is evaluated in an '#if' directive. 3975 3976 '-Wno-endif-labels' 3977 Do not warn whenever an '#else' or an '#endif' are followed by 3978 text. 3979 3980 '-Wshadow' 3981 Warn whenever a local variable or type declaration shadows another 3982 variable, parameter, type, or class member (in C++), or whenever a 3983 built-in function is shadowed. Note that in C++, the compiler 3984 warns if a local variable shadows an explicit typedef, but not if 3985 it shadows a struct/class/enum. 3986 3987 '-Wlarger-than=LEN' 3988 Warn whenever an object of larger than LEN bytes is defined. 3989 3990 '-Wframe-larger-than=LEN' 3991 Warn if the size of a function frame is larger than LEN bytes. The 3992 computation done to determine the stack frame size is approximate 3993 and not conservative. The actual requirements may be somewhat 3994 greater than LEN even if you do not get a warning. In addition, 3995 any space allocated via 'alloca', variable-length arrays, or 3996 related constructs is not included by the compiler when determining 3997 whether or not to issue a warning. 3998 3999 '-Wno-free-nonheap-object' 4000 Do not warn when attempting to free an object that was not 4001 allocated on the heap. 4002 4003 '-Wstack-usage=LEN' 4004 Warn if the stack usage of a function might be larger than LEN 4005 bytes. The computation done to determine the stack usage is 4006 conservative. Any space allocated via 'alloca', variable-length 4007 arrays, or related constructs is included by the compiler when 4008 determining whether or not to issue a warning. 4009 4010 The message is in keeping with the output of '-fstack-usage'. 4011 4012 * If the stack usage is fully static but exceeds the specified 4013 amount, it's: 4014 4015 warning: stack usage is 1120 bytes 4016 * If the stack usage is (partly) dynamic but bounded, it's: 4017 4018 warning: stack usage might be 1648 bytes 4019 * If the stack usage is (partly) dynamic and not bounded, it's: 4020 4021 warning: stack usage might be unbounded 4022 4023 '-Wunsafe-loop-optimizations' 4024 Warn if the loop cannot be optimized because the compiler cannot 4025 assume anything on the bounds of the loop indices. With 4026 '-funsafe-loop-optimizations' warn if the compiler makes such 4027 assumptions. 4028 4029 '-Wno-pedantic-ms-format (MinGW targets only)' 4030 When used in combination with '-Wformat' and '-pedantic' without 4031 GNU extensions, this option disables the warnings about non-ISO 4032 'printf' / 'scanf' format width specifiers 'I32', 'I64', and 'I' 4033 used on Windows targets, which depend on the MS runtime. 4034 4035 '-Wpointer-arith' 4036 Warn about anything that depends on the "size of" a function type 4037 or of 'void'. GNU C assigns these types a size of 1, for 4038 convenience in calculations with 'void *' pointers and pointers to 4039 functions. In C++, warn also when an arithmetic operation involves 4040 'NULL'. This warning is also enabled by '-Wpedantic'. 4041 4042 '-Wtype-limits' 4043 Warn if a comparison is always true or always false due to the 4044 limited range of the data type, but do not warn for constant 4045 expressions. For example, warn if an unsigned variable is compared 4046 against zero with '<' or '>='. This warning is also enabled by 4047 '-Wextra'. 4048 4049 '-Wbad-function-cast (C and Objective-C only)' 4050 Warn whenever a function call is cast to a non-matching type. For 4051 example, warn if 'int malloc()' is cast to 'anything *'. 4052 4053 '-Wc++-compat (C and Objective-C only)' 4054 Warn about ISO C constructs that are outside of the common subset 4055 of ISO C and ISO C++, e.g. request for implicit conversion from 4056 'void *' to a pointer to non-'void' type. 4057 4058 '-Wc++11-compat (C++ and Objective-C++ only)' 4059 Warn about C++ constructs whose meaning differs between ISO C++ 4060 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are 4061 keywords in ISO C++ 2011. This warning turns on '-Wnarrowing' and 4062 is enabled by '-Wall'. 4063 4064 '-Wcast-qual' 4065 Warn whenever a pointer is cast so as to remove a type qualifier 4066 from the target type. For example, warn if a 'const char *' is 4067 cast to an ordinary 'char *'. 4068 4069 Also warn when making a cast that introduces a type qualifier in an 4070 unsafe way. For example, casting 'char **' to 'const char **' is 4071 unsafe, as in this example: 4072 4073 /* p is char ** value. */ 4074 const char **q = (const char **) p; 4075 /* Assignment of readonly string to const char * is OK. */ 4076 *q = "string"; 4077 /* Now char** pointer points to read-only memory. */ 4078 **p = 'b'; 4079 4080 '-Wcast-align' 4081 Warn whenever a pointer is cast such that the required alignment of 4082 the target is increased. For example, warn if a 'char *' is cast 4083 to an 'int *' on machines where integers can only be accessed at 4084 two- or four-byte boundaries. 4085 4086 '-Wwrite-strings' 4087 When compiling C, give string constants the type 'const 4088 char[LENGTH]' so that copying the address of one into a non-'const' 4089 'char *' pointer produces a warning. These warnings help you find 4090 at compile time code that can try to write into a string constant, 4091 but only if you have been very careful about using 'const' in 4092 declarations and prototypes. Otherwise, it is just a nuisance. 4093 This is why we did not make '-Wall' request these warnings. 4094 4095 When compiling C++, warn about the deprecated conversion from 4096 string literals to 'char *'. This warning is enabled by default 4097 for C++ programs. 4098 4099 '-Wclobbered' 4100 Warn for variables that might be changed by 'longjmp' or 'vfork'. 4101 This warning is also enabled by '-Wextra'. 4102 4103 '-Wconversion' 4104 Warn for implicit conversions that may alter a value. This 4105 includes conversions between real and integer, like 'abs (x)' when 4106 'x' is 'double'; conversions between signed and unsigned, like 4107 'unsigned ui = -1'; and conversions to smaller types, like 'sqrtf 4108 (M_PI)'. Do not warn for explicit casts like 'abs ((int) x)' and 4109 'ui = (unsigned) -1', or if the value is not changed by the 4110 conversion like in 'abs (2.0)'. Warnings about conversions between 4111 signed and unsigned integers can be disabled by using 4112 '-Wno-sign-conversion'. 4113 4114 For C++, also warn for confusing overload resolution for 4115 user-defined conversions; and conversions that never use a type 4116 conversion operator: conversions to 'void', the same type, a base 4117 class or a reference to them. Warnings about conversions between 4118 signed and unsigned integers are disabled by default in C++ unless 4119 '-Wsign-conversion' is explicitly enabled. 4120 4121 '-Wno-conversion-null (C++ and Objective-C++ only)' 4122 Do not warn for conversions between 'NULL' and non-pointer types. 4123 '-Wconversion-null' is enabled by default. 4124 4125 '-Wzero-as-null-pointer-constant (C++ and Objective-C++ only)' 4126 Warn when a literal '0' is used as null pointer constant. This can 4127 be useful to facilitate the conversion to 'nullptr' in C++11. 4128 4129 '-Wuseless-cast (C++ and Objective-C++ only)' 4130 Warn when an expression is casted to its own type. 4131 4132 '-Wempty-body' 4133 Warn if an empty body occurs in an 'if', 'else' or 'do while' 4134 statement. This warning is also enabled by '-Wextra'. 4135 4136 '-Wenum-compare' 4137 Warn about a comparison between values of different enumerated 4138 types. In C++ enumeral mismatches in conditional expressions are 4139 also diagnosed and the warning is enabled by default. In C this 4140 warning is enabled by '-Wall'. 4141 4142 '-Wjump-misses-init (C, Objective-C only)' 4143 Warn if a 'goto' statement or a 'switch' statement jumps forward 4144 across the initialization of a variable, or jumps backward to a 4145 label after the variable has been initialized. This only warns 4146 about variables that are initialized when they are declared. This 4147 warning is only supported for C and Objective-C; in C++ this sort 4148 of branch is an error in any case. 4149 4150 '-Wjump-misses-init' is included in '-Wc++-compat'. It can be 4151 disabled with the '-Wno-jump-misses-init' option. 4152 4153 '-Wsign-compare' 4154 Warn when a comparison between signed and unsigned values could 4155 produce an incorrect result when the signed value is converted to 4156 unsigned. This warning is also enabled by '-Wextra'; to get the 4157 other warnings of '-Wextra' without this warning, use '-Wextra 4158 -Wno-sign-compare'. 4159 4160 '-Wsign-conversion' 4161 Warn for implicit conversions that may change the sign of an 4162 integer value, like assigning a signed integer expression to an 4163 unsigned integer variable. An explicit cast silences the warning. 4164 In C, this option is enabled also by '-Wconversion'. 4165 4166 '-Wsizeof-pointer-memaccess' 4167 Warn for suspicious length parameters to certain string and memory 4168 built-in functions if the argument uses 'sizeof'. This warning 4169 warns e.g. about 'memset (ptr, 0, sizeof (ptr));' if 'ptr' is not 4170 an array, but a pointer, and suggests a possible fix, or about 4171 'memcpy (&foo, ptr, sizeof (&foo));'. This warning is enabled by 4172 '-Wall'. 4173 4174 '-Waddress' 4175 Warn about suspicious uses of memory addresses. These include 4176 using the address of a function in a conditional expression, such 4177 as 'void func(void); if (func)', and comparisons against the memory 4178 address of a string literal, such as 'if (x == "abc")'. Such uses 4179 typically indicate a programmer error: the address of a function 4180 always evaluates to true, so their use in a conditional usually 4181 indicate that the programmer forgot the parentheses in a function 4182 call; and comparisons against string literals result in unspecified 4183 behavior and are not portable in C, so they usually indicate that 4184 the programmer intended to use 'strcmp'. This warning is enabled 4185 by '-Wall'. 4186 4187 '-Wlogical-op' 4188 Warn about suspicious uses of logical operators in expressions. 4189 This includes using logical operators in contexts where a bit-wise 4190 operator is likely to be expected. 4191 4192 '-Waggregate-return' 4193 Warn if any functions that return structures or unions are defined 4194 or called. (In languages where you can return an array, this also 4195 elicits a warning.) 4196 4197 '-Wno-aggressive-loop-optimizations' 4198 Warn if in a loop with constant number of iterations the compiler 4199 detects undefined behavior in some statement during one or more of 4200 the iterations. 4201 4202 '-Wno-attributes' 4203 Do not warn if an unexpected '__attribute__' is used, such as 4204 unrecognized attributes, function attributes applied to variables, 4205 etc. This does not stop errors for incorrect use of supported 4206 attributes. 4207 4208 '-Wno-builtin-macro-redefined' 4209 Do not warn if certain built-in macros are redefined. This 4210 suppresses warnings for redefinition of '__TIMESTAMP__', 4211 '__TIME__', '__DATE__', '__FILE__', and '__BASE_FILE__'. 4212 4213 '-Wstrict-prototypes (C and Objective-C only)' 4214 Warn if a function is declared or defined without specifying the 4215 argument types. (An old-style function definition is permitted 4216 without a warning if preceded by a declaration that specifies the 4217 argument types.) 4218 4219 '-Wold-style-declaration (C and Objective-C only)' 4220 Warn for obsolescent usages, according to the C Standard, in a 4221 declaration. For example, warn if storage-class specifiers like 4222 'static' are not the first things in a declaration. This warning 4223 is also enabled by '-Wextra'. 4224 4225 '-Wold-style-definition (C and Objective-C only)' 4226 Warn if an old-style function definition is used. A warning is 4227 given even if there is a previous prototype. 4228 4229 '-Wmissing-parameter-type (C and Objective-C only)' 4230 A function parameter is declared without a type specifier in 4231 K&R-style functions: 4232 4233 void foo(bar) { } 4234 4235 This warning is also enabled by '-Wextra'. 4236 4237 '-Wmissing-prototypes (C and Objective-C only)' 4238 Warn if a global function is defined without a previous prototype 4239 declaration. This warning is issued even if the definition itself 4240 provides a prototype. Use this option to detect global functions 4241 that do not have a matching prototype declaration in a header file. 4242 This option is not valid for C++ because all function declarations 4243 provide prototypes and a non-matching declaration will declare an 4244 overload rather than conflict with an earlier declaration. Use 4245 '-Wmissing-declarations' to detect missing declarations in C++. 4246 4247 '-Wmissing-declarations' 4248 Warn if a global function is defined without a previous 4249 declaration. Do so even if the definition itself provides a 4250 prototype. Use this option to detect global functions that are not 4251 declared in header files. In C, no warnings are issued for 4252 functions with previous non-prototype declarations; use 4253 '-Wmissing-prototype' to detect missing prototypes. In C++, no 4254 warnings are issued for function templates, or for inline 4255 functions, or for functions in anonymous namespaces. 4256 4257 '-Wmissing-field-initializers' 4258 Warn if a structure's initializer has some fields missing. For 4259 example, the following code causes such a warning, because 'x.h' is 4260 implicitly zero: 4261 4262 struct s { int f, g, h; }; 4263 struct s x = { 3, 4 }; 4264 4265 This option does not warn about designated initializers, so the 4266 following modification does not trigger a warning: 4267 4268 struct s { int f, g, h; }; 4269 struct s x = { .f = 3, .g = 4 }; 4270 4271 This warning is included in '-Wextra'. To get other '-Wextra' 4272 warnings without this one, use '-Wextra 4273 -Wno-missing-field-initializers'. 4274 4275 '-Wno-multichar' 4276 Do not warn if a multicharacter constant (''FOOF'') is used. 4277 Usually they indicate a typo in the user's code, as they have 4278 implementation-defined values, and should not be used in portable 4279 code. 4280 4281 '-Wnormalized=<none|id|nfc|nfkc>' 4282 In ISO C and ISO C++, two identifiers are different if they are 4283 different sequences of characters. However, sometimes when 4284 characters outside the basic ASCII character set are used, you can 4285 have two different character sequences that look the same. To 4286 avoid confusion, the ISO 10646 standard sets out some 4287 "normalization rules" which when applied ensure that two sequences 4288 that look the same are turned into the same sequence. GCC can warn 4289 you if you are using identifiers that have not been normalized; 4290 this option controls that warning. 4291 4292 There are four levels of warning supported by GCC. The default is 4293 '-Wnormalized=nfc', which warns about any identifier that is not in 4294 the ISO 10646 "C" normalized form, "NFC". NFC is the recommended 4295 form for most uses. 4296 4297 Unfortunately, there are some characters allowed in identifiers by 4298 ISO C and ISO C++ that, when turned into NFC, are not allowed in 4299 identifiers. That is, there's no way to use these symbols in 4300 portable ISO C or C++ and have all your identifiers in NFC. 4301 '-Wnormalized=id' suppresses the warning for these characters. It 4302 is hoped that future versions of the standards involved will 4303 correct this, which is why this option is not the default. 4304 4305 You can switch the warning off for all characters by writing 4306 '-Wnormalized=none'. You should only do this if you are using some 4307 other normalization scheme (like "D"), because otherwise you can 4308 easily create bugs that are literally impossible to see. 4309 4310 Some characters in ISO 10646 have distinct meanings but look 4311 identical in some fonts or display methodologies, especially once 4312 formatting has been applied. For instance '\u207F', "SUPERSCRIPT 4313 LATIN SMALL LETTER N", displays just like a regular 'n' that has 4314 been placed in a superscript. ISO 10646 defines the "NFKC" 4315 normalization scheme to convert all these into a standard form as 4316 well, and GCC warns if your code is not in NFKC if you use 4317 '-Wnormalized=nfkc'. This warning is comparable to warning about 4318 every identifier that contains the letter O because it might be 4319 confused with the digit 0, and so is not the default, but may be 4320 useful as a local coding convention if the programming environment 4321 cannot be fixed to display these characters distinctly. 4322 4323 '-Wno-deprecated' 4324 Do not warn about usage of deprecated features. *Note Deprecated 4325 Features::. 4326 4327 '-Wno-deprecated-declarations' 4328 Do not warn about uses of functions (*note Function Attributes::), 4329 variables (*note Variable Attributes::), and types (*note Type 4330 Attributes::) marked as deprecated by using the 'deprecated' 4331 attribute. 4332 4333 '-Wno-overflow' 4334 Do not warn about compile-time overflow in constant expressions. 4335 4336 '-Woverride-init (C and Objective-C only)' 4337 Warn if an initialized field without side effects is overridden 4338 when using designated initializers (*note Designated Initializers: 4339 Designated Inits.). 4340 4341 This warning is included in '-Wextra'. To get other '-Wextra' 4342 warnings without this one, use '-Wextra -Wno-override-init'. 4343 4344 '-Wpacked' 4345 Warn if a structure is given the packed attribute, but the packed 4346 attribute has no effect on the layout or size of the structure. 4347 Such structures may be mis-aligned for little benefit. For 4348 instance, in this code, the variable 'f.x' in 'struct bar' is 4349 misaligned even though 'struct bar' does not itself have the packed 4350 attribute: 4351 4352 struct foo { 4353 int x; 4354 char a, b, c, d; 4355 } __attribute__((packed)); 4356 struct bar { 4357 char z; 4358 struct foo f; 4359 }; 4360 4361 '-Wpacked-bitfield-compat' 4362 The 4.1, 4.2 and 4.3 series of GCC ignore the 'packed' attribute on 4363 bit-fields of type 'char'. This has been fixed in GCC 4.4 but the 4364 change can lead to differences in the structure layout. GCC 4365 informs you when the offset of such a field has changed in GCC 4.4. 4366 For example there is no longer a 4-bit padding between field 'a' 4367 and 'b' in this structure: 4368 4369 struct foo 4370 { 4371 char a:4; 4372 char b:8; 4373 } __attribute__ ((packed)); 4374 4375 This warning is enabled by default. Use 4376 '-Wno-packed-bitfield-compat' to disable this warning. 4377 4378 '-Wpadded' 4379 Warn if padding is included in a structure, either to align an 4380 element of the structure or to align the whole structure. 4381 Sometimes when this happens it is possible to rearrange the fields 4382 of the structure to reduce the padding and so make the structure 4383 smaller. 4384 4385 '-Wredundant-decls' 4386 Warn if anything is declared more than once in the same scope, even 4387 in cases where multiple declaration is valid and changes nothing. 4388 4389 '-Wnested-externs (C and Objective-C only)' 4390 Warn if an 'extern' declaration is encountered within a function. 4391 4392 '-Wno-inherited-variadic-ctor' 4393 Suppress warnings about use of C++11 inheriting constructors when 4394 the base class inherited from has a C variadic constructor; the 4395 warning is on by default because the ellipsis is not inherited. 4396 4397 '-Winline' 4398 Warn if a function that is declared as inline cannot be inlined. 4399 Even with this option, the compiler does not warn about failures to 4400 inline functions declared in system headers. 4401 4402 The compiler uses a variety of heuristics to determine whether or 4403 not to inline a function. For example, the compiler takes into 4404 account the size of the function being inlined and the amount of 4405 inlining that has already been done in the current function. 4406 Therefore, seemingly insignificant changes in the source program 4407 can cause the warnings produced by '-Winline' to appear or 4408 disappear. 4409 4410 '-Wno-invalid-offsetof (C++ and Objective-C++ only)' 4411 Suppress warnings from applying the 'offsetof' macro to a non-POD 4412 type. According to the 1998 ISO C++ standard, applying 'offsetof' 4413 to a non-POD type is undefined. In existing C++ implementations, 4414 however, 'offsetof' typically gives meaningful results even when 4415 applied to certain kinds of non-POD types (such as a simple 4416 'struct' that fails to be a POD type only by virtue of having a 4417 constructor). This flag is for users who are aware that they are 4418 writing nonportable code and who have deliberately chosen to ignore 4419 the warning about it. 4420 4421 The restrictions on 'offsetof' may be relaxed in a future version 4422 of the C++ standard. 4423 4424 '-Wno-int-to-pointer-cast' 4425 Suppress warnings from casts to pointer type of an integer of a 4426 different size. In C++, casting to a pointer type of smaller size 4427 is an error. 'Wint-to-pointer-cast' is enabled by default. 4428 4429 '-Wno-pointer-to-int-cast (C and Objective-C only)' 4430 Suppress warnings from casts from a pointer to an integer type of a 4431 different size. 4432 4433 '-Winvalid-pch' 4434 Warn if a precompiled header (*note Precompiled Headers::) is found 4435 in the search path but can't be used. 4436 4437 '-Wlong-long' 4438 Warn if 'long long' type is used. This is enabled by either 4439 '-Wpedantic' or '-Wtraditional' in ISO C90 and C++98 modes. To 4440 inhibit the warning messages, use '-Wno-long-long'. 4441 4442 '-Wvariadic-macros' 4443 Warn if variadic macros are used in pedantic ISO C90 mode, or the 4444 GNU alternate syntax when in pedantic ISO C99 mode. This is 4445 default. To inhibit the warning messages, use 4446 '-Wno-variadic-macros'. 4447 4448 '-Wvarargs' 4449 Warn upon questionable usage of the macros used to handle variable 4450 arguments like 'va_start'. This is default. To inhibit the 4451 warning messages, use '-Wno-varargs'. 4452 4453 '-Wvector-operation-performance' 4454 Warn if vector operation is not implemented via SIMD capabilities 4455 of the architecture. Mainly useful for the performance tuning. 4456 Vector operation can be implemented 'piecewise', which means that 4457 the scalar operation is performed on every vector element; 'in 4458 parallel', which means that the vector operation is implemented 4459 using scalars of wider type, which normally is more performance 4460 efficient; and 'as a single scalar', which means that vector fits 4461 into a scalar type. 4462 4463 '-Wno-virtual-move-assign' 4464 Suppress warnings about inheriting from a virtual base with a 4465 non-trivial C++11 move assignment operator. This is dangerous 4466 because if the virtual base is reachable along more than one path, 4467 it will be moved multiple times, which can mean both objects end up 4468 in the moved-from state. If the move assignment operator is 4469 written to avoid moving from a moved-from object, this warning can 4470 be disabled. 4471 4472 '-Wvla' 4473 Warn if variable length array is used in the code. '-Wno-vla' 4474 prevents the '-Wpedantic' warning of the variable length array. 4475 4476 '-Wvolatile-register-var' 4477 Warn if a register variable is declared volatile. The volatile 4478 modifier does not inhibit all optimizations that may eliminate 4479 reads and/or writes to register variables. This warning is enabled 4480 by '-Wall'. 4481 4482 '-Wdisabled-optimization' 4483 Warn if a requested optimization pass is disabled. This warning 4484 does not generally indicate that there is anything wrong with your 4485 code; it merely indicates that GCC's optimizers are unable to 4486 handle the code effectively. Often, the problem is that your code 4487 is too big or too complex; GCC refuses to optimize programs when 4488 the optimization itself is likely to take inordinate amounts of 4489 time. 4490 4491 '-Wpointer-sign (C and Objective-C only)' 4492 Warn for pointer argument passing or assignment with different 4493 signedness. This option is only supported for C and Objective-C. 4494 It is implied by '-Wall' and by '-Wpedantic', which can be disabled 4495 with '-Wno-pointer-sign'. 4496 4497 '-Wstack-protector' 4498 This option is only active when '-fstack-protector' is active. It 4499 warns about functions that are not protected against stack 4500 smashing. 4501 4502 '-Wno-mudflap' 4503 Suppress warnings about constructs that cannot be instrumented by 4504 '-fmudflap'. 4505 4506 '-Woverlength-strings' 4507 Warn about string constants that are longer than the "minimum 4508 maximum" length specified in the C standard. Modern compilers 4509 generally allow string constants that are much longer than the 4510 standard's minimum limit, but very portable programs should avoid 4511 using longer strings. 4512 4513 The limit applies _after_ string constant concatenation, and does 4514 not count the trailing NUL. In C90, the limit was 509 characters; 4515 in C99, it was raised to 4095. C++98 does not specify a normative 4516 minimum maximum, so we do not diagnose overlength strings in C++. 4517 4518 This option is implied by '-Wpedantic', and can be disabled with 4519 '-Wno-overlength-strings'. 4520 4521 '-Wunsuffixed-float-constants (C and Objective-C only)' 4522 4523 Issue a warning for any floating constant that does not have a 4524 suffix. When used together with '-Wsystem-headers' it warns about 4525 such constants in system header files. This can be useful when 4526 preparing code to use with the 'FLOAT_CONST_DECIMAL64' pragma from 4527 the decimal floating-point extension to C99. 4528 4529 4530 File: gcc.info, Node: Debugging Options, Next: Optimize Options, Prev: Warning Options, Up: Invoking GCC 4531 4532 3.9 Options for Debugging Your Program or GCC 4533 ============================================= 4534 4535 GCC has various special options that are used for debugging either your 4536 program or GCC: 4537 4538 '-g' 4539 Produce debugging information in the operating system's native 4540 format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this 4541 debugging information. 4542 4543 On most systems that use stabs format, '-g' enables use of extra 4544 debugging information that only GDB can use; this extra information 4545 makes debugging work better in GDB but probably makes other 4546 debuggers crash or refuse to read the program. If you want to 4547 control for certain whether to generate the extra information, use 4548 '-gstabs+', '-gstabs', '-gxcoff+', '-gxcoff', or '-gvms' (see 4549 below). 4550 4551 GCC allows you to use '-g' with '-O'. The shortcuts taken by 4552 optimized code may occasionally produce surprising results: some 4553 variables you declared may not exist at all; flow of control may 4554 briefly move where you did not expect it; some statements may not 4555 be executed because they compute constant results or their values 4556 are already at hand; some statements may execute in different 4557 places because they have been moved out of loops. 4558 4559 Nevertheless it proves possible to debug optimized output. This 4560 makes it reasonable to use the optimizer for programs that might 4561 have bugs. 4562 4563 The following options are useful when GCC is generated with the 4564 capability for more than one debugging format. 4565 4566 '-gsplit-dwarf' 4567 Separate as much dwarf debugging information as possible into a 4568 separate output file with the extension .dwo. This option allows 4569 the build system to avoid linking files with debug information. To 4570 be useful, this option requires a debugger capable of reading .dwo 4571 files. 4572 4573 '-ggdb' 4574 Produce debugging information for use by GDB. This means to use 4575 the most expressive format available (DWARF 2, stabs, or the native 4576 format if neither of those are supported), including GDB extensions 4577 if at all possible. 4578 4579 '-gpubnames' 4580 Generate dwarf .debug_pubnames and .debug_pubtypes sections. 4581 4582 '-gstabs' 4583 Produce debugging information in stabs format (if that is 4584 supported), without GDB extensions. This is the format used by DBX 4585 on most BSD systems. On MIPS, Alpha and System V Release 4 systems 4586 this option produces stabs debugging output that is not understood 4587 by DBX or SDB. On System V Release 4 systems this option requires 4588 the GNU assembler. 4589 4590 '-feliminate-unused-debug-symbols' 4591 Produce debugging information in stabs format (if that is 4592 supported), for only symbols that are actually used. 4593 4594 '-femit-class-debug-always' 4595 Instead of emitting debugging information for a C++ class in only 4596 one object file, emit it in all object files using the class. This 4597 option should be used only with debuggers that are unable to handle 4598 the way GCC normally emits debugging information for classes 4599 because using this option increases the size of debugging 4600 information by as much as a factor of two. 4601 4602 '-fdebug-types-section' 4603 When using DWARF Version 4 or higher, type DIEs can be put into 4604 their own '.debug_types' section instead of making them part of the 4605 '.debug_info' section. It is more efficient to put them in a 4606 separate comdat sections since the linker can then remove 4607 duplicates. But not all DWARF consumers support '.debug_types' 4608 sections yet and on some objects '.debug_types' produces larger 4609 instead of smaller debugging information. 4610 4611 '-gstabs+' 4612 Produce debugging information in stabs format (if that is 4613 supported), using GNU extensions understood only by the GNU 4614 debugger (GDB). The use of these extensions is likely to make 4615 other debuggers crash or refuse to read the program. 4616 4617 '-gcoff' 4618 Produce debugging information in COFF format (if that is 4619 supported). This is the format used by SDB on most System V 4620 systems prior to System V Release 4. 4621 4622 '-gxcoff' 4623 Produce debugging information in XCOFF format (if that is 4624 supported). This is the format used by the DBX debugger on IBM 4625 RS/6000 systems. 4626 4627 '-gxcoff+' 4628 Produce debugging information in XCOFF format (if that is 4629 supported), using GNU extensions understood only by the GNU 4630 debugger (GDB). The use of these extensions is likely to make 4631 other debuggers crash or refuse to read the program, and may cause 4632 assemblers other than the GNU assembler (GAS) to fail with an 4633 error. 4634 4635 '-gdwarf-VERSION' 4636 Produce debugging information in DWARF format (if that is 4637 supported). The value of VERSION may be either 2, 3 or 4; the 4638 default version for most targets is 4. 4639 4640 Note that with DWARF Version 2, some ports require and always use 4641 some non-conflicting DWARF 3 extensions in the unwind tables. 4642 4643 Version 4 may require GDB 7.0 and '-fvar-tracking-assignments' for 4644 maximum benefit. 4645 4646 '-grecord-gcc-switches' 4647 This switch causes the command-line options used to invoke the 4648 compiler that may affect code generation to be appended to the 4649 DW_AT_producer attribute in DWARF debugging information. The 4650 options are concatenated with spaces separating them from each 4651 other and from the compiler version. See also 4652 '-frecord-gcc-switches' for another way of storing compiler options 4653 into the object file. This is the default. 4654 4655 '-gno-record-gcc-switches' 4656 Disallow appending command-line options to the DW_AT_producer 4657 attribute in DWARF debugging information. 4658 4659 '-gstrict-dwarf' 4660 Disallow using extensions of later DWARF standard version than 4661 selected with '-gdwarf-VERSION'. On most targets using 4662 non-conflicting DWARF extensions from later standard versions is 4663 allowed. 4664 4665 '-gno-strict-dwarf' 4666 Allow using extensions of later DWARF standard version than 4667 selected with '-gdwarf-VERSION'. 4668 4669 '-gvms' 4670 Produce debugging information in Alpha/VMS debug format (if that is 4671 supported). This is the format used by DEBUG on Alpha/VMS systems. 4672 4673 '-gLEVEL' 4674 '-ggdbLEVEL' 4675 '-gstabsLEVEL' 4676 '-gcoffLEVEL' 4677 '-gxcoffLEVEL' 4678 '-gvmsLEVEL' 4679 Request debugging information and also use LEVEL to specify how 4680 much information. The default level is 2. 4681 4682 Level 0 produces no debug information at all. Thus, '-g0' negates 4683 '-g'. 4684 4685 Level 1 produces minimal information, enough for making backtraces 4686 in parts of the program that you don't plan to debug. This 4687 includes descriptions of functions and external variables, but no 4688 information about local variables and no line numbers. 4689 4690 Level 3 includes extra information, such as all the macro 4691 definitions present in the program. Some debuggers support macro 4692 expansion when you use '-g3'. 4693 4694 '-gdwarf-2' does not accept a concatenated debug level, because GCC 4695 used to support an option '-gdwarf' that meant to generate debug 4696 information in version 1 of the DWARF format (which is very 4697 different from version 2), and it would have been too confusing. 4698 That debug format is long obsolete, but the option cannot be 4699 changed now. Instead use an additional '-gLEVEL' option to change 4700 the debug level for DWARF. 4701 4702 '-gtoggle' 4703 Turn off generation of debug info, if leaving out this option 4704 generates it, or turn it on at level 2 otherwise. The position of 4705 this argument in the command line does not matter; it takes effect 4706 after all other options are processed, and it does so only once, no 4707 matter how many times it is given. This is mainly intended to be 4708 used with '-fcompare-debug'. 4709 4710 '-fsanitize=address' 4711 Enable AddressSanitizer, a fast memory error detector. Memory 4712 access instructions will be instrumented to detect out-of-bounds 4713 and use-after-free bugs. See 4714 <http://code.google.com/p/address-sanitizer/> for more details. 4715 4716 '-fsanitize=thread' 4717 Enable ThreadSanitizer, a fast data race detector. Memory access 4718 instructions will be instrumented to detect data race bugs. See 4719 <http://code.google.com/p/data-race-test/wiki/ThreadSanitizer> for 4720 more details. 4721 4722 '-fdump-final-insns[=FILE]' 4723 Dump the final internal representation (RTL) to FILE. If the 4724 optional argument is omitted (or if FILE is '.'), the name of the 4725 dump file is determined by appending '.gkd' to the compilation 4726 output file name. 4727 4728 '-fcompare-debug[=OPTS]' 4729 If no error occurs during compilation, run the compiler a second 4730 time, adding OPTS and '-fcompare-debug-second' to the arguments 4731 passed to the second compilation. Dump the final internal 4732 representation in both compilations, and print an error if they 4733 differ. 4734 4735 If the equal sign is omitted, the default '-gtoggle' is used. 4736 4737 The environment variable 'GCC_COMPARE_DEBUG', if defined, non-empty 4738 and nonzero, implicitly enables '-fcompare-debug'. If 4739 'GCC_COMPARE_DEBUG' is defined to a string starting with a dash, 4740 then it is used for OPTS, otherwise the default '-gtoggle' is used. 4741 4742 '-fcompare-debug=', with the equal sign but without OPTS, is 4743 equivalent to '-fno-compare-debug', which disables the dumping of 4744 the final representation and the second compilation, preventing 4745 even 'GCC_COMPARE_DEBUG' from taking effect. 4746 4747 To verify full coverage during '-fcompare-debug' testing, set 4748 'GCC_COMPARE_DEBUG' to say '-fcompare-debug-not-overridden', which 4749 GCC rejects as an invalid option in any actual compilation (rather 4750 than preprocessing, assembly or linking). To get just a warning, 4751 setting 'GCC_COMPARE_DEBUG' to '-w%n-fcompare-debug not overridden' 4752 will do. 4753 4754 '-fcompare-debug-second' 4755 This option is implicitly passed to the compiler for the second 4756 compilation requested by '-fcompare-debug', along with options to 4757 silence warnings, and omitting other options that would cause 4758 side-effect compiler outputs to files or to the standard output. 4759 Dump files and preserved temporary files are renamed so as to 4760 contain the '.gk' additional extension during the second 4761 compilation, to avoid overwriting those generated by the first. 4762 4763 When this option is passed to the compiler driver, it causes the 4764 _first_ compilation to be skipped, which makes it useful for little 4765 other than debugging the compiler proper. 4766 4767 '-feliminate-dwarf2-dups' 4768 Compress DWARF 2 debugging information by eliminating duplicated 4769 information about each symbol. This option only makes sense when 4770 generating DWARF 2 debugging information with '-gdwarf-2'. 4771 4772 '-femit-struct-debug-baseonly' 4773 Emit debug information for struct-like types only when the base 4774 name of the compilation source file matches the base name of file 4775 in which the struct is defined. 4776 4777 This option substantially reduces the size of debugging 4778 information, but at significant potential loss in type information 4779 to the debugger. See '-femit-struct-debug-reduced' for a less 4780 aggressive option. See '-femit-struct-debug-detailed' for more 4781 detailed control. 4782 4783 This option works only with DWARF 2. 4784 4785 '-femit-struct-debug-reduced' 4786 Emit debug information for struct-like types only when the base 4787 name of the compilation source file matches the base name of file 4788 in which the type is defined, unless the struct is a template or 4789 defined in a system header. 4790 4791 This option significantly reduces the size of debugging 4792 information, with some potential loss in type information to the 4793 debugger. See '-femit-struct-debug-baseonly' for a more aggressive 4794 option. See '-femit-struct-debug-detailed' for more detailed 4795 control. 4796 4797 This option works only with DWARF 2. 4798 4799 '-femit-struct-debug-detailed[=SPEC-LIST]' 4800 Specify the struct-like types for which the compiler generates 4801 debug information. The intent is to reduce duplicate struct debug 4802 information between different object files within the same program. 4803 4804 This option is a detailed version of '-femit-struct-debug-reduced' 4805 and '-femit-struct-debug-baseonly', which serves for most needs. 4806 4807 A specification has the syntax 4808 ['dir:'|'ind:']['ord:'|'gen:']('any'|'sys'|'base'|'none') 4809 4810 The optional first word limits the specification to structs that 4811 are used directly ('dir:') or used indirectly ('ind:'). A struct 4812 type is used directly when it is the type of a variable, member. 4813 Indirect uses arise through pointers to structs. That is, when use 4814 of an incomplete struct is valid, the use is indirect. An example 4815 is 'struct one direct; struct two * indirect;'. 4816 4817 The optional second word limits the specification to ordinary 4818 structs ('ord:') or generic structs ('gen:'). Generic structs are 4819 a bit complicated to explain. For C++, these are non-explicit 4820 specializations of template classes, or non-template classes within 4821 the above. Other programming languages have generics, but 4822 '-femit-struct-debug-detailed' does not yet implement them. 4823 4824 The third word specifies the source files for those structs for 4825 which the compiler should emit debug information. The values 4826 'none' and 'any' have the normal meaning. The value 'base' means 4827 that the base of name of the file in which the type declaration 4828 appears must match the base of the name of the main compilation 4829 file. In practice, this means that when compiling 'foo.c', debug 4830 information is generated for types declared in that file and 4831 'foo.h', but not other header files. The value 'sys' means those 4832 types satisfying 'base' or declared in system or compiler headers. 4833 4834 You may need to experiment to determine the best settings for your 4835 application. 4836 4837 The default is '-femit-struct-debug-detailed=all'. 4838 4839 This option works only with DWARF 2. 4840 4841 '-fno-merge-debug-strings' 4842 Direct the linker to not merge together strings in the debugging 4843 information that are identical in different object files. Merging 4844 is not supported by all assemblers or linkers. Merging decreases 4845 the size of the debug information in the output file at the cost of 4846 increasing link processing time. Merging is enabled by default. 4847 4848 '-fdebug-prefix-map=OLD=NEW' 4849 When compiling files in directory 'OLD', record debugging 4850 information describing them as in 'NEW' instead. 4851 4852 '-fno-dwarf2-cfi-asm' 4853 Emit DWARF 2 unwind info as compiler generated '.eh_frame' section 4854 instead of using GAS '.cfi_*' directives. 4855 4856 '-p' 4857 Generate extra code to write profile information suitable for the 4858 analysis program 'prof'. You must use this option when compiling 4859 the source files you want data about, and you must also use it when 4860 linking. 4861 4862 '-pg' 4863 Generate extra code to write profile information suitable for the 4864 analysis program 'gprof'. You must use this option when compiling 4865 the source files you want data about, and you must also use it when 4866 linking. 4867 4868 '-Q' 4869 Makes the compiler print out each function name as it is compiled, 4870 and print some statistics about each pass when it finishes. 4871 4872 '-ftime-report' 4873 Makes the compiler print some statistics about the time consumed by 4874 each pass when it finishes. 4875 4876 '-fmem-report' 4877 Makes the compiler print some statistics about permanent memory 4878 allocation when it finishes. 4879 4880 '-fmem-report-wpa' 4881 Makes the compiler print some statistics about permanent memory 4882 allocation for the WPA phase only. 4883 4884 '-fpre-ipa-mem-report' 4885 '-fpost-ipa-mem-report' 4886 Makes the compiler print some statistics about permanent memory 4887 allocation before or after interprocedural optimization. 4888 4889 '-fprofile-report' 4890 Makes the compiler print some statistics about consistency of the 4891 (estimated) profile and effect of individual passes. 4892 4893 '-fstack-usage' 4894 Makes the compiler output stack usage information for the program, 4895 on a per-function basis. The filename for the dump is made by 4896 appending '.su' to the AUXNAME. AUXNAME is generated from the name 4897 of the output file, if explicitly specified and it is not an 4898 executable, otherwise it is the basename of the source file. An 4899 entry is made up of three fields: 4900 4901 * The name of the function. 4902 * A number of bytes. 4903 * One or more qualifiers: 'static', 'dynamic', 'bounded'. 4904 4905 The qualifier 'static' means that the function manipulates the 4906 stack statically: a fixed number of bytes are allocated for the 4907 frame on function entry and released on function exit; no stack 4908 adjustments are otherwise made in the function. The second field 4909 is this fixed number of bytes. 4910 4911 The qualifier 'dynamic' means that the function manipulates the 4912 stack dynamically: in addition to the static allocation described 4913 above, stack adjustments are made in the body of the function, for 4914 example to push/pop arguments around function calls. If the 4915 qualifier 'bounded' is also present, the amount of these 4916 adjustments is bounded at compile time and the second field is an 4917 upper bound of the total amount of stack used by the function. If 4918 it is not present, the amount of these adjustments is not bounded 4919 at compile time and the second field only represents the bounded 4920 part. 4921 4922 '-fprofile-arcs' 4923 Add code so that program flow "arcs" are instrumented. During 4924 execution the program records how many times each branch and call 4925 is executed and how many times it is taken or returns. When the 4926 compiled program exits it saves this data to a file called 4927 'AUXNAME.gcda' for each source file. The data may be used for 4928 profile-directed optimizations ('-fbranch-probabilities'), or for 4929 test coverage analysis ('-ftest-coverage'). Each object file's 4930 AUXNAME is generated from the name of the output file, if 4931 explicitly specified and it is not the final executable, otherwise 4932 it is the basename of the source file. In both cases any suffix is 4933 removed (e.g. 'foo.gcda' for input file 'dir/foo.c', or 4934 'dir/foo.gcda' for output file specified as '-o dir/foo.o'). *Note 4935 Cross-profiling::. 4936 4937 '--coverage' 4938 4939 This option is used to compile and link code instrumented for 4940 coverage analysis. The option is a synonym for '-fprofile-arcs' 4941 '-ftest-coverage' (when compiling) and '-lgcov' (when linking). 4942 See the documentation for those options for more details. 4943 4944 * Compile the source files with '-fprofile-arcs' plus 4945 optimization and code generation options. For test coverage 4946 analysis, use the additional '-ftest-coverage' option. You do 4947 not need to profile every source file in a program. 4948 4949 * Link your object files with '-lgcov' or '-fprofile-arcs' (the 4950 latter implies the former). 4951 4952 * Run the program on a representative workload to generate the 4953 arc profile information. This may be repeated any number of 4954 times. You can run concurrent instances of your program, and 4955 provided that the file system supports locking, the data files 4956 will be correctly updated. Also 'fork' calls are detected and 4957 correctly handled (double counting will not happen). 4958 4959 * For profile-directed optimizations, compile the source files 4960 again with the same optimization and code generation options 4961 plus '-fbranch-probabilities' (*note Options that Control 4962 Optimization: Optimize Options.). 4963 4964 * For test coverage analysis, use 'gcov' to produce human 4965 readable information from the '.gcno' and '.gcda' files. 4966 Refer to the 'gcov' documentation for further information. 4967 4968 With '-fprofile-arcs', for each function of your program GCC 4969 creates a program flow graph, then finds a spanning tree for the 4970 graph. Only arcs that are not on the spanning tree have to be 4971 instrumented: the compiler adds code to count the number of times 4972 that these arcs are executed. When an arc is the only exit or only 4973 entrance to a block, the instrumentation code can be added to the 4974 block; otherwise, a new basic block must be created to hold the 4975 instrumentation code. 4976 4977 '-ftest-coverage' 4978 Produce a notes file that the 'gcov' code-coverage utility (*note 4979 'gcov'--a Test Coverage Program: Gcov.) can use to show program 4980 coverage. Each source file's note file is called 'AUXNAME.gcno'. 4981 Refer to the '-fprofile-arcs' option above for a description of 4982 AUXNAME and instructions on how to generate test coverage data. 4983 Coverage data matches the source files more closely if you do not 4984 optimize. 4985 4986 '-fdbg-cnt-list' 4987 Print the name and the counter upper bound for all debug counters. 4988 4989 '-fdbg-cnt=COUNTER-VALUE-LIST' 4990 Set the internal debug counter upper bound. COUNTER-VALUE-LIST is 4991 a comma-separated list of NAME:VALUE pairs which sets the upper 4992 bound of each debug counter NAME to VALUE. All debug counters have 4993 the initial upper bound of 'UINT_MAX'; thus 'dbg_cnt()' returns 4994 true always unless the upper bound is set by this option. For 4995 example, with '-fdbg-cnt=dce:10,tail_call:0', 'dbg_cnt(dce)' 4996 returns true only for first 10 invocations. 4997 4998 '-fenable-KIND-PASS' 4999 '-fdisable-KIND-PASS=RANGE-LIST' 5000 5001 This is a set of options that are used to explicitly disable/enable 5002 optimization passes. These options are intended for use for 5003 debugging GCC. Compiler users should use regular options for 5004 enabling/disabling passes instead. 5005 5006 '-fdisable-ipa-PASS' 5007 Disable IPA pass PASS. PASS is the pass name. If the same 5008 pass is statically invoked in the compiler multiple times, the 5009 pass name should be appended with a sequential number starting 5010 from 1. 5011 5012 '-fdisable-rtl-PASS' 5013 '-fdisable-rtl-PASS=RANGE-LIST' 5014 Disable RTL pass PASS. PASS is the pass name. If the same 5015 pass is statically invoked in the compiler multiple times, the 5016 pass name should be appended with a sequential number starting 5017 from 1. RANGE-LIST is a comma-separated list of function 5018 ranges or assembler names. Each range is a number pair 5019 separated by a colon. The range is inclusive in both ends. 5020 If the range is trivial, the number pair can be simplified as 5021 a single number. If the function's call graph node's UID 5022 falls within one of the specified ranges, the PASS is disabled 5023 for that function. The UID is shown in the function header of 5024 a dump file, and the pass names can be dumped by using option 5025 '-fdump-passes'. 5026 5027 '-fdisable-tree-PASS' 5028 '-fdisable-tree-PASS=RANGE-LIST' 5029 Disable tree pass PASS. See '-fdisable-rtl' for the 5030 description of option arguments. 5031 5032 '-fenable-ipa-PASS' 5033 Enable IPA pass PASS. PASS is the pass name. If the same 5034 pass is statically invoked in the compiler multiple times, the 5035 pass name should be appended with a sequential number starting 5036 from 1. 5037 5038 '-fenable-rtl-PASS' 5039 '-fenable-rtl-PASS=RANGE-LIST' 5040 Enable RTL pass PASS. See '-fdisable-rtl' for option argument 5041 description and examples. 5042 5043 '-fenable-tree-PASS' 5044 '-fenable-tree-PASS=RANGE-LIST' 5045 Enable tree pass PASS. See '-fdisable-rtl' for the 5046 description of option arguments. 5047 5048 Here are some examples showing uses of these options. 5049 5050 5051 # disable ccp1 for all functions 5052 -fdisable-tree-ccp1 5053 # disable complete unroll for function whose cgraph node uid is 1 5054 -fenable-tree-cunroll=1 5055 # disable gcse2 for functions at the following ranges [1,1], 5056 # [300,400], and [400,1000] 5057 # disable gcse2 for functions foo and foo2 5058 -fdisable-rtl-gcse2=foo,foo2 5059 # disable early inlining 5060 -fdisable-tree-einline 5061 # disable ipa inlining 5062 -fdisable-ipa-inline 5063 # enable tree full unroll 5064 -fenable-tree-unroll 5065 5066 5067 '-dLETTERS' 5068 '-fdump-rtl-PASS' 5069 '-fdump-rtl-PASS=FILENAME' 5070 Says to make debugging dumps during compilation at times specified 5071 by LETTERS. This is used for debugging the RTL-based passes of the 5072 compiler. The file names for most of the dumps are made by 5073 appending a pass number and a word to the DUMPNAME, and the files 5074 are created in the directory of the output file. In case of 5075 '=FILENAME' option, the dump is output on the given file instead of 5076 the pass numbered dump files. Note that the pass number is 5077 computed statically as passes get registered into the pass manager. 5078 Thus the numbering is not related to the dynamic order of execution 5079 of passes. In particular, a pass installed by a plugin could have 5080 a number over 200 even if it executed quite early. DUMPNAME is 5081 generated from the name of the output file, if explicitly specified 5082 and it is not an executable, otherwise it is the basename of the 5083 source file. These switches may have different effects when '-E' 5084 is used for preprocessing. 5085 5086 Debug dumps can be enabled with a '-fdump-rtl' switch or some '-d' 5087 option LETTERS. Here are the possible letters for use in PASS and 5088 LETTERS, and their meanings: 5089 5090 '-fdump-rtl-alignments' 5091 Dump after branch alignments have been computed. 5092 5093 '-fdump-rtl-asmcons' 5094 Dump after fixing rtl statements that have unsatisfied in/out 5095 constraints. 5096 5097 '-fdump-rtl-auto_inc_dec' 5098 Dump after auto-inc-dec discovery. This pass is only run on 5099 architectures that have auto inc or auto dec instructions. 5100 5101 '-fdump-rtl-barriers' 5102 Dump after cleaning up the barrier instructions. 5103 5104 '-fdump-rtl-bbpart' 5105 Dump after partitioning hot and cold basic blocks. 5106 5107 '-fdump-rtl-bbro' 5108 Dump after block reordering. 5109 5110 '-fdump-rtl-btl1' 5111 '-fdump-rtl-btl2' 5112 '-fdump-rtl-btl1' and '-fdump-rtl-btl2' enable dumping after 5113 the two branch target load optimization passes. 5114 5115 '-fdump-rtl-bypass' 5116 Dump after jump bypassing and control flow optimizations. 5117 5118 '-fdump-rtl-combine' 5119 Dump after the RTL instruction combination pass. 5120 5121 '-fdump-rtl-compgotos' 5122 Dump after duplicating the computed gotos. 5123 5124 '-fdump-rtl-ce1' 5125 '-fdump-rtl-ce2' 5126 '-fdump-rtl-ce3' 5127 '-fdump-rtl-ce1', '-fdump-rtl-ce2', and '-fdump-rtl-ce3' 5128 enable dumping after the three if conversion passes. 5129 5130 '-fdump-rtl-cprop_hardreg' 5131 Dump after hard register copy propagation. 5132 5133 '-fdump-rtl-csa' 5134 Dump after combining stack adjustments. 5135 5136 '-fdump-rtl-cse1' 5137 '-fdump-rtl-cse2' 5138 '-fdump-rtl-cse1' and '-fdump-rtl-cse2' enable dumping after 5139 the two common subexpression elimination passes. 5140 5141 '-fdump-rtl-dce' 5142 Dump after the standalone dead code elimination passes. 5143 5144 '-fdump-rtl-dbr' 5145 Dump after delayed branch scheduling. 5146 5147 '-fdump-rtl-dce1' 5148 '-fdump-rtl-dce2' 5149 '-fdump-rtl-dce1' and '-fdump-rtl-dce2' enable dumping after 5150 the two dead store elimination passes. 5151 5152 '-fdump-rtl-eh' 5153 Dump after finalization of EH handling code. 5154 5155 '-fdump-rtl-eh_ranges' 5156 Dump after conversion of EH handling range regions. 5157 5158 '-fdump-rtl-expand' 5159 Dump after RTL generation. 5160 5161 '-fdump-rtl-fwprop1' 5162 '-fdump-rtl-fwprop2' 5163 '-fdump-rtl-fwprop1' and '-fdump-rtl-fwprop2' enable dumping 5164 after the two forward propagation passes. 5165 5166 '-fdump-rtl-gcse1' 5167 '-fdump-rtl-gcse2' 5168 '-fdump-rtl-gcse1' and '-fdump-rtl-gcse2' enable dumping after 5169 global common subexpression elimination. 5170 5171 '-fdump-rtl-init-regs' 5172 Dump after the initialization of the registers. 5173 5174 '-fdump-rtl-initvals' 5175 Dump after the computation of the initial value sets. 5176 5177 '-fdump-rtl-into_cfglayout' 5178 Dump after converting to cfglayout mode. 5179 5180 '-fdump-rtl-ira' 5181 Dump after iterated register allocation. 5182 5183 '-fdump-rtl-jump' 5184 Dump after the second jump optimization. 5185 5186 '-fdump-rtl-loop2' 5187 '-fdump-rtl-loop2' enables dumping after the rtl loop 5188 optimization passes. 5189 5190 '-fdump-rtl-mach' 5191 Dump after performing the machine dependent reorganization 5192 pass, if that pass exists. 5193 5194 '-fdump-rtl-mode_sw' 5195 Dump after removing redundant mode switches. 5196 5197 '-fdump-rtl-rnreg' 5198 Dump after register renumbering. 5199 5200 '-fdump-rtl-outof_cfglayout' 5201 Dump after converting from cfglayout mode. 5202 5203 '-fdump-rtl-peephole2' 5204 Dump after the peephole pass. 5205 5206 '-fdump-rtl-postreload' 5207 Dump after post-reload optimizations. 5208 5209 '-fdump-rtl-pro_and_epilogue' 5210 Dump after generating the function prologues and epilogues. 5211 5212 '-fdump-rtl-regmove' 5213 Dump after the register move pass. 5214 5215 '-fdump-rtl-sched1' 5216 '-fdump-rtl-sched2' 5217 '-fdump-rtl-sched1' and '-fdump-rtl-sched2' enable dumping 5218 after the basic block scheduling passes. 5219 5220 '-fdump-rtl-see' 5221 Dump after sign extension elimination. 5222 5223 '-fdump-rtl-seqabstr' 5224 Dump after common sequence discovery. 5225 5226 '-fdump-rtl-shorten' 5227 Dump after shortening branches. 5228 5229 '-fdump-rtl-sibling' 5230 Dump after sibling call optimizations. 5231 5232 '-fdump-rtl-split1' 5233 '-fdump-rtl-split2' 5234 '-fdump-rtl-split3' 5235 '-fdump-rtl-split4' 5236 '-fdump-rtl-split5' 5237 '-fdump-rtl-split1', '-fdump-rtl-split2', '-fdump-rtl-split3', 5238 '-fdump-rtl-split4' and '-fdump-rtl-split5' enable dumping 5239 after five rounds of instruction splitting. 5240 5241 '-fdump-rtl-sms' 5242 Dump after modulo scheduling. This pass is only run on some 5243 architectures. 5244 5245 '-fdump-rtl-stack' 5246 Dump after conversion from GCC's "flat register file" 5247 registers to the x87's stack-like registers. This pass is 5248 only run on x86 variants. 5249 5250 '-fdump-rtl-subreg1' 5251 '-fdump-rtl-subreg2' 5252 '-fdump-rtl-subreg1' and '-fdump-rtl-subreg2' enable dumping 5253 after the two subreg expansion passes. 5254 5255 '-fdump-rtl-unshare' 5256 Dump after all rtl has been unshared. 5257 5258 '-fdump-rtl-vartrack' 5259 Dump after variable tracking. 5260 5261 '-fdump-rtl-vregs' 5262 Dump after converting virtual registers to hard registers. 5263 5264 '-fdump-rtl-web' 5265 Dump after live range splitting. 5266 5267 '-fdump-rtl-regclass' 5268 '-fdump-rtl-subregs_of_mode_init' 5269 '-fdump-rtl-subregs_of_mode_finish' 5270 '-fdump-rtl-dfinit' 5271 '-fdump-rtl-dfinish' 5272 These dumps are defined but always produce empty files. 5273 5274 '-da' 5275 '-fdump-rtl-all' 5276 Produce all the dumps listed above. 5277 5278 '-dA' 5279 Annotate the assembler output with miscellaneous debugging 5280 information. 5281 5282 '-dD' 5283 Dump all macro definitions, at the end of preprocessing, in 5284 addition to normal output. 5285 5286 '-dH' 5287 Produce a core dump whenever an error occurs. 5288 5289 '-dp' 5290 Annotate the assembler output with a comment indicating which 5291 pattern and alternative is used. The length of each 5292 instruction is also printed. 5293 5294 '-dP' 5295 Dump the RTL in the assembler output as a comment before each 5296 instruction. Also turns on '-dp' annotation. 5297 5298 '-dx' 5299 Just generate RTL for a function instead of compiling it. 5300 Usually used with '-fdump-rtl-expand'. 5301 5302 '-fdump-noaddr' 5303 When doing debugging dumps, suppress address output. This makes it 5304 more feasible to use diff on debugging dumps for compiler 5305 invocations with different compiler binaries and/or different text 5306 / bss / data / heap / stack / dso start locations. 5307 5308 '-fdump-unnumbered' 5309 When doing debugging dumps, suppress instruction numbers and 5310 address output. This makes it more feasible to use diff on 5311 debugging dumps for compiler invocations with different options, in 5312 particular with and without '-g'. 5313 5314 '-fdump-unnumbered-links' 5315 When doing debugging dumps (see '-d' option above), suppress 5316 instruction numbers for the links to the previous and next 5317 instructions in a sequence. 5318 5319 '-fdump-translation-unit (C++ only)' 5320 '-fdump-translation-unit-OPTIONS (C++ only)' 5321 Dump a representation of the tree structure for the entire 5322 translation unit to a file. The file name is made by appending 5323 '.tu' to the source file name, and the file is created in the same 5324 directory as the output file. If the '-OPTIONS' form is used, 5325 OPTIONS controls the details of the dump as described for the 5326 '-fdump-tree' options. 5327 5328 '-fdump-class-hierarchy (C++ only)' 5329 '-fdump-class-hierarchy-OPTIONS (C++ only)' 5330 Dump a representation of each class's hierarchy and virtual 5331 function table layout to a file. The file name is made by 5332 appending '.class' to the source file name, and the file is created 5333 in the same directory as the output file. If the '-OPTIONS' form 5334 is used, OPTIONS controls the details of the dump as described for 5335 the '-fdump-tree' options. 5336 5337 '-fdump-ipa-SWITCH' 5338 Control the dumping at various stages of inter-procedural analysis 5339 language tree to a file. The file name is generated by appending a 5340 switch specific suffix to the source file name, and the file is 5341 created in the same directory as the output file. The following 5342 dumps are possible: 5343 5344 'all' 5345 Enables all inter-procedural analysis dumps. 5346 5347 'cgraph' 5348 Dumps information about call-graph optimization, unused 5349 function removal, and inlining decisions. 5350 5351 'inline' 5352 Dump after function inlining. 5353 5354 '-fdump-passes' 5355 Dump the list of optimization passes that are turned on and off by 5356 the current command-line options. 5357 5358 '-fdump-statistics-OPTION' 5359 Enable and control dumping of pass statistics in a separate file. 5360 The file name is generated by appending a suffix ending in 5361 '.statistics' to the source file name, and the file is created in 5362 the same directory as the output file. If the '-OPTION' form is 5363 used, '-stats' causes counters to be summed over the whole 5364 compilation unit while '-details' dumps every event as the passes 5365 generate them. The default with no option is to sum counters for 5366 each function compiled. 5367 5368 '-fdump-tree-SWITCH' 5369 '-fdump-tree-SWITCH-OPTIONS' 5370 '-fdump-tree-SWITCH-OPTIONS=FILENAME' 5371 Control the dumping at various stages of processing the 5372 intermediate language tree to a file. The file name is generated 5373 by appending a switch-specific suffix to the source file name, and 5374 the file is created in the same directory as the output file. In 5375 case of '=FILENAME' option, the dump is output on the given file 5376 instead of the auto named dump files. If the '-OPTIONS' form is 5377 used, OPTIONS is a list of '-' separated options which control the 5378 details of the dump. Not all options are applicable to all dumps; 5379 those that are not meaningful are ignored. The following options 5380 are available 5381 5382 'address' 5383 Print the address of each node. Usually this is not 5384 meaningful as it changes according to the environment and 5385 source file. Its primary use is for tying up a dump file with 5386 a debug environment. 5387 'asmname' 5388 If 'DECL_ASSEMBLER_NAME' has been set for a given decl, use 5389 that in the dump instead of 'DECL_NAME'. Its primary use is 5390 ease of use working backward from mangled names in the 5391 assembly file. 5392 'slim' 5393 When dumping front-end intermediate representations, inhibit 5394 dumping of members of a scope or body of a function merely 5395 because that scope has been reached. Only dump such items 5396 when they are directly reachable by some other path. 5397 5398 When dumping pretty-printed trees, this option inhibits 5399 dumping the bodies of control structures. 5400 5401 When dumping RTL, print the RTL in slim (condensed) form 5402 instead of the default LISP-like representation. 5403 'raw' 5404 Print a raw representation of the tree. By default, trees are 5405 pretty-printed into a C-like representation. 5406 'details' 5407 Enable more detailed dumps (not honored by every dump option). 5408 Also include information from the optimization passes. 5409 'stats' 5410 Enable dumping various statistics about the pass (not honored 5411 by every dump option). 5412 'blocks' 5413 Enable showing basic block boundaries (disabled in raw dumps). 5414 'graph' 5415 For each of the other indicated dump files 5416 ('-fdump-rtl-PASS'), dump a representation of the control flow 5417 graph suitable for viewing with GraphViz to 5418 'FILE.PASSID.PASS.dot'. Each function in the file is 5419 pretty-printed as a subgraph, so that GraphViz can render them 5420 all in a single plot. 5421 5422 This option currently only works for RTL dumps, and the RTL is 5423 always dumped in slim form. 5424 'vops' 5425 Enable showing virtual operands for every statement. 5426 'lineno' 5427 Enable showing line numbers for statements. 5428 'uid' 5429 Enable showing the unique ID ('DECL_UID') for each variable. 5430 'verbose' 5431 Enable showing the tree dump for each statement. 5432 'eh' 5433 Enable showing the EH region number holding each statement. 5434 'scev' 5435 Enable showing scalar evolution analysis details. 5436 'optimized' 5437 Enable showing optimization information (only available in 5438 certain passes). 5439 'missed' 5440 Enable showing missed optimization information (only available 5441 in certain passes). 5442 'notes' 5443 Enable other detailed optimization information (only available 5444 in certain passes). 5445 '=FILENAME' 5446 Instead of an auto named dump file, output into the given file 5447 name. The file names 'stdout' and 'stderr' are treated 5448 specially and are considered already open standard streams. 5449 For example, 5450 5451 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump 5452 -fdump-tree-pre=stderr file.c 5453 5454 outputs vectorizer dump into 'foo.dump', while the PRE dump is 5455 output on to 'stderr'. If two conflicting dump filenames are 5456 given for the same pass, then the latter option overrides the 5457 earlier one. 5458 5459 'all' 5460 Turn on all options, except 'raw', 'slim', 'verbose' and 5461 'lineno'. 5462 5463 'optall' 5464 Turn on all optimization options, i.e., 'optimized', 'missed', 5465 and 'note'. 5466 5467 The following tree dumps are possible: 5468 5469 'original' 5470 Dump before any tree based optimization, to 'FILE.original'. 5471 5472 'optimized' 5473 Dump after all tree based optimization, to 'FILE.optimized'. 5474 5475 'gimple' 5476 Dump each function before and after the gimplification pass to 5477 a file. The file name is made by appending '.gimple' to the 5478 source file name. 5479 5480 'cfg' 5481 Dump the control flow graph of each function to a file. The 5482 file name is made by appending '.cfg' to the source file name. 5483 5484 'ch' 5485 Dump each function after copying loop headers. The file name 5486 is made by appending '.ch' to the source file name. 5487 5488 'ssa' 5489 Dump SSA related information to a file. The file name is made 5490 by appending '.ssa' to the source file name. 5491 5492 'alias' 5493 Dump aliasing information for each function. The file name is 5494 made by appending '.alias' to the source file name. 5495 5496 'ccp' 5497 Dump each function after CCP. The file name is made by 5498 appending '.ccp' to the source file name. 5499 5500 'storeccp' 5501 Dump each function after STORE-CCP. The file name is made by 5502 appending '.storeccp' to the source file name. 5503 5504 'pre' 5505 Dump trees after partial redundancy elimination. The file 5506 name is made by appending '.pre' to the source file name. 5507 5508 'fre' 5509 Dump trees after full redundancy elimination. The file name 5510 is made by appending '.fre' to the source file name. 5511 5512 'copyprop' 5513 Dump trees after copy propagation. The file name is made by 5514 appending '.copyprop' to the source file name. 5515 5516 'store_copyprop' 5517 Dump trees after store copy-propagation. The file name is 5518 made by appending '.store_copyprop' to the source file name. 5519 5520 'dce' 5521 Dump each function after dead code elimination. The file name 5522 is made by appending '.dce' to the source file name. 5523 5524 'mudflap' 5525 Dump each function after adding mudflap instrumentation. The 5526 file name is made by appending '.mudflap' to the source file 5527 name. 5528 5529 'sra' 5530 Dump each function after performing scalar replacement of 5531 aggregates. The file name is made by appending '.sra' to the 5532 source file name. 5533 5534 'sink' 5535 Dump each function after performing code sinking. The file 5536 name is made by appending '.sink' to the source file name. 5537 5538 'dom' 5539 Dump each function after applying dominator tree 5540 optimizations. The file name is made by appending '.dom' to 5541 the source file name. 5542 5543 'dse' 5544 Dump each function after applying dead store elimination. The 5545 file name is made by appending '.dse' to the source file name. 5546 5547 'phiopt' 5548 Dump each function after optimizing PHI nodes into 5549 straightline code. The file name is made by appending 5550 '.phiopt' to the source file name. 5551 5552 'forwprop' 5553 Dump each function after forward propagating single use 5554 variables. The file name is made by appending '.forwprop' to 5555 the source file name. 5556 5557 'copyrename' 5558 Dump each function after applying the copy rename 5559 optimization. The file name is made by appending 5560 '.copyrename' to the source file name. 5561 5562 'nrv' 5563 Dump each function after applying the named return value 5564 optimization on generic trees. The file name is made by 5565 appending '.nrv' to the source file name. 5566 5567 'vect' 5568 Dump each function after applying vectorization of loops. The 5569 file name is made by appending '.vect' to the source file 5570 name. 5571 5572 'slp' 5573 Dump each function after applying vectorization of basic 5574 blocks. The file name is made by appending '.slp' to the 5575 source file name. 5576 5577 'vrp' 5578 Dump each function after Value Range Propagation (VRP). The 5579 file name is made by appending '.vrp' to the source file name. 5580 5581 'all' 5582 Enable all the available tree dumps with the flags provided in 5583 this option. 5584 5585 '-fopt-info' 5586 '-fopt-info-OPTIONS' 5587 '-fopt-info-OPTIONS=FILENAME' 5588 Controls optimization dumps from various optimization passes. If 5589 the '-OPTIONS' form is used, OPTIONS is a list of '-' separated 5590 options to select the dump details and optimizations. If OPTIONS 5591 is not specified, it defaults to 'all' for details and 'optall' for 5592 optimization groups. If the FILENAME is not specified, it defaults 5593 to 'stderr'. Note that the output FILENAME will be overwritten in 5594 case of multiple translation units. If a combined output from 5595 multiple translation units is desired, 'stderr' should be used 5596 instead. 5597 5598 The options can be divided into two groups, 1) options describing 5599 the verbosity of the dump, and 2) options describing which 5600 optimizations should be included. The options from both the groups 5601 can be freely mixed as they are non-overlapping. However, in case 5602 of any conflicts, the latter options override the earlier options 5603 on the command line. Though multiple -fopt-info options are 5604 accepted, only one of them can have '=filename'. If other 5605 filenames are provided then all but the first one are ignored. 5606 5607 The dump verbosity has the following options 5608 5609 'optimized' 5610 Print information when an optimization is successfully 5611 applied. It is up to a pass to decide which information is 5612 relevant. For example, the vectorizer passes print the source 5613 location of loops which got successfully vectorized. 5614 'missed' 5615 Print information about missed optimizations. Individual 5616 passes control which information to include in the output. 5617 For example, 5618 5619 gcc -O2 -ftree-vectorize -fopt-info-vec-missed 5620 5621 will print information about missed optimization opportunities 5622 from vectorization passes on stderr. 5623 'note' 5624 Print verbose information about optimizations, such as certain 5625 transformations, more detailed messages about decisions etc. 5626 'all' 5627 Print detailed optimization information. This includes 5628 OPTIMIZED, MISSED, and NOTE. 5629 5630 The second set of options describes a group of optimizations and 5631 may include one or more of the following. 5632 5633 'ipa' 5634 Enable dumps from all interprocedural optimizations. 5635 'loop' 5636 Enable dumps from all loop optimizations. 5637 'inline' 5638 Enable dumps from all inlining optimizations. 5639 'vec' 5640 Enable dumps from all vectorization optimizations. 5641 5642 For example, 5643 gcc -O3 -fopt-info-missed=missed.all 5644 5645 outputs missed optimization report from all the passes into 5646 'missed.all'. 5647 5648 As another example, 5649 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 5650 5651 will output information about missed optimizations as well as 5652 optimized locations from all the inlining passes into 'inline.txt'. 5653 5654 If the FILENAME is provided, then the dumps from all the applicable 5655 optimizations are concatenated into the 'filename'. Otherwise the 5656 dump is output onto 'stderr'. If OPTIONS is omitted, it defaults 5657 to 'all-optall', which means dump all available optimization info 5658 from all the passes. In the following example, all optimization 5659 info is output on to 'stderr'. 5660 5661 gcc -O3 -fopt-info 5662 5663 Note that '-fopt-info-vec-missed' behaves the same as 5664 '-fopt-info-missed-vec'. 5665 5666 As another example, consider 5667 5668 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 5669 5670 Here the two output filenames 'vec.miss' and 'loop.opt' are in 5671 conflict since only one output file is allowed. In this case, only 5672 the first option takes effect and the subsequent options are 5673 ignored. Thus only the 'vec.miss' is produced which cotaints dumps 5674 from the vectorizer about missed opportunities. 5675 5676 '-ftree-vectorizer-verbose=N' 5677 This option is deprecated and is implemented in terms of 5678 '-fopt-info'. Please use '-fopt-info-KIND' form instead, where 5679 KIND is one of the valid opt-info options. It prints additional 5680 optimization information. For N=0 no diagnostic information is 5681 reported. If N=1 the vectorizer reports each loop that got 5682 vectorized, and the total number of loops that got vectorized. If 5683 N=2 the vectorizer reports locations which could not be vectorized 5684 and the reasons for those. For any higher verbosity levels all the 5685 analysis and transformation information from the vectorizer is 5686 reported. 5687 5688 Note that the information output by '-ftree-vectorizer-verbose' 5689 option is sent to 'stderr'. If the equivalent form 5690 '-fopt-info-OPTIONS=FILENAME' is used then the output is sent into 5691 FILENAME instead. 5692 5693 '-frandom-seed=STRING' 5694 This option provides a seed that GCC uses in place of random 5695 numbers in generating certain symbol names that have to be 5696 different in every compiled file. It is also used to place unique 5697 stamps in coverage data files and the object files that produce 5698 them. You can use the '-frandom-seed' option to produce 5699 reproducibly identical object files. 5700 5701 The STRING should be different for every file you compile. 5702 5703 '-fsched-verbose=N' 5704 On targets that use instruction scheduling, this option controls 5705 the amount of debugging output the scheduler prints. This 5706 information is written to standard error, unless 5707 '-fdump-rtl-sched1' or '-fdump-rtl-sched2' is specified, in which 5708 case it is output to the usual dump listing file, '.sched1' or 5709 '.sched2' respectively. However for N greater than nine, the 5710 output is always printed to standard error. 5711 5712 For N greater than zero, '-fsched-verbose' outputs the same 5713 information as '-fdump-rtl-sched1' and '-fdump-rtl-sched2'. For N 5714 greater than one, it also output basic block probabilities, 5715 detailed ready list information and unit/insn info. For N greater 5716 than two, it includes RTL at abort point, control-flow and regions 5717 info. And for N over four, '-fsched-verbose' also includes 5718 dependence info. 5719 5720 '-save-temps' 5721 '-save-temps=cwd' 5722 Store the usual "temporary" intermediate files permanently; place 5723 them in the current directory and name them based on the source 5724 file. Thus, compiling 'foo.c' with '-c -save-temps' produces files 5725 'foo.i' and 'foo.s', as well as 'foo.o'. This creates a 5726 preprocessed 'foo.i' output file even though the compiler now 5727 normally uses an integrated preprocessor. 5728 5729 When used in combination with the '-x' command-line option, 5730 '-save-temps' is sensible enough to avoid over writing an input 5731 source file with the same extension as an intermediate file. The 5732 corresponding intermediate file may be obtained by renaming the 5733 source file before using '-save-temps'. 5734 5735 If you invoke GCC in parallel, compiling several different source 5736 files that share a common base name in different subdirectories or 5737 the same source file compiled for multiple output destinations, it 5738 is likely that the different parallel compilers will interfere with 5739 each other, and overwrite the temporary files. For instance: 5740 5741 gcc -save-temps -o outdir1/foo.o indir1/foo.c& 5742 gcc -save-temps -o outdir2/foo.o indir2/foo.c& 5743 5744 may result in 'foo.i' and 'foo.o' being written to simultaneously 5745 by both compilers. 5746 5747 '-save-temps=obj' 5748 Store the usual "temporary" intermediate files permanently. If the 5749 '-o' option is used, the temporary files are based on the object 5750 file. If the '-o' option is not used, the '-save-temps=obj' switch 5751 behaves like '-save-temps'. 5752 5753 For example: 5754 5755 gcc -save-temps=obj -c foo.c 5756 gcc -save-temps=obj -c bar.c -o dir/xbar.o 5757 gcc -save-temps=obj foobar.c -o dir2/yfoobar 5758 5759 creates 'foo.i', 'foo.s', 'dir/xbar.i', 'dir/xbar.s', 5760 'dir2/yfoobar.i', 'dir2/yfoobar.s', and 'dir2/yfoobar.o'. 5761 5762 '-time[=FILE]' 5763 Report the CPU time taken by each subprocess in the compilation 5764 sequence. For C source files, this is the compiler proper and 5765 assembler (plus the linker if linking is done). 5766 5767 Without the specification of an output file, the output looks like 5768 this: 5769 5770 # cc1 0.12 0.01 5771 # as 0.00 0.01 5772 5773 The first number on each line is the "user time", that is time 5774 spent executing the program itself. The second number is "system 5775 time", time spent executing operating system routines on behalf of 5776 the program. Both numbers are in seconds. 5777 5778 With the specification of an output file, the output is appended to 5779 the named file, and it looks like this: 5780 5781 0.12 0.01 cc1 OPTIONS 5782 0.00 0.01 as OPTIONS 5783 5784 The "user time" and the "system time" are moved before the program 5785 name, and the options passed to the program are displayed, so that 5786 one can later tell what file was being compiled, and with which 5787 options. 5788 5789 '-fvar-tracking' 5790 Run variable tracking pass. It computes where variables are stored 5791 at each position in code. Better debugging information is then 5792 generated (if the debugging information format supports this 5793 information). 5794 5795 It is enabled by default when compiling with optimization ('-Os', 5796 '-O', '-O2', ...), debugging information ('-g') and the debug info 5797 format supports it. 5798 5799 '-fvar-tracking-assignments' 5800 Annotate assignments to user variables early in the compilation and 5801 attempt to carry the annotations over throughout the compilation 5802 all the way to the end, in an attempt to improve debug information 5803 while optimizing. Use of '-gdwarf-4' is recommended along with it. 5804 5805 It can be enabled even if var-tracking is disabled, in which case 5806 annotations are created and maintained, but discarded at the end. 5807 5808 '-fvar-tracking-assignments-toggle' 5809 Toggle '-fvar-tracking-assignments', in the same way that 5810 '-gtoggle' toggles '-g'. 5811 5812 '-print-file-name=LIBRARY' 5813 Print the full absolute name of the library file LIBRARY that would 5814 be used when linking--and don't do anything else. With this 5815 option, GCC does not compile or link anything; it just prints the 5816 file name. 5817 5818 '-print-multi-directory' 5819 Print the directory name corresponding to the multilib selected by 5820 any other switches present in the command line. This directory is 5821 supposed to exist in 'GCC_EXEC_PREFIX'. 5822 5823 '-print-multi-lib' 5824 Print the mapping from multilib directory names to compiler 5825 switches that enable them. The directory name is separated from 5826 the switches by ';', and each switch starts with an '@' instead of 5827 the '-', without spaces between multiple switches. This is 5828 supposed to ease shell processing. 5829 5830 '-print-multi-os-directory' 5831 Print the path to OS libraries for the selected multilib, relative 5832 to some 'lib' subdirectory. If OS libraries are present in the 5833 'lib' subdirectory and no multilibs are used, this is usually just 5834 '.', if OS libraries are present in 'libSUFFIX' sibling directories 5835 this prints e.g. '../lib64', '../lib' or '../lib32', or if OS 5836 libraries are present in 'lib/SUBDIR' subdirectories it prints e.g. 5837 'amd64', 'sparcv9' or 'ev6'. 5838 5839 '-print-multiarch' 5840 Print the path to OS libraries for the selected multiarch, relative 5841 to some 'lib' subdirectory. 5842 5843 '-print-prog-name=PROGRAM' 5844 Like '-print-file-name', but searches for a program such as 'cpp'. 5845 5846 '-print-libgcc-file-name' 5847 Same as '-print-file-name=libgcc.a'. 5848 5849 This is useful when you use '-nostdlib' or '-nodefaultlibs' but you 5850 do want to link with 'libgcc.a'. You can do: 5851 5852 gcc -nostdlib FILES... `gcc -print-libgcc-file-name` 5853 5854 '-print-search-dirs' 5855 Print the name of the configured installation directory and a list 5856 of program and library directories 'gcc' searches--and don't do 5857 anything else. 5858 5859 This is useful when 'gcc' prints the error message 'installation 5860 problem, cannot exec cpp0: No such file or directory'. To resolve 5861 this you either need to put 'cpp0' and the other compiler 5862 components where 'gcc' expects to find them, or you can set the 5863 environment variable 'GCC_EXEC_PREFIX' to the directory where you 5864 installed them. Don't forget the trailing '/'. *Note Environment 5865 Variables::. 5866 5867 '-print-sysroot' 5868 Print the target sysroot directory that is used during compilation. 5869 This is the target sysroot specified either at configure time or 5870 using the '--sysroot' option, possibly with an extra suffix that 5871 depends on compilation options. If no target sysroot is specified, 5872 the option prints nothing. 5873 5874 '-print-sysroot-headers-suffix' 5875 Print the suffix added to the target sysroot when searching for 5876 headers, or give an error if the compiler is not configured with 5877 such a suffix--and don't do anything else. 5878 5879 '-dumpmachine' 5880 Print the compiler's target machine (for example, 5881 'i686-pc-linux-gnu')--and don't do anything else. 5882 5883 '-dumpversion' 5884 Print the compiler version (for example, '3.0')--and don't do 5885 anything else. 5886 5887 '-dumpspecs' 5888 Print the compiler's built-in specs--and don't do anything else. 5889 (This is used when GCC itself is being built.) *Note Spec Files::. 5890 5891 '-fno-eliminate-unused-debug-types' 5892 Normally, when producing DWARF 2 output, GCC avoids producing debug 5893 symbol output for types that are nowhere used in the source file 5894 being compiled. Sometimes it is useful to have GCC emit debugging 5895 information for all types declared in a compilation unit, 5896 regardless of whether or not they are actually used in that 5897 compilation unit, for example if, in the debugger, you want to cast 5898 a value to a type that is not actually used in your program (but is 5899 declared). More often, however, this results in a significant 5900 amount of wasted space. 5901 5902 5903 File: gcc.info, Node: Optimize Options, Next: Preprocessor Options, Prev: Debugging Options, Up: Invoking GCC 5904 5905 3.10 Options That Control Optimization 5906 ====================================== 5907 5908 These options control various sorts of optimizations. 5909 5910 Without any optimization option, the compiler's goal is to reduce the 5911 cost of compilation and to make debugging produce the expected results. 5912 Statements are independent: if you stop the program with a breakpoint 5913 between statements, you can then assign a new value to any variable or 5914 change the program counter to any other statement in the function and 5915 get exactly the results you expect from the source code. 5916 5917 Turning on optimization flags makes the compiler attempt to improve the 5918 performance and/or code size at the expense of compilation time and 5919 possibly the ability to debug the program. 5920 5921 The compiler performs optimization based on the knowledge it has of the 5922 program. Compiling multiple files at once to a single output file mode 5923 allows the compiler to use information gained from all of the files when 5924 compiling each of them. 5925 5926 Not all optimizations are controlled directly by a flag. Only 5927 optimizations that have a flag are listed in this section. 5928 5929 Most optimizations are only enabled if an '-O' level is set on the 5930 command line. Otherwise they are disabled, even if individual 5931 optimization flags are specified. 5932 5933 Depending on the target and how GCC was configured, a slightly 5934 different set of optimizations may be enabled at each '-O' level than 5935 those listed here. You can invoke GCC with '-Q --help=optimizers' to 5936 find out the exact set of optimizations that are enabled at each level. 5937 *Note Overall Options::, for examples. 5938 5939 '-O' 5940 '-O1' 5941 Optimize. Optimizing compilation takes somewhat more time, and a 5942 lot more memory for a large function. 5943 5944 With '-O', the compiler tries to reduce code size and execution 5945 time, without performing any optimizations that take a great deal 5946 of compilation time. 5947 5948 '-O' turns on the following optimization flags: 5949 -fauto-inc-dec 5950 -fcompare-elim 5951 -fcprop-registers 5952 -fdce 5953 -fdefer-pop 5954 -fdelayed-branch 5955 -fdse 5956 -fguess-branch-probability 5957 -fif-conversion2 5958 -fif-conversion 5959 -fipa-pure-const 5960 -fipa-profile 5961 -fipa-reference 5962 -fmerge-constants 5963 -fsplit-wide-types 5964 -ftree-bit-ccp 5965 -ftree-builtin-call-dce 5966 -ftree-ccp 5967 -ftree-ch 5968 -ftree-copyrename 5969 -ftree-dce 5970 -ftree-dominator-opts 5971 -ftree-dse 5972 -ftree-forwprop 5973 -ftree-fre 5974 -ftree-phiprop 5975 -ftree-slsr 5976 -ftree-sra 5977 -ftree-pta 5978 -ftree-ter 5979 -funit-at-a-time 5980 5981 '-O' also turns on '-fomit-frame-pointer' on machines where doing 5982 so does not interfere with debugging. 5983 5984 '-O2' 5985 Optimize even more. GCC performs nearly all supported 5986 optimizations that do not involve a space-speed tradeoff. As 5987 compared to '-O', this option increases both compilation time and 5988 the performance of the generated code. 5989 5990 '-O2' turns on all optimization flags specified by '-O'. It also 5991 turns on the following optimization flags: 5992 -fthread-jumps 5993 -falign-functions -falign-jumps 5994 -falign-loops -falign-labels 5995 -fcaller-saves 5996 -fcrossjumping 5997 -fcse-follow-jumps -fcse-skip-blocks 5998 -fdelete-null-pointer-checks 5999 -fdevirtualize 6000 -fexpensive-optimizations 6001 -fgcse -fgcse-lm 6002 -fhoist-adjacent-loads 6003 -finline-small-functions 6004 -findirect-inlining 6005 -fipa-sra 6006 -foptimize-sibling-calls 6007 -fpartial-inlining 6008 -fpeephole2 6009 -fregmove 6010 -freorder-blocks -freorder-functions 6011 -frerun-cse-after-loop 6012 -fsched-interblock -fsched-spec 6013 -fschedule-insns -fschedule-insns2 6014 -fstrict-aliasing -fstrict-overflow 6015 -ftree-switch-conversion -ftree-tail-merge 6016 -ftree-pre 6017 -ftree-vrp 6018 6019 Please note the warning under '-fgcse' about invoking '-O2' on 6020 programs that use computed gotos. 6021 6022 '-O3' 6023 Optimize yet more. '-O3' turns on all optimizations specified by 6024 '-O2' and also turns on the '-finline-functions', 6025 '-funswitch-loops', '-fpredictive-commoning', 6026 '-fgcse-after-reload', '-ftree-vectorize', '-fvect-cost-model', 6027 '-ftree-partial-pre' and '-fipa-cp-clone' options. 6028 6029 '-O0' 6030 Reduce compilation time and make debugging produce the expected 6031 results. This is the default. 6032 6033 '-Os' 6034 Optimize for size. '-Os' enables all '-O2' optimizations that do 6035 not typically increase code size. It also performs further 6036 optimizations designed to reduce code size. 6037 6038 '-Os' disables the following optimization flags: 6039 -falign-functions -falign-jumps -falign-loops 6040 -falign-labels -freorder-blocks -freorder-blocks-and-partition 6041 -fprefetch-loop-arrays -ftree-vect-loop-version 6042 6043 '-Ofast' 6044 Disregard strict standards compliance. '-Ofast' enables all '-O3' 6045 optimizations. It also enables optimizations that are not valid 6046 for all standard-compliant programs. It turns on '-ffast-math' and 6047 the Fortran-specific '-fno-protect-parens' and '-fstack-arrays'. 6048 6049 '-Og' 6050 Optimize debugging experience. '-Og' enables optimizations that do 6051 not interfere with debugging. It should be the optimization level 6052 of choice for the standard edit-compile-debug cycle, offering a 6053 reasonable level of optimization while maintaining fast compilation 6054 and a good debugging experience. 6055 6056 If you use multiple '-O' options, with or without level numbers, 6057 the last such option is the one that is effective. 6058 6059 Options of the form '-fFLAG' specify machine-independent flags. Most 6060 flags have both positive and negative forms; the negative form of 6061 '-ffoo' is '-fno-foo'. In the table below, only one of the forms is 6062 listed--the one you typically use. You can figure out the other form by 6063 either removing 'no-' or adding it. 6064 6065 The following options control specific optimizations. They are either 6066 activated by '-O' options or are related to ones that are. You can use 6067 the following flags in the rare cases when "fine-tuning" of 6068 optimizations to be performed is desired. 6069 6070 '-fno-default-inline' 6071 Do not make member functions inline by default merely because they 6072 are defined inside the class scope (C++ only). Otherwise, when you 6073 specify '-O', member functions defined inside class scope are 6074 compiled inline by default; i.e., you don't need to add 'inline' in 6075 front of the member function name. 6076 6077 '-fno-defer-pop' 6078 Always pop the arguments to each function call as soon as that 6079 function returns. For machines that must pop arguments after a 6080 function call, the compiler normally lets arguments accumulate on 6081 the stack for several function calls and pops them all at once. 6082 6083 Disabled at levels '-O', '-O2', '-O3', '-Os'. 6084 6085 '-fforward-propagate' 6086 Perform a forward propagation pass on RTL. The pass tries to 6087 combine two instructions and checks if the result can be 6088 simplified. If loop unrolling is active, two passes are performed 6089 and the second is scheduled after loop unrolling. 6090 6091 This option is enabled by default at optimization levels '-O', 6092 '-O2', '-O3', '-Os'. 6093 6094 '-ffp-contract=STYLE' 6095 '-ffp-contract=off' disables floating-point expression contraction. 6096 '-ffp-contract=fast' enables floating-point expression contraction 6097 such as forming of fused multiply-add operations if the target has 6098 native support for them. '-ffp-contract=on' enables floating-point 6099 expression contraction if allowed by the language standard. This 6100 is currently not implemented and treated equal to 6101 '-ffp-contract=off'. 6102 6103 The default is '-ffp-contract=fast'. 6104 6105 '-fomit-frame-pointer' 6106 Don't keep the frame pointer in a register for functions that don't 6107 need one. This avoids the instructions to save, set up and restore 6108 frame pointers; it also makes an extra register available in many 6109 functions. *It also makes debugging impossible on some machines.* 6110 6111 On some machines, such as the VAX, this flag has no effect, because 6112 the standard calling sequence automatically handles the frame 6113 pointer and nothing is saved by pretending it doesn't exist. The 6114 machine-description macro 'FRAME_POINTER_REQUIRED' controls whether 6115 a target machine supports this flag. *Note Register Usage: 6116 (gccint)Registers. 6117 6118 Starting with GCC version 4.6, the default setting (when not 6119 optimizing for size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 6120 targets has been changed to '-fomit-frame-pointer'. The default 6121 can be reverted to '-fno-omit-frame-pointer' by configuring GCC 6122 with the '--enable-frame-pointer' configure option. 6123 6124 Enabled at levels '-O', '-O2', '-O3', '-Os'. 6125 6126 '-foptimize-sibling-calls' 6127 Optimize sibling and tail recursive calls. 6128 6129 Enabled at levels '-O2', '-O3', '-Os'. 6130 6131 '-fno-inline' 6132 Do not expand any functions inline apart from those marked with the 6133 'always_inline' attribute. This is the default when not 6134 optimizing. 6135 6136 Single functions can be exempted from inlining by marking them with 6137 the 'noinline' attribute. 6138 6139 '-finline-small-functions' 6140 Integrate functions into their callers when their body is smaller 6141 than expected function call code (so overall size of program gets 6142 smaller). The compiler heuristically decides which functions are 6143 simple enough to be worth integrating in this way. This inlining 6144 applies to all functions, even those not declared inline. 6145 6146 Enabled at level '-O2'. 6147 6148 '-findirect-inlining' 6149 Inline also indirect calls that are discovered to be known at 6150 compile time thanks to previous inlining. This option has any 6151 effect only when inlining itself is turned on by the 6152 '-finline-functions' or '-finline-small-functions' options. 6153 6154 Enabled at level '-O2'. 6155 6156 '-finline-functions' 6157 Consider all functions for inlining, even if they are not declared 6158 inline. The compiler heuristically decides which functions are 6159 worth integrating in this way. 6160 6161 If all calls to a given function are integrated, and the function 6162 is declared 'static', then the function is normally not output as 6163 assembler code in its own right. 6164 6165 Enabled at level '-O3'. 6166 6167 '-finline-functions-called-once' 6168 Consider all 'static' functions called once for inlining into their 6169 caller even if they are not marked 'inline'. If a call to a given 6170 function is integrated, then the function is not output as 6171 assembler code in its own right. 6172 6173 Enabled at levels '-O1', '-O2', '-O3' and '-Os'. 6174 6175 '-fearly-inlining' 6176 Inline functions marked by 'always_inline' and functions whose body 6177 seems smaller than the function call overhead early before doing 6178 '-fprofile-generate' instrumentation and real inlining pass. Doing 6179 so makes profiling significantly cheaper and usually inlining 6180 faster on programs having large chains of nested wrapper functions. 6181 6182 Enabled by default. 6183 6184 '-fipa-sra' 6185 Perform interprocedural scalar replacement of aggregates, removal 6186 of unused parameters and replacement of parameters passed by 6187 reference by parameters passed by value. 6188 6189 Enabled at levels '-O2', '-O3' and '-Os'. 6190 6191 '-finline-limit=N' 6192 By default, GCC limits the size of functions that can be inlined. 6193 This flag allows coarse control of this limit. N is the size of 6194 functions that can be inlined in number of pseudo instructions. 6195 6196 Inlining is actually controlled by a number of parameters, which 6197 may be specified individually by using '--param NAME=VALUE'. The 6198 '-finline-limit=N' option sets some of these parameters as follows: 6199 6200 'max-inline-insns-single' 6201 is set to N/2. 6202 'max-inline-insns-auto' 6203 is set to N/2. 6204 6205 See below for a documentation of the individual parameters 6206 controlling inlining and for the defaults of these parameters. 6207 6208 _Note:_ there may be no value to '-finline-limit' that results in 6209 default behavior. 6210 6211 _Note:_ pseudo instruction represents, in this particular context, 6212 an abstract measurement of function's size. In no way does it 6213 represent a count of assembly instructions and as such its exact 6214 meaning might change from one release to an another. 6215 6216 '-fno-keep-inline-dllexport' 6217 This is a more fine-grained version of '-fkeep-inline-functions', 6218 which applies only to functions that are declared using the 6219 'dllexport' attribute or declspec (*Note Declaring Attributes of 6220 Functions: Function Attributes.) 6221 6222 '-fkeep-inline-functions' 6223 In C, emit 'static' functions that are declared 'inline' into the 6224 object file, even if the function has been inlined into all of its 6225 callers. This switch does not affect functions using the 'extern 6226 inline' extension in GNU C90. In C++, emit any and all inline 6227 functions into the object file. 6228 6229 '-fkeep-static-consts' 6230 Emit variables declared 'static const' when optimization isn't 6231 turned on, even if the variables aren't referenced. 6232 6233 GCC enables this option by default. If you want to force the 6234 compiler to check if a variable is referenced, regardless of 6235 whether or not optimization is turned on, use the 6236 '-fno-keep-static-consts' option. 6237 6238 '-fmerge-constants' 6239 Attempt to merge identical constants (string constants and 6240 floating-point constants) across compilation units. 6241 6242 This option is the default for optimized compilation if the 6243 assembler and linker support it. Use '-fno-merge-constants' to 6244 inhibit this behavior. 6245 6246 Enabled at levels '-O', '-O2', '-O3', '-Os'. 6247 6248 '-fmerge-all-constants' 6249 Attempt to merge identical constants and identical variables. 6250 6251 This option implies '-fmerge-constants'. In addition to 6252 '-fmerge-constants' this considers e.g. even constant initialized 6253 arrays or initialized constant variables with integral or 6254 floating-point types. Languages like C or C++ require each 6255 variable, including multiple instances of the same variable in 6256 recursive calls, to have distinct locations, so using this option 6257 results in non-conforming behavior. 6258 6259 '-fmodulo-sched' 6260 Perform swing modulo scheduling immediately before the first 6261 scheduling pass. This pass looks at innermost loops and reorders 6262 their instructions by overlapping different iterations. 6263 6264 '-fmodulo-sched-allow-regmoves' 6265 Perform more aggressive SMS-based modulo scheduling with register 6266 moves allowed. By setting this flag certain anti-dependences edges 6267 are deleted, which triggers the generation of reg-moves based on 6268 the life-range analysis. This option is effective only with 6269 '-fmodulo-sched' enabled. 6270 6271 '-fno-branch-count-reg' 6272 Do not use "decrement and branch" instructions on a count register, 6273 but instead generate a sequence of instructions that decrement a 6274 register, compare it against zero, then branch based upon the 6275 result. This option is only meaningful on architectures that 6276 support such instructions, which include x86, PowerPC, IA-64 and 6277 S/390. 6278 6279 The default is '-fbranch-count-reg'. 6280 6281 '-fno-function-cse' 6282 Do not put function addresses in registers; make each instruction 6283 that calls a constant function contain the function's address 6284 explicitly. 6285 6286 This option results in less efficient code, but some strange hacks 6287 that alter the assembler output may be confused by the 6288 optimizations performed when this option is not used. 6289 6290 The default is '-ffunction-cse' 6291 6292 '-fno-zero-initialized-in-bss' 6293 If the target supports a BSS section, GCC by default puts variables 6294 that are initialized to zero into BSS. This can save space in the 6295 resulting code. 6296 6297 This option turns off this behavior because some programs 6298 explicitly rely on variables going to the data section--e.g., so 6299 that the resulting executable can find the beginning of that 6300 section and/or make assumptions based on that. 6301 6302 The default is '-fzero-initialized-in-bss'. 6303 6304 '-fmudflap -fmudflapth -fmudflapir' 6305 For front-ends that support it (C and C++), instrument all risky 6306 pointer/array dereferencing operations, some standard library 6307 string/heap functions, and some other associated constructs with 6308 range/validity tests. Modules so instrumented should be immune to 6309 buffer overflows, invalid heap use, and some other classes of C/C++ 6310 programming errors. The instrumentation relies on a separate 6311 runtime library ('libmudflap'), which is linked into a program if 6312 '-fmudflap' is given at link time. Run-time behavior of the 6313 instrumented program is controlled by the 'MUDFLAP_OPTIONS' 6314 environment variable. See 'env MUDFLAP_OPTIONS=-help a.out' for 6315 its options. 6316 6317 Use '-fmudflapth' instead of '-fmudflap' to compile and to link if 6318 your program is multi-threaded. Use '-fmudflapir', in addition to 6319 '-fmudflap' or '-fmudflapth', if instrumentation should ignore 6320 pointer reads. This produces less instrumentation (and therefore 6321 faster execution) and still provides some protection against 6322 outright memory corrupting writes, but allows erroneously read data 6323 to propagate within a program. 6324 6325 '-fthread-jumps' 6326 Perform optimizations that check to see if a jump branches to a 6327 location where another comparison subsumed by the first is found. 6328 If so, the first branch is redirected to either the destination of 6329 the second branch or a point immediately following it, depending on 6330 whether the condition is known to be true or false. 6331 6332 Enabled at levels '-O2', '-O3', '-Os'. 6333 6334 '-fsplit-wide-types' 6335 When using a type that occupies multiple registers, such as 'long 6336 long' on a 32-bit system, split the registers apart and allocate 6337 them independently. This normally generates better code for those 6338 types, but may make debugging more difficult. 6339 6340 Enabled at levels '-O', '-O2', '-O3', '-Os'. 6341 6342 '-fcse-follow-jumps' 6343 In common subexpression elimination (CSE), scan through jump 6344 instructions when the target of the jump is not reached by any 6345 other path. For example, when CSE encounters an 'if' statement 6346 with an 'else' clause, CSE follows the jump when the condition 6347 tested is false. 6348 6349 Enabled at levels '-O2', '-O3', '-Os'. 6350 6351 '-fcse-skip-blocks' 6352 This is similar to '-fcse-follow-jumps', but causes CSE to follow 6353 jumps that conditionally skip over blocks. When CSE encounters a 6354 simple 'if' statement with no else clause, '-fcse-skip-blocks' 6355 causes CSE to follow the jump around the body of the 'if'. 6356 6357 Enabled at levels '-O2', '-O3', '-Os'. 6358 6359 '-frerun-cse-after-loop' 6360 Re-run common subexpression elimination after loop optimizations 6361 are performed. 6362 6363 Enabled at levels '-O2', '-O3', '-Os'. 6364 6365 '-fgcse' 6366 Perform a global common subexpression elimination pass. This pass 6367 also performs global constant and copy propagation. 6368 6369 _Note:_ When compiling a program using computed gotos, a GCC 6370 extension, you may get better run-time performance if you disable 6371 the global common subexpression elimination pass by adding 6372 '-fno-gcse' to the command line. 6373 6374 Enabled at levels '-O2', '-O3', '-Os'. 6375 6376 '-fgcse-lm' 6377 When '-fgcse-lm' is enabled, global common subexpression 6378 elimination attempts to move loads that are only killed by stores 6379 into themselves. This allows a loop containing a load/store 6380 sequence to be changed to a load outside the loop, and a copy/store 6381 within the loop. 6382 6383 Enabled by default when '-fgcse' is enabled. 6384 6385 '-fgcse-sm' 6386 When '-fgcse-sm' is enabled, a store motion pass is run after 6387 global common subexpression elimination. This pass attempts to 6388 move stores out of loops. When used in conjunction with 6389 '-fgcse-lm', loops containing a load/store sequence can be changed 6390 to a load before the loop and a store after the loop. 6391 6392 Not enabled at any optimization level. 6393 6394 '-fgcse-las' 6395 When '-fgcse-las' is enabled, the global common subexpression 6396 elimination pass eliminates redundant loads that come after stores 6397 to the same memory location (both partial and full redundancies). 6398 6399 Not enabled at any optimization level. 6400 6401 '-fgcse-after-reload' 6402 When '-fgcse-after-reload' is enabled, a redundant load elimination 6403 pass is performed after reload. The purpose of this pass is to 6404 clean up redundant spilling. 6405 6406 '-faggressive-loop-optimizations' 6407 This option tells the loop optimizer to use language constraints to 6408 derive bounds for the number of iterations of a loop. This assumes 6409 that loop code does not invoke undefined behavior by for example 6410 causing signed integer overflows or out-of-bound array accesses. 6411 The bounds for the number of iterations of a loop are used to guide 6412 loop unrolling and peeling and loop exit test optimizations. This 6413 option is enabled by default. 6414 6415 '-funsafe-loop-optimizations' 6416 This option tells the loop optimizer to assume that loop indices do 6417 not overflow, and that loops with nontrivial exit condition are not 6418 infinite. This enables a wider range of loop optimizations even if 6419 the loop optimizer itself cannot prove that these assumptions are 6420 valid. If you use '-Wunsafe-loop-optimizations', the compiler 6421 warns you if it finds this kind of loop. 6422 6423 '-fcrossjumping' 6424 Perform cross-jumping transformation. This transformation unifies 6425 equivalent code and saves code size. The resulting code may or may 6426 not perform better than without cross-jumping. 6427 6428 Enabled at levels '-O2', '-O3', '-Os'. 6429 6430 '-fauto-inc-dec' 6431 Combine increments or decrements of addresses with memory accesses. 6432 This pass is always skipped on architectures that do not have 6433 instructions to support this. Enabled by default at '-O' and 6434 higher on architectures that support this. 6435 6436 '-fdce' 6437 Perform dead code elimination (DCE) on RTL. Enabled by default at 6438 '-O' and higher. 6439 6440 '-fdse' 6441 Perform dead store elimination (DSE) on RTL. Enabled by default at 6442 '-O' and higher. 6443 6444 '-fif-conversion' 6445 Attempt to transform conditional jumps into branch-less 6446 equivalents. This includes use of conditional moves, min, max, set 6447 flags and abs instructions, and some tricks doable by standard 6448 arithmetics. The use of conditional execution on chips where it is 6449 available is controlled by 'if-conversion2'. 6450 6451 Enabled at levels '-O', '-O2', '-O3', '-Os'. 6452 6453 '-fif-conversion2' 6454 Use conditional execution (where available) to transform 6455 conditional jumps into branch-less equivalents. 6456 6457 Enabled at levels '-O', '-O2', '-O3', '-Os'. 6458 6459 '-fdelete-null-pointer-checks' 6460 Assume that programs cannot safely dereference null pointers, and 6461 that no code or data element resides there. This enables simple 6462 constant folding optimizations at all optimization levels. In 6463 addition, other optimization passes in GCC use this flag to control 6464 global dataflow analyses that eliminate useless checks for null 6465 pointers; these assume that if a pointer is checked after it has 6466 already been dereferenced, it cannot be null. 6467 6468 Note however that in some environments this assumption is not true. 6469 Use '-fno-delete-null-pointer-checks' to disable this optimization 6470 for programs that depend on that behavior. 6471 6472 Some targets, especially embedded ones, disable this option at all 6473 levels. Otherwise it is enabled at all levels: '-O0', '-O1', 6474 '-O2', '-O3', '-Os'. Passes that use the information are enabled 6475 independently at different optimization levels. 6476 6477 '-fdevirtualize' 6478 Attempt to convert calls to virtual functions to direct calls. 6479 This is done both within a procedure and interprocedurally as part 6480 of indirect inlining ('-findirect-inlining') and interprocedural 6481 constant propagation ('-fipa-cp'). Enabled at levels '-O2', '-O3', 6482 '-Os'. 6483 6484 '-fexpensive-optimizations' 6485 Perform a number of minor optimizations that are relatively 6486 expensive. 6487 6488 Enabled at levels '-O2', '-O3', '-Os'. 6489 6490 '-free' 6491 Attempt to remove redundant extension instructions. This is 6492 especially helpful for the x86-64 architecture, which implicitly 6493 zero-extends in 64-bit registers after writing to their lower 6494 32-bit half. 6495 6496 Enabled for x86 at levels '-O2', '-O3'. 6497 6498 '-foptimize-register-move' 6499 '-fregmove' 6500 Attempt to reassign register numbers in move instructions and as 6501 operands of other simple instructions in order to maximize the 6502 amount of register tying. This is especially helpful on machines 6503 with two-operand instructions. 6504 6505 Note '-fregmove' and '-foptimize-register-move' are the same 6506 optimization. 6507 6508 Enabled at levels '-O2', '-O3', '-Os'. 6509 6510 '-fira-algorithm=ALGORITHM' 6511 Use the specified coloring algorithm for the integrated register 6512 allocator. The ALGORITHM argument can be 'priority', which 6513 specifies Chow's priority coloring, or 'CB', which specifies 6514 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not 6515 implemented for all architectures, but for those targets that do 6516 support it, it is the default because it generates better code. 6517 6518 '-fira-region=REGION' 6519 Use specified regions for the integrated register allocator. The 6520 REGION argument should be one of the following: 6521 6522 'all' 6523 Use all loops as register allocation regions. This can give 6524 the best results for machines with a small and/or irregular 6525 register set. 6526 6527 'mixed' 6528 Use all loops except for loops with small register pressure as 6529 the regions. This value usually gives the best results in 6530 most cases and for most architectures, and is enabled by 6531 default when compiling with optimization for speed ('-O', 6532 '-O2', ...). 6533 6534 'one' 6535 Use all functions as a single region. This typically results 6536 in the smallest code size, and is enabled by default for '-Os' 6537 or '-O0'. 6538 6539 '-fira-hoist-pressure' 6540 Use IRA to evaluate register pressure in the code hoisting pass for 6541 decisions to hoist expressions. This option usually results in 6542 smaller code, but it can slow the compiler down. 6543 6544 This option is enabled at level '-Os' for all targets. 6545 6546 '-fira-loop-pressure' 6547 Use IRA to evaluate register pressure in loops for decisions to 6548 move loop invariants. This option usually results in generation of 6549 faster and smaller code on machines with large register files (>= 6550 32 registers), but it can slow the compiler down. 6551 6552 This option is enabled at level '-O3' for some targets. 6553 6554 '-fno-ira-share-save-slots' 6555 Disable sharing of stack slots used for saving call-used hard 6556 registers living through a call. Each hard register gets a 6557 separate stack slot, and as a result function stack frames are 6558 larger. 6559 6560 '-fno-ira-share-spill-slots' 6561 Disable sharing of stack slots allocated for pseudo-registers. 6562 Each pseudo-register that does not get a hard register gets a 6563 separate stack slot, and as a result function stack frames are 6564 larger. 6565 6566 '-fira-verbose=N' 6567 Control the verbosity of the dump file for the integrated register 6568 allocator. The default value is 5. If the value N is greater or 6569 equal to 10, the dump output is sent to stderr using the same 6570 format as N minus 10. 6571 6572 '-fdelayed-branch' 6573 If supported for the target machine, attempt to reorder 6574 instructions to exploit instruction slots available after delayed 6575 branch instructions. 6576 6577 Enabled at levels '-O', '-O2', '-O3', '-Os'. 6578 6579 '-fschedule-insns' 6580 If supported for the target machine, attempt to reorder 6581 instructions to eliminate execution stalls due to required data 6582 being unavailable. This helps machines that have slow floating 6583 point or memory load instructions by allowing other instructions to 6584 be issued until the result of the load or floating-point 6585 instruction is required. 6586 6587 Enabled at levels '-O2', '-O3'. 6588 6589 '-fschedule-insns2' 6590 Similar to '-fschedule-insns', but requests an additional pass of 6591 instruction scheduling after register allocation has been done. 6592 This is especially useful on machines with a relatively small 6593 number of registers and where memory load instructions take more 6594 than one cycle. 6595 6596 Enabled at levels '-O2', '-O3', '-Os'. 6597 6598 '-fno-sched-interblock' 6599 Don't schedule instructions across basic blocks. This is normally 6600 enabled by default when scheduling before register allocation, i.e. 6601 with '-fschedule-insns' or at '-O2' or higher. 6602 6603 '-fno-sched-spec' 6604 Don't allow speculative motion of non-load instructions. This is 6605 normally enabled by default when scheduling before register 6606 allocation, i.e. with '-fschedule-insns' or at '-O2' or higher. 6607 6608 '-fsched-pressure' 6609 Enable register pressure sensitive insn scheduling before register 6610 allocation. This only makes sense when scheduling before register 6611 allocation is enabled, i.e. with '-fschedule-insns' or at '-O2' or 6612 higher. Usage of this option can improve the generated code and 6613 decrease its size by preventing register pressure increase above 6614 the number of available hard registers and subsequent spills in 6615 register allocation. 6616 6617 '-fsched-spec-load' 6618 Allow speculative motion of some load instructions. This only 6619 makes sense when scheduling before register allocation, i.e. with 6620 '-fschedule-insns' or at '-O2' or higher. 6621 6622 '-fsched-spec-load-dangerous' 6623 Allow speculative motion of more load instructions. This only 6624 makes sense when scheduling before register allocation, i.e. with 6625 '-fschedule-insns' or at '-O2' or higher. 6626 6627 '-fsched-stalled-insns' 6628 '-fsched-stalled-insns=N' 6629 Define how many insns (if any) can be moved prematurely from the 6630 queue of stalled insns into the ready list during the second 6631 scheduling pass. '-fno-sched-stalled-insns' means that no insns 6632 are moved prematurely, '-fsched-stalled-insns=0' means there is no 6633 limit on how many queued insns can be moved prematurely. 6634 '-fsched-stalled-insns' without a value is equivalent to 6635 '-fsched-stalled-insns=1'. 6636 6637 '-fsched-stalled-insns-dep' 6638 '-fsched-stalled-insns-dep=N' 6639 Define how many insn groups (cycles) are examined for a dependency 6640 on a stalled insn that is a candidate for premature removal from 6641 the queue of stalled insns. This has an effect only during the 6642 second scheduling pass, and only if '-fsched-stalled-insns' is 6643 used. '-fno-sched-stalled-insns-dep' is equivalent to 6644 '-fsched-stalled-insns-dep=0'. '-fsched-stalled-insns-dep' without 6645 a value is equivalent to '-fsched-stalled-insns-dep=1'. 6646 6647 '-fsched2-use-superblocks' 6648 When scheduling after register allocation, use superblock 6649 scheduling. This allows motion across basic block boundaries, 6650 resulting in faster schedules. This option is experimental, as not 6651 all machine descriptions used by GCC model the CPU closely enough 6652 to avoid unreliable results from the algorithm. 6653 6654 This only makes sense when scheduling after register allocation, 6655 i.e. with '-fschedule-insns2' or at '-O2' or higher. 6656 6657 '-fsched-group-heuristic' 6658 Enable the group heuristic in the scheduler. This heuristic favors 6659 the instruction that belongs to a schedule group. This is enabled 6660 by default when scheduling is enabled, i.e. with '-fschedule-insns' 6661 or '-fschedule-insns2' or at '-O2' or higher. 6662 6663 '-fsched-critical-path-heuristic' 6664 Enable the critical-path heuristic in the scheduler. This 6665 heuristic favors instructions on the critical path. This is 6666 enabled by default when scheduling is enabled, i.e. with 6667 '-fschedule-insns' or '-fschedule-insns2' or at '-O2' or higher. 6668 6669 '-fsched-spec-insn-heuristic' 6670 Enable the speculative instruction heuristic in the scheduler. 6671 This heuristic favors speculative instructions with greater 6672 dependency weakness. This is enabled by default when scheduling is 6673 enabled, i.e. with '-fschedule-insns' or '-fschedule-insns2' or at 6674 '-O2' or higher. 6675 6676 '-fsched-rank-heuristic' 6677 Enable the rank heuristic in the scheduler. This heuristic favors 6678 the instruction belonging to a basic block with greater size or 6679 frequency. This is enabled by default when scheduling is enabled, 6680 i.e. with '-fschedule-insns' or '-fschedule-insns2' or at '-O2' or 6681 higher. 6682 6683 '-fsched-last-insn-heuristic' 6684 Enable the last-instruction heuristic in the scheduler. This 6685 heuristic favors the instruction that is less dependent on the last 6686 instruction scheduled. This is enabled by default when scheduling 6687 is enabled, i.e. with '-fschedule-insns' or '-fschedule-insns2' or 6688 at '-O2' or higher. 6689 6690 '-fsched-dep-count-heuristic' 6691 Enable the dependent-count heuristic in the scheduler. This 6692 heuristic favors the instruction that has more instructions 6693 depending on it. This is enabled by default when scheduling is 6694 enabled, i.e. with '-fschedule-insns' or '-fschedule-insns2' or at 6695 '-O2' or higher. 6696 6697 '-freschedule-modulo-scheduled-loops' 6698 Modulo scheduling is performed before traditional scheduling. If a 6699 loop is modulo scheduled, later scheduling passes may change its 6700 schedule. Use this option to control that behavior. 6701 6702 '-fselective-scheduling' 6703 Schedule instructions using selective scheduling algorithm. 6704 Selective scheduling runs instead of the first scheduler pass. 6705 6706 '-fselective-scheduling2' 6707 Schedule instructions using selective scheduling algorithm. 6708 Selective scheduling runs instead of the second scheduler pass. 6709 6710 '-fsel-sched-pipelining' 6711 Enable software pipelining of innermost loops during selective 6712 scheduling. This option has no effect unless one of 6713 '-fselective-scheduling' or '-fselective-scheduling2' is turned on. 6714 6715 '-fsel-sched-pipelining-outer-loops' 6716 When pipelining loops during selective scheduling, also pipeline 6717 outer loops. This option has no effect unless 6718 '-fsel-sched-pipelining' is turned on. 6719 6720 '-fshrink-wrap' 6721 Emit function prologues only before parts of the function that need 6722 it, rather than at the top of the function. This flag is enabled 6723 by default at '-O' and higher. 6724 6725 '-fcaller-saves' 6726 Enable allocation of values to registers that are clobbered by 6727 function calls, by emitting extra instructions to save and restore 6728 the registers around such calls. Such allocation is done only when 6729 it seems to result in better code. 6730 6731 This option is always enabled by default on certain machines, 6732 usually those which have no call-preserved registers to use 6733 instead. 6734 6735 Enabled at levels '-O2', '-O3', '-Os'. 6736 6737 '-fcombine-stack-adjustments' 6738 Tracks stack adjustments (pushes and pops) and stack memory 6739 references and then tries to find ways to combine them. 6740 6741 Enabled by default at '-O1' and higher. 6742 6743 '-fconserve-stack' 6744 Attempt to minimize stack usage. The compiler attempts to use less 6745 stack space, even if that makes the program slower. This option 6746 implies setting the 'large-stack-frame' parameter to 100 and the 6747 'large-stack-frame-growth' parameter to 400. 6748 6749 '-ftree-reassoc' 6750 Perform reassociation on trees. This flag is enabled by default at 6751 '-O' and higher. 6752 6753 '-ftree-pre' 6754 Perform partial redundancy elimination (PRE) on trees. This flag 6755 is enabled by default at '-O2' and '-O3'. 6756 6757 '-ftree-partial-pre' 6758 Make partial redundancy elimination (PRE) more aggressive. This 6759 flag is enabled by default at '-O3'. 6760 6761 '-ftree-forwprop' 6762 Perform forward propagation on trees. This flag is enabled by 6763 default at '-O' and higher. 6764 6765 '-ftree-fre' 6766 Perform full redundancy elimination (FRE) on trees. The difference 6767 between FRE and PRE is that FRE only considers expressions that are 6768 computed on all paths leading to the redundant computation. This 6769 analysis is faster than PRE, though it exposes fewer redundancies. 6770 This flag is enabled by default at '-O' and higher. 6771 6772 '-ftree-phiprop' 6773 Perform hoisting of loads from conditional pointers on trees. This 6774 pass is enabled by default at '-O' and higher. 6775 6776 '-fhoist-adjacent-loads' 6777 Speculatively hoist loads from both branches of an if-then-else if 6778 the loads are from adjacent locations in the same structure and the 6779 target architecture has a conditional move instruction. This flag 6780 is enabled by default at '-O2' and higher. 6781 6782 '-ftree-copy-prop' 6783 Perform copy propagation on trees. This pass eliminates 6784 unnecessary copy operations. This flag is enabled by default at 6785 '-O' and higher. 6786 6787 '-fipa-pure-const' 6788 Discover which functions are pure or constant. Enabled by default 6789 at '-O' and higher. 6790 6791 '-fipa-reference' 6792 Discover which static variables do not escape the compilation unit. 6793 Enabled by default at '-O' and higher. 6794 6795 '-fipa-pta' 6796 Perform interprocedural pointer analysis and interprocedural 6797 modification and reference analysis. This option can cause 6798 excessive memory and compile-time usage on large compilation units. 6799 It is not enabled by default at any optimization level. 6800 6801 '-fipa-profile' 6802 Perform interprocedural profile propagation. The functions called 6803 only from cold functions are marked as cold. Also functions 6804 executed once (such as 'cold', 'noreturn', static constructors or 6805 destructors) are identified. Cold functions and loop less parts of 6806 functions executed once are then optimized for size. Enabled by 6807 default at '-O' and higher. 6808 6809 '-fipa-cp' 6810 Perform interprocedural constant propagation. This optimization 6811 analyzes the program to determine when values passed to functions 6812 are constants and then optimizes accordingly. This optimization 6813 can substantially increase performance if the application has 6814 constants passed to functions. This flag is enabled by default at 6815 '-O2', '-Os' and '-O3'. 6816 6817 '-fipa-cp-clone' 6818 Perform function cloning to make interprocedural constant 6819 propagation stronger. When enabled, interprocedural constant 6820 propagation performs function cloning when externally visible 6821 function can be called with constant arguments. Because this 6822 optimization can create multiple copies of functions, it may 6823 significantly increase code size (see '--param 6824 ipcp-unit-growth=VALUE'). This flag is enabled by default at 6825 '-O3'. 6826 6827 '-ftree-sink' 6828 Perform forward store motion on trees. This flag is enabled by 6829 default at '-O' and higher. 6830 6831 '-ftree-bit-ccp' 6832 Perform sparse conditional bit constant propagation on trees and 6833 propagate pointer alignment information. This pass only operates 6834 on local scalar variables and is enabled by default at '-O' and 6835 higher. It requires that '-ftree-ccp' is enabled. 6836 6837 '-ftree-ccp' 6838 Perform sparse conditional constant propagation (CCP) on trees. 6839 This pass only operates on local scalar variables and is enabled by 6840 default at '-O' and higher. 6841 6842 '-ftree-switch-conversion' 6843 Perform conversion of simple initializations in a switch to 6844 initializations from a scalar array. This flag is enabled by 6845 default at '-O2' and higher. 6846 6847 '-ftree-tail-merge' 6848 Look for identical code sequences. When found, replace one with a 6849 jump to the other. This optimization is known as tail merging or 6850 cross jumping. This flag is enabled by default at '-O2' and 6851 higher. The compilation time in this pass can be limited using 6852 'max-tail-merge-comparisons' parameter and 6853 'max-tail-merge-iterations' parameter. 6854 6855 '-ftree-dce' 6856 Perform dead code elimination (DCE) on trees. This flag is enabled 6857 by default at '-O' and higher. 6858 6859 '-ftree-builtin-call-dce' 6860 Perform conditional dead code elimination (DCE) for calls to 6861 built-in functions that may set 'errno' but are otherwise 6862 side-effect free. This flag is enabled by default at '-O2' and 6863 higher if '-Os' is not also specified. 6864 6865 '-ftree-dominator-opts' 6866 Perform a variety of simple scalar cleanups (constant/copy 6867 propagation, redundancy elimination, range propagation and 6868 expression simplification) based on a dominator tree traversal. 6869 This also performs jump threading (to reduce jumps to jumps). This 6870 flag is enabled by default at '-O' and higher. 6871 6872 '-ftree-dse' 6873 Perform dead store elimination (DSE) on trees. A dead store is a 6874 store into a memory location that is later overwritten by another 6875 store without any intervening loads. In this case the earlier 6876 store can be deleted. This flag is enabled by default at '-O' and 6877 higher. 6878 6879 '-ftree-ch' 6880 Perform loop header copying on trees. This is beneficial since it 6881 increases effectiveness of code motion optimizations. It also 6882 saves one jump. This flag is enabled by default at '-O' and 6883 higher. It is not enabled for '-Os', since it usually increases 6884 code size. 6885 6886 '-ftree-loop-optimize' 6887 Perform loop optimizations on trees. This flag is enabled by 6888 default at '-O' and higher. 6889 6890 '-ftree-loop-linear' 6891 Perform loop interchange transformations on tree. Same as 6892 '-floop-interchange'. To use this code transformation, GCC has to 6893 be configured with '--with-ppl' and '--with-cloog' to enable the 6894 Graphite loop transformation infrastructure. 6895 6896 '-floop-interchange' 6897 Perform loop interchange transformations on loops. Interchanging 6898 two nested loops switches the inner and outer loops. For example, 6899 given a loop like: 6900 DO J = 1, M 6901 DO I = 1, N 6902 A(J, I) = A(J, I) * C 6903 ENDDO 6904 ENDDO 6905 loop interchange transforms the loop as if it were written: 6906 DO I = 1, N 6907 DO J = 1, M 6908 A(J, I) = A(J, I) * C 6909 ENDDO 6910 ENDDO 6911 which can be beneficial when 'N' is larger than the caches, because 6912 in Fortran, the elements of an array are stored in memory 6913 contiguously by column, and the original loop iterates over rows, 6914 potentially creating at each access a cache miss. This 6915 optimization applies to all the languages supported by GCC and is 6916 not limited to Fortran. To use this code transformation, GCC has 6917 to be configured with '--with-ppl' and '--with-cloog' to enable the 6918 Graphite loop transformation infrastructure. 6919 6920 '-floop-strip-mine' 6921 Perform loop strip mining transformations on loops. Strip mining 6922 splits a loop into two nested loops. The outer loop has strides 6923 equal to the strip size and the inner loop has strides of the 6924 original loop within a strip. The strip length can be changed 6925 using the 'loop-block-tile-size' parameter. For example, given a 6926 loop like: 6927 DO I = 1, N 6928 A(I) = A(I) + C 6929 ENDDO 6930 loop strip mining transforms the loop as if it were written: 6931 DO II = 1, N, 51 6932 DO I = II, min (II + 50, N) 6933 A(I) = A(I) + C 6934 ENDDO 6935 ENDDO 6936 This optimization applies to all the languages supported by GCC and 6937 is not limited to Fortran. To use this code transformation, GCC 6938 has to be configured with '--with-ppl' and '--with-cloog' to enable 6939 the Graphite loop transformation infrastructure. 6940 6941 '-floop-block' 6942 Perform loop blocking transformations on loops. Blocking strip 6943 mines each loop in the loop nest such that the memory accesses of 6944 the element loops fit inside caches. The strip length can be 6945 changed using the 'loop-block-tile-size' parameter. For example, 6946 given a loop like: 6947 DO I = 1, N 6948 DO J = 1, M 6949 A(J, I) = B(I) + C(J) 6950 ENDDO 6951 ENDDO 6952 loop blocking transforms the loop as if it were written: 6953 DO II = 1, N, 51 6954 DO JJ = 1, M, 51 6955 DO I = II, min (II + 50, N) 6956 DO J = JJ, min (JJ + 50, M) 6957 A(J, I) = B(I) + C(J) 6958 ENDDO 6959 ENDDO 6960 ENDDO 6961 ENDDO 6962 which can be beneficial when 'M' is larger than the caches, because 6963 the innermost loop iterates over a smaller amount of data which can 6964 be kept in the caches. This optimization applies to all the 6965 languages supported by GCC and is not limited to Fortran. To use 6966 this code transformation, GCC has to be configured with 6967 '--with-ppl' and '--with-cloog' to enable the Graphite loop 6968 transformation infrastructure. 6969 6970 '-fgraphite-identity' 6971 Enable the identity transformation for graphite. For every SCoP we 6972 generate the polyhedral representation and transform it back to 6973 gimple. Using '-fgraphite-identity' we can check the costs or 6974 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some 6975 minimal optimizations are also performed by the code generator 6976 CLooG, like index splitting and dead code elimination in loops. 6977 6978 '-floop-nest-optimize' 6979 Enable the ISL based loop nest optimizer. This is a generic loop 6980 nest optimizer based on the Pluto optimization algorithms. It 6981 calculates a loop structure optimized for data-locality and 6982 parallelism. This option is experimental. 6983 6984 '-floop-parallelize-all' 6985 Use the Graphite data dependence analysis to identify loops that 6986 can be parallelized. Parallelize all the loops that can be 6987 analyzed to not contain loop carried dependences without checking 6988 that it is profitable to parallelize the loops. 6989 6990 '-fcheck-data-deps' 6991 Compare the results of several data dependence analyzers. This 6992 option is used for debugging the data dependence analyzers. 6993 6994 '-ftree-loop-if-convert' 6995 Attempt to transform conditional jumps in the innermost loops to 6996 branch-less equivalents. The intent is to remove control-flow from 6997 the innermost loops in order to improve the ability of the 6998 vectorization pass to handle these loops. This is enabled by 6999 default if vectorization is enabled. 7000 7001 '-ftree-loop-if-convert-stores' 7002 Attempt to also if-convert conditional jumps containing memory 7003 writes. This transformation can be unsafe for multi-threaded 7004 programs as it transforms conditional memory writes into 7005 unconditional memory writes. For example, 7006 for (i = 0; i < N; i++) 7007 if (cond) 7008 A[i] = expr; 7009 is transformed to 7010 for (i = 0; i < N; i++) 7011 A[i] = cond ? expr : A[i]; 7012 potentially producing data races. 7013 7014 '-ftree-loop-distribution' 7015 Perform loop distribution. This flag can improve cache performance 7016 on big loop bodies and allow further loop optimizations, like 7017 parallelization or vectorization, to take place. For example, the 7018 loop 7019 DO I = 1, N 7020 A(I) = B(I) + C 7021 D(I) = E(I) * F 7022 ENDDO 7023 is transformed to 7024 DO I = 1, N 7025 A(I) = B(I) + C 7026 ENDDO 7027 DO I = 1, N 7028 D(I) = E(I) * F 7029 ENDDO 7030 7031 '-ftree-loop-distribute-patterns' 7032 Perform loop distribution of patterns that can be code generated 7033 with calls to a library. This flag is enabled by default at '-O3'. 7034 7035 This pass distributes the initialization loops and generates a call 7036 to memset zero. For example, the loop 7037 DO I = 1, N 7038 A(I) = 0 7039 B(I) = A(I) + I 7040 ENDDO 7041 is transformed to 7042 DO I = 1, N 7043 A(I) = 0 7044 ENDDO 7045 DO I = 1, N 7046 B(I) = A(I) + I 7047 ENDDO 7048 and the initialization loop is transformed into a call to memset 7049 zero. 7050 7051 '-ftree-loop-im' 7052 Perform loop invariant motion on trees. This pass moves only 7053 invariants that are hard to handle at RTL level (function calls, 7054 operations that expand to nontrivial sequences of insns). With 7055 '-funswitch-loops' it also moves operands of conditions that are 7056 invariant out of the loop, so that we can use just trivial 7057 invariantness analysis in loop unswitching. The pass also includes 7058 store motion. 7059 7060 '-ftree-loop-ivcanon' 7061 Create a canonical counter for number of iterations in loops for 7062 which determining number of iterations requires complicated 7063 analysis. Later optimizations then may determine the number 7064 easily. Useful especially in connection with unrolling. 7065 7066 '-fivopts' 7067 Perform induction variable optimizations (strength reduction, 7068 induction variable merging and induction variable elimination) on 7069 trees. 7070 7071 '-ftree-parallelize-loops=n' 7072 Parallelize loops, i.e., split their iteration space to run in n 7073 threads. This is only possible for loops whose iterations are 7074 independent and can be arbitrarily reordered. The optimization is 7075 only profitable on multiprocessor machines, for loops that are 7076 CPU-intensive, rather than constrained e.g. by memory bandwidth. 7077 This option implies '-pthread', and thus is only supported on 7078 targets that have support for '-pthread'. 7079 7080 '-ftree-pta' 7081 Perform function-local points-to analysis on trees. This flag is 7082 enabled by default at '-O' and higher. 7083 7084 '-ftree-sra' 7085 Perform scalar replacement of aggregates. This pass replaces 7086 structure references with scalars to prevent committing structures 7087 to memory too early. This flag is enabled by default at '-O' and 7088 higher. 7089 7090 '-ftree-copyrename' 7091 Perform copy renaming on trees. This pass attempts to rename 7092 compiler temporaries to other variables at copy locations, usually 7093 resulting in variable names which more closely resemble the 7094 original variables. This flag is enabled by default at '-O' and 7095 higher. 7096 7097 '-ftree-coalesce-inlined-vars' 7098 Tell the copyrename pass (see '-ftree-copyrename') to attempt to 7099 combine small user-defined variables too, but only if they were 7100 inlined from other functions. It is a more limited form of 7101 '-ftree-coalesce-vars'. This may harm debug information of such 7102 inlined variables, but it will keep variables of the inlined-into 7103 function apart from each other, such that they are more likely to 7104 contain the expected values in a debugging session. This was the 7105 default in GCC versions older than 4.7. 7106 7107 '-ftree-coalesce-vars' 7108 Tell the copyrename pass (see '-ftree-copyrename') to attempt to 7109 combine small user-defined variables too, instead of just compiler 7110 temporaries. This may severely limit the ability to debug an 7111 optimized program compiled with '-fno-var-tracking-assignments'. 7112 In the negated form, this flag prevents SSA coalescing of user 7113 variables, including inlined ones. This option is enabled by 7114 default. 7115 7116 '-ftree-ter' 7117 Perform temporary expression replacement during the SSA->normal 7118 phase. Single use/single def temporaries are replaced at their use 7119 location with their defining expression. This results in 7120 non-GIMPLE code, but gives the expanders much more complex trees to 7121 work on resulting in better RTL generation. This is enabled by 7122 default at '-O' and higher. 7123 7124 '-ftree-slsr' 7125 Perform straight-line strength reduction on trees. This recognizes 7126 related expressions involving multiplications and replaces them by 7127 less expensive calculations when possible. This is enabled by 7128 default at '-O' and higher. 7129 7130 '-ftree-vectorize' 7131 Perform loop vectorization on trees. This flag is enabled by 7132 default at '-O3'. 7133 7134 '-ftree-slp-vectorize' 7135 Perform basic block vectorization on trees. This flag is enabled 7136 by default at '-O3' and when '-ftree-vectorize' is enabled. 7137 7138 '-ftree-vect-loop-version' 7139 Perform loop versioning when doing loop vectorization on trees. 7140 When a loop appears to be vectorizable except that data alignment 7141 or data dependence cannot be determined at compile time, then 7142 vectorized and non-vectorized versions of the loop are generated 7143 along with run-time checks for alignment or dependence to control 7144 which version is executed. This option is enabled by default 7145 except at level '-Os' where it is disabled. 7146 7147 '-fvect-cost-model' 7148 Enable cost model for vectorization. This option is enabled by 7149 default at '-O3'. 7150 7151 '-ftree-vrp' 7152 Perform Value Range Propagation on trees. This is similar to the 7153 constant propagation pass, but instead of values, ranges of values 7154 are propagated. This allows the optimizers to remove unnecessary 7155 range checks like array bound checks and null pointer checks. This 7156 is enabled by default at '-O2' and higher. Null pointer check 7157 elimination is only done if '-fdelete-null-pointer-checks' is 7158 enabled. 7159 7160 '-ftracer' 7161 Perform tail duplication to enlarge superblock size. This 7162 transformation simplifies the control flow of the function allowing 7163 other optimizations to do a better job. 7164 7165 '-funroll-loops' 7166 Unroll loops whose number of iterations can be determined at 7167 compile time or upon entry to the loop. '-funroll-loops' implies 7168 '-frerun-cse-after-loop'. This option makes code larger, and may 7169 or may not make it run faster. 7170 7171 '-funroll-all-loops' 7172 Unroll all loops, even if their number of iterations is uncertain 7173 when the loop is entered. This usually makes programs run more 7174 slowly. '-funroll-all-loops' implies the same options as 7175 '-funroll-loops', 7176 7177 '-fsplit-ivs-in-unroller' 7178 Enables expression of values of induction variables in later 7179 iterations of the unrolled loop using the value in the first 7180 iteration. This breaks long dependency chains, thus improving 7181 efficiency of the scheduling passes. 7182 7183 A combination of '-fweb' and CSE is often sufficient to obtain the 7184 same effect. However, that is not reliable in cases where the loop 7185 body is more complicated than a single basic block. It also does 7186 not work at all on some architectures due to restrictions in the 7187 CSE pass. 7188 7189 This optimization is enabled by default. 7190 7191 '-fvariable-expansion-in-unroller' 7192 With this option, the compiler creates multiple copies of some 7193 local variables when unrolling a loop, which can result in superior 7194 code. 7195 7196 '-fpartial-inlining' 7197 Inline parts of functions. This option has any effect only when 7198 inlining itself is turned on by the '-finline-functions' or 7199 '-finline-small-functions' options. 7200 7201 Enabled at level '-O2'. 7202 7203 '-fpredictive-commoning' 7204 Perform predictive commoning optimization, i.e., reusing 7205 computations (especially memory loads and stores) performed in 7206 previous iterations of loops. 7207 7208 This option is enabled at level '-O3'. 7209 7210 '-fprefetch-loop-arrays' 7211 If supported by the target machine, generate instructions to 7212 prefetch memory to improve the performance of loops that access 7213 large arrays. 7214 7215 This option may generate better or worse code; results are highly 7216 dependent on the structure of loops within the source code. 7217 7218 Disabled at level '-Os'. 7219 7220 '-fno-peephole' 7221 '-fno-peephole2' 7222 Disable any machine-specific peephole optimizations. The 7223 difference between '-fno-peephole' and '-fno-peephole2' is in how 7224 they are implemented in the compiler; some targets use one, some 7225 use the other, a few use both. 7226 7227 '-fpeephole' is enabled by default. '-fpeephole2' enabled at 7228 levels '-O2', '-O3', '-Os'. 7229 7230 '-fno-guess-branch-probability' 7231 Do not guess branch probabilities using heuristics. 7232 7233 GCC uses heuristics to guess branch probabilities if they are not 7234 provided by profiling feedback ('-fprofile-arcs'). These 7235 heuristics are based on the control flow graph. If some branch 7236 probabilities are specified by '__builtin_expect', then the 7237 heuristics are used to guess branch probabilities for the rest of 7238 the control flow graph, taking the '__builtin_expect' info into 7239 account. The interactions between the heuristics and 7240 '__builtin_expect' can be complex, and in some cases, it may be 7241 useful to disable the heuristics so that the effects of 7242 '__builtin_expect' are easier to understand. 7243 7244 The default is '-fguess-branch-probability' at levels '-O', '-O2', 7245 '-O3', '-Os'. 7246 7247 '-freorder-blocks' 7248 Reorder basic blocks in the compiled function in order to reduce 7249 number of taken branches and improve code locality. 7250 7251 Enabled at levels '-O2', '-O3'. 7252 7253 '-freorder-blocks-and-partition' 7254 In addition to reordering basic blocks in the compiled function, in 7255 order to reduce number of taken branches, partitions hot and cold 7256 basic blocks into separate sections of the assembly and .o files, 7257 to improve paging and cache locality performance. 7258 7259 This optimization is automatically turned off in the presence of 7260 exception handling, for linkonce sections, for functions with a 7261 user-defined section attribute and on any architecture that does 7262 not support named sections. 7263 7264 '-freorder-functions' 7265 Reorder functions in the object file in order to improve code 7266 locality. This is implemented by using special subsections 7267 '.text.hot' for most frequently executed functions and 7268 '.text.unlikely' for unlikely executed functions. Reordering is 7269 done by the linker so object file format must support named 7270 sections and linker must place them in a reasonable way. 7271 7272 Also profile feedback must be available to make this option 7273 effective. See '-fprofile-arcs' for details. 7274 7275 Enabled at levels '-O2', '-O3', '-Os'. 7276 7277 '-fstrict-aliasing' 7278 Allow the compiler to assume the strictest aliasing rules 7279 applicable to the language being compiled. For C (and C++), this 7280 activates optimizations based on the type of expressions. In 7281 particular, an object of one type is assumed never to reside at the 7282 same address as an object of a different type, unless the types are 7283 almost the same. For example, an 'unsigned int' can alias an 7284 'int', but not a 'void*' or a 'double'. A character type may alias 7285 any other type. 7286 7287 Pay special attention to code like this: 7288 union a_union { 7289 int i; 7290 double d; 7291 }; 7292 7293 int f() { 7294 union a_union t; 7295 t.d = 3.0; 7296 return t.i; 7297 } 7298 The practice of reading from a different union member than the one 7299 most recently written to (called "type-punning") is common. Even 7300 with '-fstrict-aliasing', type-punning is allowed, provided the 7301 memory is accessed through the union type. So, the code above 7302 works as expected. *Note Structures unions enumerations and 7303 bit-fields implementation::. However, this code might not: 7304 int f() { 7305 union a_union t; 7306 int* ip; 7307 t.d = 3.0; 7308 ip = &t.i; 7309 return *ip; 7310 } 7311 7312 Similarly, access by taking the address, casting the resulting 7313 pointer and dereferencing the result has undefined behavior, even 7314 if the cast uses a union type, e.g.: 7315 int f() { 7316 double d = 3.0; 7317 return ((union a_union *) &d)->i; 7318 } 7319 7320 The '-fstrict-aliasing' option is enabled at levels '-O2', '-O3', 7321 '-Os'. 7322 7323 '-fstrict-overflow' 7324 Allow the compiler to assume strict signed overflow rules, 7325 depending on the language being compiled. For C (and C++) this 7326 means that overflow when doing arithmetic with signed numbers is 7327 undefined, which means that the compiler may assume that it does 7328 not happen. This permits various optimizations. For example, the 7329 compiler assumes that an expression like 'i + 10 > i' is always 7330 true for signed 'i'. This assumption is only valid if signed 7331 overflow is undefined, as the expression is false if 'i + 10' 7332 overflows when using twos complement arithmetic. When this option 7333 is in effect any attempt to determine whether an operation on 7334 signed numbers overflows must be written carefully to not actually 7335 involve overflow. 7336 7337 This option also allows the compiler to assume strict pointer 7338 semantics: given a pointer to an object, if adding an offset to 7339 that pointer does not produce a pointer to the same object, the 7340 addition is undefined. This permits the compiler to conclude that 7341 'p + u > p' is always true for a pointer 'p' and unsigned integer 7342 'u'. This assumption is only valid because pointer wraparound is 7343 undefined, as the expression is false if 'p + u' overflows using 7344 twos complement arithmetic. 7345 7346 See also the '-fwrapv' option. Using '-fwrapv' means that integer 7347 signed overflow is fully defined: it wraps. When '-fwrapv' is 7348 used, there is no difference between '-fstrict-overflow' and 7349 '-fno-strict-overflow' for integers. With '-fwrapv' certain types 7350 of overflow are permitted. For example, if the compiler gets an 7351 overflow when doing arithmetic on constants, the overflowed value 7352 can still be used with '-fwrapv', but not otherwise. 7353 7354 The '-fstrict-overflow' option is enabled at levels '-O2', '-O3', 7355 '-Os'. 7356 7357 '-falign-functions' 7358 '-falign-functions=N' 7359 Align the start of functions to the next power-of-two greater than 7360 N, skipping up to N bytes. For instance, '-falign-functions=32' 7361 aligns functions to the next 32-byte boundary, but 7362 '-falign-functions=24' aligns to the next 32-byte boundary only if 7363 this can be done by skipping 23 bytes or less. 7364 7365 '-fno-align-functions' and '-falign-functions=1' are equivalent and 7366 mean that functions are not aligned. 7367 7368 Some assemblers only support this flag when N is a power of two; in 7369 that case, it is rounded up. 7370 7371 If N is not specified or is zero, use a machine-dependent default. 7372 7373 Enabled at levels '-O2', '-O3'. 7374 7375 '-falign-labels' 7376 '-falign-labels=N' 7377 Align all branch targets to a power-of-two boundary, skipping up to 7378 N bytes like '-falign-functions'. This option can easily make code 7379 slower, because it must insert dummy operations for when the branch 7380 target is reached in the usual flow of the code. 7381 7382 '-fno-align-labels' and '-falign-labels=1' are equivalent and mean 7383 that labels are not aligned. 7384 7385 If '-falign-loops' or '-falign-jumps' are applicable and are 7386 greater than this value, then their values are used instead. 7387 7388 If N is not specified or is zero, use a machine-dependent default 7389 which is very likely to be '1', meaning no alignment. 7390 7391 Enabled at levels '-O2', '-O3'. 7392 7393 '-falign-loops' 7394 '-falign-loops=N' 7395 Align loops to a power-of-two boundary, skipping up to N bytes like 7396 '-falign-functions'. If the loops are executed many times, this 7397 makes up for any execution of the dummy operations. 7398 7399 '-fno-align-loops' and '-falign-loops=1' are equivalent and mean 7400 that loops are not aligned. 7401 7402 If N is not specified or is zero, use a machine-dependent default. 7403 7404 Enabled at levels '-O2', '-O3'. 7405 7406 '-falign-jumps' 7407 '-falign-jumps=N' 7408 Align branch targets to a power-of-two boundary, for branch targets 7409 where the targets can only be reached by jumping, skipping up to N 7410 bytes like '-falign-functions'. In this case, no dummy operations 7411 need be executed. 7412 7413 '-fno-align-jumps' and '-falign-jumps=1' are equivalent and mean 7414 that loops are not aligned. 7415 7416 If N is not specified or is zero, use a machine-dependent default. 7417 7418 Enabled at levels '-O2', '-O3'. 7419 7420 '-funit-at-a-time' 7421 This option is left for compatibility reasons. '-funit-at-a-time' 7422 has no effect, while '-fno-unit-at-a-time' implies 7423 '-fno-toplevel-reorder' and '-fno-section-anchors'. 7424 7425 Enabled by default. 7426 7427 '-fno-toplevel-reorder' 7428 Do not reorder top-level functions, variables, and 'asm' 7429 statements. Output them in the same order that they appear in the 7430 input file. When this option is used, unreferenced static 7431 variables are not removed. This option is intended to support 7432 existing code that relies on a particular ordering. For new code, 7433 it is better to use attributes. 7434 7435 Enabled at level '-O0'. When disabled explicitly, it also implies 7436 '-fno-section-anchors', which is otherwise enabled at '-O0' on some 7437 targets. 7438 7439 '-fweb' 7440 Constructs webs as commonly used for register allocation purposes 7441 and assign each web individual pseudo register. This allows the 7442 register allocation pass to operate on pseudos directly, but also 7443 strengthens several other optimization passes, such as CSE, loop 7444 optimizer and trivial dead code remover. It can, however, make 7445 debugging impossible, since variables no longer stay in a "home 7446 register". 7447 7448 Enabled by default with '-funroll-loops'. 7449 7450 '-fwhole-program' 7451 Assume that the current compilation unit represents the whole 7452 program being compiled. All public functions and variables with 7453 the exception of 'main' and those merged by attribute 7454 'externally_visible' become static functions and in effect are 7455 optimized more aggressively by interprocedural optimizers. 7456 7457 This option should not be used in combination with '-flto'. 7458 Instead relying on a linker plugin should provide safer and more 7459 precise information. 7460 7461 '-flto[=N]' 7462 This option runs the standard link-time optimizer. When invoked 7463 with source code, it generates GIMPLE (one of GCC's internal 7464 representations) and writes it to special ELF sections in the 7465 object file. When the object files are linked together, all the 7466 function bodies are read from these ELF sections and instantiated 7467 as if they had been part of the same translation unit. 7468 7469 To use the link-time optimizer, '-flto' needs to be specified at 7470 compile time and during the final link. For example: 7471 7472 gcc -c -O2 -flto foo.c 7473 gcc -c -O2 -flto bar.c 7474 gcc -o myprog -flto -O2 foo.o bar.o 7475 7476 The first two invocations to GCC save a bytecode representation of 7477 GIMPLE into special ELF sections inside 'foo.o' and 'bar.o'. The 7478 final invocation reads the GIMPLE bytecode from 'foo.o' and 7479 'bar.o', merges the two files into a single internal image, and 7480 compiles the result as usual. Since both 'foo.o' and 'bar.o' are 7481 merged into a single image, this causes all the interprocedural 7482 analyses and optimizations in GCC to work across the two files as 7483 if they were a single one. This means, for example, that the 7484 inliner is able to inline functions in 'bar.o' into functions in 7485 'foo.o' and vice-versa. 7486 7487 Another (simpler) way to enable link-time optimization is: 7488 7489 gcc -o myprog -flto -O2 foo.c bar.c 7490 7491 The above generates bytecode for 'foo.c' and 'bar.c', merges them 7492 together into a single GIMPLE representation and optimizes them as 7493 usual to produce 'myprog'. 7494 7495 The only important thing to keep in mind is that to enable 7496 link-time optimizations the '-flto' flag needs to be passed to both 7497 the compile and the link commands. 7498 7499 To make whole program optimization effective, it is necessary to 7500 make certain whole program assumptions. The compiler needs to know 7501 what functions and variables can be accessed by libraries and 7502 runtime outside of the link-time optimized unit. When supported by 7503 the linker, the linker plugin (see '-fuse-linker-plugin') passes 7504 information to the compiler about used and externally visible 7505 symbols. When the linker plugin is not available, 7506 '-fwhole-program' should be used to allow the compiler to make 7507 these assumptions, which leads to more aggressive optimization 7508 decisions. 7509 7510 Note that when a file is compiled with '-flto', the generated 7511 object file is larger than a regular object file because it 7512 contains GIMPLE bytecodes and the usual final code. This means 7513 that object files with LTO information can be linked as normal 7514 object files; if '-flto' is not passed to the linker, no 7515 interprocedural optimizations are applied. 7516 7517 Additionally, the optimization flags used to compile individual 7518 files are not necessarily related to those used at link time. For 7519 instance, 7520 7521 gcc -c -O0 -flto foo.c 7522 gcc -c -O0 -flto bar.c 7523 gcc -o myprog -flto -O3 foo.o bar.o 7524 7525 This produces individual object files with unoptimized assembler 7526 code, but the resulting binary 'myprog' is optimized at '-O3'. If, 7527 instead, the final binary is generated without '-flto', then 7528 'myprog' is not optimized. 7529 7530 When producing the final binary with '-flto', GCC only applies 7531 link-time optimizations to those files that contain bytecode. 7532 Therefore, you can mix and match object files and libraries with 7533 GIMPLE bytecodes and final object code. GCC automatically selects 7534 which files to optimize in LTO mode and which files to link without 7535 further processing. 7536 7537 There are some code generation flags preserved by GCC when 7538 generating bytecodes, as they need to be used during the final link 7539 stage. Currently, the following options are saved into the GIMPLE 7540 bytecode files: '-fPIC', '-fcommon' and all the '-m' target flags. 7541 7542 At link time, these options are read in and reapplied. Note that 7543 the current implementation makes no attempt to recognize 7544 conflicting values for these options. If different files have 7545 conflicting option values (e.g., one file is compiled with '-fPIC' 7546 and another isn't), the compiler simply uses the last value read 7547 from the bytecode files. It is recommended, then, that you compile 7548 all the files participating in the same link with the same options. 7549 7550 If LTO encounters objects with C linkage declared with incompatible 7551 types in separate translation units to be linked together 7552 (undefined behavior according to ISO C99 6.2.7), a non-fatal 7553 diagnostic may be issued. The behavior is still undefined at run 7554 time. 7555 7556 Another feature of LTO is that it is possible to apply 7557 interprocedural optimizations on files written in different 7558 languages. This requires support in the language front end. 7559 Currently, the C, C++ and Fortran front ends are capable of 7560 emitting GIMPLE bytecodes, so something like this should work: 7561 7562 gcc -c -flto foo.c 7563 g++ -c -flto bar.cc 7564 gfortran -c -flto baz.f90 7565 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 7566 7567 Notice that the final link is done with 'g++' to get the C++ 7568 runtime libraries and '-lgfortran' is added to get the Fortran 7569 runtime libraries. In general, when mixing languages in LTO mode, 7570 you should use the same link command options as when mixing 7571 languages in a regular (non-LTO) compilation; all you need to add 7572 is '-flto' to all the compile and link commands. 7573 7574 If object files containing GIMPLE bytecode are stored in a library 7575 archive, say 'libfoo.a', it is possible to extract and use them in 7576 an LTO link if you are using a linker with plugin support. To 7577 enable this feature, use the flag '-fuse-linker-plugin' at link 7578 time: 7579 7580 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 7581 7582 With the linker plugin enabled, the linker extracts the needed 7583 GIMPLE files from 'libfoo.a' and passes them on to the running GCC 7584 to make them part of the aggregated GIMPLE image to be optimized. 7585 7586 If you are not using a linker with plugin support and/or do not 7587 enable the linker plugin, then the objects inside 'libfoo.a' are 7588 extracted and linked as usual, but they do not participate in the 7589 LTO optimization process. 7590 7591 Link-time optimizations do not require the presence of the whole 7592 program to operate. If the program does not require any symbols to 7593 be exported, it is possible to combine '-flto' and 7594 '-fwhole-program' to allow the interprocedural optimizers to use 7595 more aggressive assumptions which may lead to improved optimization 7596 opportunities. Use of '-fwhole-program' is not needed when linker 7597 plugin is active (see '-fuse-linker-plugin'). 7598 7599 The current implementation of LTO makes no attempt to generate 7600 bytecode that is portable between different types of hosts. The 7601 bytecode files are versioned and there is a strict version check, 7602 so bytecode files generated in one version of GCC will not work 7603 with an older/newer version of GCC. 7604 7605 Link-time optimization does not work well with generation of 7606 debugging information. Combining '-flto' with '-g' is currently 7607 experimental and expected to produce wrong results. 7608 7609 If you specify the optional N, the optimization and code generation 7610 done at link time is executed in parallel using N parallel jobs by 7611 utilizing an installed 'make' program. The environment variable 7612 'MAKE' may be used to override the program used. The default value 7613 for N is 1. 7614 7615 You can also specify '-flto=jobserver' to use GNU make's job server 7616 mode to determine the number of parallel jobs. This is useful when 7617 the Makefile calling GCC is already executing in parallel. You 7618 must prepend a '+' to the command recipe in the parent Makefile for 7619 this to work. This option likely only works if 'MAKE' is GNU make. 7620 7621 This option is disabled by default. 7622 7623 '-flto-partition=ALG' 7624 Specify the partitioning algorithm used by the link-time optimizer. 7625 The value is either '1to1' to specify a partitioning mirroring the 7626 original source files or 'balanced' to specify partitioning into 7627 equally sized chunks (whenever possible) or 'max' to create new 7628 partition for every symbol where possible. Specifying 'none' as an 7629 algorithm disables partitioning and streaming completely. The 7630 default value is 'balanced'. While '1to1' can be used as an 7631 workaround for various code ordering issues, the 'max' partitioning 7632 is intended for internal testing only. 7633 7634 '-flto-compression-level=N' 7635 This option specifies the level of compression used for 7636 intermediate language written to LTO object files, and is only 7637 meaningful in conjunction with LTO mode ('-flto'). Valid values 7638 are 0 (no compression) to 9 (maximum compression). Values outside 7639 this range are clamped to either 0 or 9. If the option is not 7640 given, a default balanced compression setting is used. 7641 7642 '-flto-report' 7643 Prints a report with internal details on the workings of the 7644 link-time optimizer. The contents of this report vary from version 7645 to version. It is meant to be useful to GCC developers when 7646 processing object files in LTO mode (via '-flto'). 7647 7648 Disabled by default. 7649 7650 '-fuse-linker-plugin' 7651 Enables the use of a linker plugin during link-time optimization. 7652 This option relies on plugin support in the linker, which is 7653 available in gold or in GNU ld 2.21 or newer. 7654 7655 This option enables the extraction of object files with GIMPLE 7656 bytecode out of library archives. This improves the quality of 7657 optimization by exposing more code to the link-time optimizer. 7658 This information specifies what symbols can be accessed externally 7659 (by non-LTO object or during dynamic linking). Resulting code 7660 quality improvements on binaries (and shared libraries that use 7661 hidden visibility) are similar to '-fwhole-program'. See '-flto' 7662 for a description of the effect of this flag and how to use it. 7663 7664 This option is enabled by default when LTO support in GCC is 7665 enabled and GCC was configured for use with a linker supporting 7666 plugins (GNU ld 2.21 or newer or gold). 7667 7668 '-ffat-lto-objects' 7669 Fat LTO objects are object files that contain both the intermediate 7670 language and the object code. This makes them usable for both LTO 7671 linking and normal linking. This option is effective only when 7672 compiling with '-flto' and is ignored at link time. 7673 7674 '-fno-fat-lto-objects' improves compilation time over plain LTO, 7675 but requires the complete toolchain to be aware of LTO. It requires 7676 a linker with linker plugin support for basic functionality. 7677 Additionally, 'nm', 'ar' and 'ranlib' need to support linker 7678 plugins to allow a full-featured build environment (capable of 7679 building static libraries etc). GCC provides the 'gcc-ar', 7680 'gcc-nm', 'gcc-ranlib' wrappers to pass the right options to these 7681 tools. With non fat LTO makefiles need to be modified to use them. 7682 7683 The default is '-ffat-lto-objects' but this default is intended to 7684 change in future releases when linker plugin enabled environments 7685 become more common. 7686 7687 '-fcompare-elim' 7688 After register allocation and post-register allocation instruction 7689 splitting, identify arithmetic instructions that compute processor 7690 flags similar to a comparison operation based on that arithmetic. 7691 If possible, eliminate the explicit comparison operation. 7692 7693 This pass only applies to certain targets that cannot explicitly 7694 represent the comparison operation before register allocation is 7695 complete. 7696 7697 Enabled at levels '-O', '-O2', '-O3', '-Os'. 7698 7699 '-fuse-ld=bfd' 7700 Use the 'bfd' linker instead of the default linker. 7701 7702 '-fuse-ld=gold' 7703 Use the 'gold' linker instead of the default linker. 7704 7705 '-fcprop-registers' 7706 After register allocation and post-register allocation instruction 7707 splitting, perform a copy-propagation pass to try to reduce 7708 scheduling dependencies and occasionally eliminate the copy. 7709 7710 Enabled at levels '-O', '-O2', '-O3', '-Os'. 7711 7712 '-fprofile-correction' 7713 Profiles collected using an instrumented binary for multi-threaded 7714 programs may be inconsistent due to missed counter updates. When 7715 this option is specified, GCC uses heuristics to correct or smooth 7716 out such inconsistencies. By default, GCC emits an error message 7717 when an inconsistent profile is detected. 7718 7719 '-fprofile-dir=PATH' 7720 7721 Set the directory to search for the profile data files in to PATH. 7722 This option affects only the profile data generated by 7723 '-fprofile-generate', '-ftest-coverage', '-fprofile-arcs' and used 7724 by '-fprofile-use' and '-fbranch-probabilities' and its related 7725 options. Both absolute and relative paths can be used. By 7726 default, GCC uses the current directory as PATH, thus the profile 7727 data file appears in the same directory as the object file. 7728 7729 '-fprofile-generate' 7730 '-fprofile-generate=PATH' 7731 7732 Enable options usually used for instrumenting application to 7733 produce profile useful for later recompilation with profile 7734 feedback based optimization. You must use '-fprofile-generate' 7735 both when compiling and when linking your program. 7736 7737 The following options are enabled: '-fprofile-arcs', 7738 '-fprofile-values', '-fvpt'. 7739 7740 If PATH is specified, GCC looks at the PATH to find the profile 7741 feedback data files. See '-fprofile-dir'. 7742 7743 '-fprofile-use' 7744 '-fprofile-use=PATH' 7745 Enable profile feedback directed optimizations, and optimizations 7746 generally profitable only with profile feedback available. 7747 7748 The following options are enabled: '-fbranch-probabilities', 7749 '-fvpt', '-funroll-loops', '-fpeel-loops', '-ftracer', 7750 '-ftree-vectorize', 'ftree-loop-distribute-patterns' 7751 7752 By default, GCC emits an error message if the feedback profiles do 7753 not match the source code. This error can be turned into a warning 7754 by using '-Wcoverage-mismatch'. Note this may result in poorly 7755 optimized code. 7756 7757 If PATH is specified, GCC looks at the PATH to find the profile 7758 feedback data files. See '-fprofile-dir'. 7759 7760 The following options control compiler behavior regarding 7761 floating-point arithmetic. These options trade off between speed and 7762 correctness. All must be specifically enabled. 7763 7764 '-ffloat-store' 7765 Do not store floating-point variables in registers, and inhibit 7766 other options that might change whether a floating-point value is 7767 taken from a register or memory. 7768 7769 This option prevents undesirable excess precision on machines such 7770 as the 68000 where the floating registers (of the 68881) keep more 7771 precision than a 'double' is supposed to have. Similarly for the 7772 x86 architecture. For most programs, the excess precision does 7773 only good, but a few programs rely on the precise definition of 7774 IEEE floating point. Use '-ffloat-store' for such programs, after 7775 modifying them to store all pertinent intermediate computations 7776 into variables. 7777 7778 '-fexcess-precision=STYLE' 7779 This option allows further control over excess precision on 7780 machines where floating-point registers have more precision than 7781 the IEEE 'float' and 'double' types and the processor does not 7782 support operations rounding to those types. By default, 7783 '-fexcess-precision=fast' is in effect; this means that operations 7784 are carried out in the precision of the registers and that it is 7785 unpredictable when rounding to the types specified in the source 7786 code takes place. When compiling C, if 7787 '-fexcess-precision=standard' is specified then excess precision 7788 follows the rules specified in ISO C99; in particular, both casts 7789 and assignments cause values to be rounded to their semantic types 7790 (whereas '-ffloat-store' only affects assignments). This option is 7791 enabled by default for C if a strict conformance option such as 7792 '-std=c99' is used. 7793 7794 '-fexcess-precision=standard' is not implemented for languages 7795 other than C, and has no effect if '-funsafe-math-optimizations' or 7796 '-ffast-math' is specified. On the x86, it also has no effect if 7797 '-mfpmath=sse' or '-mfpmath=sse+387' is specified; in the former 7798 case, IEEE semantics apply without excess precision, and in the 7799 latter, rounding is unpredictable. 7800 7801 '-ffast-math' 7802 Sets '-fno-math-errno', '-funsafe-math-optimizations', 7803 '-ffinite-math-only', '-fno-rounding-math', '-fno-signaling-nans' 7804 and '-fcx-limited-range'. 7805 7806 This option causes the preprocessor macro '__FAST_MATH__' to be 7807 defined. 7808 7809 This option is not turned on by any '-O' option besides '-Ofast' 7810 since it can result in incorrect output for programs that depend on 7811 an exact implementation of IEEE or ISO rules/specifications for 7812 math functions. It may, however, yield faster code for programs 7813 that do not require the guarantees of these specifications. 7814 7815 '-fno-math-errno' 7816 Do not set 'errno' after calling math functions that are executed 7817 with a single instruction, e.g., 'sqrt'. A program that relies on 7818 IEEE exceptions for math error handling may want to use this flag 7819 for speed while maintaining IEEE arithmetic compatibility. 7820 7821 This option is not turned on by any '-O' option since it can result 7822 in incorrect output for programs that depend on an exact 7823 implementation of IEEE or ISO rules/specifications for math 7824 functions. It may, however, yield faster code for programs that do 7825 not require the guarantees of these specifications. 7826 7827 The default is '-fmath-errno'. 7828 7829 On Darwin systems, the math library never sets 'errno'. There is 7830 therefore no reason for the compiler to consider the possibility 7831 that it might, and '-fno-math-errno' is the default. 7832 7833 '-funsafe-math-optimizations' 7834 7835 Allow optimizations for floating-point arithmetic that (a) assume 7836 that arguments and results are valid and (b) may violate IEEE or 7837 ANSI standards. When used at link-time, it may include libraries 7838 or startup files that change the default FPU control word or other 7839 similar optimizations. 7840 7841 This option is not turned on by any '-O' option since it can result 7842 in incorrect output for programs that depend on an exact 7843 implementation of IEEE or ISO rules/specifications for math 7844 functions. It may, however, yield faster code for programs that do 7845 not require the guarantees of these specifications. Enables 7846 '-fno-signed-zeros', '-fno-trapping-math', '-fassociative-math' and 7847 '-freciprocal-math'. 7848 7849 The default is '-fno-unsafe-math-optimizations'. 7850 7851 '-fassociative-math' 7852 7853 Allow re-association of operands in series of floating-point 7854 operations. This violates the ISO C and C++ language standard by 7855 possibly changing computation result. NOTE: re-ordering may change 7856 the sign of zero as well as ignore NaNs and inhibit or create 7857 underflow or overflow (and thus cannot be used on code that relies 7858 on rounding behavior like '(x + 2**52) - 2**52'. May also reorder 7859 floating-point comparisons and thus may not be used when ordered 7860 comparisons are required. This option requires that both 7861 '-fno-signed-zeros' and '-fno-trapping-math' be in effect. 7862 Moreover, it doesn't make much sense with '-frounding-math'. For 7863 Fortran the option is automatically enabled when both 7864 '-fno-signed-zeros' and '-fno-trapping-math' are in effect. 7865 7866 The default is '-fno-associative-math'. 7867 7868 '-freciprocal-math' 7869 7870 Allow the reciprocal of a value to be used instead of dividing by 7871 the value if this enables optimizations. For example 'x / y' can 7872 be replaced with 'x * (1/y)', which is useful if '(1/y)' is subject 7873 to common subexpression elimination. Note that this loses 7874 precision and increases the number of flops operating on the value. 7875 7876 The default is '-fno-reciprocal-math'. 7877 7878 '-ffinite-math-only' 7879 Allow optimizations for floating-point arithmetic that assume that 7880 arguments and results are not NaNs or +-Infs. 7881 7882 This option is not turned on by any '-O' option since it can result 7883 in incorrect output for programs that depend on an exact 7884 implementation of IEEE or ISO rules/specifications for math 7885 functions. It may, however, yield faster code for programs that do 7886 not require the guarantees of these specifications. 7887 7888 The default is '-fno-finite-math-only'. 7889 7890 '-fno-signed-zeros' 7891 Allow optimizations for floating-point arithmetic that ignore the 7892 signedness of zero. IEEE arithmetic specifies the behavior of 7893 distinct +0.0 and -0.0 values, which then prohibits simplification 7894 of expressions such as x+0.0 or 0.0*x (even with 7895 '-ffinite-math-only'). This option implies that the sign of a zero 7896 result isn't significant. 7897 7898 The default is '-fsigned-zeros'. 7899 7900 '-fno-trapping-math' 7901 Compile code assuming that floating-point operations cannot 7902 generate user-visible traps. These traps include division by zero, 7903 overflow, underflow, inexact result and invalid operation. This 7904 option requires that '-fno-signaling-nans' be in effect. Setting 7905 this option may allow faster code if one relies on "non-stop" IEEE 7906 arithmetic, for example. 7907 7908 This option should never be turned on by any '-O' option since it 7909 can result in incorrect output for programs that depend on an exact 7910 implementation of IEEE or ISO rules/specifications for math 7911 functions. 7912 7913 The default is '-ftrapping-math'. 7914 7915 '-frounding-math' 7916 Disable transformations and optimizations that assume default 7917 floating-point rounding behavior. This is round-to-zero for all 7918 floating point to integer conversions, and round-to-nearest for all 7919 other arithmetic truncations. This option should be specified for 7920 programs that change the FP rounding mode dynamically, or that may 7921 be executed with a non-default rounding mode. This option disables 7922 constant folding of floating-point expressions at compile time 7923 (which may be affected by rounding mode) and arithmetic 7924 transformations that are unsafe in the presence of sign-dependent 7925 rounding modes. 7926 7927 The default is '-fno-rounding-math'. 7928 7929 This option is experimental and does not currently guarantee to 7930 disable all GCC optimizations that are affected by rounding mode. 7931 Future versions of GCC may provide finer control of this setting 7932 using C99's 'FENV_ACCESS' pragma. This command-line option will be 7933 used to specify the default state for 'FENV_ACCESS'. 7934 7935 '-fsignaling-nans' 7936 Compile code assuming that IEEE signaling NaNs may generate 7937 user-visible traps during floating-point operations. Setting this 7938 option disables optimizations that may change the number of 7939 exceptions visible with signaling NaNs. This option implies 7940 '-ftrapping-math'. 7941 7942 This option causes the preprocessor macro '__SUPPORT_SNAN__' to be 7943 defined. 7944 7945 The default is '-fno-signaling-nans'. 7946 7947 This option is experimental and does not currently guarantee to 7948 disable all GCC optimizations that affect signaling NaN behavior. 7949 7950 '-fsingle-precision-constant' 7951 Treat floating-point constants as single precision instead of 7952 implicitly converting them to double-precision constants. 7953 7954 '-fcx-limited-range' 7955 When enabled, this option states that a range reduction step is not 7956 needed when performing complex division. Also, there is no 7957 checking whether the result of a complex multiplication or division 7958 is 'NaN + I*NaN', with an attempt to rescue the situation in that 7959 case. The default is '-fno-cx-limited-range', but is enabled by 7960 '-ffast-math'. 7961 7962 This option controls the default setting of the ISO C99 7963 'CX_LIMITED_RANGE' pragma. Nevertheless, the option applies to all 7964 languages. 7965 7966 '-fcx-fortran-rules' 7967 Complex multiplication and division follow Fortran rules. Range 7968 reduction is done as part of complex division, but there is no 7969 checking whether the result of a complex multiplication or division 7970 is 'NaN + I*NaN', with an attempt to rescue the situation in that 7971 case. 7972 7973 The default is '-fno-cx-fortran-rules'. 7974 7975 The following options control optimizations that may improve 7976 performance, but are not enabled by any '-O' options. This section 7977 includes experimental options that may produce broken code. 7978 7979 '-fbranch-probabilities' 7980 After running a program compiled with '-fprofile-arcs' (*note 7981 Options for Debugging Your Program or 'gcc': Debugging Options.), 7982 you can compile it a second time using '-fbranch-probabilities', to 7983 improve optimizations based on the number of times each branch was 7984 taken. When a program compiled with '-fprofile-arcs' exits, it 7985 saves arc execution counts to a file called 'SOURCENAME.gcda' for 7986 each source file. The information in this data file is very 7987 dependent on the structure of the generated code, so you must use 7988 the same source code and the same optimization options for both 7989 compilations. 7990 7991 With '-fbranch-probabilities', GCC puts a 'REG_BR_PROB' note on 7992 each 'JUMP_INSN' and 'CALL_INSN'. These can be used to improve 7993 optimization. Currently, they are only used in one place: in 7994 'reorg.c', instead of guessing which path a branch is most likely 7995 to take, the 'REG_BR_PROB' values are used to exactly determine 7996 which path is taken more often. 7997 7998 '-fprofile-values' 7999 If combined with '-fprofile-arcs', it adds code so that some data 8000 about values of expressions in the program is gathered. 8001 8002 With '-fbranch-probabilities', it reads back the data gathered from 8003 profiling values of expressions for usage in optimizations. 8004 8005 Enabled with '-fprofile-generate' and '-fprofile-use'. 8006 8007 '-fvpt' 8008 If combined with '-fprofile-arcs', this option instructs the 8009 compiler to add code to gather information about values of 8010 expressions. 8011 8012 With '-fbranch-probabilities', it reads back the data gathered and 8013 actually performs the optimizations based on them. Currently the 8014 optimizations include specialization of division operations using 8015 the knowledge about the value of the denominator. 8016 8017 '-frename-registers' 8018 Attempt to avoid false dependencies in scheduled code by making use 8019 of registers left over after register allocation. This 8020 optimization most benefits processors with lots of registers. 8021 Depending on the debug information format adopted by the target, 8022 however, it can make debugging impossible, since variables no 8023 longer stay in a "home register". 8024 8025 Enabled by default with '-funroll-loops' and '-fpeel-loops'. 8026 8027 '-ftracer' 8028 Perform tail duplication to enlarge superblock size. This 8029 transformation simplifies the control flow of the function allowing 8030 other optimizations to do a better job. 8031 8032 Enabled with '-fprofile-use'. 8033 8034 '-funroll-loops' 8035 Unroll loops whose number of iterations can be determined at 8036 compile time or upon entry to the loop. '-funroll-loops' implies 8037 '-frerun-cse-after-loop', '-fweb' and '-frename-registers'. It 8038 also turns on complete loop peeling (i.e. complete removal of loops 8039 with a small constant number of iterations). This option makes 8040 code larger, and may or may not make it run faster. 8041 8042 Enabled with '-fprofile-use'. 8043 8044 '-funroll-all-loops' 8045 Unroll all loops, even if their number of iterations is uncertain 8046 when the loop is entered. This usually makes programs run more 8047 slowly. '-funroll-all-loops' implies the same options as 8048 '-funroll-loops'. 8049 8050 '-fpeel-loops' 8051 Peels loops for which there is enough information that they do not 8052 roll much (from profile feedback). It also turns on complete loop 8053 peeling (i.e. complete removal of loops with small constant number 8054 of iterations). 8055 8056 Enabled with '-fprofile-use'. 8057 8058 '-fmove-loop-invariants' 8059 Enables the loop invariant motion pass in the RTL loop optimizer. 8060 Enabled at level '-O1' 8061 8062 '-funswitch-loops' 8063 Move branches with loop invariant conditions out of the loop, with 8064 duplicates of the loop on both branches (modified according to 8065 result of the condition). 8066 8067 '-ffunction-sections' 8068 '-fdata-sections' 8069 Place each function or data item into its own section in the output 8070 file if the target supports arbitrary sections. The name of the 8071 function or the name of the data item determines the section's name 8072 in the output file. 8073 8074 Use these options on systems where the linker can perform 8075 optimizations to improve locality of reference in the instruction 8076 space. Most systems using the ELF object format and SPARC 8077 processors running Solaris 2 have linkers with such optimizations. 8078 AIX may have these optimizations in the future. 8079 8080 Only use these options when there are significant benefits from 8081 doing so. When you specify these options, the assembler and linker 8082 create larger object and executable files and are also slower. You 8083 cannot use 'gprof' on all systems if you specify this option, and 8084 you may have problems with debugging if you specify both this 8085 option and '-g'. 8086 8087 '-fbranch-target-load-optimize' 8088 Perform branch target register load optimization before prologue / 8089 epilogue threading. The use of target registers can typically be 8090 exposed only during reload, thus hoisting loads out of loops and 8091 doing inter-block scheduling needs a separate optimization pass. 8092 8093 '-fbranch-target-load-optimize2' 8094 Perform branch target register load optimization after prologue / 8095 epilogue threading. 8096 8097 '-fbtr-bb-exclusive' 8098 When performing branch target register load optimization, don't 8099 reuse branch target registers within any basic block. 8100 8101 '-fstack-protector' 8102 Emit extra code to check for buffer overflows, such as stack 8103 smashing attacks. This is done by adding a guard variable to 8104 functions with vulnerable objects. This includes functions that 8105 call 'alloca', and functions with buffers larger than 8 bytes. The 8106 guards are initialized when a function is entered and then checked 8107 when the function exits. If a guard check fails, an error message 8108 is printed and the program exits. 8109 8110 '-fstack-protector-all' 8111 Like '-fstack-protector' except that all functions are protected. 8112 8113 '-fsection-anchors' 8114 Try to reduce the number of symbolic address calculations by using 8115 shared "anchor" symbols to address nearby objects. This 8116 transformation can help to reduce the number of GOT entries and GOT 8117 accesses on some targets. 8118 8119 For example, the implementation of the following function 'foo': 8120 8121 static int a, b, c; 8122 int foo (void) { return a + b + c; } 8123 8124 usually calculates the addresses of all three variables, but if you 8125 compile it with '-fsection-anchors', it accesses the variables from 8126 a common anchor point instead. The effect is similar to the 8127 following pseudocode (which isn't valid C): 8128 8129 int foo (void) 8130 { 8131 register int *xr = &x; 8132 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 8133 } 8134 8135 Not all targets support this option. 8136 8137 '--param NAME=VALUE' 8138 In some places, GCC uses various constants to control the amount of 8139 optimization that is done. For example, GCC does not inline 8140 functions that contain more than a certain number of instructions. 8141 You can control some of these constants on the command line using 8142 the '--param' option. 8143 8144 The names of specific parameters, and the meaning of the values, 8145 are tied to the internals of the compiler, and are subject to 8146 change without notice in future releases. 8147 8148 In each case, the VALUE is an integer. The allowable choices for 8149 NAME are: 8150 8151 'predictable-branch-outcome' 8152 When branch is predicted to be taken with probability lower 8153 than this threshold (in percent), then it is considered well 8154 predictable. The default is 10. 8155 8156 'max-crossjump-edges' 8157 The maximum number of incoming edges to consider for 8158 cross-jumping. The algorithm used by '-fcrossjumping' is 8159 O(N^2) in the number of edges incoming to each block. 8160 Increasing values mean more aggressive optimization, making 8161 the compilation time increase with probably small improvement 8162 in executable size. 8163 8164 'min-crossjump-insns' 8165 The minimum number of instructions that must be matched at the 8166 end of two blocks before cross-jumping is performed on them. 8167 This value is ignored in the case where all instructions in 8168 the block being cross-jumped from are matched. The default 8169 value is 5. 8170 8171 'max-grow-copy-bb-insns' 8172 The maximum code size expansion factor when copying basic 8173 blocks instead of jumping. The expansion is relative to a 8174 jump instruction. The default value is 8. 8175 8176 'max-goto-duplication-insns' 8177 The maximum number of instructions to duplicate to a block 8178 that jumps to a computed goto. To avoid O(N^2) behavior in a 8179 number of passes, GCC factors computed gotos early in the 8180 compilation process, and unfactors them as late as possible. 8181 Only computed jumps at the end of a basic blocks with no more 8182 than max-goto-duplication-insns are unfactored. The default 8183 value is 8. 8184 8185 'max-delay-slot-insn-search' 8186 The maximum number of instructions to consider when looking 8187 for an instruction to fill a delay slot. If more than this 8188 arbitrary number of instructions are searched, the time 8189 savings from filling the delay slot are minimal, so stop 8190 searching. Increasing values mean more aggressive 8191 optimization, making the compilation time increase with 8192 probably small improvement in execution time. 8193 8194 'max-delay-slot-live-search' 8195 When trying to fill delay slots, the maximum number of 8196 instructions to consider when searching for a block with valid 8197 live register information. Increasing this arbitrarily chosen 8198 value means more aggressive optimization, increasing the 8199 compilation time. This parameter should be removed when the 8200 delay slot code is rewritten to maintain the control-flow 8201 graph. 8202 8203 'max-gcse-memory' 8204 The approximate maximum amount of memory that can be allocated 8205 in order to perform the global common subexpression 8206 elimination optimization. If more memory than specified is 8207 required, the optimization is not done. 8208 8209 'max-gcse-insertion-ratio' 8210 If the ratio of expression insertions to deletions is larger 8211 than this value for any expression, then RTL PRE inserts or 8212 removes the expression and thus leaves partially redundant 8213 computations in the instruction stream. The default value is 8214 20. 8215 8216 'max-pending-list-length' 8217 The maximum number of pending dependencies scheduling allows 8218 before flushing the current state and starting over. Large 8219 functions with few branches or calls can create excessively 8220 large lists which needlessly consume memory and resources. 8221 8222 'max-modulo-backtrack-attempts' 8223 The maximum number of backtrack attempts the scheduler should 8224 make when modulo scheduling a loop. Larger values can 8225 exponentially increase compilation time. 8226 8227 'max-inline-insns-single' 8228 Several parameters control the tree inliner used in GCC. This 8229 number sets the maximum number of instructions (counted in 8230 GCC's internal representation) in a single function that the 8231 tree inliner considers for inlining. This only affects 8232 functions declared inline and methods implemented in a class 8233 declaration (C++). The default value is 400. 8234 8235 'max-inline-insns-auto' 8236 When you use '-finline-functions' (included in '-O3'), a lot 8237 of functions that would otherwise not be considered for 8238 inlining by the compiler are investigated. To those 8239 functions, a different (more restrictive) limit compared to 8240 functions declared inline can be applied. The default value 8241 is 40. 8242 8243 'inline-min-speedup' 8244 When estimated performance improvement of caller + callee 8245 runtime exceeds this threshold (in precent), the function can 8246 be inlined regardless the limit on '--param 8247 max-inline-insns-single' and '--param max-inline-insns-auto'. 8248 8249 'large-function-insns' 8250 The limit specifying really large functions. For functions 8251 larger than this limit after inlining, inlining is constrained 8252 by '--param large-function-growth'. This parameter is useful 8253 primarily to avoid extreme compilation time caused by 8254 non-linear algorithms used by the back end. The default value 8255 is 2700. 8256 8257 'large-function-growth' 8258 Specifies maximal growth of large function caused by inlining 8259 in percents. The default value is 100 which limits large 8260 function growth to 2.0 times the original size. 8261 8262 'large-unit-insns' 8263 The limit specifying large translation unit. Growth caused by 8264 inlining of units larger than this limit is limited by 8265 '--param inline-unit-growth'. For small units this might be 8266 too tight. For example, consider a unit consisting of 8267 function A that is inline and B that just calls A three times. 8268 If B is small relative to A, the growth of unit is 300\% and 8269 yet such inlining is very sane. For very large units 8270 consisting of small inlineable functions, however, the overall 8271 unit growth limit is needed to avoid exponential explosion of 8272 code size. Thus for smaller units, the size is increased to 8273 '--param large-unit-insns' before applying '--param 8274 inline-unit-growth'. The default is 10000. 8275 8276 'inline-unit-growth' 8277 Specifies maximal overall growth of the compilation unit 8278 caused by inlining. The default value is 30 which limits unit 8279 growth to 1.3 times the original size. 8280 8281 'ipcp-unit-growth' 8282 Specifies maximal overall growth of the compilation unit 8283 caused by interprocedural constant propagation. The default 8284 value is 10 which limits unit growth to 1.1 times the original 8285 size. 8286 8287 'large-stack-frame' 8288 The limit specifying large stack frames. While inlining the 8289 algorithm is trying to not grow past this limit too much. The 8290 default value is 256 bytes. 8291 8292 'large-stack-frame-growth' 8293 Specifies maximal growth of large stack frames caused by 8294 inlining in percents. The default value is 1000 which limits 8295 large stack frame growth to 11 times the original size. 8296 8297 'max-inline-insns-recursive' 8298 'max-inline-insns-recursive-auto' 8299 Specifies the maximum number of instructions an out-of-line 8300 copy of a self-recursive inline function can grow into by 8301 performing recursive inlining. 8302 8303 For functions declared inline, '--param 8304 max-inline-insns-recursive' is taken into account. For 8305 functions not declared inline, recursive inlining happens only 8306 when '-finline-functions' (included in '-O3') is enabled and 8307 '--param max-inline-insns-recursive-auto' is used. The 8308 default value is 450. 8309 8310 'max-inline-recursive-depth' 8311 'max-inline-recursive-depth-auto' 8312 Specifies the maximum recursion depth used for recursive 8313 inlining. 8314 8315 For functions declared inline, '--param 8316 max-inline-recursive-depth' is taken into account. For 8317 functions not declared inline, recursive inlining happens only 8318 when '-finline-functions' (included in '-O3') is enabled and 8319 '--param max-inline-recursive-depth-auto' is used. The 8320 default value is 8. 8321 8322 'min-inline-recursive-probability' 8323 Recursive inlining is profitable only for function having deep 8324 recursion in average and can hurt for function having little 8325 recursion depth by increasing the prologue size or complexity 8326 of function body to other optimizers. 8327 8328 When profile feedback is available (see '-fprofile-generate') 8329 the actual recursion depth can be guessed from probability 8330 that function recurses via a given call expression. This 8331 parameter limits inlining only to call expressions whose 8332 probability exceeds the given threshold (in percents). The 8333 default value is 10. 8334 8335 'early-inlining-insns' 8336 Specify growth that the early inliner can make. In effect it 8337 increases the amount of inlining for code having a large 8338 abstraction penalty. The default value is 10. 8339 8340 'max-early-inliner-iterations' 8341 'max-early-inliner-iterations' 8342 Limit of iterations of the early inliner. This basically 8343 bounds the number of nested indirect calls the early inliner 8344 can resolve. Deeper chains are still handled by late 8345 inlining. 8346 8347 'comdat-sharing-probability' 8348 'comdat-sharing-probability' 8349 Probability (in percent) that C++ inline function with comdat 8350 visibility are shared across multiple compilation units. The 8351 default value is 20. 8352 8353 'min-vect-loop-bound' 8354 The minimum number of iterations under which loops are not 8355 vectorized when '-ftree-vectorize' is used. The number of 8356 iterations after vectorization needs to be greater than the 8357 value specified by this option to allow vectorization. The 8358 default value is 0. 8359 8360 'gcse-cost-distance-ratio' 8361 Scaling factor in calculation of maximum distance an 8362 expression can be moved by GCSE optimizations. This is 8363 currently supported only in the code hoisting pass. The 8364 bigger the ratio, the more aggressive code hoisting is with 8365 simple expressions, i.e., the expressions that have cost less 8366 than 'gcse-unrestricted-cost'. Specifying 0 disables hoisting 8367 of simple expressions. The default value is 10. 8368 8369 'gcse-unrestricted-cost' 8370 Cost, roughly measured as the cost of a single typical machine 8371 instruction, at which GCSE optimizations do not constrain the 8372 distance an expression can travel. This is currently 8373 supported only in the code hoisting pass. The lesser the 8374 cost, the more aggressive code hoisting is. Specifying 0 8375 allows all expressions to travel unrestricted distances. The 8376 default value is 3. 8377 8378 'max-hoist-depth' 8379 The depth of search in the dominator tree for expressions to 8380 hoist. This is used to avoid quadratic behavior in hoisting 8381 algorithm. The value of 0 does not limit on the search, but 8382 may slow down compilation of huge functions. The default 8383 value is 30. 8384 8385 'max-tail-merge-comparisons' 8386 The maximum amount of similar bbs to compare a bb with. This 8387 is used to avoid quadratic behavior in tree tail merging. The 8388 default value is 10. 8389 8390 'max-tail-merge-iterations' 8391 The maximum amount of iterations of the pass over the 8392 function. This is used to limit compilation time in tree tail 8393 merging. The default value is 2. 8394 8395 'max-unrolled-insns' 8396 The maximum number of instructions that a loop may have to be 8397 unrolled. If a loop is unrolled, this parameter also 8398 determines how many times the loop code is unrolled. 8399 8400 'max-average-unrolled-insns' 8401 The maximum number of instructions biased by probabilities of 8402 their execution that a loop may have to be unrolled. If a 8403 loop is unrolled, this parameter also determines how many 8404 times the loop code is unrolled. 8405 8406 'max-unroll-times' 8407 The maximum number of unrollings of a single loop. 8408 8409 'max-peeled-insns' 8410 The maximum number of instructions that a loop may have to be 8411 peeled. If a loop is peeled, this parameter also determines 8412 how many times the loop code is peeled. 8413 8414 'max-peel-times' 8415 The maximum number of peelings of a single loop. 8416 8417 'max-peel-branches' 8418 The maximum number of branches on the hot path through the 8419 peeled sequence. 8420 8421 'max-completely-peeled-insns' 8422 The maximum number of insns of a completely peeled loop. 8423 8424 'max-completely-peel-times' 8425 The maximum number of iterations of a loop to be suitable for 8426 complete peeling. 8427 8428 'max-completely-peel-loop-nest-depth' 8429 The maximum depth of a loop nest suitable for complete 8430 peeling. 8431 8432 'max-unswitch-insns' 8433 The maximum number of insns of an unswitched loop. 8434 8435 'max-unswitch-level' 8436 The maximum number of branches unswitched in a single loop. 8437 8438 'lim-expensive' 8439 The minimum cost of an expensive expression in the loop 8440 invariant motion. 8441 8442 'iv-consider-all-candidates-bound' 8443 Bound on number of candidates for induction variables, below 8444 which all candidates are considered for each use in induction 8445 variable optimizations. If there are more candidates than 8446 this, only the most relevant ones are considered to avoid 8447 quadratic time complexity. 8448 8449 'iv-max-considered-uses' 8450 The induction variable optimizations give up on loops that 8451 contain more induction variable uses. 8452 8453 'iv-always-prune-cand-set-bound' 8454 If the number of candidates in the set is smaller than this 8455 value, always try to remove unnecessary ivs from the set when 8456 adding a new one. 8457 8458 'scev-max-expr-size' 8459 Bound on size of expressions used in the scalar evolutions 8460 analyzer. Large expressions slow the analyzer. 8461 8462 'scev-max-expr-complexity' 8463 Bound on the complexity of the expressions in the scalar 8464 evolutions analyzer. Complex expressions slow the analyzer. 8465 8466 'omega-max-vars' 8467 The maximum number of variables in an Omega constraint system. 8468 The default value is 128. 8469 8470 'omega-max-geqs' 8471 The maximum number of inequalities in an Omega constraint 8472 system. The default value is 256. 8473 8474 'omega-max-eqs' 8475 The maximum number of equalities in an Omega constraint 8476 system. The default value is 128. 8477 8478 'omega-max-wild-cards' 8479 The maximum number of wildcard variables that the Omega solver 8480 is able to insert. The default value is 18. 8481 8482 'omega-hash-table-size' 8483 The size of the hash table in the Omega solver. The default 8484 value is 550. 8485 8486 'omega-max-keys' 8487 The maximal number of keys used by the Omega solver. The 8488 default value is 500. 8489 8490 'omega-eliminate-redundant-constraints' 8491 When set to 1, use expensive methods to eliminate all 8492 redundant constraints. The default value is 0. 8493 8494 'vect-max-version-for-alignment-checks' 8495 The maximum number of run-time checks that can be performed 8496 when doing loop versioning for alignment in the vectorizer. 8497 See option '-ftree-vect-loop-version' for more information. 8498 8499 'vect-max-version-for-alias-checks' 8500 The maximum number of run-time checks that can be performed 8501 when doing loop versioning for alias in the vectorizer. See 8502 option '-ftree-vect-loop-version' for more information. 8503 8504 'max-iterations-to-track' 8505 The maximum number of iterations of a loop the brute-force 8506 algorithm for analysis of the number of iterations of the loop 8507 tries to evaluate. 8508 8509 'hot-bb-count-ws-permille' 8510 A basic block profile count is considered hot if it 8511 contributes to the given permillage (i.e. 0...1000) of the 8512 entire profiled execution. 8513 8514 'hot-bb-frequency-fraction' 8515 Select fraction of the entry block frequency of executions of 8516 basic block in function given basic block needs to have to be 8517 considered hot. 8518 8519 'max-predicted-iterations' 8520 The maximum number of loop iterations we predict statically. 8521 This is useful in cases where a function contains a single 8522 loop with known bound and another loop with unknown bound. 8523 The known number of iterations is predicted correctly, while 8524 the unknown number of iterations average to roughly 10. This 8525 means that the loop without bounds appears artificially cold 8526 relative to the other one. 8527 8528 'align-threshold' 8529 8530 Select fraction of the maximal frequency of executions of a 8531 basic block in a function to align the basic block. 8532 8533 'align-loop-iterations' 8534 8535 A loop expected to iterate at least the selected number of 8536 iterations is aligned. 8537 8538 'tracer-dynamic-coverage' 8539 'tracer-dynamic-coverage-feedback' 8540 8541 This value is used to limit superblock formation once the 8542 given percentage of executed instructions is covered. This 8543 limits unnecessary code size expansion. 8544 8545 The 'tracer-dynamic-coverage-feedback' is used only when 8546 profile feedback is available. The real profiles (as opposed 8547 to statically estimated ones) are much less balanced allowing 8548 the threshold to be larger value. 8549 8550 'tracer-max-code-growth' 8551 Stop tail duplication once code growth has reached given 8552 percentage. This is a rather artificial limit, as most of the 8553 duplicates are eliminated later in cross jumping, so it may be 8554 set to much higher values than is the desired code growth. 8555 8556 'tracer-min-branch-ratio' 8557 8558 Stop reverse growth when the reverse probability of best edge 8559 is less than this threshold (in percent). 8560 8561 'tracer-min-branch-ratio' 8562 'tracer-min-branch-ratio-feedback' 8563 8564 Stop forward growth if the best edge has probability lower 8565 than this threshold. 8566 8567 Similarly to 'tracer-dynamic-coverage' two values are present, 8568 one for compilation for profile feedback and one for 8569 compilation without. The value for compilation with profile 8570 feedback needs to be more conservative (higher) in order to 8571 make tracer effective. 8572 8573 'max-cse-path-length' 8574 8575 The maximum number of basic blocks on path that CSE considers. 8576 The default is 10. 8577 8578 'max-cse-insns' 8579 The maximum number of instructions CSE processes before 8580 flushing. The default is 1000. 8581 8582 'ggc-min-expand' 8583 8584 GCC uses a garbage collector to manage its own memory 8585 allocation. This parameter specifies the minimum percentage 8586 by which the garbage collector's heap should be allowed to 8587 expand between collections. Tuning this may improve 8588 compilation speed; it has no effect on code generation. 8589 8590 The default is 30% + 70% * (RAM/1GB) with an upper bound of 8591 100% when RAM >= 1GB. If 'getrlimit' is available, the notion 8592 of "RAM" is the smallest of actual RAM and 'RLIMIT_DATA' or 8593 'RLIMIT_AS'. If GCC is not able to calculate RAM on a 8594 particular platform, the lower bound of 30% is used. Setting 8595 this parameter and 'ggc-min-heapsize' to zero causes a full 8596 collection to occur at every opportunity. This is extremely 8597 slow, but can be useful for debugging. 8598 8599 'ggc-min-heapsize' 8600 8601 Minimum size of the garbage collector's heap before it begins 8602 bothering to collect garbage. The first collection occurs 8603 after the heap expands by 'ggc-min-expand'% beyond 8604 'ggc-min-heapsize'. Again, tuning this may improve 8605 compilation speed, and has no effect on code generation. 8606 8607 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit 8608 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not 8609 exceeded, but with a lower bound of 4096 (four megabytes) and 8610 an upper bound of 131072 (128 megabytes). If GCC is not able 8611 to calculate RAM on a particular platform, the lower bound is 8612 used. Setting this parameter very large effectively disables 8613 garbage collection. Setting this parameter and 8614 'ggc-min-expand' to zero causes a full collection to occur at 8615 every opportunity. 8616 8617 'max-reload-search-insns' 8618 The maximum number of instruction reload should look backward 8619 for equivalent register. Increasing values mean more 8620 aggressive optimization, making the compilation time increase 8621 with probably slightly better performance. The default value 8622 is 100. 8623 8624 'max-cselib-memory-locations' 8625 The maximum number of memory locations cselib should take into 8626 account. Increasing values mean more aggressive optimization, 8627 making the compilation time increase with probably slightly 8628 better performance. The default value is 500. 8629 8630 'reorder-blocks-duplicate' 8631 'reorder-blocks-duplicate-feedback' 8632 8633 Used by the basic block reordering pass to decide whether to 8634 use unconditional branch or duplicate the code on its 8635 destination. Code is duplicated when its estimated size is 8636 smaller than this value multiplied by the estimated size of 8637 unconditional jump in the hot spots of the program. 8638 8639 The 'reorder-block-duplicate-feedback' is used only when 8640 profile feedback is available. It may be set to higher values 8641 than 'reorder-block-duplicate' since information about the hot 8642 spots is more accurate. 8643 8644 'max-sched-ready-insns' 8645 The maximum number of instructions ready to be issued the 8646 scheduler should consider at any given time during the first 8647 scheduling pass. Increasing values mean more thorough 8648 searches, making the compilation time increase with probably 8649 little benefit. The default value is 100. 8650 8651 'max-sched-region-blocks' 8652 The maximum number of blocks in a region to be considered for 8653 interblock scheduling. The default value is 10. 8654 8655 'max-pipeline-region-blocks' 8656 The maximum number of blocks in a region to be considered for 8657 pipelining in the selective scheduler. The default value is 8658 15. 8659 8660 'max-sched-region-insns' 8661 The maximum number of insns in a region to be considered for 8662 interblock scheduling. The default value is 100. 8663 8664 'max-pipeline-region-insns' 8665 The maximum number of insns in a region to be considered for 8666 pipelining in the selective scheduler. The default value is 8667 200. 8668 8669 'min-spec-prob' 8670 The minimum probability (in percents) of reaching a source 8671 block for interblock speculative scheduling. The default 8672 value is 40. 8673 8674 'max-sched-extend-regions-iters' 8675 The maximum number of iterations through CFG to extend 8676 regions. A value of 0 (the default) disables region 8677 extensions. 8678 8679 'max-sched-insn-conflict-delay' 8680 The maximum conflict delay for an insn to be considered for 8681 speculative motion. The default value is 3. 8682 8683 'sched-spec-prob-cutoff' 8684 The minimal probability of speculation success (in percents), 8685 so that speculative insns are scheduled. The default value is 8686 40. 8687 8688 'sched-spec-state-edge-prob-cutoff' 8689 The minimum probability an edge must have for the scheduler to 8690 save its state across it. The default value is 10. 8691 8692 'sched-mem-true-dep-cost' 8693 Minimal distance (in CPU cycles) between store and load 8694 targeting same memory locations. The default value is 1. 8695 8696 'selsched-max-lookahead' 8697 The maximum size of the lookahead window of selective 8698 scheduling. It is a depth of search for available 8699 instructions. The default value is 50. 8700 8701 'selsched-max-sched-times' 8702 The maximum number of times that an instruction is scheduled 8703 during selective scheduling. This is the limit on the number 8704 of iterations through which the instruction may be pipelined. 8705 The default value is 2. 8706 8707 'selsched-max-insns-to-rename' 8708 The maximum number of best instructions in the ready list that 8709 are considered for renaming in the selective scheduler. The 8710 default value is 2. 8711 8712 'sms-min-sc' 8713 The minimum value of stage count that swing modulo scheduler 8714 generates. The default value is 2. 8715 8716 'max-last-value-rtl' 8717 The maximum size measured as number of RTLs that can be 8718 recorded in an expression in combiner for a pseudo register as 8719 last known value of that register. The default is 10000. 8720 8721 'integer-share-limit' 8722 Small integer constants can use a shared data structure, 8723 reducing the compiler's memory usage and increasing its speed. 8724 This sets the maximum value of a shared integer constant. The 8725 default value is 256. 8726 8727 'ssp-buffer-size' 8728 The minimum size of buffers (i.e. arrays) that receive stack 8729 smashing protection when '-fstack-protection' is used. 8730 8731 'max-jump-thread-duplication-stmts' 8732 Maximum number of statements allowed in a block that needs to 8733 be duplicated when threading jumps. 8734 8735 'max-fields-for-field-sensitive' 8736 Maximum number of fields in a structure treated in a field 8737 sensitive manner during pointer analysis. The default is zero 8738 for '-O0' and '-O1', and 100 for '-Os', '-O2', and '-O3'. 8739 8740 'prefetch-latency' 8741 Estimate on average number of instructions that are executed 8742 before prefetch finishes. The distance prefetched ahead is 8743 proportional to this constant. Increasing this number may 8744 also lead to less streams being prefetched (see 8745 'simultaneous-prefetches'). 8746 8747 'simultaneous-prefetches' 8748 Maximum number of prefetches that can run at the same time. 8749 8750 'l1-cache-line-size' 8751 The size of cache line in L1 cache, in bytes. 8752 8753 'l1-cache-size' 8754 The size of L1 cache, in kilobytes. 8755 8756 'l2-cache-size' 8757 The size of L2 cache, in kilobytes. 8758 8759 'min-insn-to-prefetch-ratio' 8760 The minimum ratio between the number of instructions and the 8761 number of prefetches to enable prefetching in a loop. 8762 8763 'prefetch-min-insn-to-mem-ratio' 8764 The minimum ratio between the number of instructions and the 8765 number of memory references to enable prefetching in a loop. 8766 8767 'use-canonical-types' 8768 Whether the compiler should use the "canonical" type system. 8769 By default, this should always be 1, which uses a more 8770 efficient internal mechanism for comparing types in C++ and 8771 Objective-C++. However, if bugs in the canonical type system 8772 are causing compilation failures, set this value to 0 to 8773 disable canonical types. 8774 8775 'switch-conversion-max-branch-ratio' 8776 Switch initialization conversion refuses to create arrays that 8777 are bigger than 'switch-conversion-max-branch-ratio' times the 8778 number of branches in the switch. 8779 8780 'max-partial-antic-length' 8781 Maximum length of the partial antic set computed during the 8782 tree partial redundancy elimination optimization 8783 ('-ftree-pre') when optimizing at '-O3' and above. For some 8784 sorts of source code the enhanced partial redundancy 8785 elimination optimization can run away, consuming all of the 8786 memory available on the host machine. This parameter sets a 8787 limit on the length of the sets that are computed, which 8788 prevents the runaway behavior. Setting a value of 0 for this 8789 parameter allows an unlimited set length. 8790 8791 'sccvn-max-scc-size' 8792 Maximum size of a strongly connected component (SCC) during 8793 SCCVN processing. If this limit is hit, SCCVN processing for 8794 the whole function is not done and optimizations depending on 8795 it are disabled. The default maximum SCC size is 10000. 8796 8797 'sccvn-max-alias-queries-per-access' 8798 Maximum number of alias-oracle queries we perform when looking 8799 for redundancies for loads and stores. If this limit is hit 8800 the search is aborted and the load or store is not considered 8801 redundant. The number of queries is algorithmically limited 8802 to the number of stores on all paths from the load to the 8803 function entry. The default maxmimum number of queries is 8804 1000. 8805 8806 'ira-max-loops-num' 8807 IRA uses regional register allocation by default. If a 8808 function contains more loops than the number given by this 8809 parameter, only at most the given number of the most 8810 frequently-executed loops form regions for regional register 8811 allocation. The default value of the parameter is 100. 8812 8813 'ira-max-conflict-table-size' 8814 Although IRA uses a sophisticated algorithm to compress the 8815 conflict table, the table can still require excessive amounts 8816 of memory for huge functions. If the conflict table for a 8817 function could be more than the size in MB given by this 8818 parameter, the register allocator instead uses a faster, 8819 simpler, and lower-quality algorithm that does not require 8820 building a pseudo-register conflict table. The default value 8821 of the parameter is 2000. 8822 8823 'ira-loop-reserved-regs' 8824 IRA can be used to evaluate more accurate register pressure in 8825 loops for decisions to move loop invariants (see '-O3'). The 8826 number of available registers reserved for some other purposes 8827 is given by this parameter. The default value of the 8828 parameter is 2, which is the minimal number of registers 8829 needed by typical instructions. This value is the best found 8830 from numerous experiments. 8831 8832 'loop-invariant-max-bbs-in-loop' 8833 Loop invariant motion can be very expensive, both in 8834 compilation time and in amount of needed compile-time memory, 8835 with very large loops. Loops with more basic blocks than this 8836 parameter won't have loop invariant motion optimization 8837 performed on them. The default value of the parameter is 1000 8838 for '-O1' and 10000 for '-O2' and above. 8839 8840 'loop-max-datarefs-for-datadeps' 8841 Building data dapendencies is expensive for very large loops. 8842 This parameter limits the number of data references in loops 8843 that are considered for data dependence analysis. These large 8844 loops are no handled by the optimizations using loop data 8845 dependencies. The default value is 1000. 8846 8847 'max-vartrack-size' 8848 Sets a maximum number of hash table slots to use during 8849 variable tracking dataflow analysis of any function. If this 8850 limit is exceeded with variable tracking at assignments 8851 enabled, analysis for that function is retried without it, 8852 after removing all debug insns from the function. If the 8853 limit is exceeded even without debug insns, var tracking 8854 analysis is completely disabled for the function. Setting the 8855 parameter to zero makes it unlimited. 8856 8857 'max-vartrack-expr-depth' 8858 Sets a maximum number of recursion levels when attempting to 8859 map variable names or debug temporaries to value expressions. 8860 This trades compilation time for more complete debug 8861 information. If this is set too low, value expressions that 8862 are available and could be represented in debug information 8863 may end up not being used; setting this higher may enable the 8864 compiler to find more complex debug expressions, but compile 8865 time and memory use may grow. The default is 12. 8866 8867 'min-nondebug-insn-uid' 8868 Use uids starting at this parameter for nondebug insns. The 8869 range below the parameter is reserved exclusively for debug 8870 insns created by '-fvar-tracking-assignments', but debug insns 8871 may get (non-overlapping) uids above it if the reserved range 8872 is exhausted. 8873 8874 'ipa-sra-ptr-growth-factor' 8875 IPA-SRA replaces a pointer to an aggregate with one or more 8876 new parameters only when their cumulative size is less or 8877 equal to 'ipa-sra-ptr-growth-factor' times the size of the 8878 original pointer parameter. 8879 8880 'tm-max-aggregate-size' 8881 When making copies of thread-local variables in a transaction, 8882 this parameter specifies the size in bytes after which 8883 variables are saved with the logging functions as opposed to 8884 save/restore code sequence pairs. This option only applies 8885 when using '-fgnu-tm'. 8886 8887 'graphite-max-nb-scop-params' 8888 To avoid exponential effects in the Graphite loop transforms, 8889 the number of parameters in a Static Control Part (SCoP) is 8890 bounded. The default value is 10 parameters. A variable 8891 whose value is unknown at compilation time and defined outside 8892 a SCoP is a parameter of the SCoP. 8893 8894 'graphite-max-bbs-per-function' 8895 To avoid exponential effects in the detection of SCoPs, the 8896 size of the functions analyzed by Graphite is bounded. The 8897 default value is 100 basic blocks. 8898 8899 'loop-block-tile-size' 8900 Loop blocking or strip mining transforms, enabled with 8901 '-floop-block' or '-floop-strip-mine', strip mine each loop in 8902 the loop nest by a given number of iterations. The strip 8903 length can be changed using the 'loop-block-tile-size' 8904 parameter. The default value is 51 iterations. 8905 8906 'ipa-cp-value-list-size' 8907 IPA-CP attempts to track all possible values and types passed 8908 to a function's parameter in order to propagate them and 8909 perform devirtualization. 'ipa-cp-value-list-size' is the 8910 maximum number of values and types it stores per one formal 8911 parameter of a function. 8912 8913 'lto-partitions' 8914 Specify desired number of partitions produced during WHOPR 8915 compilation. The number of partitions should exceed the 8916 number of CPUs used for compilation. The default value is 32. 8917 8918 'lto-minpartition' 8919 Size of minimal partition for WHOPR (in estimated 8920 instructions). This prevents expenses of splitting very small 8921 programs into too many partitions. 8922 8923 'cxx-max-namespaces-for-diagnostic-help' 8924 The maximum number of namespaces to consult for suggestions 8925 when C++ name lookup fails for an identifier. The default is 8926 1000. 8927 8928 'sink-frequency-threshold' 8929 The maximum relative execution frequency (in percents) of the 8930 target block relative to a statement's original block to allow 8931 statement sinking of a statement. Larger numbers result in 8932 more aggressive statement sinking. The default value is 75. 8933 A small positive adjustment is applied for statements with 8934 memory operands as those are even more profitable so sink. 8935 8936 'max-stores-to-sink' 8937 The maximum number of conditional stores paires that can be 8938 sunk. Set to 0 if either vectorization ('-ftree-vectorize') 8939 or if-conversion ('-ftree-loop-if-convert') is disabled. The 8940 default is 2. 8941 8942 'allow-load-data-races' 8943 Allow optimizers to introduce new data races on loads. Set to 8944 1 to allow, otherwise to 0. This option is enabled by default 8945 unless implicitly set by the '-fmemory-model=' option. 8946 8947 'allow-store-data-races' 8948 Allow optimizers to introduce new data races on stores. Set 8949 to 1 to allow, otherwise to 0. This option is enabled by 8950 default unless implicitly set by the '-fmemory-model=' option. 8951 8952 'allow-packed-load-data-races' 8953 Allow optimizers to introduce new data races on packed data 8954 loads. Set to 1 to allow, otherwise to 0. This option is 8955 enabled by default unless implicitly set by the 8956 '-fmemory-model=' option. 8957 8958 'allow-packed-store-data-races' 8959 Allow optimizers to introduce new data races on packed data 8960 stores. Set to 1 to allow, otherwise to 0. This option is 8961 enabled by default unless implicitly set by the 8962 '-fmemory-model=' option. 8963 8964 'case-values-threshold' 8965 The smallest number of different values for which it is best 8966 to use a jump-table instead of a tree of conditional branches. 8967 If the value is 0, use the default for the machine. The 8968 default is 0. 8969 8970 'tree-reassoc-width' 8971 Set the maximum number of instructions executed in parallel in 8972 reassociated tree. This parameter overrides target dependent 8973 heuristics used by default if has non zero value. 8974 8975 'sched-pressure-algorithm' 8976 Choose between the two available implementations of 8977 '-fsched-pressure'. Algorithm 1 is the original 8978 implementation and is the more likely to prevent instructions 8979 from being reordered. Algorithm 2 was designed to be a 8980 compromise between the relatively conservative approach taken 8981 by algorithm 1 and the rather aggressive approach taken by the 8982 default scheduler. It relies more heavily on having a regular 8983 register file and accurate register pressure classes. See 8984 'haifa-sched.c' in the GCC sources for more details. 8985 8986 The default choice depends on the target. 8987 8988 'max-slsr-cand-scan' 8989 Set the maximum number of existing candidates that will be 8990 considered when seeking a basis for a new straight-line 8991 strength reduction candidate. 8992 8993 8994 File: gcc.info, Node: Preprocessor Options, Next: Assembler Options, Prev: Optimize Options, Up: Invoking GCC 8995 8996 3.11 Options Controlling the Preprocessor 8997 ========================================= 8998 8999 These options control the C preprocessor, which is run on each C source 9000 file before actual compilation. 9001 9002 If you use the '-E' option, nothing is done except preprocessing. Some 9003 of these options make sense only together with '-E' because they cause 9004 the preprocessor output to be unsuitable for actual compilation. 9005 9006 '-Wp,OPTION' 9007 You can use '-Wp,OPTION' to bypass the compiler driver and pass 9008 OPTION directly through to the preprocessor. If OPTION contains 9009 commas, it is split into multiple options at the commas. However, 9010 many options are modified, translated or interpreted by the 9011 compiler driver before being passed to the preprocessor, and '-Wp' 9012 forcibly bypasses this phase. The preprocessor's direct interface 9013 is undocumented and subject to change, so whenever possible you 9014 should avoid using '-Wp' and let the driver handle the options 9015 instead. 9016 9017 '-Xpreprocessor OPTION' 9018 Pass OPTION as an option to the preprocessor. You can use this to 9019 supply system-specific preprocessor options that GCC does not 9020 recognize. 9021 9022 If you want to pass an option that takes an argument, you must use 9023 '-Xpreprocessor' twice, once for the option and once for the 9024 argument. 9025 9026 '-no-integrated-cpp' 9027 Perform preprocessing as a separate pass before compilation. By 9028 default, GCC performs preprocessing as an integrated part of input 9029 tokenization and parsing. If this option is provided, the 9030 appropriate language front end ('cc1', 'cc1plus', or 'cc1obj' for 9031 C, C++, and Objective-C, respectively) is instead invoked twice, 9032 once for preprocessing only and once for actual compilation of the 9033 preprocessed input. This option may be useful in conjunction with 9034 the '-B' or '-wrapper' options to specify an alternate preprocessor 9035 or perform additional processing of the program source between 9036 normal preprocessing and compilation. 9037 9038 '-D NAME' 9039 Predefine NAME as a macro, with definition '1'. 9040 9041 '-D NAME=DEFINITION' 9042 The contents of DEFINITION are tokenized and processed as if they 9043 appeared during translation phase three in a '#define' directive. 9044 In particular, the definition will be truncated by embedded newline 9045 characters. 9046 9047 If you are invoking the preprocessor from a shell or shell-like 9048 program you may need to use the shell's quoting syntax to protect 9049 characters such as spaces that have a meaning in the shell syntax. 9050 9051 If you wish to define a function-like macro on the command line, 9052 write its argument list with surrounding parentheses before the 9053 equals sign (if any). Parentheses are meaningful to most shells, 9054 so you will need to quote the option. With 'sh' and 'csh', 9055 '-D'NAME(ARGS...)=DEFINITION'' works. 9056 9057 '-D' and '-U' options are processed in the order they are given on 9058 the command line. All '-imacros FILE' and '-include FILE' options 9059 are processed after all '-D' and '-U' options. 9060 9061 '-U NAME' 9062 Cancel any previous definition of NAME, either built in or provided 9063 with a '-D' option. 9064 9065 '-undef' 9066 Do not predefine any system-specific or GCC-specific macros. The 9067 standard predefined macros remain defined. 9068 9069 '-I DIR' 9070 Add the directory DIR to the list of directories to be searched for 9071 header files. Directories named by '-I' are searched before the 9072 standard system include directories. If the directory DIR is a 9073 standard system include directory, the option is ignored to ensure 9074 that the default search order for system directories and the 9075 special treatment of system headers are not defeated . If DIR 9076 begins with '=', then the '=' will be replaced by the sysroot 9077 prefix; see '--sysroot' and '-isysroot'. 9078 9079 '-o FILE' 9080 Write output to FILE. This is the same as specifying FILE as the 9081 second non-option argument to 'cpp'. 'gcc' has a different 9082 interpretation of a second non-option argument, so you must use 9083 '-o' to specify the output file. 9084 9085 '-Wall' 9086 Turns on all optional warnings which are desirable for normal code. 9087 At present this is '-Wcomment', '-Wtrigraphs', '-Wmultichar' and a 9088 warning about integer promotion causing a change of sign in '#if' 9089 expressions. Note that many of the preprocessor's warnings are on 9090 by default and have no options to control them. 9091 9092 '-Wcomment' 9093 '-Wcomments' 9094 Warn whenever a comment-start sequence '/*' appears in a '/*' 9095 comment, or whenever a backslash-newline appears in a '//' comment. 9096 (Both forms have the same effect.) 9097 9098 '-Wtrigraphs' 9099 Most trigraphs in comments cannot affect the meaning of the 9100 program. However, a trigraph that would form an escaped newline 9101 ('??/' at the end of a line) can, by changing where the comment 9102 begins or ends. Therefore, only trigraphs that would form escaped 9103 newlines produce warnings inside a comment. 9104 9105 This option is implied by '-Wall'. If '-Wall' is not given, this 9106 option is still enabled unless trigraphs are enabled. To get 9107 trigraph conversion without warnings, but get the other '-Wall' 9108 warnings, use '-trigraphs -Wall -Wno-trigraphs'. 9109 9110 '-Wtraditional' 9111 Warn about certain constructs that behave differently in 9112 traditional and ISO C. Also warn about ISO C constructs that have 9113 no traditional C equivalent, and problematic constructs which 9114 should be avoided. 9115 9116 '-Wundef' 9117 Warn whenever an identifier which is not a macro is encountered in 9118 an '#if' directive, outside of 'defined'. Such identifiers are 9119 replaced with zero. 9120 9121 '-Wunused-macros' 9122 Warn about macros defined in the main file that are unused. A 9123 macro is "used" if it is expanded or tested for existence at least 9124 once. The preprocessor will also warn if the macro has not been 9125 used at the time it is redefined or undefined. 9126 9127 Built-in macros, macros defined on the command line, and macros 9128 defined in include files are not warned about. 9129 9130 _Note:_ If a macro is actually used, but only used in skipped 9131 conditional blocks, then CPP will report it as unused. To avoid 9132 the warning in such a case, you might improve the scope of the 9133 macro's definition by, for example, moving it into the first 9134 skipped block. Alternatively, you could provide a dummy use with 9135 something like: 9136 9137 #if defined the_macro_causing_the_warning 9138 #endif 9139 9140 '-Wendif-labels' 9141 Warn whenever an '#else' or an '#endif' are followed by text. This 9142 usually happens in code of the form 9143 9144 #if FOO 9145 ... 9146 #else FOO 9147 ... 9148 #endif FOO 9149 9150 The second and third 'FOO' should be in comments, but often are not 9151 in older programs. This warning is on by default. 9152 9153 '-Werror' 9154 Make all warnings into hard errors. Source code which triggers 9155 warnings will be rejected. 9156 9157 '-Wsystem-headers' 9158 Issue warnings for code in system headers. These are normally 9159 unhelpful in finding bugs in your own code, therefore suppressed. 9160 If you are responsible for the system library, you may want to see 9161 them. 9162 9163 '-w' 9164 Suppress all warnings, including those which GNU CPP issues by 9165 default. 9166 9167 '-pedantic' 9168 Issue all the mandatory diagnostics listed in the C standard. Some 9169 of them are left out by default, since they trigger frequently on 9170 harmless code. 9171 9172 '-pedantic-errors' 9173 Issue all the mandatory diagnostics, and make all mandatory 9174 diagnostics into errors. This includes mandatory diagnostics that 9175 GCC issues without '-pedantic' but treats as warnings. 9176 9177 '-M' 9178 Instead of outputting the result of preprocessing, output a rule 9179 suitable for 'make' describing the dependencies of the main source 9180 file. The preprocessor outputs one 'make' rule containing the 9181 object file name for that source file, a colon, and the names of 9182 all the included files, including those coming from '-include' or 9183 '-imacros' command line options. 9184 9185 Unless specified explicitly (with '-MT' or '-MQ'), the object file 9186 name consists of the name of the source file with any suffix 9187 replaced with object file suffix and with any leading directory 9188 parts removed. If there are many included files then the rule is 9189 split into several lines using '\'-newline. The rule has no 9190 commands. 9191 9192 This option does not suppress the preprocessor's debug output, such 9193 as '-dM'. To avoid mixing such debug output with the dependency 9194 rules you should explicitly specify the dependency output file with 9195 '-MF', or use an environment variable like 'DEPENDENCIES_OUTPUT' 9196 (*note Environment Variables::). Debug output will still be sent 9197 to the regular output stream as normal. 9198 9199 Passing '-M' to the driver implies '-E', and suppresses warnings 9200 with an implicit '-w'. 9201 9202 '-MM' 9203 Like '-M' but do not mention header files that are found in system 9204 header directories, nor header files that are included, directly or 9205 indirectly, from such a header. 9206 9207 This implies that the choice of angle brackets or double quotes in 9208 an '#include' directive does not in itself determine whether that 9209 header will appear in '-MM' dependency output. This is a slight 9210 change in semantics from GCC versions 3.0 and earlier. 9211 9212 '-MF FILE' 9213 When used with '-M' or '-MM', specifies a file to write the 9214 dependencies to. If no '-MF' switch is given the preprocessor 9215 sends the rules to the same place it would have sent preprocessed 9216 output. 9217 9218 When used with the driver options '-MD' or '-MMD', '-MF' overrides 9219 the default dependency output file. 9220 9221 '-MG' 9222 In conjunction with an option such as '-M' requesting dependency 9223 generation, '-MG' assumes missing header files are generated files 9224 and adds them to the dependency list without raising an error. The 9225 dependency filename is taken directly from the '#include' directive 9226 without prepending any path. '-MG' also suppresses preprocessed 9227 output, as a missing header file renders this useless. 9228 9229 This feature is used in automatic updating of makefiles. 9230 9231 '-MP' 9232 This option instructs CPP to add a phony target for each dependency 9233 other than the main file, causing each to depend on nothing. These 9234 dummy rules work around errors 'make' gives if you remove header 9235 files without updating the 'Makefile' to match. 9236 9237 This is typical output: 9238 9239 test.o: test.c test.h 9240 9241 test.h: 9242 9243 '-MT TARGET' 9244 9245 Change the target of the rule emitted by dependency generation. By 9246 default CPP takes the name of the main input file, deletes any 9247 directory components and any file suffix such as '.c', and appends 9248 the platform's usual object suffix. The result is the target. 9249 9250 An '-MT' option will set the target to be exactly the string you 9251 specify. If you want multiple targets, you can specify them as a 9252 single argument to '-MT', or use multiple '-MT' options. 9253 9254 For example, '-MT '$(objpfx)foo.o'' might give 9255 9256 $(objpfx)foo.o: foo.c 9257 9258 '-MQ TARGET' 9259 9260 Same as '-MT', but it quotes any characters which are special to 9261 Make. '-MQ '$(objpfx)foo.o'' gives 9262 9263 $$(objpfx)foo.o: foo.c 9264 9265 The default target is automatically quoted, as if it were given 9266 with '-MQ'. 9267 9268 '-MD' 9269 '-MD' is equivalent to '-M -MF FILE', except that '-E' is not 9270 implied. The driver determines FILE based on whether an '-o' 9271 option is given. If it is, the driver uses its argument but with a 9272 suffix of '.d', otherwise it takes the name of the input file, 9273 removes any directory components and suffix, and applies a '.d' 9274 suffix. 9275 9276 If '-MD' is used in conjunction with '-E', any '-o' switch is 9277 understood to specify the dependency output file (*note -MF: 9278 dashMF.), but if used without '-E', each '-o' is understood to 9279 specify a target object file. 9280 9281 Since '-E' is not implied, '-MD' can be used to generate a 9282 dependency output file as a side-effect of the compilation process. 9283 9284 '-MMD' 9285 Like '-MD' except mention only user header files, not system header 9286 files. 9287 9288 '-fpch-deps' 9289 When using precompiled headers (*note Precompiled Headers::), this 9290 flag will cause the dependency-output flags to also list the files 9291 from the precompiled header's dependencies. If not specified only 9292 the precompiled header would be listed and not the files that were 9293 used to create it because those files are not consulted when a 9294 precompiled header is used. 9295 9296 '-fpch-preprocess' 9297 This option allows use of a precompiled header (*note Precompiled 9298 Headers::) together with '-E'. It inserts a special '#pragma', 9299 '#pragma GCC pch_preprocess "FILENAME"' in the output to mark the 9300 place where the precompiled header was found, and its FILENAME. 9301 When '-fpreprocessed' is in use, GCC recognizes this '#pragma' and 9302 loads the PCH. 9303 9304 This option is off by default, because the resulting preprocessed 9305 output is only really suitable as input to GCC. It is switched on 9306 by '-save-temps'. 9307 9308 You should not write this '#pragma' in your own code, but it is 9309 safe to edit the filename if the PCH file is available in a 9310 different location. The filename may be absolute or it may be 9311 relative to GCC's current directory. 9312 9313 '-x c' 9314 '-x c++' 9315 '-x objective-c' 9316 '-x assembler-with-cpp' 9317 Specify the source language: C, C++, Objective-C, or assembly. 9318 This has nothing to do with standards conformance or extensions; it 9319 merely selects which base syntax to expect. If you give none of 9320 these options, cpp will deduce the language from the extension of 9321 the source file: '.c', '.cc', '.m', or '.S'. Some other common 9322 extensions for C++ and assembly are also recognized. If cpp does 9323 not recognize the extension, it will treat the file as C; this is 9324 the most generic mode. 9325 9326 _Note:_ Previous versions of cpp accepted a '-lang' option which 9327 selected both the language and the standards conformance level. 9328 This option has been removed, because it conflicts with the '-l' 9329 option. 9330 9331 '-std=STANDARD' 9332 '-ansi' 9333 Specify the standard to which the code should conform. Currently 9334 CPP knows about C and C++ standards; others may be added in the 9335 future. 9336 9337 STANDARD may be one of: 9338 'c90' 9339 'c89' 9340 'iso9899:1990' 9341 The ISO C standard from 1990. 'c90' is the customary 9342 shorthand for this version of the standard. 9343 9344 The '-ansi' option is equivalent to '-std=c90'. 9345 9346 'iso9899:199409' 9347 The 1990 C standard, as amended in 1994. 9348 9349 'iso9899:1999' 9350 'c99' 9351 'iso9899:199x' 9352 'c9x' 9353 The revised ISO C standard, published in December 1999. 9354 Before publication, this was known as C9X. 9355 9356 'iso9899:2011' 9357 'c11' 9358 'c1x' 9359 The revised ISO C standard, published in December 2011. 9360 Before publication, this was known as C1X. 9361 9362 'gnu90' 9363 'gnu89' 9364 The 1990 C standard plus GNU extensions. This is the default. 9365 9366 'gnu99' 9367 'gnu9x' 9368 The 1999 C standard plus GNU extensions. 9369 9370 'gnu11' 9371 'gnu1x' 9372 The 2011 C standard plus GNU extensions. 9373 9374 'c++98' 9375 The 1998 ISO C++ standard plus amendments. 9376 9377 'gnu++98' 9378 The same as '-std=c++98' plus GNU extensions. This is the 9379 default for C++ code. 9380 9381 '-I-' 9382 Split the include path. Any directories specified with '-I' 9383 options before '-I-' are searched only for headers requested with 9384 '#include "FILE"'; they are not searched for '#include <FILE>'. If 9385 additional directories are specified with '-I' options after the 9386 '-I-', those directories are searched for all '#include' 9387 directives. 9388 9389 In addition, '-I-' inhibits the use of the directory of the current 9390 file directory as the first search directory for '#include "FILE"'. 9391 This option has been deprecated. 9392 9393 '-nostdinc' 9394 Do not search the standard system directories for header files. 9395 Only the directories you have specified with '-I' options (and the 9396 directory of the current file, if appropriate) are searched. 9397 9398 '-nostdinc++' 9399 Do not search for header files in the C++-specific standard 9400 directories, but do still search the other standard directories. 9401 (This option is used when building the C++ library.) 9402 9403 '-include FILE' 9404 Process FILE as if '#include "file"' appeared as the first line of 9405 the primary source file. However, the first directory searched for 9406 FILE is the preprocessor's working directory _instead of_ the 9407 directory containing the main source file. If not found there, it 9408 is searched for in the remainder of the '#include "..."' search 9409 chain as normal. 9410 9411 If multiple '-include' options are given, the files are included in 9412 the order they appear on the command line. 9413 9414 '-imacros FILE' 9415 Exactly like '-include', except that any output produced by 9416 scanning FILE is thrown away. Macros it defines remain defined. 9417 This allows you to acquire all the macros from a header without 9418 also processing its declarations. 9419 9420 All files specified by '-imacros' are processed before all files 9421 specified by '-include'. 9422 9423 '-idirafter DIR' 9424 Search DIR for header files, but do it _after_ all directories 9425 specified with '-I' and the standard system directories have been 9426 exhausted. DIR is treated as a system include directory. If DIR 9427 begins with '=', then the '=' will be replaced by the sysroot 9428 prefix; see '--sysroot' and '-isysroot'. 9429 9430 '-iprefix PREFIX' 9431 Specify PREFIX as the prefix for subsequent '-iwithprefix' options. 9432 If the prefix represents a directory, you should include the final 9433 '/'. 9434 9435 '-iwithprefix DIR' 9436 '-iwithprefixbefore DIR' 9437 Append DIR to the prefix specified previously with '-iprefix', and 9438 add the resulting directory to the include search path. 9439 '-iwithprefixbefore' puts it in the same place '-I' would; 9440 '-iwithprefix' puts it where '-idirafter' would. 9441 9442 '-isysroot DIR' 9443 This option is like the '--sysroot' option, but applies only to 9444 header files (except for Darwin targets, where it applies to both 9445 header files and libraries). See the '--sysroot' option for more 9446 information. 9447 9448 '-imultilib DIR' 9449 Use DIR as a subdirectory of the directory containing 9450 target-specific C++ headers. 9451 9452 '-isystem DIR' 9453 Search DIR for header files, after all directories specified by 9454 '-I' but before the standard system directories. Mark it as a 9455 system directory, so that it gets the same special treatment as is 9456 applied to the standard system directories. If DIR begins with 9457 '=', then the '=' will be replaced by the sysroot prefix; see 9458 '--sysroot' and '-isysroot'. 9459 9460 '-iquote DIR' 9461 Search DIR only for header files requested with '#include "FILE"'; 9462 they are not searched for '#include <FILE>', before all directories 9463 specified by '-I' and before the standard system directories. If 9464 DIR begins with '=', then the '=' will be replaced by the sysroot 9465 prefix; see '--sysroot' and '-isysroot'. 9466 9467 '-fdirectives-only' 9468 When preprocessing, handle directives, but do not expand macros. 9469 9470 The option's behavior depends on the '-E' and '-fpreprocessed' 9471 options. 9472 9473 With '-E', preprocessing is limited to the handling of directives 9474 such as '#define', '#ifdef', and '#error'. Other preprocessor 9475 operations, such as macro expansion and trigraph conversion are not 9476 performed. In addition, the '-dD' option is implicitly enabled. 9477 9478 With '-fpreprocessed', predefinition of command line and most 9479 builtin macros is disabled. Macros such as '__LINE__', which are 9480 contextually dependent, are handled normally. This enables 9481 compilation of files previously preprocessed with '-E 9482 -fdirectives-only'. 9483 9484 With both '-E' and '-fpreprocessed', the rules for '-fpreprocessed' 9485 take precedence. This enables full preprocessing of files 9486 previously preprocessed with '-E -fdirectives-only'. 9487 9488 '-fdollars-in-identifiers' 9489 Accept '$' in identifiers. 9490 9491 '-fextended-identifiers' 9492 Accept universal character names in identifiers. This option is 9493 experimental; in a future version of GCC, it will be enabled by 9494 default for C99 and C++. 9495 9496 '-fno-canonical-system-headers' 9497 When preprocessing, do not shorten system header paths with 9498 canonicalization. 9499 9500 '-fpreprocessed' 9501 Indicate to the preprocessor that the input file has already been 9502 preprocessed. This suppresses things like macro expansion, 9503 trigraph conversion, escaped newline splicing, and processing of 9504 most directives. The preprocessor still recognizes and removes 9505 comments, so that you can pass a file preprocessed with '-C' to the 9506 compiler without problems. In this mode the integrated 9507 preprocessor is little more than a tokenizer for the front ends. 9508 9509 '-fpreprocessed' is implicit if the input file has one of the 9510 extensions '.i', '.ii' or '.mi'. These are the extensions that GCC 9511 uses for preprocessed files created by '-save-temps'. 9512 9513 '-ftabstop=WIDTH' 9514 Set the distance between tab stops. This helps the preprocessor 9515 report correct column numbers in warnings or errors, even if tabs 9516 appear on the line. If the value is less than 1 or greater than 9517 100, the option is ignored. The default is 8. 9518 9519 '-fdebug-cpp' 9520 This option is only useful for debugging GCC. When used with '-E', 9521 dumps debugging information about location maps. Every token in 9522 the output is preceded by the dump of the map its location belongs 9523 to. The dump of the map holding the location of a token would be: 9524 {'P':/file/path;'F':/includer/path;'L':LINE_NUM;'C':COL_NUM;'S':SYSTEM_HEADER_P;'M':MAP_ADDRESS;'E':MACRO_EXPANSION_P,'loc':LOCATION} 9525 9526 When used without '-E', this option has no effect. 9527 9528 '-ftrack-macro-expansion[=LEVEL]' 9529 Track locations of tokens across macro expansions. This allows the 9530 compiler to emit diagnostic about the current macro expansion stack 9531 when a compilation error occurs in a macro expansion. Using this 9532 option makes the preprocessor and the compiler consume more memory. 9533 The LEVEL parameter can be used to choose the level of precision of 9534 token location tracking thus decreasing the memory consumption if 9535 necessary. Value '0' of LEVEL de-activates this option just as if 9536 no '-ftrack-macro-expansion' was present on the command line. 9537 Value '1' tracks tokens locations in a degraded mode for the sake 9538 of minimal memory overhead. In this mode all tokens resulting from 9539 the expansion of an argument of a function-like macro have the same 9540 location. Value '2' tracks tokens locations completely. This 9541 value is the most memory hungry. When this option is given no 9542 argument, the default parameter value is '2'. 9543 9544 Note that -ftrack-macro-expansion=2 is activated by default. 9545 9546 '-fexec-charset=CHARSET' 9547 Set the execution character set, used for string and character 9548 constants. The default is UTF-8. CHARSET can be any encoding 9549 supported by the system's 'iconv' library routine. 9550 9551 '-fwide-exec-charset=CHARSET' 9552 Set the wide execution character set, used for wide string and 9553 character constants. The default is UTF-32 or UTF-16, whichever 9554 corresponds to the width of 'wchar_t'. As with '-fexec-charset', 9555 CHARSET can be any encoding supported by the system's 'iconv' 9556 library routine; however, you will have problems with encodings 9557 that do not fit exactly in 'wchar_t'. 9558 9559 '-finput-charset=CHARSET' 9560 Set the input character set, used for translation from the 9561 character set of the input file to the source character set used by 9562 GCC. If the locale does not specify, or GCC cannot get this 9563 information from the locale, the default is UTF-8. This can be 9564 overridden by either the locale or this command line option. 9565 Currently the command line option takes precedence if there's a 9566 conflict. CHARSET can be any encoding supported by the system's 9567 'iconv' library routine. 9568 9569 '-fworking-directory' 9570 Enable generation of linemarkers in the preprocessor output that 9571 will let the compiler know the current working directory at the 9572 time of preprocessing. When this option is enabled, the 9573 preprocessor will emit, after the initial linemarker, a second 9574 linemarker with the current working directory followed by two 9575 slashes. GCC will use this directory, when it's present in the 9576 preprocessed input, as the directory emitted as the current working 9577 directory in some debugging information formats. This option is 9578 implicitly enabled if debugging information is enabled, but this 9579 can be inhibited with the negated form '-fno-working-directory'. 9580 If the '-P' flag is present in the command line, this option has no 9581 effect, since no '#line' directives are emitted whatsoever. 9582 9583 '-fno-show-column' 9584 Do not print column numbers in diagnostics. This may be necessary 9585 if diagnostics are being scanned by a program that does not 9586 understand the column numbers, such as 'dejagnu'. 9587 9588 '-A PREDICATE=ANSWER' 9589 Make an assertion with the predicate PREDICATE and answer ANSWER. 9590 This form is preferred to the older form '-A PREDICATE(ANSWER)', 9591 which is still supported, because it does not use shell special 9592 characters. 9593 9594 '-A -PREDICATE=ANSWER' 9595 Cancel an assertion with the predicate PREDICATE and answer ANSWER. 9596 9597 '-dCHARS' 9598 CHARS is a sequence of one or more of the following characters, and 9599 must not be preceded by a space. Other characters are interpreted 9600 by the compiler proper, or reserved for future versions of GCC, and 9601 so are silently ignored. If you specify characters whose behavior 9602 conflicts, the result is undefined. 9603 9604 'M' 9605 Instead of the normal output, generate a list of '#define' 9606 directives for all the macros defined during the execution of 9607 the preprocessor, including predefined macros. This gives you 9608 a way of finding out what is predefined in your version of the 9609 preprocessor. Assuming you have no file 'foo.h', the command 9610 9611 touch foo.h; cpp -dM foo.h 9612 9613 will show all the predefined macros. 9614 9615 If you use '-dM' without the '-E' option, '-dM' is interpreted 9616 as a synonym for '-fdump-rtl-mach'. *Note (gcc)Debugging 9617 Options::. 9618 9619 'D' 9620 Like 'M' except in two respects: it does _not_ include the 9621 predefined macros, and it outputs _both_ the '#define' 9622 directives and the result of preprocessing. Both kinds of 9623 output go to the standard output file. 9624 9625 'N' 9626 Like 'D', but emit only the macro names, not their expansions. 9627 9628 'I' 9629 Output '#include' directives in addition to the result of 9630 preprocessing. 9631 9632 'U' 9633 Like 'D' except that only macros that are expanded, or whose 9634 definedness is tested in preprocessor directives, are output; 9635 the output is delayed until the use or test of the macro; and 9636 '#undef' directives are also output for macros tested but 9637 undefined at the time. 9638 9639 '-P' 9640 Inhibit generation of linemarkers in the output from the 9641 preprocessor. This might be useful when running the preprocessor 9642 on something that is not C code, and will be sent to a program 9643 which might be confused by the linemarkers. 9644 9645 '-C' 9646 Do not discard comments. All comments are passed through to the 9647 output file, except for comments in processed directives, which are 9648 deleted along with the directive. 9649 9650 You should be prepared for side effects when using '-C'; it causes 9651 the preprocessor to treat comments as tokens in their own right. 9652 For example, comments appearing at the start of what would be a 9653 directive line have the effect of turning that line into an 9654 ordinary source line, since the first token on the line is no 9655 longer a '#'. 9656 9657 '-CC' 9658 Do not discard comments, including during macro expansion. This is 9659 like '-C', except that comments contained within macros are also 9660 passed through to the output file where the macro is expanded. 9661 9662 In addition to the side-effects of the '-C' option, the '-CC' 9663 option causes all C++-style comments inside a macro to be converted 9664 to C-style comments. This is to prevent later use of that macro 9665 from inadvertently commenting out the remainder of the source line. 9666 9667 The '-CC' option is generally used to support lint comments. 9668 9669 '-traditional-cpp' 9670 Try to imitate the behavior of old-fashioned C preprocessors, as 9671 opposed to ISO C preprocessors. 9672 9673 '-trigraphs' 9674 Process trigraph sequences. These are three-character sequences, 9675 all starting with '??', that are defined by ISO C to stand for 9676 single characters. For example, '??/' stands for '\', so ''??/n'' 9677 is a character constant for a newline. By default, GCC ignores 9678 trigraphs, but in standard-conforming modes it converts them. See 9679 the '-std' and '-ansi' options. 9680 9681 The nine trigraphs and their replacements are 9682 9683 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- 9684 Replacement: [ ] { } # \ ^ | ~ 9685 9686 '-remap' 9687 Enable special code to work around file systems which only permit 9688 very short file names, such as MS-DOS. 9689 9690 '--help' 9691 '--target-help' 9692 Print text describing all the command line options instead of 9693 preprocessing anything. 9694 9695 '-v' 9696 Verbose mode. Print out GNU CPP's version number at the beginning 9697 of execution, and report the final form of the include path. 9698 9699 '-H' 9700 Print the name of each header file used, in addition to other 9701 normal activities. Each name is indented to show how deep in the 9702 '#include' stack it is. Precompiled header files are also printed, 9703 even if they are found to be invalid; an invalid precompiled header 9704 file is printed with '...x' and a valid one with '...!' . 9705 9706 '-version' 9707 '--version' 9708 Print out GNU CPP's version number. With one dash, proceed to 9709 preprocess as normal. With two dashes, exit immediately. 9710 9711 9712 File: gcc.info, Node: Assembler Options, Next: Link Options, Prev: Preprocessor Options, Up: Invoking GCC 9713 9714 3.12 Passing Options to the Assembler 9715 ===================================== 9716 9717 You can pass options to the assembler. 9718 9719 '-Wa,OPTION' 9720 Pass OPTION as an option to the assembler. If OPTION contains 9721 commas, it is split into multiple options at the commas. 9722 9723 '-Xassembler OPTION' 9724 Pass OPTION as an option to the assembler. You can use this to 9725 supply system-specific assembler options that GCC does not 9726 recognize. 9727 9728 If you want to pass an option that takes an argument, you must use 9729 '-Xassembler' twice, once for the option and once for the argument. 9730 9731 9732 File: gcc.info, Node: Link Options, Next: Directory Options, Prev: Assembler Options, Up: Invoking GCC 9733 9734 3.13 Options for Linking 9735 ======================== 9736 9737 These options come into play when the compiler links object files into 9738 an executable output file. They are meaningless if the compiler is not 9739 doing a link step. 9740 9741 'OBJECT-FILE-NAME' 9742 A file name that does not end in a special recognized suffix is 9743 considered to name an object file or library. (Object files are 9744 distinguished from libraries by the linker according to the file 9745 contents.) If linking is done, these object files are used as 9746 input to the linker. 9747 9748 '-c' 9749 '-S' 9750 '-E' 9751 If any of these options is used, then the linker is not run, and 9752 object file names should not be used as arguments. *Note Overall 9753 Options::. 9754 9755 '-lLIBRARY' 9756 '-l LIBRARY' 9757 Search the library named LIBRARY when linking. (The second 9758 alternative with the library as a separate argument is only for 9759 POSIX compliance and is not recommended.) 9760 9761 It makes a difference where in the command you write this option; 9762 the linker searches and processes libraries and object files in the 9763 order they are specified. Thus, 'foo.o -lz bar.o' searches library 9764 'z' after file 'foo.o' but before 'bar.o'. If 'bar.o' refers to 9765 functions in 'z', those functions may not be loaded. 9766 9767 The linker searches a standard list of directories for the library, 9768 which is actually a file named 'libLIBRARY.a'. The linker then 9769 uses this file as if it had been specified precisely by name. 9770 9771 The directories searched include several standard system 9772 directories plus any that you specify with '-L'. 9773 9774 Normally the files found this way are library files--archive files 9775 whose members are object files. The linker handles an archive file 9776 by scanning through it for members which define symbols that have 9777 so far been referenced but not defined. But if the file that is 9778 found is an ordinary object file, it is linked in the usual 9779 fashion. The only difference between using an '-l' option and 9780 specifying a file name is that '-l' surrounds LIBRARY with 'lib' 9781 and '.a' and searches several directories. 9782 9783 '-lobjc' 9784 You need this special case of the '-l' option in order to link an 9785 Objective-C or Objective-C++ program. 9786 9787 '-nostartfiles' 9788 Do not use the standard system startup files when linking. The 9789 standard system libraries are used normally, unless '-nostdlib' or 9790 '-nodefaultlibs' is used. 9791 9792 '-nodefaultlibs' 9793 Do not use the standard system libraries when linking. Only the 9794 libraries you specify are passed to the linker, and options 9795 specifying linkage of the system libraries, such as 9796 '-static-libgcc' or '-shared-libgcc', are ignored. The standard 9797 startup files are used normally, unless '-nostartfiles' is used. 9798 9799 The compiler may generate calls to 'memcmp', 'memset', 'memcpy' and 9800 'memmove'. These entries are usually resolved by entries in libc. 9801 These entry points should be supplied through some other mechanism 9802 when this option is specified. 9803 9804 '-nostdlib' 9805 Do not use the standard system startup files or libraries when 9806 linking. No startup files and only the libraries you specify are 9807 passed to the linker, and options specifying linkage of the system 9808 libraries, such as '-static-libgcc' or '-shared-libgcc', are 9809 ignored. 9810 9811 The compiler may generate calls to 'memcmp', 'memset', 'memcpy' and 9812 'memmove'. These entries are usually resolved by entries in libc. 9813 These entry points should be supplied through some other mechanism 9814 when this option is specified. 9815 9816 One of the standard libraries bypassed by '-nostdlib' and 9817 '-nodefaultlibs' is 'libgcc.a', a library of internal subroutines 9818 which GCC uses to overcome shortcomings of particular machines, or 9819 special needs for some languages. (*Note Interfacing to GCC 9820 Output: (gccint)Interface, for more discussion of 'libgcc.a'.) In 9821 most cases, you need 'libgcc.a' even when you want to avoid other 9822 standard libraries. In other words, when you specify '-nostdlib' 9823 or '-nodefaultlibs' you should usually specify '-lgcc' as well. 9824 This ensures that you have no unresolved references to internal GCC 9825 library subroutines. (An example of such an internal subroutine is 9826 '__main', used to ensure C++ constructors are called; *note 9827 'collect2': (gccint)Collect2.) 9828 9829 '-pie' 9830 Produce a position independent executable on targets that support 9831 it. For predictable results, you must also specify the same set of 9832 options used for compilation ('-fpie', '-fPIE', or model 9833 suboptions) when you specify this linker option. 9834 9835 '-rdynamic' 9836 Pass the flag '-export-dynamic' to the ELF linker, on targets that 9837 support it. This instructs the linker to add all symbols, not only 9838 used ones, to the dynamic symbol table. This option is needed for 9839 some uses of 'dlopen' or to allow obtaining backtraces from within 9840 a program. 9841 9842 '-s' 9843 Remove all symbol table and relocation information from the 9844 executable. 9845 9846 '-static' 9847 On systems that support dynamic linking, this prevents linking with 9848 the shared libraries. On other systems, this option has no effect. 9849 9850 '-shared' 9851 Produce a shared object which can then be linked with other objects 9852 to form an executable. Not all systems support this option. For 9853 predictable results, you must also specify the same set of options 9854 used for compilation ('-fpic', '-fPIC', or model suboptions) when 9855 you specify this linker option.(1) 9856 9857 '-shared-libgcc' 9858 '-static-libgcc' 9859 On systems that provide 'libgcc' as a shared library, these options 9860 force the use of either the shared or static version, respectively. 9861 If no shared version of 'libgcc' was built when the compiler was 9862 configured, these options have no effect. 9863 9864 There are several situations in which an application should use the 9865 shared 'libgcc' instead of the static version. The most common of 9866 these is when the application wishes to throw and catch exceptions 9867 across different shared libraries. In that case, each of the 9868 libraries as well as the application itself should use the shared 9869 'libgcc'. 9870 9871 Therefore, the G++ and GCJ drivers automatically add 9872 '-shared-libgcc' whenever you build a shared library or a main 9873 executable, because C++ and Java programs typically use exceptions, 9874 so this is the right thing to do. 9875 9876 If, instead, you use the GCC driver to create shared libraries, you 9877 may find that they are not always linked with the shared 'libgcc'. 9878 If GCC finds, at its configuration time, that you have a non-GNU 9879 linker or a GNU linker that does not support option 9880 '--eh-frame-hdr', it links the shared version of 'libgcc' into 9881 shared libraries by default. Otherwise, it takes advantage of the 9882 linker and optimizes away the linking with the shared version of 9883 'libgcc', linking with the static version of libgcc by default. 9884 This allows exceptions to propagate through such shared libraries, 9885 without incurring relocation costs at library load time. 9886 9887 However, if a library or main executable is supposed to throw or 9888 catch exceptions, you must link it using the G++ or GCJ driver, as 9889 appropriate for the languages used in the program, or using the 9890 option '-shared-libgcc', such that it is linked with the shared 9891 'libgcc'. 9892 9893 '-static-libasan' 9894 When the '-fsanitize=address' option is used to link a program, the 9895 GCC driver automatically links against 'libasan'. If 'libasan' is 9896 available as a shared library, and the '-static' option is not 9897 used, then this links against the shared version of 'libasan'. The 9898 '-static-libasan' option directs the GCC driver to link 'libasan' 9899 statically, without necessarily linking other libraries statically. 9900 9901 '-static-libtsan' 9902 When the '-fsanitize=thread' option is used to link a program, the 9903 GCC driver automatically links against 'libtsan'. If 'libtsan' is 9904 available as a shared library, and the '-static' option is not 9905 used, then this links against the shared version of 'libtsan'. The 9906 '-static-libtsan' option directs the GCC driver to link 'libtsan' 9907 statically, without necessarily linking other libraries statically. 9908 9909 '-static-libstdc++' 9910 When the 'g++' program is used to link a C++ program, it normally 9911 automatically links against 'libstdc++'. If 'libstdc++' is 9912 available as a shared library, and the '-static' option is not 9913 used, then this links against the shared version of 'libstdc++'. 9914 That is normally fine. However, it is sometimes useful to freeze 9915 the version of 'libstdc++' used by the program without going all 9916 the way to a fully static link. The '-static-libstdc++' option 9917 directs the 'g++' driver to link 'libstdc++' statically, without 9918 necessarily linking other libraries statically. 9919 9920 '-symbolic' 9921 Bind references to global symbols when building a shared object. 9922 Warn about any unresolved references (unless overridden by the link 9923 editor option '-Xlinker -z -Xlinker defs'). Only a few systems 9924 support this option. 9925 9926 '-T SCRIPT' 9927 Use SCRIPT as the linker script. This option is supported by most 9928 systems using the GNU linker. On some targets, such as bare-board 9929 targets without an operating system, the '-T' option may be 9930 required when linking to avoid references to undefined symbols. 9931 9932 '-Xlinker OPTION' 9933 Pass OPTION as an option to the linker. You can use this to supply 9934 system-specific linker options that GCC does not recognize. 9935 9936 If you want to pass an option that takes a separate argument, you 9937 must use '-Xlinker' twice, once for the option and once for the 9938 argument. For example, to pass '-assert definitions', you must 9939 write '-Xlinker -assert -Xlinker definitions'. It does not work to 9940 write '-Xlinker "-assert definitions"', because this passes the 9941 entire string as a single argument, which is not what the linker 9942 expects. 9943 9944 When using the GNU linker, it is usually more convenient to pass 9945 arguments to linker options using the 'OPTION=VALUE' syntax than as 9946 separate arguments. For example, you can specify '-Xlinker 9947 -Map=output.map' rather than '-Xlinker -Map -Xlinker output.map'. 9948 Other linkers may not support this syntax for command-line options. 9949 9950 '-Wl,OPTION' 9951 Pass OPTION as an option to the linker. If OPTION contains commas, 9952 it is split into multiple options at the commas. You can use this 9953 syntax to pass an argument to the option. For example, 9954 '-Wl,-Map,output.map' passes '-Map output.map' to the linker. When 9955 using the GNU linker, you can also get the same effect with 9956 '-Wl,-Map=output.map'. 9957 9958 '-u SYMBOL' 9959 Pretend the symbol SYMBOL is undefined, to force linking of library 9960 modules to define it. You can use '-u' multiple times with 9961 different symbols to force loading of additional library modules. 9962 9963 ---------- Footnotes ---------- 9964 9965 (1) On some systems, 'gcc -shared' needs to build supplementary stub 9966 code for constructors to work. On multi-libbed systems, 'gcc -shared' 9967 must select the correct support libraries to link against. Failing to 9968 supply the correct flags may lead to subtle defects. Supplying them in 9969 cases where they are not necessary is innocuous. 9970 9971 9972 File: gcc.info, Node: Directory Options, Next: Spec Files, Prev: Link Options, Up: Invoking GCC 9973 9974 3.14 Options for Directory Search 9975 ================================= 9976 9977 These options specify directories to search for header files, for 9978 libraries and for parts of the compiler: 9979 9980 '-IDIR' 9981 Add the directory DIR to the head of the list of directories to be 9982 searched for header files. This can be used to override a system 9983 header file, substituting your own version, since these directories 9984 are searched before the system header file directories. However, 9985 you should not use this option to add directories that contain 9986 vendor-supplied system header files (use '-isystem' for that). If 9987 you use more than one '-I' option, the directories are scanned in 9988 left-to-right order; the standard system directories come after. 9989 9990 If a standard system include directory, or a directory specified 9991 with '-isystem', is also specified with '-I', the '-I' option is 9992 ignored. The directory is still searched but as a system directory 9993 at its normal position in the system include chain. This is to 9994 ensure that GCC's procedure to fix buggy system headers and the 9995 ordering for the 'include_next' directive are not inadvertently 9996 changed. If you really need to change the search order for system 9997 directories, use the '-nostdinc' and/or '-isystem' options. 9998 9999 '-iplugindir=DIR' 10000 Set the directory to search for plugins that are passed by 10001 '-fplugin=NAME' instead of '-fplugin=PATH/NAME.so'. This option is 10002 not meant to be used by the user, but only passed by the driver. 10003 10004 '-iquoteDIR' 10005 Add the directory DIR to the head of the list of directories to be 10006 searched for header files only for the case of '#include "FILE"'; 10007 they are not searched for '#include <FILE>', otherwise just like 10008 '-I'. 10009 10010 '-LDIR' 10011 Add directory DIR to the list of directories to be searched for 10012 '-l'. 10013 10014 '-BPREFIX' 10015 This option specifies where to find the executables, libraries, 10016 include files, and data files of the compiler itself. 10017 10018 The compiler driver program runs one or more of the subprograms 10019 'cpp', 'cc1', 'as' and 'ld'. It tries PREFIX as a prefix for each 10020 program it tries to run, both with and without 'MACHINE/VERSION/' 10021 (*note Target Options::). 10022 10023 For each subprogram to be run, the compiler driver first tries the 10024 '-B' prefix, if any. If that name is not found, or if '-B' is not 10025 specified, the driver tries two standard prefixes, '/usr/lib/gcc/' 10026 and '/usr/local/lib/gcc/'. If neither of those results in a file 10027 name that is found, the unmodified program name is searched for 10028 using the directories specified in your 'PATH' environment 10029 variable. 10030 10031 The compiler checks to see if the path provided by the '-B' refers 10032 to a directory, and if necessary it adds a directory separator 10033 character at the end of the path. 10034 10035 '-B' prefixes that effectively specify directory names also apply 10036 to libraries in the linker, because the compiler translates these 10037 options into '-L' options for the linker. They also apply to 10038 includes files in the preprocessor, because the compiler translates 10039 these options into '-isystem' options for the preprocessor. In 10040 this case, the compiler appends 'include' to the prefix. 10041 10042 The runtime support file 'libgcc.a' can also be searched for using 10043 the '-B' prefix, if needed. If it is not found there, the two 10044 standard prefixes above are tried, and that is all. The file is 10045 left out of the link if it is not found by those means. 10046 10047 Another way to specify a prefix much like the '-B' prefix is to use 10048 the environment variable 'GCC_EXEC_PREFIX'. *Note Environment 10049 Variables::. 10050 10051 As a special kludge, if the path provided by '-B' is 10052 '[dir/]stageN/', where N is a number in the range 0 to 9, then it 10053 is replaced by '[dir/]include'. This is to help with 10054 boot-strapping the compiler. 10055 10056 '-specs=FILE' 10057 Process FILE after the compiler reads in the standard 'specs' file, 10058 in order to override the defaults which the 'gcc' driver program 10059 uses when determining what switches to pass to 'cc1', 'cc1plus', 10060 'as', 'ld', etc. More than one '-specs=FILE' can be specified on 10061 the command line, and they are processed in order, from left to 10062 right. 10063 10064 '--sysroot=DIR' 10065 Use DIR as the logical root directory for headers and libraries. 10066 For example, if the compiler normally searches for headers in 10067 '/usr/include' and libraries in '/usr/lib', it instead searches 10068 'DIR/usr/include' and 'DIR/usr/lib'. 10069 10070 If you use both this option and the '-isysroot' option, then the 10071 '--sysroot' option applies to libraries, but the '-isysroot' option 10072 applies to header files. 10073 10074 The GNU linker (beginning with version 2.16) has the necessary 10075 support for this option. If your linker does not support this 10076 option, the header file aspect of '--sysroot' still works, but the 10077 library aspect does not. 10078 10079 '--no-sysroot-suffix' 10080 For some targets, a suffix is added to the root directory specified 10081 with '--sysroot', depending on the other options used, so that 10082 headers may for example be found in 'DIR/SUFFIX/usr/include' 10083 instead of 'DIR/usr/include'. This option disables the addition of 10084 such a suffix. 10085 10086 '-I-' 10087 This option has been deprecated. Please use '-iquote' instead for 10088 '-I' directories before the '-I-' and remove the '-I-'. Any 10089 directories you specify with '-I' options before the '-I-' option 10090 are searched only for the case of '#include "FILE"'; they are not 10091 searched for '#include <FILE>'. 10092 10093 If additional directories are specified with '-I' options after the 10094 '-I-', these directories are searched for all '#include' 10095 directives. (Ordinarily _all_ '-I' directories are used this way.) 10096 10097 In addition, the '-I-' option inhibits the use of the current 10098 directory (where the current input file came from) as the first 10099 search directory for '#include "FILE"'. There is no way to 10100 override this effect of '-I-'. With '-I.' you can specify 10101 searching the directory that is current when the compiler is 10102 invoked. That is not exactly the same as what the preprocessor 10103 does by default, but it is often satisfactory. 10104 10105 '-I-' does not inhibit the use of the standard system directories 10106 for header files. Thus, '-I-' and '-nostdinc' are independent. 10107 10108 10109 File: gcc.info, Node: Spec Files, Next: Target Options, Prev: Directory Options, Up: Invoking GCC 10110 10111 3.15 Specifying subprocesses and the switches to pass to them 10112 ============================================================= 10113 10114 'gcc' is a driver program. It performs its job by invoking a sequence 10115 of other programs to do the work of compiling, assembling and linking. 10116 GCC interprets its command-line parameters and uses these to deduce 10117 which programs it should invoke, and which command-line options it ought 10118 to place on their command lines. This behavior is controlled by "spec 10119 strings". In most cases there is one spec string for each program that 10120 GCC can invoke, but a few programs have multiple spec strings to control 10121 their behavior. The spec strings built into GCC can be overridden by 10122 using the '-specs=' command-line switch to specify a spec file. 10123 10124 "Spec files" are plaintext files that are used to construct spec 10125 strings. They consist of a sequence of directives separated by blank 10126 lines. The type of directive is determined by the first non-whitespace 10127 character on the line, which can be one of the following: 10128 10129 '%COMMAND' 10130 Issues a COMMAND to the spec file processor. The commands that can 10131 appear here are: 10132 10133 '%include <FILE>' 10134 Search for FILE and insert its text at the current point in 10135 the specs file. 10136 10137 '%include_noerr <FILE>' 10138 Just like '%include', but do not generate an error message if 10139 the include file cannot be found. 10140 10141 '%rename OLD_NAME NEW_NAME' 10142 Rename the spec string OLD_NAME to NEW_NAME. 10143 10144 '*[SPEC_NAME]:' 10145 This tells the compiler to create, override or delete the named 10146 spec string. All lines after this directive up to the next 10147 directive or blank line are considered to be the text for the spec 10148 string. If this results in an empty string then the spec is 10149 deleted. (Or, if the spec did not exist, then nothing happens.) 10150 Otherwise, if the spec does not currently exist a new spec is 10151 created. If the spec does exist then its contents are overridden 10152 by the text of this directive, unless the first character of that 10153 text is the '+' character, in which case the text is appended to 10154 the spec. 10155 10156 '[SUFFIX]:' 10157 Creates a new '[SUFFIX] spec' pair. All lines after this directive 10158 and up to the next directive or blank line are considered to make 10159 up the spec string for the indicated suffix. When the compiler 10160 encounters an input file with the named suffix, it processes the 10161 spec string in order to work out how to compile that file. For 10162 example: 10163 10164 .ZZ: 10165 z-compile -input %i 10166 10167 This says that any input file whose name ends in '.ZZ' should be 10168 passed to the program 'z-compile', which should be invoked with the 10169 command-line switch '-input' and with the result of performing the 10170 '%i' substitution. (See below.) 10171 10172 As an alternative to providing a spec string, the text following a 10173 suffix directive can be one of the following: 10174 10175 '@LANGUAGE' 10176 This says that the suffix is an alias for a known LANGUAGE. 10177 This is similar to using the '-x' command-line switch to GCC 10178 to specify a language explicitly. For example: 10179 10180 .ZZ: 10181 @c++ 10182 10183 Says that .ZZ files are, in fact, C++ source files. 10184 10185 '#NAME' 10186 This causes an error messages saying: 10187 10188 NAME compiler not installed on this system. 10189 10190 GCC already has an extensive list of suffixes built into it. This 10191 directive adds an entry to the end of the list of suffixes, but 10192 since the list is searched from the end backwards, it is 10193 effectively possible to override earlier entries using this 10194 technique. 10195 10196 GCC has the following spec strings built into it. Spec files can 10197 override these strings or create their own. Note that individual 10198 targets can also add their own spec strings to this list. 10199 10200 asm Options to pass to the assembler 10201 asm_final Options to pass to the assembler post-processor 10202 cpp Options to pass to the C preprocessor 10203 cc1 Options to pass to the C compiler 10204 cc1plus Options to pass to the C++ compiler 10205 endfile Object files to include at the end of the link 10206 link Options to pass to the linker 10207 lib Libraries to include on the command line to the linker 10208 libgcc Decides which GCC support library to pass to the linker 10209 linker Sets the name of the linker 10210 predefines Defines to be passed to the C preprocessor 10211 signed_char Defines to pass to CPP to say whether char is signed 10212 by default 10213 startfile Object files to include at the start of the link 10214 10215 Here is a small example of a spec file: 10216 10217 %rename lib old_lib 10218 10219 *lib: 10220 --start-group -lgcc -lc -leval1 --end-group %(old_lib) 10221 10222 This example renames the spec called 'lib' to 'old_lib' and then 10223 overrides the previous definition of 'lib' with a new one. The new 10224 definition adds in some extra command-line options before including the 10225 text of the old definition. 10226 10227 "Spec strings" are a list of command-line options to be passed to their 10228 corresponding program. In addition, the spec strings can contain 10229 '%'-prefixed sequences to substitute variable text or to conditionally 10230 insert text into the command line. Using these constructs it is 10231 possible to generate quite complex command lines. 10232 10233 Here is a table of all defined '%'-sequences for spec strings. Note 10234 that spaces are not generated automatically around the results of 10235 expanding these sequences. Therefore you can concatenate them together 10236 or combine them with constant text in a single argument. 10237 10238 '%%' 10239 Substitute one '%' into the program name or argument. 10240 10241 '%i' 10242 Substitute the name of the input file being processed. 10243 10244 '%b' 10245 Substitute the basename of the input file being processed. This is 10246 the substring up to (and not including) the last period and not 10247 including the directory. 10248 10249 '%B' 10250 This is the same as '%b', but include the file suffix (text after 10251 the last period). 10252 10253 '%d' 10254 Marks the argument containing or following the '%d' as a temporary 10255 file name, so that that file is deleted if GCC exits successfully. 10256 Unlike '%g', this contributes no text to the argument. 10257 10258 '%gSUFFIX' 10259 Substitute a file name that has suffix SUFFIX and is chosen once 10260 per compilation, and mark the argument in the same way as '%d'. To 10261 reduce exposure to denial-of-service attacks, the file name is now 10262 chosen in a way that is hard to predict even when previously chosen 10263 file names are known. For example, '%g.s ... %g.o ... %g.s' might 10264 turn into 'ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s'. SUFFIX matches the 10265 regexp '[.A-Za-z]*' or the special string '%O', which is treated 10266 exactly as if '%O' had been preprocessed. Previously, '%g' was 10267 simply substituted with a file name chosen once per compilation, 10268 without regard to any appended suffix (which was therefore treated 10269 just like ordinary text), making such attacks more likely to 10270 succeed. 10271 10272 '%uSUFFIX' 10273 Like '%g', but generates a new temporary file name each time it 10274 appears instead of once per compilation. 10275 10276 '%USUFFIX' 10277 Substitutes the last file name generated with '%uSUFFIX', 10278 generating a new one if there is no such last file name. In the 10279 absence of any '%uSUFFIX', this is just like '%gSUFFIX', except 10280 they don't share the same suffix _space_, so '%g.s ... %U.s ... 10281 %g.s ... %U.s' involves the generation of two distinct file names, 10282 one for each '%g.s' and another for each '%U.s'. Previously, '%U' 10283 was simply substituted with a file name chosen for the previous 10284 '%u', without regard to any appended suffix. 10285 10286 '%jSUFFIX' 10287 Substitutes the name of the 'HOST_BIT_BUCKET', if any, and if it is 10288 writable, and if '-save-temps' is not used; otherwise, substitute 10289 the name of a temporary file, just like '%u'. This temporary file 10290 is not meant for communication between processes, but rather as a 10291 junk disposal mechanism. 10292 10293 '%|SUFFIX' 10294 '%mSUFFIX' 10295 Like '%g', except if '-pipe' is in effect. In that case '%|' 10296 substitutes a single dash and '%m' substitutes nothing at all. 10297 These are the two most common ways to instruct a program that it 10298 should read from standard input or write to standard output. If 10299 you need something more elaborate you can use an '%{pipe:'X'}' 10300 construct: see for example 'f/lang-specs.h'. 10301 10302 '%.SUFFIX' 10303 Substitutes .SUFFIX for the suffixes of a matched switch's args 10304 when it is subsequently output with '%*'. SUFFIX is terminated by 10305 the next space or %. 10306 10307 '%w' 10308 Marks the argument containing or following the '%w' as the 10309 designated output file of this compilation. This puts the argument 10310 into the sequence of arguments that '%o' substitutes. 10311 10312 '%o' 10313 Substitutes the names of all the output files, with spaces 10314 automatically placed around them. You should write spaces around 10315 the '%o' as well or the results are undefined. '%o' is for use in 10316 the specs for running the linker. Input files whose names have no 10317 recognized suffix are not compiled at all, but they are included 10318 among the output files, so they are linked. 10319 10320 '%O' 10321 Substitutes the suffix for object files. Note that this is handled 10322 specially when it immediately follows '%g, %u, or %U', because of 10323 the need for those to form complete file names. The handling is 10324 such that '%O' is treated exactly as if it had already been 10325 substituted, except that '%g, %u, and %U' do not currently support 10326 additional SUFFIX characters following '%O' as they do following, 10327 for example, '.o'. 10328 10329 '%p' 10330 Substitutes the standard macro predefinitions for the current 10331 target machine. Use this when running 'cpp'. 10332 10333 '%P' 10334 Like '%p', but puts '__' before and after the name of each 10335 predefined macro, except for macros that start with '__' or with 10336 '_L', where L is an uppercase letter. This is for ISO C. 10337 10338 '%I' 10339 Substitute any of '-iprefix' (made from 'GCC_EXEC_PREFIX'), 10340 '-isysroot' (made from 'TARGET_SYSTEM_ROOT'), '-isystem' (made from 10341 'COMPILER_PATH' and '-B' options) and '-imultilib' as necessary. 10342 10343 '%s' 10344 Current argument is the name of a library or startup file of some 10345 sort. Search for that file in a standard list of directories and 10346 substitute the full name found. The current working directory is 10347 included in the list of directories scanned. 10348 10349 '%T' 10350 Current argument is the name of a linker script. Search for that 10351 file in the current list of directories to scan for libraries. If 10352 the file is located insert a '--script' option into the command 10353 line followed by the full path name found. If the file is not 10354 found then generate an error message. Note: the current working 10355 directory is not searched. 10356 10357 '%eSTR' 10358 Print STR as an error message. STR is terminated by a newline. 10359 Use this when inconsistent options are detected. 10360 10361 '%(NAME)' 10362 Substitute the contents of spec string NAME at this point. 10363 10364 '%x{OPTION}' 10365 Accumulate an option for '%X'. 10366 10367 '%X' 10368 Output the accumulated linker options specified by '-Wl' or a '%x' 10369 spec string. 10370 10371 '%Y' 10372 Output the accumulated assembler options specified by '-Wa'. 10373 10374 '%Z' 10375 Output the accumulated preprocessor options specified by '-Wp'. 10376 10377 '%a' 10378 Process the 'asm' spec. This is used to compute the switches to be 10379 passed to the assembler. 10380 10381 '%A' 10382 Process the 'asm_final' spec. This is a spec string for passing 10383 switches to an assembler post-processor, if such a program is 10384 needed. 10385 10386 '%l' 10387 Process the 'link' spec. This is the spec for computing the 10388 command line passed to the linker. Typically it makes use of the 10389 '%L %G %S %D and %E' sequences. 10390 10391 '%D' 10392 Dump out a '-L' option for each directory that GCC believes might 10393 contain startup files. If the target supports multilibs then the 10394 current multilib directory is prepended to each of these paths. 10395 10396 '%L' 10397 Process the 'lib' spec. This is a spec string for deciding which 10398 libraries are included on the command line to the linker. 10399 10400 '%G' 10401 Process the 'libgcc' spec. This is a spec string for deciding 10402 which GCC support library is included on the command line to the 10403 linker. 10404 10405 '%S' 10406 Process the 'startfile' spec. This is a spec for deciding which 10407 object files are the first ones passed to the linker. Typically 10408 this might be a file named 'crt0.o'. 10409 10410 '%E' 10411 Process the 'endfile' spec. This is a spec string that specifies 10412 the last object files that are passed to the linker. 10413 10414 '%C' 10415 Process the 'cpp' spec. This is used to construct the arguments to 10416 be passed to the C preprocessor. 10417 10418 '%1' 10419 Process the 'cc1' spec. This is used to construct the options to 10420 be passed to the actual C compiler ('cc1'). 10421 10422 '%2' 10423 Process the 'cc1plus' spec. This is used to construct the options 10424 to be passed to the actual C++ compiler ('cc1plus'). 10425 10426 '%*' 10427 Substitute the variable part of a matched option. See below. Note 10428 that each comma in the substituted string is replaced by a single 10429 space. 10430 10431 '%<S' 10432 Remove all occurrences of '-S' from the command line. Note--this 10433 command is position dependent. '%' commands in the spec string 10434 before this one see '-S', '%' commands in the spec string after 10435 this one do not. 10436 10437 '%:FUNCTION(ARGS)' 10438 Call the named function FUNCTION, passing it ARGS. ARGS is first 10439 processed as a nested spec string, then split into an argument 10440 vector in the usual fashion. The function returns a string which 10441 is processed as if it had appeared literally as part of the current 10442 spec. 10443 10444 The following built-in spec functions are provided: 10445 10446 'getenv' 10447 The 'getenv' spec function takes two arguments: an environment 10448 variable name and a string. If the environment variable is 10449 not defined, a fatal error is issued. Otherwise, the return 10450 value is the value of the environment variable concatenated 10451 with the string. For example, if 'TOPDIR' is defined as 10452 '/path/to/top', then: 10453 10454 %:getenv(TOPDIR /include) 10455 10456 expands to '/path/to/top/include'. 10457 10458 'if-exists' 10459 The 'if-exists' spec function takes one argument, an absolute 10460 pathname to a file. If the file exists, 'if-exists' returns 10461 the pathname. Here is a small example of its usage: 10462 10463 *startfile: 10464 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 10465 10466 'if-exists-else' 10467 The 'if-exists-else' spec function is similar to the 10468 'if-exists' spec function, except that it takes two arguments. 10469 The first argument is an absolute pathname to a file. If the 10470 file exists, 'if-exists-else' returns the pathname. If it 10471 does not exist, it returns the second argument. This way, 10472 'if-exists-else' can be used to select one file or another, 10473 based on the existence of the first. Here is a small example 10474 of its usage: 10475 10476 *startfile: 10477 crt0%O%s %:if-exists(crti%O%s) \ 10478 %:if-exists-else(crtbeginT%O%s crtbegin%O%s) 10479 10480 'replace-outfile' 10481 The 'replace-outfile' spec function takes two arguments. It 10482 looks for the first argument in the outfiles array and 10483 replaces it with the second argument. Here is a small example 10484 of its usage: 10485 10486 %{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)} 10487 10488 'remove-outfile' 10489 The 'remove-outfile' spec function takes one argument. It 10490 looks for the first argument in the outfiles array and removes 10491 it. Here is a small example its usage: 10492 10493 %:remove-outfile(-lm) 10494 10495 'pass-through-libs' 10496 The 'pass-through-libs' spec function takes any number of 10497 arguments. It finds any '-l' options and any non-options 10498 ending in '.a' (which it assumes are the names of linker input 10499 library archive files) and returns a result containing all the 10500 found arguments each prepended by '-plugin-opt=-pass-through=' 10501 and joined by spaces. This list is intended to be passed to 10502 the LTO linker plugin. 10503 10504 %:pass-through-libs(%G %L %G) 10505 10506 'print-asm-header' 10507 The 'print-asm-header' function takes no arguments and simply 10508 prints a banner like: 10509 10510 Assembler options 10511 ================= 10512 10513 Use "-Wa,OPTION" to pass "OPTION" to the assembler. 10514 10515 It is used to separate compiler options from assembler options 10516 in the '--target-help' output. 10517 10518 '%{S}' 10519 Substitutes the '-S' switch, if that switch is given to GCC. If 10520 that switch is not specified, this substitutes nothing. Note that 10521 the leading dash is omitted when specifying this option, and it is 10522 automatically inserted if the substitution is performed. Thus the 10523 spec string '%{foo}' matches the command-line option '-foo' and 10524 outputs the command-line option '-foo'. 10525 10526 '%W{S}' 10527 Like %{'S'} but mark last argument supplied within as a file to be 10528 deleted on failure. 10529 10530 '%{S*}' 10531 Substitutes all the switches specified to GCC whose names start 10532 with '-S', but which also take an argument. This is used for 10533 switches like '-o', '-D', '-I', etc. GCC considers '-o foo' as 10534 being one switch whose name starts with 'o'. %{o*} substitutes 10535 this text, including the space. Thus two arguments are generated. 10536 10537 '%{S*&T*}' 10538 Like %{'S'*}, but preserve order of 'S' and 'T' options (the order 10539 of 'S' and 'T' in the spec is not significant). There can be any 10540 number of ampersand-separated variables; for each the wild card is 10541 optional. Useful for CPP as '%{D*&U*&A*}'. 10542 10543 '%{S:X}' 10544 Substitutes 'X', if the '-S' switch is given to GCC. 10545 10546 '%{!S:X}' 10547 Substitutes 'X', if the '-S' switch is _not_ given to GCC. 10548 10549 '%{S*:X}' 10550 Substitutes 'X' if one or more switches whose names start with '-S' 10551 are specified to GCC. Normally 'X' is substituted only once, no 10552 matter how many such switches appeared. However, if '%*' appears 10553 somewhere in 'X', then 'X' is substituted once for each matching 10554 switch, with the '%*' replaced by the part of that switch matching 10555 the '*'. 10556 10557 '%{.S:X}' 10558 Substitutes 'X', if processing a file with suffix 'S'. 10559 10560 '%{!.S:X}' 10561 Substitutes 'X', if _not_ processing a file with suffix 'S'. 10562 10563 '%{,S:X}' 10564 Substitutes 'X', if processing a file for language 'S'. 10565 10566 '%{!,S:X}' 10567 Substitutes 'X', if not processing a file for language 'S'. 10568 10569 '%{S|P:X}' 10570 Substitutes 'X' if either '-S' or '-P' is given to GCC. This may 10571 be combined with '!', '.', ',', and '*' sequences as well, although 10572 they have a stronger binding than the '|'. If '%*' appears in 'X', 10573 all of the alternatives must be starred, and only the first 10574 matching alternative is substituted. 10575 10576 For example, a spec string like this: 10577 10578 %{.c:-foo} %{!.c:-bar} %{.c|d:-baz} %{!.c|d:-boggle} 10579 10580 outputs the following command-line options from the following input 10581 command-line options: 10582 10583 fred.c -foo -baz 10584 jim.d -bar -boggle 10585 -d fred.c -foo -baz -boggle 10586 -d jim.d -bar -baz -boggle 10587 10588 '%{S:X; T:Y; :D}' 10589 10590 If 'S' is given to GCC, substitutes 'X'; else if 'T' is given to 10591 GCC, substitutes 'Y'; else substitutes 'D'. There can be as many 10592 clauses as you need. This may be combined with '.', ',', '!', '|', 10593 and '*' as needed. 10594 10595 The conditional text 'X' in a %{'S':'X'} or similar construct may 10596 contain other nested '%' constructs or spaces, or even newlines. They 10597 are processed as usual, as described above. Trailing white space in 'X' 10598 is ignored. White space may also appear anywhere on the left side of 10599 the colon in these constructs, except between '.' or '*' and the 10600 corresponding word. 10601 10602 The '-O', '-f', '-m', and '-W' switches are handled specifically in 10603 these constructs. If another value of '-O' or the negated form of a 10604 '-f', '-m', or '-W' switch is found later in the command line, the 10605 earlier switch value is ignored, except with {'S'*} where 'S' is just 10606 one letter, which passes all matching options. 10607 10608 The character '|' at the beginning of the predicate text is used to 10609 indicate that a command should be piped to the following command, but 10610 only if '-pipe' is specified. 10611 10612 It is built into GCC which switches take arguments and which do not. 10613 (You might think it would be useful to generalize this to allow each 10614 compiler's spec to say which switches take arguments. But this cannot 10615 be done in a consistent fashion. GCC cannot even decide which input 10616 files have been specified without knowing which switches take arguments, 10617 and it must know which input files to compile in order to tell which 10618 compilers to run). 10619 10620 GCC also knows implicitly that arguments starting in '-l' are to be 10621 treated as compiler output files, and passed to the linker in their 10622 proper position among the other output files. 10623 10624 10625 File: gcc.info, Node: Target Options, Next: Submodel Options, Prev: Spec Files, Up: Invoking GCC 10626 10627 3.16 Specifying Target Machine and Compiler Version 10628 =================================================== 10629 10630 The usual way to run GCC is to run the executable called 'gcc', or 10631 'MACHINE-gcc' when cross-compiling, or 'MACHINE-gcc-VERSION' to run a 10632 version other than the one that was installed last. 10633 10634 10635 File: gcc.info, Node: Submodel Options, Next: Code Gen Options, Prev: Target Options, Up: Invoking GCC 10636 10637 3.17 Hardware Models and Configurations 10638 ======================================= 10639 10640 Each target machine types can have its own special options, starting 10641 with '-m', to choose among various hardware models or 10642 configurations--for example, 68010 vs 68020, floating coprocessor or 10643 none. A single installed version of the compiler can compile for any 10644 model or configuration, according to the options specified. 10645 10646 Some configurations of the compiler also support additional special 10647 options, usually for compatibility with other compilers on the same 10648 platform. 10649 10650 * Menu: 10651 10652 * AArch64 Options:: 10653 * Adapteva Epiphany Options:: 10654 * ARM Options:: 10655 * AVR Options:: 10656 * Blackfin Options:: 10657 * C6X Options:: 10658 * CRIS Options:: 10659 * CR16 Options:: 10660 * Darwin Options:: 10661 * DEC Alpha Options:: 10662 * FR30 Options:: 10663 * FRV Options:: 10664 * GNU/Linux Options:: 10665 * H8/300 Options:: 10666 * HPPA Options:: 10667 * i386 and x86-64 Options:: 10668 * i386 and x86-64 Windows Options:: 10669 * IA-64 Options:: 10670 * LM32 Options:: 10671 * M32C Options:: 10672 * M32R/D Options:: 10673 * M680x0 Options:: 10674 * MCore Options:: 10675 * MeP Options:: 10676 * MicroBlaze Options:: 10677 * MIPS Options:: 10678 * MMIX Options:: 10679 * MN10300 Options:: 10680 * Moxie Options:: 10681 * PDP-11 Options:: 10682 * picoChip Options:: 10683 * PowerPC Options:: 10684 * RL78 Options:: 10685 * RS/6000 and PowerPC Options:: 10686 * RX Options:: 10687 * S/390 and zSeries Options:: 10688 * Score Options:: 10689 * SH Options:: 10690 * Solaris 2 Options:: 10691 * SPARC Options:: 10692 * SPU Options:: 10693 * System V Options:: 10694 * TILE-Gx Options:: 10695 * TILEPro Options:: 10696 * V850 Options:: 10697 * VAX Options:: 10698 * VMS Options:: 10699 * VxWorks Options:: 10700 * x86-64 Options:: 10701 * Xstormy16 Options:: 10702 * Xtensa Options:: 10703 * zSeries Options:: 10704 10705 10706 File: gcc.info, Node: AArch64 Options, Next: Adapteva Epiphany Options, Up: Submodel Options 10707 10708 3.17.1 AArch64 Options 10709 ---------------------- 10710 10711 These options are defined for AArch64 implementations: 10712 10713 '-mbig-endian' 10714 Generate big-endian code. This is the default when GCC is 10715 configured for an 'aarch64_be-*-*' target. 10716 10717 '-mgeneral-regs-only' 10718 Generate code which uses only the general registers. 10719 10720 '-mlittle-endian' 10721 Generate little-endian code. This is the default when GCC is 10722 configured for an 'aarch64-*-*' but not an 'aarch64_be-*-*' target. 10723 10724 '-mcmodel=tiny' 10725 Generate code for the tiny code model. The program and its 10726 statically defined symbols must be within 1GB of each other. 10727 Pointers are 64 bits. Programs can be statically or dynamically 10728 linked. This model is not fully implemented and mostly treated as 10729 'small'. 10730 10731 '-mcmodel=small' 10732 Generate code for the small code model. The program and its 10733 statically defined symbols must be within 4GB of each other. 10734 Pointers are 64 bits. Programs can be statically or dynamically 10735 linked. This is the default code model. 10736 10737 '-mcmodel=large' 10738 Generate code for the large code model. This makes no assumptions 10739 about addresses and sizes of sections. Pointers are 64 bits. 10740 Programs can be statically linked only. 10741 10742 '-mstrict-align' 10743 Do not assume that unaligned memory references will be handled by 10744 the system. 10745 10746 '-momit-leaf-frame-pointer' 10747 '-mno-omit-leaf-frame-pointer' 10748 Omit or keep the frame pointer in leaf functions. The former 10749 behaviour is the default. 10750 10751 '-mtls-dialect=desc' 10752 Use TLS descriptors as the thread-local storage mechanism for 10753 dynamic accesses of TLS variables. This is the default. 10754 10755 '-mtls-dialect=traditional' 10756 Use traditional TLS as the thread-local storage mechanism for 10757 dynamic accesses of TLS variables. 10758 10759 '-march=NAME' 10760 Specify the name of the target architecture, optionally suffixed by 10761 one or more feature modifiers. This option has the form 10762 '-march=ARCH{+[no]FEATURE}*', where the only value for ARCH is 10763 'armv8-a'. The possible values for FEATURE are documented in the 10764 sub-section below. 10765 10766 Where conflicting feature modifiers are specified, the right-most 10767 feature is used. 10768 10769 GCC uses this name to determine what kind of instructions it can 10770 emit when generating assembly code. This option can be used in 10771 conjunction with or instead of the '-mcpu=' option. 10772 10773 '-mcpu=NAME' 10774 Specify the name of the target processor, optionally suffixed by 10775 one or more feature modifiers. This option has the form 10776 '-mcpu=CPU{+[no]FEATURE}*', where the possible values for CPU are 10777 'generic', 'large'. The possible values for FEATURE are documented 10778 in the sub-section below. 10779 10780 Where conflicting feature modifiers are specified, the right-most 10781 feature is used. 10782 10783 GCC uses this name to determine what kind of instructions it can 10784 emit when generating assembly code. 10785 10786 '-mtune=NAME' 10787 Specify the name of the processor to tune the performance for. The 10788 code will be tuned as if the target processor were of the type 10789 specified in this option, but still using instructions compatible 10790 with the target processor specified by a '-mcpu=' option. This 10791 option cannot be suffixed by feature modifiers. 10792 10793 3.17.1.1 '-march' and '-mcpu' feature modifiers 10794 ............................................... 10795 10796 Feature modifiers used with '-march' and '-mcpu' can be one the 10797 following: 10798 10799 'crypto' 10800 Enable Crypto extension. This implies Advanced SIMD is enabled. 10801 'fp' 10802 Enable floating-point instructions. 10803 'simd' 10804 Enable Advanced SIMD instructions. This implies floating-point 10805 instructions are enabled. This is the default for all current 10806 possible values for options '-march' and '-mcpu='. 10807 10808 10809 File: gcc.info, Node: Adapteva Epiphany Options, Next: ARM Options, Prev: AArch64 Options, Up: Submodel Options 10810 10811 3.17.2 Adapteva Epiphany Options 10812 -------------------------------- 10813 10814 These '-m' options are defined for Adapteva Epiphany: 10815 10816 '-mhalf-reg-file' 10817 Don't allocate any register in the range 'r32'...'r63'. That 10818 allows code to run on hardware variants that lack these registers. 10819 10820 '-mprefer-short-insn-regs' 10821 Preferrentially allocate registers that allow short instruction 10822 generation. This can result in increased instruction count, so 10823 this may either reduce or increase overall code size. 10824 10825 '-mbranch-cost=NUM' 10826 Set the cost of branches to roughly NUM "simple" instructions. 10827 This cost is only a heuristic and is not guaranteed to produce 10828 consistent results across releases. 10829 10830 '-mcmove' 10831 Enable the generation of conditional moves. 10832 10833 '-mnops=NUM' 10834 Emit NUM NOPs before every other generated instruction. 10835 10836 '-mno-soft-cmpsf' 10837 For single-precision floating-point comparisons, emit an 'fsub' 10838 instruction and test the flags. This is faster than a software 10839 comparison, but can get incorrect results in the presence of NaNs, 10840 or when two different small numbers are compared such that their 10841 difference is calculated as zero. The default is '-msoft-cmpsf', 10842 which uses slower, but IEEE-compliant, software comparisons. 10843 10844 '-mstack-offset=NUM' 10845 Set the offset between the top of the stack and the stack pointer. 10846 E.g., a value of 8 means that the eight bytes in the range 10847 'sp+0...sp+7' can be used by leaf functions without stack 10848 allocation. Values other than '8' or '16' are untested and 10849 unlikely to work. Note also that this option changes the ABI; 10850 compiling a program with a different stack offset than the 10851 libraries have been compiled with generally does not work. This 10852 option can be useful if you want to evaluate if a different stack 10853 offset would give you better code, but to actually use a different 10854 stack offset to build working programs, it is recommended to 10855 configure the toolchain with the appropriate 10856 '--with-stack-offset=NUM' option. 10857 10858 '-mno-round-nearest' 10859 Make the scheduler assume that the rounding mode has been set to 10860 truncating. The default is '-mround-nearest'. 10861 10862 '-mlong-calls' 10863 If not otherwise specified by an attribute, assume all calls might 10864 be beyond the offset range of the 'b' / 'bl' instructions, and 10865 therefore load the function address into a register before 10866 performing a (otherwise direct) call. This is the default. 10867 10868 '-mshort-calls' 10869 If not otherwise specified by an attribute, assume all direct calls 10870 are in the range of the 'b' / 'bl' instructions, so use these 10871 instructions for direct calls. The default is '-mlong-calls'. 10872 10873 '-msmall16' 10874 Assume addresses can be loaded as 16-bit unsigned values. This 10875 does not apply to function addresses for which '-mlong-calls' 10876 semantics are in effect. 10877 10878 '-mfp-mode=MODE' 10879 Set the prevailing mode of the floating-point unit. This 10880 determines the floating-point mode that is provided and expected at 10881 function call and return time. Making this mode match the mode you 10882 predominantly need at function start can make your programs smaller 10883 and faster by avoiding unnecessary mode switches. 10884 10885 MODE can be set to one the following values: 10886 10887 'caller' 10888 Any mode at function entry is valid, and retained or restored 10889 when the function returns, and when it calls other functions. 10890 This mode is useful for compiling libraries or other 10891 compilation units you might want to incorporate into different 10892 programs with different prevailing FPU modes, and the 10893 convenience of being able to use a single object file 10894 outweighs the size and speed overhead for any extra mode 10895 switching that might be needed, compared with what would be 10896 needed with a more specific choice of prevailing FPU mode. 10897 10898 'truncate' 10899 This is the mode used for floating-point calculations with 10900 truncating (i.e. round towards zero) rounding mode. That 10901 includes conversion from floating point to integer. 10902 10903 'round-nearest' 10904 This is the mode used for floating-point calculations with 10905 round-to-nearest-or-even rounding mode. 10906 10907 'int' 10908 This is the mode used to perform integer calculations in the 10909 FPU, e.g. integer multiply, or integer 10910 multiply-and-accumulate. 10911 10912 The default is '-mfp-mode=caller' 10913 10914 '-mnosplit-lohi' 10915 '-mno-postinc' 10916 '-mno-postmodify' 10917 Code generation tweaks that disable, respectively, splitting of 10918 32-bit loads, generation of post-increment addresses, and 10919 generation of post-modify addresses. The defaults are 10920 'msplit-lohi', '-mpost-inc', and '-mpost-modify'. 10921 10922 '-mnovect-double' 10923 Change the preferred SIMD mode to SImode. The default is 10924 '-mvect-double', which uses DImode as preferred SIMD mode. 10925 10926 '-max-vect-align=NUM' 10927 The maximum alignment for SIMD vector mode types. NUM may be 4 or 10928 8. The default is 8. Note that this is an ABI change, even though 10929 many library function interfaces are unaffected if they don't use 10930 SIMD vector modes in places that affect size and/or alignment of 10931 relevant types. 10932 10933 '-msplit-vecmove-early' 10934 Split vector moves into single word moves before reload. In theory 10935 this can give better register allocation, but so far the reverse 10936 seems to be generally the case. 10937 10938 '-m1reg-REG' 10939 Specify a register to hold the constant -1, which makes loading 10940 small negative constants and certain bitmasks faster. Allowable 10941 values for REG are 'r43' and 'r63', which specify use of that 10942 register as a fixed register, and 'none', which means that no 10943 register is used for this purpose. The default is '-m1reg-none'. 10944 10945 10946 File: gcc.info, Node: ARM Options, Next: AVR Options, Prev: Adapteva Epiphany Options, Up: Submodel Options 10947 10948 3.17.3 ARM Options 10949 ------------------ 10950 10951 These '-m' options are defined for Advanced RISC Machines (ARM) 10952 architectures: 10953 10954 '-mabi=NAME' 10955 Generate code for the specified ABI. Permissible values are: 10956 'apcs-gnu', 'atpcs', 'aapcs', 'aapcs-linux' and 'iwmmxt'. 10957 10958 '-mapcs-frame' 10959 Generate a stack frame that is compliant with the ARM Procedure 10960 Call Standard for all functions, even if this is not strictly 10961 necessary for correct execution of the code. Specifying 10962 '-fomit-frame-pointer' with this option causes the stack frames not 10963 to be generated for leaf functions. The default is 10964 '-mno-apcs-frame'. 10965 10966 '-mapcs' 10967 This is a synonym for '-mapcs-frame'. 10968 10969 '-mthumb-interwork' 10970 Generate code that supports calling between the ARM and Thumb 10971 instruction sets. Without this option, on pre-v5 architectures, 10972 the two instruction sets cannot be reliably used inside one 10973 program. The default is '-mno-thumb-interwork', since slightly 10974 larger code is generated when '-mthumb-interwork' is specified. In 10975 AAPCS configurations this option is meaningless. 10976 10977 '-mno-sched-prolog' 10978 Prevent the reordering of instructions in the function prologue, or 10979 the merging of those instruction with the instructions in the 10980 function's body. This means that all functions start with a 10981 recognizable set of instructions (or in fact one of a choice from a 10982 small set of different function prologues), and this information 10983 can be used to locate the start of functions inside an executable 10984 piece of code. The default is '-msched-prolog'. 10985 10986 '-mfloat-abi=NAME' 10987 Specifies which floating-point ABI to use. Permissible values are: 10988 'soft', 'softfp' and 'hard'. 10989 10990 Specifying 'soft' causes GCC to generate output containing library 10991 calls for floating-point operations. 'softfp' allows the 10992 generation of code using hardware floating-point instructions, but 10993 still uses the soft-float calling conventions. 'hard' allows 10994 generation of floating-point instructions and uses FPU-specific 10995 calling conventions. 10996 10997 The default depends on the specific target configuration. Note 10998 that the hard-float and soft-float ABIs are not link-compatible; 10999 you must compile your entire program with the same ABI, and link 11000 with a compatible set of libraries. 11001 11002 '-mlittle-endian' 11003 Generate code for a processor running in little-endian mode. This 11004 is the default for all standard configurations. 11005 11006 '-mbig-endian' 11007 Generate code for a processor running in big-endian mode; the 11008 default is to compile code for a little-endian processor. 11009 11010 '-mwords-little-endian' 11011 This option only applies when generating code for big-endian 11012 processors. Generate code for a little-endian word order but a 11013 big-endian byte order. That is, a byte order of the form 11014 '32107654'. Note: this option should only be used if you require 11015 compatibility with code for big-endian ARM processors generated by 11016 versions of the compiler prior to 2.8. This option is now 11017 deprecated. 11018 11019 '-march=NAME' 11020 This specifies the name of the target ARM architecture. GCC uses 11021 this name to determine what kind of instructions it can emit when 11022 generating assembly code. This option can be used in conjunction 11023 with or instead of the '-mcpu=' option. Permissible names are: 11024 'armv2', 'armv2a', 'armv3', 'armv3m', 'armv4', 'armv4t', 'armv5', 11025 'armv5t', 'armv5e', 'armv5te', 'armv6', 'armv6j', 'armv6t2', 11026 'armv6z', 'armv6zk', 'armv6-m', 'armv7', 'armv7-a', 'armv7-r', 11027 'armv7-m', 'armv7e-m' 'armv8-a', 'iwmmxt', 'iwmmxt2', 'ep9312'. 11028 11029 '-march=native' causes the compiler to auto-detect the architecture 11030 of the build computer. At present, this feature is only supported 11031 on Linux, and not all architectures are recognized. If the 11032 auto-detect is unsuccessful the option has no effect. 11033 11034 '-mtune=NAME' 11035 This option specifies the name of the target ARM processor for 11036 which GCC should tune the performance of the code. For some ARM 11037 implementations better performance can be obtained by using this 11038 option. Permissible names are: 'arm2', 'arm250', 'arm3', 'arm6', 11039 'arm60', 'arm600', 'arm610', 'arm620', 'arm7', 'arm7m', 'arm7d', 11040 'arm7dm', 'arm7di', 'arm7dmi', 'arm70', 'arm700', 'arm700i', 11041 'arm710', 'arm710c', 'arm7100', 'arm720', 'arm7500', 'arm7500fe', 11042 'arm7tdmi', 'arm7tdmi-s', 'arm710t', 'arm720t', 'arm740t', 11043 'strongarm', 'strongarm110', 'strongarm1100', 'strongarm1110', 11044 'arm8', 'arm810', 'arm9', 'arm9e', 'arm920', 'arm920t', 'arm922t', 11045 'arm946e-s', 'arm966e-s', 'arm968e-s', 'arm926ej-s', 'arm940t', 11046 'arm9tdmi', 'arm10tdmi', 'arm1020t', 'arm1026ej-s', 'arm10e', 11047 'arm1020e', 'arm1022e', 'arm1136j-s', 'arm1136jf-s', 'mpcore', 11048 'mpcorenovfp', 'arm1156t2-s', 'arm1156t2f-s', 'arm1176jz-s', 11049 'arm1176jzf-s', 'cortex-a5', 'cortex-a7', 'cortex-a8', 'cortex-a9', 11050 'cortex-a15', 'cortex-r4', 'cortex-r4f', 'cortex-r5', 'cortex-m4', 11051 'cortex-m3', 'cortex-m1', 'cortex-m0', 'cortex-m0plus', 11052 'marvell-pj4', 'xscale', 'iwmmxt', 'iwmmxt2', 'ep9312', 'fa526', 11053 'fa626', 'fa606te', 'fa626te', 'fmp626', 'fa726te'. 11054 11055 '-mtune=generic-ARCH' specifies that GCC should tune the 11056 performance for a blend of processors within architecture ARCH. 11057 The aim is to generate code that run well on the current most 11058 popular processors, balancing between optimizations that benefit 11059 some CPUs in the range, and avoiding performance pitfalls of other 11060 CPUs. The effects of this option may change in future GCC versions 11061 as CPU models come and go. 11062 11063 '-mtune=native' causes the compiler to auto-detect the CPU of the 11064 build computer. At present, this feature is only supported on 11065 Linux, and not all architectures are recognized. If the 11066 auto-detect is unsuccessful the option has no effect. 11067 11068 '-mcpu=NAME' 11069 This specifies the name of the target ARM processor. GCC uses this 11070 name to derive the name of the target ARM architecture (as if 11071 specified by '-march') and the ARM processor type for which to tune 11072 for performance (as if specified by '-mtune'). Where this option 11073 is used in conjunction with '-march' or '-mtune', those options 11074 take precedence over the appropriate part of this option. 11075 11076 Permissible names for this option are the same as those for 11077 '-mtune'. 11078 11079 '-mcpu=generic-ARCH' is also permissible, and is equivalent to 11080 '-march=ARCH -mtune=generic-ARCH'. See '-mtune' for more 11081 information. 11082 11083 '-mcpu=native' causes the compiler to auto-detect the CPU of the 11084 build computer. At present, this feature is only supported on 11085 Linux, and not all architectures are recognized. If the 11086 auto-detect is unsuccessful the option has no effect. 11087 11088 '-mfpu=NAME' 11089 This specifies what floating-point hardware (or hardware emulation) 11090 is available on the target. Permissible names are: 'vfp', 'vfpv3', 11091 'vfpv3-fp16', 'vfpv3-d16', 'vfpv3-d16-fp16', 'vfpv3xd', 11092 'vfpv3xd-fp16', 'neon', 'neon-fp16', 'vfpv4', 'vfpv4-d16', 11093 'fpv4-sp-d16', 'neon-vfpv4', 'fp-armv8', 'neon-fp-armv8', and 11094 'crypto-neon-fp-armv8'. 11095 11096 If '-msoft-float' is specified this specifies the format of 11097 floating-point values. 11098 11099 If the selected floating-point hardware includes the NEON extension 11100 (e.g. '-mfpu'='neon'), note that floating-point operations are not 11101 generated by GCC's auto-vectorization pass unless 11102 '-funsafe-math-optimizations' is also specified. This is because 11103 NEON hardware does not fully implement the IEEE 754 standard for 11104 floating-point arithmetic (in particular denormal values are 11105 treated as zero), so the use of NEON instructions may lead to a 11106 loss of precision. 11107 11108 '-mfp16-format=NAME' 11109 Specify the format of the '__fp16' half-precision floating-point 11110 type. Permissible names are 'none', 'ieee', and 'alternative'; the 11111 default is 'none', in which case the '__fp16' type is not defined. 11112 *Note Half-Precision::, for more information. 11113 11114 '-mstructure-size-boundary=N' 11115 The sizes of all structures and unions are rounded up to a multiple 11116 of the number of bits set by this option. Permissible values are 11117 8, 32 and 64. The default value varies for different toolchains. 11118 For the COFF targeted toolchain the default value is 8. A value of 11119 64 is only allowed if the underlying ABI supports it. 11120 11121 Specifying a larger number can produce faster, more efficient code, 11122 but can also increase the size of the program. Different values 11123 are potentially incompatible. Code compiled with one value cannot 11124 necessarily expect to work with code or libraries compiled with 11125 another value, if they exchange information using structures or 11126 unions. 11127 11128 '-mabort-on-noreturn' 11129 Generate a call to the function 'abort' at the end of a 'noreturn' 11130 function. It is executed if the function tries to return. 11131 11132 '-mlong-calls' 11133 '-mno-long-calls' 11134 Tells the compiler to perform function calls by first loading the 11135 address of the function into a register and then performing a 11136 subroutine call on this register. This switch is needed if the 11137 target function lies outside of the 64-megabyte addressing range of 11138 the offset-based version of subroutine call instruction. 11139 11140 Even if this switch is enabled, not all function calls are turned 11141 into long calls. The heuristic is that static functions, functions 11142 that have the 'short-call' attribute, functions that are inside the 11143 scope of a '#pragma no_long_calls' directive, and functions whose 11144 definitions have already been compiled within the current 11145 compilation unit are not turned into long calls. The exceptions to 11146 this rule are that weak function definitions, functions with the 11147 'long-call' attribute or the 'section' attribute, and functions 11148 that are within the scope of a '#pragma long_calls' directive are 11149 always turned into long calls. 11150 11151 This feature is not enabled by default. Specifying 11152 '-mno-long-calls' restores the default behavior, as does placing 11153 the function calls within the scope of a '#pragma long_calls_off' 11154 directive. Note these switches have no effect on how the compiler 11155 generates code to handle function calls via function pointers. 11156 11157 '-msingle-pic-base' 11158 Treat the register used for PIC addressing as read-only, rather 11159 than loading it in the prologue for each function. The runtime 11160 system is responsible for initializing this register with an 11161 appropriate value before execution begins. 11162 11163 '-mpic-register=REG' 11164 Specify the register to be used for PIC addressing. For standard 11165 PIC base case, the default will be any suitable register determined 11166 by compiler. For single PIC base case, the default is 'R9' if 11167 target is EABI based or stack-checking is enabled, otherwise the 11168 default is 'R10'. 11169 11170 '-mpoke-function-name' 11171 Write the name of each function into the text section, directly 11172 preceding the function prologue. The generated code is similar to 11173 this: 11174 11175 t0 11176 .ascii "arm_poke_function_name", 0 11177 .align 11178 t1 11179 .word 0xff000000 + (t1 - t0) 11180 arm_poke_function_name 11181 mov ip, sp 11182 stmfd sp!, {fp, ip, lr, pc} 11183 sub fp, ip, #4 11184 11185 When performing a stack backtrace, code can inspect the value of 11186 'pc' stored at 'fp + 0'. If the trace function then looks at 11187 location 'pc - 12' and the top 8 bits are set, then we know that 11188 there is a function name embedded immediately preceding this 11189 location and has length '((pc[-3]) & 0xff000000)'. 11190 11191 '-mthumb' 11192 '-marm' 11193 11194 Select between generating code that executes in ARM and Thumb 11195 states. The default for most configurations is to generate code 11196 that executes in ARM state, but the default can be changed by 11197 configuring GCC with the '--with-mode='STATE configure option. 11198 11199 '-mtpcs-frame' 11200 Generate a stack frame that is compliant with the Thumb Procedure 11201 Call Standard for all non-leaf functions. (A leaf function is one 11202 that does not call any other functions.) The default is 11203 '-mno-tpcs-frame'. 11204 11205 '-mtpcs-leaf-frame' 11206 Generate a stack frame that is compliant with the Thumb Procedure 11207 Call Standard for all leaf functions. (A leaf function is one that 11208 does not call any other functions.) The default is 11209 '-mno-apcs-leaf-frame'. 11210 11211 '-mcallee-super-interworking' 11212 Gives all externally visible functions in the file being compiled 11213 an ARM instruction set header which switches to Thumb mode before 11214 executing the rest of the function. This allows these functions to 11215 be called from non-interworking code. This option is not valid in 11216 AAPCS configurations because interworking is enabled by default. 11217 11218 '-mcaller-super-interworking' 11219 Allows calls via function pointers (including virtual functions) to 11220 execute correctly regardless of whether the target code has been 11221 compiled for interworking or not. There is a small overhead in the 11222 cost of executing a function pointer if this option is enabled. 11223 This option is not valid in AAPCS configurations because 11224 interworking is enabled by default. 11225 11226 '-mtp=NAME' 11227 Specify the access model for the thread local storage pointer. The 11228 valid models are 'soft', which generates calls to 11229 '__aeabi_read_tp', 'cp15', which fetches the thread pointer from 11230 'cp15' directly (supported in the arm6k architecture), and 'auto', 11231 which uses the best available method for the selected processor. 11232 The default setting is 'auto'. 11233 11234 '-mtls-dialect=DIALECT' 11235 Specify the dialect to use for accessing thread local storage. Two 11236 DIALECTs are supported--'gnu' and 'gnu2'. The 'gnu' dialect 11237 selects the original GNU scheme for supporting local and global 11238 dynamic TLS models. The 'gnu2' dialect selects the GNU descriptor 11239 scheme, which provides better performance for shared libraries. 11240 The GNU descriptor scheme is compatible with the original scheme, 11241 but does require new assembler, linker and library support. 11242 Initial and local exec TLS models are unaffected by this option and 11243 always use the original scheme. 11244 11245 '-mword-relocations' 11246 Only generate absolute relocations on word-sized values (i.e. 11247 R_ARM_ABS32). This is enabled by default on targets (uClinux, 11248 SymbianOS) where the runtime loader imposes this restriction, and 11249 when '-fpic' or '-fPIC' is specified. 11250 11251 '-mfix-cortex-m3-ldrd' 11252 Some Cortex-M3 cores can cause data corruption when 'ldrd' 11253 instructions with overlapping destination and base registers are 11254 used. This option avoids generating these instructions. This 11255 option is enabled by default when '-mcpu=cortex-m3' is specified. 11256 11257 '-munaligned-access' 11258 '-mno-unaligned-access' 11259 Enables (or disables) reading and writing of 16- and 32- bit values 11260 from addresses that are not 16- or 32- bit aligned. By default 11261 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M 11262 architectures, and enabled for all other architectures. If 11263 unaligned access is not enabled then words in packed data 11264 structures will be accessed a byte at a time. 11265 11266 The ARM attribute 'Tag_CPU_unaligned_access' will be set in the 11267 generated object file to either true or false, depending upon the 11268 setting of this option. If unaligned access is enabled then the 11269 preprocessor symbol '__ARM_FEATURE_UNALIGNED' will also be defined. 11270 11271 11272 File: gcc.info, Node: AVR Options, Next: Blackfin Options, Prev: ARM Options, Up: Submodel Options 11273 11274 3.17.4 AVR Options 11275 ------------------ 11276 11277 These options are defined for AVR implementations: 11278 11279 '-mmcu=MCU' 11280 Specify Atmel AVR instruction set architectures (ISA) or MCU type. 11281 11282 The default for this option is 'avr2'. 11283 11284 GCC supports the following AVR devices and ISAs: 11285 11286 'avr2' 11287 "Classic" devices with up to 8 KiB of program memory. 11288 MCU = 'attiny22', 'attiny26', 'at90c8534', 'at90s2313', 11289 'at90s2323', 'at90s2333', 'at90s2343', 'at90s4414', 11290 'at90s4433', 'at90s4434', 'at90s8515', 'at90s8535'. 11291 11292 'avr25' 11293 "Classic" devices with up to 8 KiB of program memory and with 11294 the 'MOVW' instruction. 11295 MCU = 'ata5272', 'ata6289', 'attiny13', 'attiny13a', 11296 'attiny2313', 'attiny2313a', 'attiny24', 'attiny24a', 11297 'attiny25', 'attiny261', 'attiny261a', 'attiny43u', 11298 'attiny4313', 'attiny44', 'attiny44a', 'attiny45', 11299 'attiny461', 'attiny461a', 'attiny48', 'attiny84', 11300 'attiny84a', 'attiny85', 'attiny861', 'attiny861a', 11301 'attiny87', 'attiny88', 'at86rf401'. 11302 11303 'avr3' 11304 "Classic" devices with 16 KiB up to 64 KiB of program memory. 11305 MCU = 'at43usb355', 'at76c711'. 11306 11307 'avr31' 11308 "Classic" devices with 128 KiB of program memory. 11309 MCU = 'atmega103', 'at43usb320'. 11310 11311 'avr35' 11312 "Classic" devices with 16 KiB up to 64 KiB of program memory 11313 and with the 'MOVW' instruction. 11314 MCU = 'ata5505', 'atmega16u2', 'atmega32u2', 'atmega8u2', 11315 'attiny1634', 'attiny167', 'at90usb162', 'at90usb82'. 11316 11317 'avr4' 11318 "Enhanced" devices with up to 8 KiB of program memory. 11319 MCU = 'ata6285', 'ata6286', 'atmega48', 'atmega48a', 11320 'atmega48p', 'atmega48pa', 'atmega8', 'atmega8a', 11321 'atmega8hva', 'atmega8515', 'atmega8535', 'atmega88', 11322 'atmega88a', 'atmega88p', 'atmega88pa', 'at90pwm1', 11323 'at90pwm2', 'at90pwm2b', 'at90pwm3', 'at90pwm3b', 'at90pwm81'. 11324 11325 'avr5' 11326 "Enhanced" devices with 16 KiB up to 64 KiB of program memory. 11327 11328 MCU = 'ata5790', 'ata5790n', 'ata5795', 'atmega16', 11329 'atmega16a', 'atmega16hva', 'atmega16hva2', 'atmega16hvb', 11330 'atmega16hvbrevb', 'atmega16m1', 'atmega16u4', 'atmega161', 11331 'atmega162', 'atmega163', 'atmega164a', 'atmega164p', 11332 'atmega164pa', 'atmega165', 'atmega165a', 'atmega165p', 11333 'atmega165pa', 'atmega168', 'atmega168a', 'atmega168p', 11334 'atmega168pa', 'atmega169', 'atmega169a', 'atmega169p', 11335 'atmega169pa', 'atmega26hvg', 'atmega32', 'atmega32a', 11336 'atmega32c1', 'atmega32hvb', 'atmega32hvbrevb', 'atmega32m1', 11337 'atmega32u4', 'atmega32u6', 'atmega323', 'atmega324a', 11338 'atmega324p', 'atmega324pa', 'atmega325', 'atmega325a', 11339 'atmega325p', 'atmega3250', 'atmega3250a', 'atmega3250p', 11340 'atmega3250pa', 'atmega328', 'atmega328p', 'atmega329', 11341 'atmega329a', 'atmega329p', 'atmega329pa', 'atmega3290', 11342 'atmega3290a', 'atmega3290p', 'atmega3290pa', 'atmega406', 11343 'atmega48hvf', 'atmega64', 'atmega64a', 'atmega64c1', 11344 'atmega64hve', 'atmega64m1', 'atmega64rfa2', 'atmega64rfr2', 11345 'atmega640', 'atmega644', 'atmega644a', 'atmega644p', 11346 'atmega644pa', 'atmega645', 'atmega645a', 'atmega645p', 11347 'atmega6450', 'atmega6450a', 'atmega6450p', 'atmega649', 11348 'atmega649a', 'atmega649p', 'atmega6490', 'atmega6490a', 11349 'atmega6490p', 'at90can32', 'at90can64', 'at90pwm161', 11350 'at90pwm216', 'at90pwm316', 'at90scr100', 'at90usb646', 11351 'at90usb647', 'at94k', 'm3000'. 11352 11353 'avr51' 11354 "Enhanced" devices with 128 KiB of program memory. 11355 MCU = 'atmega128', 'atmega128a', 'atmega128rfa1', 11356 'atmega1280', 'atmega1281', 'atmega1284', 'atmega1284p', 11357 'at90can128', 'at90usb1286', 'at90usb1287'. 11358 11359 'avr6' 11360 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB 11361 of program memory. 11362 MCU = 'atmega2560', 'atmega2561'. 11363 11364 'avrxmega2' 11365 "XMEGA" devices with more than 8 KiB and up to 64 KiB of 11366 program memory. 11367 MCU = 'atmxt112sl', 'atmxt224', 'atmxt224e', 'atmxt336s', 11368 'atxmega16a4', 'atxmega16a4u', 'atxmega16c4', 'atxmega16d4', 11369 'atxmega16x1', 'atxmega32a4', 'atxmega32a4u', 'atxmega32c4', 11370 'atxmega32d4', 'atxmega32e5', 'atxmega32x1'. 11371 11372 'avrxmega4' 11373 "XMEGA" devices with more than 64 KiB and up to 128 KiB of 11374 program memory. 11375 MCU = 'atxmega64a3', 'atxmega64a3u', 'atxmega64a4u', 11376 'atxmega64b1', 'atxmega64b3', 'atxmega64c3', 'atxmega64d3', 11377 'atxmega64d4'. 11378 11379 'avrxmega5' 11380 "XMEGA" devices with more than 64 KiB and up to 128 KiB of 11381 program memory and more than 64 KiB of RAM. 11382 MCU = 'atxmega64a1', 'atxmega64a1u'. 11383 11384 'avrxmega6' 11385 "XMEGA" devices with more than 128 KiB of program memory. 11386 MCU = 'atmxt540s', 'atmxt540sreva', 'atxmega128a3', 11387 'atxmega128a3u', 'atxmega128b1', 'atxmega128b3', 11388 'atxmega128c3', 'atxmega128d3', 'atxmega128d4', 11389 'atxmega192a3', 'atxmega192a3u', 'atxmega192c3', 11390 'atxmega192d3', 'atxmega256a3', 'atxmega256a3b', 11391 'atxmega256a3bu', 'atxmega256a3u', 'atxmega256c3', 11392 'atxmega256d3', 'atxmega384c3', 'atxmega384d3'. 11393 11394 'avrxmega7' 11395 "XMEGA" devices with more than 128 KiB of program memory and 11396 more than 64 KiB of RAM. 11397 MCU = 'atxmega128a1', 'atxmega128a1u', 'atxmega128a4u'. 11398 11399 'avr1' 11400 This ISA is implemented by the minimal AVR core and supported 11401 for assembler only. 11402 MCU = 'attiny11', 'attiny12', 'attiny15', 'attiny28', 11403 'at90s1200'. 11404 11405 '-maccumulate-args' 11406 Accumulate outgoing function arguments and acquire/release the 11407 needed stack space for outgoing function arguments once in function 11408 prologue/epilogue. Without this option, outgoing arguments are 11409 pushed before calling a function and popped afterwards. 11410 11411 Popping the arguments after the function call can be expensive on 11412 AVR so that accumulating the stack space might lead to smaller 11413 executables because arguments need not to be removed from the stack 11414 after such a function call. 11415 11416 This option can lead to reduced code size for functions that 11417 perform several calls to functions that get their arguments on the 11418 stack like calls to printf-like functions. 11419 11420 '-mbranch-cost=COST' 11421 Set the branch costs for conditional branch instructions to COST. 11422 Reasonable values for COST are small, non-negative integers. The 11423 default branch cost is 0. 11424 11425 '-mcall-prologues' 11426 Functions prologues/epilogues are expanded as calls to appropriate 11427 subroutines. Code size is smaller. 11428 11429 '-mint8' 11430 Assume 'int' to be 8-bit integer. This affects the sizes of all 11431 types: a 'char' is 1 byte, an 'int' is 1 byte, a 'long' is 2 bytes, 11432 and 'long long' is 4 bytes. Please note that this option does not 11433 conform to the C standards, but it results in smaller code size. 11434 11435 '-mno-interrupts' 11436 Generated code is not compatible with hardware interrupts. Code 11437 size is smaller. 11438 11439 '-mrelax' 11440 Try to replace 'CALL' resp. 'JMP' instruction by the shorter 11441 'RCALL' resp. 'RJMP' instruction if applicable. Setting '-mrelax' 11442 just adds the '--relax' option to the linker command line when the 11443 linker is called. 11444 11445 Jump relaxing is performed by the linker because jump offsets are 11446 not known before code is located. Therefore, the assembler code 11447 generated by the compiler is the same, but the instructions in the 11448 executable may differ from instructions in the assembler code. 11449 11450 Relaxing must be turned on if linker stubs are needed, see the 11451 section on 'EIND' and linker stubs below. 11452 11453 '-msp8' 11454 Treat the stack pointer register as an 8-bit register, i.e. assume 11455 the high byte of the stack pointer is zero. In general, you don't 11456 need to set this option by hand. 11457 11458 This option is used internally by the compiler to select and build 11459 multilibs for architectures 'avr2' and 'avr25'. These 11460 architectures mix devices with and without 'SPH'. For any setting 11461 other than '-mmcu=avr2' or '-mmcu=avr25' the compiler driver will 11462 add or remove this option from the compiler proper's command line, 11463 because the compiler then knows if the device or architecture has 11464 an 8-bit stack pointer and thus no 'SPH' register or not. 11465 11466 '-mstrict-X' 11467 Use address register 'X' in a way proposed by the hardware. This 11468 means that 'X' is only used in indirect, post-increment or 11469 pre-decrement addressing. 11470 11471 Without this option, the 'X' register may be used in the same way 11472 as 'Y' or 'Z' which then is emulated by additional instructions. 11473 For example, loading a value with 'X+const' addressing with a small 11474 non-negative 'const < 64' to a register RN is performed as 11475 11476 adiw r26, const ; X += const 11477 ld RN, X ; RN = *X 11478 sbiw r26, const ; X -= const 11479 11480 '-mtiny-stack' 11481 Only change the lower 8 bits of the stack pointer. 11482 11483 '-Waddr-space-convert' 11484 Warn about conversions between address spaces in the case where the 11485 resulting address space is not contained in the incoming address 11486 space. 11487 11488 3.17.4.1 'EIND' and Devices with more than 128 Ki Bytes of Flash 11489 ................................................................ 11490 11491 Pointers in the implementation are 16 bits wide. The address of a 11492 function or label is represented as word address so that indirect jumps 11493 and calls can target any code address in the range of 64 Ki words. 11494 11495 In order to facilitate indirect jump on devices with more than 128 Ki 11496 bytes of program memory space, there is a special function register 11497 called 'EIND' that serves as most significant part of the target address 11498 when 'EICALL' or 'EIJMP' instructions are used. 11499 11500 Indirect jumps and calls on these devices are handled as follows by the 11501 compiler and are subject to some limitations: 11502 11503 * The compiler never sets 'EIND'. 11504 11505 * The compiler uses 'EIND' implicitely in 'EICALL'/'EIJMP' 11506 instructions or might read 'EIND' directly in order to emulate an 11507 indirect call/jump by means of a 'RET' instruction. 11508 11509 * The compiler assumes that 'EIND' never changes during the startup 11510 code or during the application. In particular, 'EIND' is not 11511 saved/restored in function or interrupt service routine 11512 prologue/epilogue. 11513 11514 * For indirect calls to functions and computed goto, the linker 11515 generates _stubs_. Stubs are jump pads sometimes also called 11516 _trampolines_. Thus, the indirect call/jump jumps to such a stub. 11517 The stub contains a direct jump to the desired address. 11518 11519 * Linker relaxation must be turned on so that the linker will 11520 generate the stubs correctly an all situaltion. See the compiler 11521 option '-mrelax' and the linler option '--relax'. There are corner 11522 cases where the linker is supposed to generate stubs but aborts 11523 without relaxation and without a helpful error message. 11524 11525 * The default linker script is arranged for code with 'EIND = 0'. If 11526 code is supposed to work for a setup with 'EIND != 0', a custom 11527 linker script has to be used in order to place the sections whose 11528 name start with '.trampolines' into the segment where 'EIND' points 11529 to. 11530 11531 * The startup code from libgcc never sets 'EIND'. Notice that 11532 startup code is a blend of code from libgcc and AVR-LibC. For the 11533 impact of AVR-LibC on 'EIND', see the 11534 AVR-LibC user manual (http://nongnu.org/avr-libc/user-manual/). 11535 11536 * It is legitimate for user-specific startup code to set up 'EIND' 11537 early, for example by means of initialization code located in 11538 section '.init3'. Such code runs prior to general startup code 11539 that initializes RAM and calls constructors, but after the bit of 11540 startup code from AVR-LibC that sets 'EIND' to the segment where 11541 the vector table is located. 11542 #include <avr/io.h> 11543 11544 static void 11545 __attribute__((section(".init3"),naked,used,no_instrument_function)) 11546 init3_set_eind (void) 11547 { 11548 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 11549 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 11550 } 11551 11552 The '__trampolines_start' symbol is defined in the linker script. 11553 11554 * Stubs are generated automatically by the linker if the following 11555 two conditions are met: 11556 11557 - The address of a label is taken by means of the 'gs' modifier 11558 (short for _generate stubs_) like so: 11559 LDI r24, lo8(gs(FUNC)) 11560 LDI r25, hi8(gs(FUNC)) 11561 - The final location of that label is in a code segment 11562 _outside_ the segment where the stubs are located. 11563 11564 * The compiler emits such 'gs' modifiers for code labels in the 11565 following situations: 11566 - Taking address of a function or code label. 11567 - Computed goto. 11568 - If prologue-save function is used, see '-mcall-prologues' 11569 command-line option. 11570 - Switch/case dispatch tables. If you do not want such dispatch 11571 tables you can specify the '-fno-jump-tables' command-line 11572 option. 11573 - C and C++ constructors/destructors called during 11574 startup/shutdown. 11575 - If the tools hit a 'gs()' modifier explained above. 11576 11577 * Jumping to non-symbolic addresses like so is _not_ supported: 11578 11579 int main (void) 11580 { 11581 /* Call function at word address 0x2 */ 11582 return ((int(*)(void)) 0x2)(); 11583 } 11584 11585 Instead, a stub has to be set up, i.e. the function has to be 11586 called through a symbol ('func_4' in the example): 11587 11588 int main (void) 11589 { 11590 extern int func_4 (void); 11591 11592 /* Call function at byte address 0x4 */ 11593 return func_4(); 11594 } 11595 11596 and the application be linked with '-Wl,--defsym,func_4=0x4'. 11597 Alternatively, 'func_4' can be defined in the linker script. 11598 11599 3.17.4.2 Handling of the 'RAMPD', 'RAMPX', 'RAMPY' and 'RAMPZ' Special Function Registers 11600 ......................................................................................... 11601 11602 Some AVR devices support memories larger than the 64 KiB range that can 11603 be accessed with 16-bit pointers. To access memory locations outside 11604 this 64 KiB range, the contentent of a 'RAMP' register is used as high 11605 part of the address: The 'X', 'Y', 'Z' address register is concatenated 11606 with the 'RAMPX', 'RAMPY', 'RAMPZ' special function register, 11607 respectively, to get a wide address. Similarly, 'RAMPD' is used 11608 together with direct addressing. 11609 11610 * The startup code initializes the 'RAMP' special function registers 11611 with zero. 11612 11613 * If a *note named address space: AVR Named Address Spaces. other 11614 than generic or '__flash' is used, then 'RAMPZ' is set as needed 11615 before the operation. 11616 11617 * If the device supports RAM larger than 64 and the compiler needs 11618 to change 'RAMPZ' to accomplish an operation, 'RAMPZ' is reset to 11619 zero after the operation. 11620 11621 * If the device comes with a specific 'RAMP' register, the ISR 11622 prologue/epilogue saves/restores that SFR and initializes it with 11623 zero in case the ISR code might (implicitly) use it. 11624 11625 * RAM larger than 64 is not supported by GCC for AVR targets. If 11626 you use inline assembler to read from locations outside the 16-bit 11627 address range and change one of the 'RAMP' registers, you must 11628 reset it to zero after the access. 11629 11630 3.17.4.3 AVR Built-in Macros 11631 ............................ 11632 11633 GCC defines several built-in macros so that the user code can test for 11634 the presence or absence of features. Almost any of the following 11635 built-in macros are deduced from device capabilities and thus triggered 11636 by the '-mmcu=' command-line option. 11637 11638 For even more AVR-specific built-in macros see *note AVR Named Address 11639 Spaces:: and *note AVR Built-in Functions::. 11640 11641 '__AVR_ARCH__' 11642 Build-in macro that resolves to a decimal number that identifies 11643 the architecture and depends on the '-mmcu=MCU' option. Possible 11644 values are: 11645 11646 '2', '25', '3', '31', '35', '4', '5', '51', '6', '102', '104', 11647 '105', '106', '107' 11648 11649 for MCU='avr2', 'avr25', 'avr3', 'avr31', 'avr35', 'avr4', 'avr5', 11650 'avr51', 'avr6', 'avrxmega2', 'avrxmega4', 'avrxmega5', 11651 'avrxmega6', 'avrxmega7', respectively. If MCU specifies a device, 11652 this built-in macro is set accordingly. For example, with 11653 '-mmcu=atmega8' the macro will be defined to '4'. 11654 11655 '__AVR_DEVICE__' 11656 Setting '-mmcu=DEVICE' defines this built-in macro which reflects 11657 the device's name. For example, '-mmcu=atmega8' defines the 11658 built-in macro '__AVR_ATmega8__', '-mmcu=attiny261a' defines 11659 '__AVR_ATtiny261A__', etc. 11660 11661 The built-in macros' names follow the scheme '__AVR_DEVICE__' where 11662 DEVICE is the device name as from the AVR user manual. The 11663 difference between DEVICE in the built-in macro and DEVICE in 11664 '-mmcu=DEVICE' is that the latter is always lowercase. 11665 11666 If DEVICE is not a device but only a core architecture like 11667 'avr51', this macro will not be defined. 11668 11669 '__AVR_XMEGA__' 11670 The device / architecture belongs to the XMEGA family of devices. 11671 11672 '__AVR_HAVE_ELPM__' 11673 The device has the the 'ELPM' instruction. 11674 11675 '__AVR_HAVE_ELPMX__' 11676 The device has the 'ELPM RN,Z' and 'ELPM RN,Z+' instructions. 11677 11678 '__AVR_HAVE_MOVW__' 11679 The device has the 'MOVW' instruction to perform 16-bit 11680 register-register moves. 11681 11682 '__AVR_HAVE_LPMX__' 11683 The device has the 'LPM RN,Z' and 'LPM RN,Z+' instructions. 11684 11685 '__AVR_HAVE_MUL__' 11686 The device has a hardware multiplier. 11687 11688 '__AVR_HAVE_JMP_CALL__' 11689 The device has the 'JMP' and 'CALL' instructions. This is the case 11690 for devices with at least 16 KiB of program memory. 11691 11692 '__AVR_HAVE_EIJMP_EICALL__' 11693 '__AVR_3_BYTE_PC__' 11694 The device has the 'EIJMP' and 'EICALL' instructions. This is the 11695 case for devices with more than 128 KiB of program memory. This 11696 also means that the program counter (PC) is 3 bytes wide. 11697 11698 '__AVR_2_BYTE_PC__' 11699 The program counter (PC) is 2 bytes wide. This is the case for 11700 devices with up to 128 KiB of program memory. 11701 11702 '__AVR_HAVE_8BIT_SP__' 11703 '__AVR_HAVE_16BIT_SP__' 11704 The stack pointer (SP) register is treated as 8-bit respectively 11705 16-bit register by the compiler. The definition of these macros is 11706 affected by '-mtiny-stack'. 11707 11708 '__AVR_HAVE_SPH__' 11709 '__AVR_SP8__' 11710 The device has the SPH (high part of stack pointer) special 11711 function register or has an 8-bit stack pointer, respectively. The 11712 definition of these macros is affected by '-mmcu=' and in the cases 11713 of '-mmcu=avr2' and '-mmcu=avr25' also by '-msp8'. 11714 11715 '__AVR_HAVE_RAMPD__' 11716 '__AVR_HAVE_RAMPX__' 11717 '__AVR_HAVE_RAMPY__' 11718 '__AVR_HAVE_RAMPZ__' 11719 The device has the 'RAMPD', 'RAMPX', 'RAMPY', 'RAMPZ' special 11720 function register, respectively. 11721 11722 '__NO_INTERRUPTS__' 11723 This macro reflects the '-mno-interrupts' command line option. 11724 11725 '__AVR_ERRATA_SKIP__' 11726 '__AVR_ERRATA_SKIP_JMP_CALL__' 11727 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 11728 instructions because of a hardware erratum. Skip instructions are 11729 'SBRS', 'SBRC', 'SBIS', 'SBIC' and 'CPSE'. The second macro is 11730 only defined if '__AVR_HAVE_JMP_CALL__' is also set. 11731 11732 '__AVR_SFR_OFFSET__=OFFSET' 11733 Instructions that can address I/O special function registers 11734 directly like 'IN', 'OUT', 'SBI', etc. may use a different address 11735 as if addressed by an instruction to access RAM like 'LD' or 'STS'. 11736 This offset depends on the device architecture and has to be 11737 subtracted from the RAM address in order to get the respective 11738 I/O address. 11739 11740 '__WITH_AVRLIBC__' 11741 The compiler is configured to be used together with AVR-Libc. See 11742 the '--with-avrlibc' configure option. 11743 11744 11745 File: gcc.info, Node: Blackfin Options, Next: C6X Options, Prev: AVR Options, Up: Submodel Options 11746 11747 3.17.5 Blackfin Options 11748 ----------------------- 11749 11750 '-mcpu=CPU[-SIREVISION]' 11751 Specifies the name of the target Blackfin processor. Currently, 11752 CPU can be one of 'bf512', 'bf514', 'bf516', 'bf518', 'bf522', 11753 'bf523', 'bf524', 'bf525', 'bf526', 'bf527', 'bf531', 'bf532', 11754 'bf533', 'bf534', 'bf536', 'bf537', 'bf538', 'bf539', 'bf542', 11755 'bf544', 'bf547', 'bf548', 'bf549', 'bf542m', 'bf544m', 'bf547m', 11756 'bf548m', 'bf549m', 'bf561', 'bf592'. 11757 11758 The optional SIREVISION specifies the silicon revision of the 11759 target Blackfin processor. Any workarounds available for the 11760 targeted silicon revision are enabled. If SIREVISION is 'none', no 11761 workarounds are enabled. If SIREVISION is 'any', all workarounds 11762 for the targeted processor are enabled. The '__SILICON_REVISION__' 11763 macro is defined to two hexadecimal digits representing the major 11764 and minor numbers in the silicon revision. If SIREVISION is 11765 'none', the '__SILICON_REVISION__' is not defined. If SIREVISION 11766 is 'any', the '__SILICON_REVISION__' is defined to be '0xffff'. If 11767 this optional SIREVISION is not used, GCC assumes the latest known 11768 silicon revision of the targeted Blackfin processor. 11769 11770 GCC defines a preprocessor macro for the specified CPU. For the 11771 'bfin-elf' toolchain, this option causes the hardware BSP provided 11772 by libgloss to be linked in if '-msim' is not given. 11773 11774 Without this option, 'bf532' is used as the processor by default. 11775 11776 Note that support for 'bf561' is incomplete. For 'bf561', only the 11777 preprocessor macro is defined. 11778 11779 '-msim' 11780 Specifies that the program will be run on the simulator. This 11781 causes the simulator BSP provided by libgloss to be linked in. 11782 This option has effect only for 'bfin-elf' toolchain. Certain 11783 other options, such as '-mid-shared-library' and '-mfdpic', imply 11784 '-msim'. 11785 11786 '-momit-leaf-frame-pointer' 11787 Don't keep the frame pointer in a register for leaf functions. 11788 This avoids the instructions to save, set up and restore frame 11789 pointers and makes an extra register available in leaf functions. 11790 The option '-fomit-frame-pointer' removes the frame pointer for all 11791 functions, which might make debugging harder. 11792 11793 '-mspecld-anomaly' 11794 When enabled, the compiler ensures that the generated code does not 11795 contain speculative loads after jump instructions. If this option 11796 is used, '__WORKAROUND_SPECULATIVE_LOADS' is defined. 11797 11798 '-mno-specld-anomaly' 11799 Don't generate extra code to prevent speculative loads from 11800 occurring. 11801 11802 '-mcsync-anomaly' 11803 When enabled, the compiler ensures that the generated code does not 11804 contain CSYNC or SSYNC instructions too soon after conditional 11805 branches. If this option is used, '__WORKAROUND_SPECULATIVE_SYNCS' 11806 is defined. 11807 11808 '-mno-csync-anomaly' 11809 Don't generate extra code to prevent CSYNC or SSYNC instructions 11810 from occurring too soon after a conditional branch. 11811 11812 '-mlow-64k' 11813 When enabled, the compiler is free to take advantage of the 11814 knowledge that the entire program fits into the low 64k of memory. 11815 11816 '-mno-low-64k' 11817 Assume that the program is arbitrarily large. This is the default. 11818 11819 '-mstack-check-l1' 11820 Do stack checking using information placed into L1 scratchpad 11821 memory by the uClinux kernel. 11822 11823 '-mid-shared-library' 11824 Generate code that supports shared libraries via the library ID 11825 method. This allows for execute in place and shared libraries in 11826 an environment without virtual memory management. This option 11827 implies '-fPIC'. With a 'bfin-elf' target, this option implies 11828 '-msim'. 11829 11830 '-mno-id-shared-library' 11831 Generate code that doesn't assume ID-based shared libraries are 11832 being used. This is the default. 11833 11834 '-mleaf-id-shared-library' 11835 Generate code that supports shared libraries via the library ID 11836 method, but assumes that this library or executable won't link 11837 against any other ID shared libraries. That allows the compiler to 11838 use faster code for jumps and calls. 11839 11840 '-mno-leaf-id-shared-library' 11841 Do not assume that the code being compiled won't link against any 11842 ID shared libraries. Slower code is generated for jump and call 11843 insns. 11844 11845 '-mshared-library-id=n' 11846 Specifies the identification number of the ID-based shared library 11847 being compiled. Specifying a value of 0 generates more compact 11848 code; specifying other values forces the allocation of that number 11849 to the current library but is no more space- or time-efficient than 11850 omitting this option. 11851 11852 '-msep-data' 11853 Generate code that allows the data segment to be located in a 11854 different area of memory from the text segment. This allows for 11855 execute in place in an environment without virtual memory 11856 management by eliminating relocations against the text section. 11857 11858 '-mno-sep-data' 11859 Generate code that assumes that the data segment follows the text 11860 segment. This is the default. 11861 11862 '-mlong-calls' 11863 '-mno-long-calls' 11864 Tells the compiler to perform function calls by first loading the 11865 address of the function into a register and then performing a 11866 subroutine call on this register. This switch is needed if the 11867 target function lies outside of the 24-bit addressing range of the 11868 offset-based version of subroutine call instruction. 11869 11870 This feature is not enabled by default. Specifying 11871 '-mno-long-calls' restores the default behavior. Note these 11872 switches have no effect on how the compiler generates code to 11873 handle function calls via function pointers. 11874 11875 '-mfast-fp' 11876 Link with the fast floating-point library. This library relaxes 11877 some of the IEEE floating-point standard's rules for checking 11878 inputs against Not-a-Number (NAN), in the interest of performance. 11879 11880 '-minline-plt' 11881 Enable inlining of PLT entries in function calls to functions that 11882 are not known to bind locally. It has no effect without '-mfdpic'. 11883 11884 '-mmulticore' 11885 Build a standalone application for multicore Blackfin processors. 11886 This option causes proper start files and link scripts supporting 11887 multicore to be used, and defines the macro '__BFIN_MULTICORE'. It 11888 can only be used with '-mcpu=bf561[-SIREVISION]'. 11889 11890 This option can be used with '-mcorea' or '-mcoreb', which selects 11891 the one-application-per-core programming model. Without '-mcorea' 11892 or '-mcoreb', the single-application/dual-core programming model is 11893 used. In this model, the main function of Core B should be named 11894 as 'coreb_main'. 11895 11896 If this option is not used, the single-core application programming 11897 model is used. 11898 11899 '-mcorea' 11900 Build a standalone application for Core A of BF561 when using the 11901 one-application-per-core programming model. Proper start files and 11902 link scripts are used to support Core A, and the macro 11903 '__BFIN_COREA' is defined. This option can only be used in 11904 conjunction with '-mmulticore'. 11905 11906 '-mcoreb' 11907 Build a standalone application for Core B of BF561 when using the 11908 one-application-per-core programming model. Proper start files and 11909 link scripts are used to support Core B, and the macro 11910 '__BFIN_COREB' is defined. When this option is used, 'coreb_main' 11911 should be used instead of 'main'. This option can only be used in 11912 conjunction with '-mmulticore'. 11913 11914 '-msdram' 11915 Build a standalone application for SDRAM. Proper start files and 11916 link scripts are used to put the application into SDRAM, and the 11917 macro '__BFIN_SDRAM' is defined. The loader should initialize 11918 SDRAM before loading the application. 11919 11920 '-micplb' 11921 Assume that ICPLBs are enabled at run time. This has an effect on 11922 certain anomaly workarounds. For Linux targets, the default is to 11923 assume ICPLBs are enabled; for standalone applications the default 11924 is off. 11925 11926 11927 File: gcc.info, Node: C6X Options, Next: CRIS Options, Prev: Blackfin Options, Up: Submodel Options 11928 11929 3.17.6 C6X Options 11930 ------------------ 11931 11932 '-march=NAME' 11933 This specifies the name of the target architecture. GCC uses this 11934 name to determine what kind of instructions it can emit when 11935 generating assembly code. Permissible names are: 'c62x', 'c64x', 11936 'c64x+', 'c67x', 'c67x+', 'c674x'. 11937 11938 '-mbig-endian' 11939 Generate code for a big-endian target. 11940 11941 '-mlittle-endian' 11942 Generate code for a little-endian target. This is the default. 11943 11944 '-msim' 11945 Choose startup files and linker script suitable for the simulator. 11946 11947 '-msdata=default' 11948 Put small global and static data in the '.neardata' section, which 11949 is pointed to by register 'B14'. Put small uninitialized global 11950 and static data in the '.bss' section, which is adjacent to the 11951 '.neardata' section. Put small read-only data into the '.rodata' 11952 section. The corresponding sections used for large pieces of data 11953 are '.fardata', '.far' and '.const'. 11954 11955 '-msdata=all' 11956 Put all data, not just small objects, into the sections reserved 11957 for small data, and use addressing relative to the 'B14' register 11958 to access them. 11959 11960 '-msdata=none' 11961 Make no use of the sections reserved for small data, and use 11962 absolute addresses to access all data. Put all initialized global 11963 and static data in the '.fardata' section, and all uninitialized 11964 data in the '.far' section. Put all constant data into the 11965 '.const' section. 11966 11967 11968 File: gcc.info, Node: CRIS Options, Next: CR16 Options, Prev: C6X Options, Up: Submodel Options 11969 11970 3.17.7 CRIS Options 11971 ------------------- 11972 11973 These options are defined specifically for the CRIS ports. 11974 11975 '-march=ARCHITECTURE-TYPE' 11976 '-mcpu=ARCHITECTURE-TYPE' 11977 Generate code for the specified architecture. The choices for 11978 ARCHITECTURE-TYPE are 'v3', 'v8' and 'v10' for respectively 11979 ETRAX 4, ETRAX 100, and ETRAX 100 LX. Default is 'v0' except for 11980 cris-axis-linux-gnu, where the default is 'v10'. 11981 11982 '-mtune=ARCHITECTURE-TYPE' 11983 Tune to ARCHITECTURE-TYPE everything applicable about the generated 11984 code, except for the ABI and the set of available instructions. 11985 The choices for ARCHITECTURE-TYPE are the same as for 11986 '-march=ARCHITECTURE-TYPE'. 11987 11988 '-mmax-stack-frame=N' 11989 Warn when the stack frame of a function exceeds N bytes. 11990 11991 '-metrax4' 11992 '-metrax100' 11993 The options '-metrax4' and '-metrax100' are synonyms for 11994 '-march=v3' and '-march=v8' respectively. 11995 11996 '-mmul-bug-workaround' 11997 '-mno-mul-bug-workaround' 11998 Work around a bug in the 'muls' and 'mulu' instructions for CPU 11999 models where it applies. This option is active by default. 12000 12001 '-mpdebug' 12002 Enable CRIS-specific verbose debug-related information in the 12003 assembly code. This option also has the effect of turning off the 12004 '#NO_APP' formatted-code indicator to the assembler at the 12005 beginning of the assembly file. 12006 12007 '-mcc-init' 12008 Do not use condition-code results from previous instruction; always 12009 emit compare and test instructions before use of condition codes. 12010 12011 '-mno-side-effects' 12012 Do not emit instructions with side effects in addressing modes 12013 other than post-increment. 12014 12015 '-mstack-align' 12016 '-mno-stack-align' 12017 '-mdata-align' 12018 '-mno-data-align' 12019 '-mconst-align' 12020 '-mno-const-align' 12021 These options ('no-' options) arrange (eliminate arrangements) for 12022 the stack frame, individual data and constants to be aligned for 12023 the maximum single data access size for the chosen CPU model. The 12024 default is to arrange for 32-bit alignment. ABI details such as 12025 structure layout are not affected by these options. 12026 12027 '-m32-bit' 12028 '-m16-bit' 12029 '-m8-bit' 12030 Similar to the stack- data- and const-align options above, these 12031 options arrange for stack frame, writable data and constants to all 12032 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit 12033 alignment. 12034 12035 '-mno-prologue-epilogue' 12036 '-mprologue-epilogue' 12037 With '-mno-prologue-epilogue', the normal function prologue and 12038 epilogue which set up the stack frame are omitted and no return 12039 instructions or return sequences are generated in the code. Use 12040 this option only together with visual inspection of the compiled 12041 code: no warnings or errors are generated when call-saved registers 12042 must be saved, or storage for local variables needs to be 12043 allocated. 12044 12045 '-mno-gotplt' 12046 '-mgotplt' 12047 With '-fpic' and '-fPIC', don't generate (do generate) instruction 12048 sequences that load addresses for functions from the PLT part of 12049 the GOT rather than (traditional on other architectures) calls to 12050 the PLT. The default is '-mgotplt'. 12051 12052 '-melf' 12053 Legacy no-op option only recognized with the cris-axis-elf and 12054 cris-axis-linux-gnu targets. 12055 12056 '-mlinux' 12057 Legacy no-op option only recognized with the cris-axis-linux-gnu 12058 target. 12059 12060 '-sim' 12061 This option, recognized for the cris-axis-elf, arranges to link 12062 with input-output functions from a simulator library. Code, 12063 initialized data and zero-initialized data are allocated 12064 consecutively. 12065 12066 '-sim2' 12067 Like '-sim', but pass linker options to locate initialized data at 12068 0x40000000 and zero-initialized data at 0x80000000. 12069 12070 12071 File: gcc.info, Node: CR16 Options, Next: Darwin Options, Prev: CRIS Options, Up: Submodel Options 12072 12073 3.17.8 CR16 Options 12074 ------------------- 12075 12076 These options are defined specifically for the CR16 ports. 12077 12078 '-mmac' 12079 Enable the use of multiply-accumulate instructions. Disabled by 12080 default. 12081 12082 '-mcr16cplus' 12083 '-mcr16c' 12084 Generate code for CR16C or CR16C+ architecture. CR16C+ 12085 architecture is default. 12086 12087 '-msim' 12088 Links the library libsim.a which is in compatible with simulator. 12089 Applicable to ELF compiler only. 12090 12091 '-mint32' 12092 Choose integer type as 32-bit wide. 12093 12094 '-mbit-ops' 12095 Generates 'sbit'/'cbit' instructions for bit manipulations. 12096 12097 '-mdata-model=MODEL' 12098 Choose a data model. The choices for MODEL are 'near', 'far' or 12099 'medium'. 'medium' is default. However, 'far' is not valid with 12100 '-mcr16c', as the CR16C architecture does not support the far data 12101 model. 12102 12103 12104 File: gcc.info, Node: Darwin Options, Next: DEC Alpha Options, Prev: CR16 Options, Up: Submodel Options 12105 12106 3.17.9 Darwin Options 12107 --------------------- 12108 12109 These options are defined for all architectures running the Darwin 12110 operating system. 12111 12112 FSF GCC on Darwin does not create "fat" object files; it creates an 12113 object file for the single architecture that GCC was built to target. 12114 Apple's GCC on Darwin does create "fat" files if multiple '-arch' 12115 options are used; it does so by running the compiler or linker multiple 12116 times and joining the results together with 'lipo'. 12117 12118 The subtype of the file created (like 'ppc7400' or 'ppc970' or 'i686') 12119 is determined by the flags that specify the ISA that GCC is targeting, 12120 like '-mcpu' or '-march'. The '-force_cpusubtype_ALL' option can be 12121 used to override this. 12122 12123 The Darwin tools vary in their behavior when presented with an ISA 12124 mismatch. The assembler, 'as', only permits instructions to be used 12125 that are valid for the subtype of the file it is generating, so you 12126 cannot put 64-bit instructions in a 'ppc750' object file. The linker 12127 for shared libraries, '/usr/bin/libtool', fails and prints an error if 12128 asked to create a shared library with a less restrictive subtype than 12129 its input files (for instance, trying to put a 'ppc970' object file in a 12130 'ppc7400' library). The linker for executables, 'ld', quietly gives the 12131 executable the most restrictive subtype of any of its input files. 12132 12133 '-FDIR' 12134 Add the framework directory DIR to the head of the list of 12135 directories to be searched for header files. These directories are 12136 interleaved with those specified by '-I' options and are scanned in 12137 a left-to-right order. 12138 12139 A framework directory is a directory with frameworks in it. A 12140 framework is a directory with a 'Headers' and/or 'PrivateHeaders' 12141 directory contained directly in it that ends in '.framework'. The 12142 name of a framework is the name of this directory excluding the 12143 '.framework'. Headers associated with the framework are found in 12144 one of those two directories, with 'Headers' being searched first. 12145 A subframework is a framework directory that is in a framework's 12146 'Frameworks' directory. Includes of subframework headers can only 12147 appear in a header of a framework that contains the subframework, 12148 or in a sibling subframework header. Two subframeworks are 12149 siblings if they occur in the same framework. A subframework 12150 should not have the same name as a framework; a warning is issued 12151 if this is violated. Currently a subframework cannot have 12152 subframeworks; in the future, the mechanism may be extended to 12153 support this. The standard frameworks can be found in 12154 '/System/Library/Frameworks' and '/Library/Frameworks'. An example 12155 include looks like '#include <Framework/header.h>', where 12156 'Framework' denotes the name of the framework and 'header.h' is 12157 found in the 'PrivateHeaders' or 'Headers' directory. 12158 12159 '-iframeworkDIR' 12160 Like '-F' except the directory is a treated as a system directory. 12161 The main difference between this '-iframework' and '-F' is that 12162 with '-iframework' the compiler does not warn about constructs 12163 contained within header files found via DIR. This option is valid 12164 only for the C family of languages. 12165 12166 '-gused' 12167 Emit debugging information for symbols that are used. For stabs 12168 debugging format, this enables '-feliminate-unused-debug-symbols'. 12169 This is by default ON. 12170 12171 '-gfull' 12172 Emit debugging information for all symbols and types. 12173 12174 '-mmacosx-version-min=VERSION' 12175 The earliest version of MacOS X that this executable will run on is 12176 VERSION. Typical values of VERSION include '10.1', '10.2', and 12177 '10.3.9'. 12178 12179 If the compiler was built to use the system's headers by default, 12180 then the default for this option is the system version on which the 12181 compiler is running, otherwise the default is to make choices that 12182 are compatible with as many systems and code bases as possible. 12183 12184 '-mkernel' 12185 Enable kernel development mode. The '-mkernel' option sets 12186 '-static', '-fno-common', '-fno-cxa-atexit', '-fno-exceptions', 12187 '-fno-non-call-exceptions', '-fapple-kext', '-fno-weak' and 12188 '-fno-rtti' where applicable. This mode also sets '-mno-altivec', 12189 '-msoft-float', '-fno-builtin' and '-mlong-branch' for PowerPC 12190 targets. 12191 12192 '-mone-byte-bool' 12193 Override the defaults for 'bool' so that 'sizeof(bool)==1'. By 12194 default 'sizeof(bool)' is '4' when compiling for Darwin/PowerPC and 12195 '1' when compiling for Darwin/x86, so this option has no effect on 12196 x86. 12197 12198 *Warning:* The '-mone-byte-bool' switch causes GCC to generate code 12199 that is not binary compatible with code generated without that 12200 switch. Using this switch may require recompiling all other 12201 modules in a program, including system libraries. Use this switch 12202 to conform to a non-default data model. 12203 12204 '-mfix-and-continue' 12205 '-ffix-and-continue' 12206 '-findirect-data' 12207 Generate code suitable for fast turnaround development, such as to 12208 allow GDB to dynamically load '.o' files into already-running 12209 programs. '-findirect-data' and '-ffix-and-continue' are provided 12210 for backwards compatibility. 12211 12212 '-all_load' 12213 Loads all members of static archive libraries. See man ld(1) for 12214 more information. 12215 12216 '-arch_errors_fatal' 12217 Cause the errors having to do with files that have the wrong 12218 architecture to be fatal. 12219 12220 '-bind_at_load' 12221 Causes the output file to be marked such that the dynamic linker 12222 will bind all undefined references when the file is loaded or 12223 launched. 12224 12225 '-bundle' 12226 Produce a Mach-o bundle format file. See man ld(1) for more 12227 information. 12228 12229 '-bundle_loader EXECUTABLE' 12230 This option specifies the EXECUTABLE that will load the build 12231 output file being linked. See man ld(1) for more information. 12232 12233 '-dynamiclib' 12234 When passed this option, GCC produces a dynamic library instead of 12235 an executable when linking, using the Darwin 'libtool' command. 12236 12237 '-force_cpusubtype_ALL' 12238 This causes GCC's output file to have the ALL subtype, instead of 12239 one controlled by the '-mcpu' or '-march' option. 12240 12241 '-allowable_client CLIENT_NAME' 12242 '-client_name' 12243 '-compatibility_version' 12244 '-current_version' 12245 '-dead_strip' 12246 '-dependency-file' 12247 '-dylib_file' 12248 '-dylinker_install_name' 12249 '-dynamic' 12250 '-exported_symbols_list' 12251 '-filelist' 12252 '-flat_namespace' 12253 '-force_flat_namespace' 12254 '-headerpad_max_install_names' 12255 '-image_base' 12256 '-init' 12257 '-install_name' 12258 '-keep_private_externs' 12259 '-multi_module' 12260 '-multiply_defined' 12261 '-multiply_defined_unused' 12262 '-noall_load' 12263 '-no_dead_strip_inits_and_terms' 12264 '-nofixprebinding' 12265 '-nomultidefs' 12266 '-noprebind' 12267 '-noseglinkedit' 12268 '-pagezero_size' 12269 '-prebind' 12270 '-prebind_all_twolevel_modules' 12271 '-private_bundle' 12272 '-read_only_relocs' 12273 '-sectalign' 12274 '-sectobjectsymbols' 12275 '-whyload' 12276 '-seg1addr' 12277 '-sectcreate' 12278 '-sectobjectsymbols' 12279 '-sectorder' 12280 '-segaddr' 12281 '-segs_read_only_addr' 12282 '-segs_read_write_addr' 12283 '-seg_addr_table' 12284 '-seg_addr_table_filename' 12285 '-seglinkedit' 12286 '-segprot' 12287 '-segs_read_only_addr' 12288 '-segs_read_write_addr' 12289 '-single_module' 12290 '-static' 12291 '-sub_library' 12292 '-sub_umbrella' 12293 '-twolevel_namespace' 12294 '-umbrella' 12295 '-undefined' 12296 '-unexported_symbols_list' 12297 '-weak_reference_mismatches' 12298 '-whatsloaded' 12299 These options are passed to the Darwin linker. The Darwin linker 12300 man page describes them in detail. 12301 12302 12303 File: gcc.info, Node: DEC Alpha Options, Next: FR30 Options, Prev: Darwin Options, Up: Submodel Options 12304 12305 3.17.10 DEC Alpha Options 12306 ------------------------- 12307 12308 These '-m' options are defined for the DEC Alpha implementations: 12309 12310 '-mno-soft-float' 12311 '-msoft-float' 12312 Use (do not use) the hardware floating-point instructions for 12313 floating-point operations. When '-msoft-float' is specified, 12314 functions in 'libgcc.a' are used to perform floating-point 12315 operations. Unless they are replaced by routines that emulate the 12316 floating-point operations, or compiled in such a way as to call 12317 such emulations routines, these routines issue floating-point 12318 operations. If you are compiling for an Alpha without 12319 floating-point operations, you must ensure that the library is 12320 built so as not to call them. 12321 12322 Note that Alpha implementations without floating-point operations 12323 are required to have floating-point registers. 12324 12325 '-mfp-reg' 12326 '-mno-fp-regs' 12327 Generate code that uses (does not use) the floating-point register 12328 set. '-mno-fp-regs' implies '-msoft-float'. If the floating-point 12329 register set is not used, floating-point operands are passed in 12330 integer registers as if they were integers and floating-point 12331 results are passed in '$0' instead of '$f0'. This is a 12332 non-standard calling sequence, so any function with a 12333 floating-point argument or return value called by code compiled 12334 with '-mno-fp-regs' must also be compiled with that option. 12335 12336 A typical use of this option is building a kernel that does not 12337 use, and hence need not save and restore, any floating-point 12338 registers. 12339 12340 '-mieee' 12341 The Alpha architecture implements floating-point hardware optimized 12342 for maximum performance. It is mostly compliant with the IEEE 12343 floating-point standard. However, for full compliance, software 12344 assistance is required. This option generates code fully 12345 IEEE-compliant code _except_ that the INEXACT-FLAG is not 12346 maintained (see below). If this option is turned on, the 12347 preprocessor macro '_IEEE_FP' is defined during compilation. The 12348 resulting code is less efficient but is able to correctly support 12349 denormalized numbers and exceptional IEEE values such as 12350 not-a-number and plus/minus infinity. Other Alpha compilers call 12351 this option '-ieee_with_no_inexact'. 12352 12353 '-mieee-with-inexact' 12354 This is like '-mieee' except the generated code also maintains the 12355 IEEE INEXACT-FLAG. Turning on this option causes the generated 12356 code to implement fully-compliant IEEE math. In addition to 12357 '_IEEE_FP', '_IEEE_FP_EXACT' is defined as a preprocessor macro. 12358 On some Alpha implementations the resulting code may execute 12359 significantly slower than the code generated by default. Since 12360 there is very little code that depends on the INEXACT-FLAG, you 12361 should normally not specify this option. Other Alpha compilers 12362 call this option '-ieee_with_inexact'. 12363 12364 '-mfp-trap-mode=TRAP-MODE' 12365 This option controls what floating-point related traps are enabled. 12366 Other Alpha compilers call this option '-fptm TRAP-MODE'. The trap 12367 mode can be set to one of four values: 12368 12369 'n' 12370 This is the default (normal) setting. The only traps that are 12371 enabled are the ones that cannot be disabled in software 12372 (e.g., division by zero trap). 12373 12374 'u' 12375 In addition to the traps enabled by 'n', underflow traps are 12376 enabled as well. 12377 12378 'su' 12379 Like 'u', but the instructions are marked to be safe for 12380 software completion (see Alpha architecture manual for 12381 details). 12382 12383 'sui' 12384 Like 'su', but inexact traps are enabled as well. 12385 12386 '-mfp-rounding-mode=ROUNDING-MODE' 12387 Selects the IEEE rounding mode. Other Alpha compilers call this 12388 option '-fprm ROUNDING-MODE'. The ROUNDING-MODE can be one of: 12389 12390 'n' 12391 Normal IEEE rounding mode. Floating-point numbers are rounded 12392 towards the nearest machine number or towards the even machine 12393 number in case of a tie. 12394 12395 'm' 12396 Round towards minus infinity. 12397 12398 'c' 12399 Chopped rounding mode. Floating-point numbers are rounded 12400 towards zero. 12401 12402 'd' 12403 Dynamic rounding mode. A field in the floating-point control 12404 register (FPCR, see Alpha architecture reference manual) 12405 controls the rounding mode in effect. The C library 12406 initializes this register for rounding towards plus infinity. 12407 Thus, unless your program modifies the FPCR, 'd' corresponds 12408 to round towards plus infinity. 12409 12410 '-mtrap-precision=TRAP-PRECISION' 12411 In the Alpha architecture, floating-point traps are imprecise. 12412 This means without software assistance it is impossible to recover 12413 from a floating trap and program execution normally needs to be 12414 terminated. GCC can generate code that can assist operating system 12415 trap handlers in determining the exact location that caused a 12416 floating-point trap. Depending on the requirements of an 12417 application, different levels of precisions can be selected: 12418 12419 'p' 12420 Program precision. This option is the default and means a 12421 trap handler can only identify which program caused a 12422 floating-point exception. 12423 12424 'f' 12425 Function precision. The trap handler can determine the 12426 function that caused a floating-point exception. 12427 12428 'i' 12429 Instruction precision. The trap handler can determine the 12430 exact instruction that caused a floating-point exception. 12431 12432 Other Alpha compilers provide the equivalent options called 12433 '-scope_safe' and '-resumption_safe'. 12434 12435 '-mieee-conformant' 12436 This option marks the generated code as IEEE conformant. You must 12437 not use this option unless you also specify '-mtrap-precision=i' 12438 and either '-mfp-trap-mode=su' or '-mfp-trap-mode=sui'. Its only 12439 effect is to emit the line '.eflag 48' in the function prologue of 12440 the generated assembly file. 12441 12442 '-mbuild-constants' 12443 Normally GCC examines a 32- or 64-bit integer constant to see if it 12444 can construct it from smaller constants in two or three 12445 instructions. If it cannot, it outputs the constant as a literal 12446 and generates code to load it from the data segment at run time. 12447 12448 Use this option to require GCC to construct _all_ integer constants 12449 using code, even if it takes more instructions (the maximum is 12450 six). 12451 12452 You typically use this option to build a shared library dynamic 12453 loader. Itself a shared library, it must relocate itself in memory 12454 before it can find the variables and constants in its own data 12455 segment. 12456 12457 '-mbwx' 12458 '-mno-bwx' 12459 '-mcix' 12460 '-mno-cix' 12461 '-mfix' 12462 '-mno-fix' 12463 '-mmax' 12464 '-mno-max' 12465 Indicate whether GCC should generate code to use the optional BWX, 12466 CIX, FIX and MAX instruction sets. The default is to use the 12467 instruction sets supported by the CPU type specified via '-mcpu=' 12468 option or that of the CPU on which GCC was built if none is 12469 specified. 12470 12471 '-mfloat-vax' 12472 '-mfloat-ieee' 12473 Generate code that uses (does not use) VAX F and G floating-point 12474 arithmetic instead of IEEE single and double precision. 12475 12476 '-mexplicit-relocs' 12477 '-mno-explicit-relocs' 12478 Older Alpha assemblers provided no way to generate symbol 12479 relocations except via assembler macros. Use of these macros does 12480 not allow optimal instruction scheduling. GNU binutils as of 12481 version 2.12 supports a new syntax that allows the compiler to 12482 explicitly mark which relocations should apply to which 12483 instructions. This option is mostly useful for debugging, as GCC 12484 detects the capabilities of the assembler when it is built and sets 12485 the default accordingly. 12486 12487 '-msmall-data' 12488 '-mlarge-data' 12489 When '-mexplicit-relocs' is in effect, static data is accessed via 12490 "gp-relative" relocations. When '-msmall-data' is used, objects 8 12491 bytes long or smaller are placed in a "small data area" (the 12492 '.sdata' and '.sbss' sections) and are accessed via 16-bit 12493 relocations off of the '$gp' register. This limits the size of the 12494 small data area to 64KB, but allows the variables to be directly 12495 accessed via a single instruction. 12496 12497 The default is '-mlarge-data'. With this option the data area is 12498 limited to just below 2GB. Programs that require more than 2GB of 12499 data must use 'malloc' or 'mmap' to allocate the data in the heap 12500 instead of in the program's data segment. 12501 12502 When generating code for shared libraries, '-fpic' implies 12503 '-msmall-data' and '-fPIC' implies '-mlarge-data'. 12504 12505 '-msmall-text' 12506 '-mlarge-text' 12507 When '-msmall-text' is used, the compiler assumes that the code of 12508 the entire program (or shared library) fits in 4MB, and is thus 12509 reachable with a branch instruction. When '-msmall-data' is used, 12510 the compiler can assume that all local symbols share the same '$gp' 12511 value, and thus reduce the number of instructions required for a 12512 function call from 4 to 1. 12513 12514 The default is '-mlarge-text'. 12515 12516 '-mcpu=CPU_TYPE' 12517 Set the instruction set and instruction scheduling parameters for 12518 machine type CPU_TYPE. You can specify either the 'EV' style name 12519 or the corresponding chip number. GCC supports scheduling 12520 parameters for the EV4, EV5 and EV6 family of processors and 12521 chooses the default values for the instruction set from the 12522 processor you specify. If you do not specify a processor type, GCC 12523 defaults to the processor on which the compiler was built. 12524 12525 Supported values for CPU_TYPE are 12526 12527 'ev4' 12528 'ev45' 12529 '21064' 12530 Schedules as an EV4 and has no instruction set extensions. 12531 12532 'ev5' 12533 '21164' 12534 Schedules as an EV5 and has no instruction set extensions. 12535 12536 'ev56' 12537 '21164a' 12538 Schedules as an EV5 and supports the BWX extension. 12539 12540 'pca56' 12541 '21164pc' 12542 '21164PC' 12543 Schedules as an EV5 and supports the BWX and MAX extensions. 12544 12545 'ev6' 12546 '21264' 12547 Schedules as an EV6 and supports the BWX, FIX, and MAX 12548 extensions. 12549 12550 'ev67' 12551 '21264a' 12552 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX 12553 extensions. 12554 12555 Native toolchains also support the value 'native', which selects 12556 the best architecture option for the host processor. 12557 '-mcpu=native' has no effect if GCC does not recognize the 12558 processor. 12559 12560 '-mtune=CPU_TYPE' 12561 Set only the instruction scheduling parameters for machine type 12562 CPU_TYPE. The instruction set is not changed. 12563 12564 Native toolchains also support the value 'native', which selects 12565 the best architecture option for the host processor. 12566 '-mtune=native' has no effect if GCC does not recognize the 12567 processor. 12568 12569 '-mmemory-latency=TIME' 12570 Sets the latency the scheduler should assume for typical memory 12571 references as seen by the application. This number is highly 12572 dependent on the memory access patterns used by the application and 12573 the size of the external cache on the machine. 12574 12575 Valid options for TIME are 12576 12577 'NUMBER' 12578 A decimal number representing clock cycles. 12579 12580 'L1' 12581 'L2' 12582 'L3' 12583 'main' 12584 The compiler contains estimates of the number of clock cycles 12585 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches 12586 (also called Dcache, Scache, and Bcache), as well as to main 12587 memory. Note that L3 is only valid for EV5. 12588 12589 12590 File: gcc.info, Node: FR30 Options, Next: FRV Options, Prev: DEC Alpha Options, Up: Submodel Options 12591 12592 3.17.11 FR30 Options 12593 -------------------- 12594 12595 These options are defined specifically for the FR30 port. 12596 12597 '-msmall-model' 12598 Use the small address space model. This can produce smaller code, 12599 but it does assume that all symbolic values and addresses fit into 12600 a 20-bit range. 12601 12602 '-mno-lsim' 12603 Assume that runtime support has been provided and so there is no 12604 need to include the simulator library ('libsim.a') on the linker 12605 command line. 12606 12607 12608 File: gcc.info, Node: FRV Options, Next: GNU/Linux Options, Prev: FR30 Options, Up: Submodel Options 12609 12610 3.