|
|
1.1 ! root 1: This is Info file gcc.info, produced by Makeinfo-1.54 from the input ! 2: file gcc.texi. ! 3: ! 4: This file documents the use and the internals of the GNU compiler. ! 5: ! 6: Published by the Free Software Foundation 675 Massachusetts Avenue ! 7: Cambridge, MA 02139 USA ! 8: ! 9: Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc. ! 10: ! 11: Permission is granted to make and distribute verbatim copies of this ! 12: manual provided the copyright notice and this permission notice are ! 13: preserved on all copies. ! 14: ! 15: Permission is granted to copy and distribute modified versions of ! 16: this manual under the conditions for verbatim copying, provided also ! 17: that the sections entitled "GNU General Public License" and "Protect ! 18: Your Freedom--Fight `Look And Feel'" are included exactly as in the ! 19: original, and provided that the entire resulting derived work is ! 20: distributed under the terms of a permission notice identical to this ! 21: one. ! 22: ! 23: Permission is granted to copy and distribute translations of this ! 24: manual into another language, under the above conditions for modified ! 25: versions, except that the sections entitled "GNU General Public ! 26: License" and "Protect Your Freedom--Fight `Look And Feel'", and this ! 27: permission notice, may be included in translations approved by the Free ! 28: Software Foundation instead of in the original English. ! 29: ! 30: ! 31: File: gcc.info, Node: Optimize Options, Next: Preprocessor Options, Prev: Debugging Options, Up: Invoking GCC ! 32: ! 33: Options That Control Optimization ! 34: ================================= ! 35: ! 36: These options control various sorts of optimizations: ! 37: ! 38: `-O' ! 39: `-O1' ! 40: Optimize. Optimizing compilation takes somewhat more time, and a ! 41: lot more memory for a large function. ! 42: ! 43: Without `-O', the compiler's goal is to reduce the cost of ! 44: compilation and to make debugging produce the expected results. ! 45: Statements are independent: if you stop the program with a ! 46: breakpoint between statements, you can then assign a new value to ! 47: any variable or change the program counter to any other statement ! 48: in the function and get exactly the results you would expect from ! 49: the source code. ! 50: ! 51: Without `-O', only variables declared `register' are allocated in ! 52: registers. The resulting compiled code is a little worse than ! 53: produced by PCC without `-O'. ! 54: ! 55: With `-O', the compiler tries to reduce code size and execution ! 56: time. ! 57: ! 58: When `-O' is specified, the two options `-fthread-jumps' and ! 59: `-fdelayed-branch' are turned on. On some machines other flags may ! 60: also be turned on. ! 61: ! 62: `-O2' ! 63: Optimize even more. Nearly all supported optimizations that do not ! 64: involve a space-speed tradeoff are performed. As compared to `-O', ! 65: this option increases both compilation time and the performance of ! 66: the generated code. ! 67: ! 68: `-O2' turns on all optional optimizations except for loop unrolling ! 69: and frame pointer elimination. ! 70: ! 71: `-O0' ! 72: Do not optimize. ! 73: ! 74: If you use multiple `-O' options, with or without level numbers, ! 75: the last such option is the one that is effective. ! 76: ! 77: Options of the form `-fFLAG' specify machine-independent flags. ! 78: Most flags have both positive and negative forms; the negative form of ! 79: `-ffoo' would be `-fno-foo'. In the table below, only one of the forms ! 80: is listed--the one which is not the default. You can figure out the ! 81: other form by either removing `no-' or adding it. ! 82: ! 83: `-ffloat-store' ! 84: Do not store floating point variables in registers, and inhibit ! 85: other options that might change whether a floating point value is ! 86: taken from a register or memory. ! 87: ! 88: This option prevents undesirable excess precision on machines such ! 89: as the 68000 where the floating registers (of the 68881) keep more ! 90: precision than a `double' is supposed to have. For most programs, ! 91: the excess precision does only good, but a few programs rely on the ! 92: precise definition of IEEE floating point. Use `-ffloat-store' for ! 93: such programs. ! 94: ! 95: `-fno-default-inline' ! 96: Do not make member functions inline by default merely because they ! 97: are defined inside the class scope (C++ only). Otherwise, when ! 98: you specify `-O', member functions defined inside class scope are ! 99: compiled inline by default; i.e., you don't need to add `inline' ! 100: in front of the member function name. ! 101: ! 102: `-fno-defer-pop' ! 103: Always pop the arguments to each function call as soon as that ! 104: function returns. For machines which must pop arguments after a ! 105: function call, the compiler normally lets arguments accumulate on ! 106: the stack for several function calls and pops them all at once. ! 107: ! 108: `-fforce-mem' ! 109: Force memory operands to be copied into registers before doing ! 110: arithmetic on them. This may produce better code by making all ! 111: memory references potential common subexpressions. When they are ! 112: not common subexpressions, instruction combination should ! 113: eliminate the separate register-load. I am interested in hearing ! 114: about the difference this makes. ! 115: ! 116: `-fforce-addr' ! 117: Force memory address constants to be copied into registers before ! 118: doing arithmetic on them. This may produce better code just as ! 119: `-fforce-mem' may. I am interested in hearing about the ! 120: difference this makes. ! 121: ! 122: `-fomit-frame-pointer' ! 123: Don't keep the frame pointer in a register for functions that ! 124: don't need one. This avoids the instructions to save, set up and ! 125: restore frame pointers; it also makes an extra register available ! 126: in many functions. *It also makes debugging impossible on some ! 127: machines.* ! 128: ! 129: On some machines, such as the Vax, this flag has no effect, because ! 130: the standard calling sequence automatically handles the frame ! 131: pointer and nothing is saved by pretending it doesn't exist. The ! 132: machine-description macro `FRAME_POINTER_REQUIRED' controls ! 133: whether a target machine supports this flag. *Note Registers::. ! 134: ! 135: `-fno-inline' ! 136: Don't pay attention to the `inline' keyword. Normally this option ! 137: is used to keep the compiler from expanding any functions inline. ! 138: Note that if you are not optimizing, no functions can be expanded ! 139: inline. ! 140: ! 141: `-finline-functions' ! 142: Integrate all simple functions into their callers. The compiler ! 143: heuristically decides which functions are simple enough to be worth ! 144: integrating in this way. ! 145: ! 146: If all calls to a given function are integrated, and the function ! 147: is declared `static', then the function is normally not output as ! 148: assembler code in its own right. ! 149: ! 150: `-fkeep-inline-functions' ! 151: Even if all calls to a given function are integrated, and the ! 152: function is declared `static', nevertheless output a separate ! 153: run-time callable version of the function. ! 154: ! 155: `-fno-function-cse' ! 156: Do not put function addresses in registers; make each instruction ! 157: that calls a constant function contain the function's address ! 158: explicitly. ! 159: ! 160: This option results in less efficient code, but some strange hacks ! 161: that alter the assembler output may be confused by the ! 162: optimizations performed when this option is not used. ! 163: ! 164: `-ffast-math' ! 165: This option allows GCC to violate some ANSI or IEEE rules and/or ! 166: specifications in the interest of optimizing code for speed. For ! 167: example, it allows the compiler to assume arguments to the `sqrt' ! 168: function are non-negative numbers. ! 169: ! 170: This option should never be turned on by any `-O' option since it ! 171: can result in incorrect output for programs which depend on an ! 172: exact implementation of IEEE or ANSI rules/specifications for math ! 173: functions. ! 174: ! 175: The following options control specific optimizations. The `-O2' ! 176: option turns on all of these optimizations except `-funroll-loops' and ! 177: `-funroll-all-loops'. On most machines, the `-O' option turns on the ! 178: `-fthread-jumps' and `-fdelayed-branch' options, but specific machines ! 179: may handle it differently. ! 180: ! 181: You can use the following flags in the rare cases when "fine-tuning" ! 182: of optimizations to be performed is desired. ! 183: ! 184: `-fstrength-reduce' ! 185: Perform the optimizations of loop strength reduction and ! 186: elimination of iteration variables. ! 187: ! 188: `-fthread-jumps' ! 189: Perform optimizations where we check to see if a jump branches to a ! 190: location where another comparison subsumed by the first is found. ! 191: If so, the first branch is redirected to either the destination of ! 192: the second branch or a point immediately following it, depending ! 193: on whether the condition is known to be true or false. ! 194: ! 195: `-fcse-follow-jumps' ! 196: In common subexpression elimination, scan through jump instructions ! 197: when the target of the jump is not reached by any other path. For ! 198: example, when CSE encounters an `if' statement with an `else' ! 199: clause, CSE will follow the jump when the condition tested is ! 200: false. ! 201: ! 202: `-fcse-skip-blocks' ! 203: This is similar to `-fcse-follow-jumps', but causes CSE to follow ! 204: jumps which conditionally skip over blocks. When CSE encounters a ! 205: simple `if' statement with no else clause, `-fcse-skip-blocks' ! 206: causes CSE to follow the jump around the body of the `if'. ! 207: ! 208: `-frerun-cse-after-loop' ! 209: Re-run common subexpression elimination after loop optimizations ! 210: has been performed. ! 211: ! 212: `-fexpensive-optimizations' ! 213: Perform a number of minor optimizations that are relatively ! 214: expensive. ! 215: ! 216: `-fdelayed-branch' ! 217: If supported for the target machine, attempt to reorder ! 218: instructions to exploit instruction slots available after delayed ! 219: branch instructions. ! 220: ! 221: `-fschedule-insns' ! 222: If supported for the target machine, attempt to reorder ! 223: instructions to eliminate execution stalls due to required data ! 224: being unavailable. This helps machines that have slow floating ! 225: point or memory load instructions by allowing other instructions ! 226: to be issued until the result of the load or floating point ! 227: instruction is required. ! 228: ! 229: `-fschedule-insns2' ! 230: Similar to `-fschedule-insns', but requests an additional pass of ! 231: instruction scheduling after register allocation has been done. ! 232: This is especially useful on machines with a relatively small ! 233: number of registers and where memory load instructions take more ! 234: than one cycle. ! 235: ! 236: `-fcaller-saves' ! 237: Enable values to be allocated in registers that will be clobbered ! 238: by function calls, by emitting extra instructions to save and ! 239: restore the registers around such calls. Such allocation is done ! 240: only when it seems to result in better code than would otherwise ! 241: be produced. ! 242: ! 243: This option is enabled by default on certain machines, usually ! 244: those which have no call-preserved registers to use instead. ! 245: ! 246: `-funroll-loops' ! 247: Perform the optimization of loop unrolling. This is only done for ! 248: loops whose number of iterations can be determined at compile time ! 249: or run time. `-funroll-loop' implies both `-fstrength-reduce' and ! 250: `-frerun-cse-after-loop'. ! 251: ! 252: `-funroll-all-loops' ! 253: Perform the optimization of loop unrolling. This is done for all ! 254: loops and usually makes programs run more slowly. ! 255: `-funroll-all-loops' implies `-fstrength-reduce' as well as ! 256: `-frerun-cse-after-loop'. ! 257: ! 258: `-fno-peephole' ! 259: Disable any machine-specific peephole optimizations. ! 260: ! 261: ! 262: File: gcc.info, Node: Preprocessor Options, Next: Assembler Options, Prev: Optimize Options, Up: Invoking GCC ! 263: ! 264: Options Controlling the Preprocessor ! 265: ==================================== ! 266: ! 267: These options control the C preprocessor, which is run on each C ! 268: source file before actual compilation. ! 269: ! 270: If you use the `-E' option, nothing is done except preprocessing. ! 271: Some of these options make sense only together with `-E' because they ! 272: cause the preprocessor output to be unsuitable for actual compilation. ! 273: ! 274: `-include FILE' ! 275: Process FILE as input before processing the regular input file. ! 276: In effect, the contents of FILE are compiled first. Any `-D' and ! 277: `-U' options on the command line are always processed before ! 278: `-include FILE', regardless of the order in which they are ! 279: written. All the `-include' and `-imacros' options are processed ! 280: in the order in which they are written. ! 281: ! 282: `-imacros FILE' ! 283: Process FILE as input, discarding the resulting output, before ! 284: processing the regular input file. Because the output generated ! 285: from FILE is discarded, the only effect of `-imacros FILE' is to ! 286: make the macros defined in FILE available for use in the main ! 287: input. ! 288: ! 289: Any `-D' and `-U' options on the command line are always processed ! 290: before `-imacros FILE', regardless of the order in which they are ! 291: written. All the `-include' and `-imacros' options are processed ! 292: in the order in which they are written. ! 293: ! 294: `-idirafter DIR' ! 295: Add the directory DIR to the second include path. The directories ! 296: on the second include path are searched when a header file is not ! 297: found in any of the directories in the main include path (the one ! 298: that `-I' adds to). ! 299: ! 300: `-iprefix PREFIX' ! 301: Specify PREFIX as the prefix for subsequent `-iwithprefix' options. ! 302: ! 303: `-iwithprefix DIR' ! 304: Add a directory to the second include path. The directory's name ! 305: is made by concatenating PREFIX and DIR, where PREFIX was ! 306: specified previously with `-iprefix'. If you have not specified a ! 307: prefix yet, the directory containing the installed passes of the ! 308: compiler is used as the default. ! 309: ! 310: `-iwithprefixbefore DIR' ! 311: Add a directory to the main include path. The directory's name is ! 312: made by concatenating PREFIX and DIR, as in the case of ! 313: `-iwithprefix'. ! 314: ! 315: `-nostdinc' ! 316: Do not search the standard system directories for header files. ! 317: Only the directories you have specified with `-I' options (and the ! 318: current directory, if appropriate) are searched. *Note Directory ! 319: Options::, for information on `-I'. ! 320: ! 321: By using both `-nostdinc' and `-I-', you can limit the include-file ! 322: search path to only those directories you specify explicitly. ! 323: ! 324: `-undef' ! 325: Do not predefine any nonstandard macros. (Including architecture ! 326: flags). ! 327: ! 328: `-E' ! 329: Run only the C preprocessor. Preprocess all the C source files ! 330: specified and output the results to standard output or to the ! 331: specified output file. ! 332: ! 333: `-C' ! 334: Tell the preprocessor not to discard comments. Used with the `-E' ! 335: option. ! 336: ! 337: `-P' ! 338: Tell the preprocessor not to generate `#line' commands. Used with ! 339: the `-E' option. ! 340: ! 341: `-M' ! 342: Tell the preprocessor to output a rule suitable for `make' ! 343: describing the dependencies of each object file. For each source ! 344: file, the preprocessor outputs one `make'-rule whose target is the ! 345: object file name for that source file and whose dependencies are ! 346: all the `#include' header files it uses. This rule may be a ! 347: single line or may be continued with `\'-newline if it is long. ! 348: The list of rules is printed on standard output instead of the ! 349: preprocessed C program. ! 350: ! 351: `-M' implies `-E'. ! 352: ! 353: Another way to specify output of a `make' rule is by setting the ! 354: environment variable `DEPENDENCIES_OUTPUT' (*note Environment ! 355: Variables::.). ! 356: ! 357: `-MM' ! 358: Like `-M' but the output mentions only the user header files ! 359: included with `#include "FILE"'. System header files included ! 360: with `#include <FILE>' are omitted. ! 361: ! 362: `-MD' ! 363: Like `-M' but the dependency information is written to files with ! 364: names made by replacing `.o' with `.d' at the end of the output ! 365: file names. This is in addition to compiling the input files as ! 366: specified--`-MD' does not inhibit ordinary compilation the way ! 367: `-M' does. ! 368: ! 369: The Mach utility `md' can be used to merge the `.d' files into a ! 370: single dependency file suitable for using with the `make' command. ! 371: ! 372: `-MMD' ! 373: Like `-MD' except mention only user header files, not system ! 374: header files. ! 375: ! 376: `-H' ! 377: Print the name of each header file used, in addition to other ! 378: normal activities. ! 379: ! 380: `-AQUESTION(ANSWER)' ! 381: Assert the answer ANSWER for QUESTION, in case it is tested with a ! 382: preprocessor conditional such as `#if #QUESTION(ANSWER)'. `-A-' ! 383: disables the standard assertions that normally describe the target ! 384: machine. ! 385: ! 386: `-DMACRO' ! 387: Define macro MACRO with the string `1' as its definition. ! 388: ! 389: `-DMACRO=DEFN' ! 390: Define macro MACRO as DEFN. All instances of `-D' on the command ! 391: line are processed before any `-U' options. ! 392: ! 393: `-UMACRO' ! 394: Undefine macro MACRO. `-U' options are evaluated after all `-D' ! 395: options, but before any `-include' and `-imacros' options. ! 396: ! 397: `-dM' ! 398: Tell the preprocessor to output only a list of the macro ! 399: definitions that are in effect at the end of preprocessing. Used ! 400: with the `-E' option. ! 401: ! 402: `-dD' ! 403: Tell the preprocessing to pass all macro definitions into the ! 404: output, in their proper sequence in the rest of the output. ! 405: ! 406: `-dN' ! 407: Like `-dD' except that the macro arguments and contents are ! 408: omitted. Only `#define NAME' is included in the output. ! 409: ! 410: `-trigraphs' ! 411: Support ANSI C trigraphs. You don't want to know about this ! 412: brain-damage. The `-ansi' option also has this effect. ! 413: ! 414: ! 415: File: gcc.info, Node: Assembler Options, Next: Link Options, Prev: Preprocessor Options, Up: Invoking GCC ! 416: ! 417: Passing Options to the Assembler ! 418: ================================ ! 419: ! 420: `-Wa,OPTION' ! 421: Pass OPTION as an option to the assembler. If OPTION contains ! 422: commas, it is split into multiple options at the commas. ! 423: ! 424: ! 425: File: gcc.info, Node: Link Options, Next: Directory Options, Prev: Assembler Options, Up: Invoking GCC ! 426: ! 427: Options for Linking ! 428: =================== ! 429: ! 430: These options come into play when the compiler links object files ! 431: into an executable output file. They are meaningless if the compiler is ! 432: not doing a link step. ! 433: ! 434: `OBJECT-FILE-NAME' ! 435: A file name that does not end in a special recognized suffix is ! 436: considered to name an object file or library. (Object files are ! 437: distinguished from libraries by the linker according to the file ! 438: contents.) If linking is done, these object files are used as ! 439: input to the linker. ! 440: ! 441: `-c' ! 442: `-S' ! 443: `-E' ! 444: If any of these options is used, then the linker is not run, and ! 445: object file names should not be used as arguments. *Note Overall ! 446: Options::. ! 447: ! 448: `-lLIBRARY' ! 449: Search the library named LIBRARY when linking. ! 450: ! 451: It makes a difference where in the command you write this option; ! 452: the linker searches processes libraries and object files in the ! 453: order they are specified. Thus, `foo.o -lz bar.o' searches ! 454: library `z' after file `foo.o' but before `bar.o'. If `bar.o' ! 455: refers to functions in `z', those functions may not be loaded. ! 456: ! 457: The linker searches a standard list of directories for the library, ! 458: which is actually a file named `libLIBRARY.a'. The linker then ! 459: uses this file as if it had been specified precisely by name. ! 460: ! 461: The directories searched include several standard system ! 462: directories plus any that you specify with `-L'. ! 463: ! 464: Normally the files found this way are library files--archive files ! 465: whose members are object files. The linker handles an archive ! 466: file by scanning through it for members which define symbols that ! 467: have so far been referenced but not defined. But if the file that ! 468: is found is an ordinary object file, it is linked in the usual ! 469: fashion. The only difference between using an `-l' option and ! 470: specifying a file name is that `-l' surrounds LIBRARY with `lib' ! 471: and `.a' and searches several directories. ! 472: ! 473: `-lobjc' ! 474: You need this special case of the `-l' option in order to link an ! 475: Objective C program. ! 476: ! 477: `-nostartfiles' ! 478: Do not use the standard system startup files when linking. The ! 479: standard libraries are used normally. ! 480: ! 481: `-nostdlib' ! 482: Don't use the standard system libraries and startup files when ! 483: linking. Only the files you specify will be passed to the linker. ! 484: ! 485: `-static' ! 486: On systems that support dynamic linking, this prevents linking ! 487: with the shared libraries. On other systems, this option has no ! 488: effect. ! 489: ! 490: `-shared' ! 491: Produce a shared object which can then be linked with other ! 492: objects to form an executable. Only a few systems support this ! 493: option. ! 494: ! 495: `-symbolic' ! 496: Bind references to global symbols when building a shared object. ! 497: Warn about any unresolved references (unless overridden by the ! 498: link editor option `-Xlinker -z -Xlinker defs'). Only a few ! 499: systems support this option. ! 500: ! 501: `-Xlinker OPTION' ! 502: Pass OPTION as an option to the linker. You can use this to ! 503: supply system-specific linker options which GNU CC does not know ! 504: how to recognize. ! 505: ! 506: If you want to pass an option that takes an argument, you must use ! 507: `-Xlinker' twice, once for the option and once for the argument. ! 508: For example, to pass `-assert definitions', you must write ! 509: `-Xlinker -assert -Xlinker definitions'. It does not work to write ! 510: `-Xlinker "-assert definitions"', because this passes the entire ! 511: string as a single argument, which is not what the linker expects. ! 512: ! 513: `-Wl,OPTION' ! 514: Pass OPTION as an option to the linker. If OPTION contains ! 515: commas, it is split into multiple options at the commas. ! 516: ! 517: `-u SYMBOL' ! 518: Pretend the symbol SYMBOL is undefined, to force linking of ! 519: library modules to define it. You can use `-u' multiple times with ! 520: different symbols to force loading of additional library modules. ! 521: ! 522: ! 523: File: gcc.info, Node: Directory Options, Next: Target Options, Prev: Link Options, Up: Invoking GCC ! 524: ! 525: Options for Directory Search ! 526: ============================ ! 527: ! 528: These options specify directories to search for header files, for ! 529: libraries and for parts of the compiler: ! 530: ! 531: `-IDIR' ! 532: Append directory DIR to the list of directories searched for ! 533: include files. ! 534: ! 535: `-I-' ! 536: Any directories you specify with `-I' options before the `-I-' ! 537: option are searched only for the case of `#include "FILE"'; they ! 538: are not searched for `#include <FILE>'. ! 539: ! 540: If additional directories are specified with `-I' options after ! 541: the `-I-', these directories are searched for all `#include' ! 542: directives. (Ordinarily *all* `-I' directories are used this way.) ! 543: ! 544: In addition, the `-I-' option inhibits the use of the current ! 545: directory (where the current input file came from) as the first ! 546: search directory for `#include "FILE"'. There is no way to ! 547: override this effect of `-I-'. With `-I.' you can specify ! 548: searching the directory which was current when the compiler was ! 549: invoked. That is not exactly the same as what the preprocessor ! 550: does by default, but it is often satisfactory. ! 551: ! 552: `-I-' does not inhibit the use of the standard system directories ! 553: for header files. Thus, `-I-' and `-nostdinc' are independent. ! 554: ! 555: `-LDIR' ! 556: Add directory DIR to the list of directories to be searched for ! 557: `-l'. ! 558: ! 559: `-BPREFIX' ! 560: This option specifies where to find the executables, libraries and ! 561: data files of the compiler itself. ! 562: ! 563: The compiler driver program runs one or more of the subprograms ! 564: `cpp', `cc1', `as' and `ld'. It tries PREFIX as a prefix for each ! 565: program it tries to run, both with and without `MACHINE/VERSION/' ! 566: (*note Target Options::.). ! 567: ! 568: For each subprogram to be run, the compiler driver first tries the ! 569: `-B' prefix, if any. If that name is not found, or if `-B' was ! 570: not specified, the driver tries two standard prefixes, which are ! 571: `/usr/lib/gcc/' and `/usr/local/lib/gcc-lib/'. If neither of ! 572: those results in a file name that is found, the unmodified program ! 573: name is searched for using the directories specified in your ! 574: `PATH' environment variable. ! 575: ! 576: `-B' prefixes that effectively specify directory names also apply ! 577: to libraries in the linker, because the compiler translates these ! 578: options into `-L' options for the linker. ! 579: ! 580: The run-time support file `libgcc.a' can also be searched for using ! 581: the `-B' prefix, if needed. If it is not found there, the two ! 582: standard prefixes above are tried, and that is all. The file is ! 583: left out of the link if it is not found by those means. ! 584: ! 585: Another way to specify a prefix much like the `-B' prefix is to use ! 586: the environment variable `GCC_EXEC_PREFIX'. *Note Environment ! 587: Variables::. ! 588: ! 589: ! 590: File: gcc.info, Node: Target Options, Next: Submodel Options, Prev: Directory Options, Up: Invoking GCC ! 591: ! 592: Specifying Target Machine and Compiler Version ! 593: ============================================== ! 594: ! 595: By default, GNU CC compiles code for the same type of machine that ! 596: you are using. However, it can also be installed as a cross-compiler, ! 597: to compile for some other type of machine. In fact, several different ! 598: configurations of GNU CC, for different target machines, can be ! 599: installed side by side. Then you specify which one to use with the ! 600: `-b' option. ! 601: ! 602: In addition, older and newer versions of GNU CC can be installed side ! 603: by side. One of them (probably the newest) will be the default, but ! 604: you may sometimes wish to use another. ! 605: ! 606: `-b MACHINE' ! 607: The argument MACHINE specifies the target machine for compilation. ! 608: This is useful when you have installed GNU CC as a cross-compiler. ! 609: ! 610: The value to use for MACHINE is the same as was specified as the ! 611: machine type when configuring GNU CC as a cross-compiler. For ! 612: example, if a cross-compiler was configured with `configure ! 613: i386v', meaning to compile for an 80386 running System V, then you ! 614: would specify `-b i386v' to run that cross compiler. ! 615: ! 616: When you do not specify `-b', it normally means to compile for the ! 617: same type of machine that you are using. ! 618: ! 619: `-V VERSION' ! 620: The argument VERSION specifies which version of GNU CC to run. ! 621: This is useful when multiple versions are installed. For example, ! 622: VERSION might be `2.0', meaning to run GNU CC version 2.0. ! 623: ! 624: The default version, when you do not specify `-V', is controlled ! 625: by the way GNU CC is installed. Normally, it will be a version ! 626: that is recommended for general use. ! 627: ! 628: The `-b' and `-V' options actually work by controlling part of the ! 629: file name used for the executable files and libraries used for ! 630: compilation. A given version of GNU CC, for a given target machine, is ! 631: normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'. ! 632: ! 633: Thus, sites can customize the effect of `-b' or `-V' either by ! 634: changing the names of these directories or adding alternate names (or ! 635: symbolic links). If in directory `/usr/local/lib/gcc-lib/' the file ! 636: `80386' is a link to the file `i386v', then `-b 80386' becomes an alias ! 637: for `-b i386v'. ! 638: ! 639: In one respect, the `-b' or `-V' do not completely change to a ! 640: different compiler: the top-level driver program `gcc' that you ! 641: originally invoked continues to run and invoke the other executables ! 642: (preprocessor, compiler per se, assembler and linker) that do the real ! 643: work. However, since no real work is done in the driver program, it ! 644: usually does not matter that the driver program in use is not the one ! 645: for the specified target and version. ! 646: ! 647: The only way that the driver program depends on the target machine is ! 648: in the parsing and handling of special machine-specific options. ! 649: However, this is controlled by a file which is found, along with the ! 650: other executables, in the directory for the specified version and ! 651: target machine. As a result, a single installed driver program adapts ! 652: to any specified target machine and compiler version. ! 653: ! 654: The driver program executable does control one significant thing, ! 655: however: the default version and target machine. Therefore, you can ! 656: install different instances of the driver program, compiled for ! 657: different targets or versions, under different names. ! 658: ! 659: For example, if the driver for version 2.0 is installed as `ogcc' ! 660: and that for version 2.1 is installed as `gcc', then the command `gcc' ! 661: will use version 2.1 by default, while `ogcc' will use 2.0 by default. ! 662: However, you can choose either version with either command with the ! 663: `-V' option. ! 664: ! 665: ! 666: File: gcc.info, Node: Submodel Options, Next: Code Gen Options, Prev: Target Options, Up: Invoking GCC ! 667: ! 668: Hardware Models and Configurations ! 669: ================================== ! 670: ! 671: Earlier we discussed the standard option `-b' which chooses among ! 672: different installed compilers for completely different target machines, ! 673: such as Vax vs. 68000 vs. 80386. ! 674: ! 675: In addition, each of these target machine types can have its own ! 676: special options, starting with `-m', to choose among various hardware ! 677: models or configurations--for example, 68010 vs 68020, floating ! 678: coprocessor or none. A single installed version of the compiler can ! 679: compile for any model or configuration, according to the options ! 680: specified. ! 681: ! 682: Some configurations of the compiler also support additional special ! 683: options, usually for compatibility with other compilers on the same ! 684: platform. ! 685: ! 686: These options are defined by the macro `TARGET_SWITCHES' in the ! 687: machine description. The default for the options is also defined by ! 688: that macro, which enables you to change the defaults. ! 689: ! 690: * Menu: ! 691: ! 692: * M680x0 Options:: ! 693: * VAX Options:: ! 694: * SPARC Options:: ! 695: * Convex Options:: ! 696: * AMD29K Options:: ! 697: * M88K Options:: ! 698: * RS/6000 and PowerPC Options:: ! 699: * RT Options:: ! 700: * MIPS Options:: ! 701: * i386 Options:: ! 702: * HPPA Options:: ! 703: * Intel 960 Options:: ! 704: * DEC Alpha Options:: ! 705: * Clipper Options:: ! 706: * System V Options:: ! 707: ! 708: ! 709: File: gcc.info, Node: M680x0 Options, Next: VAX Options, Up: Submodel Options ! 710: ! 711: M680x0 Options ! 712: -------------- ! 713: ! 714: These are the `-m' options defined for the 68000 series. The default ! 715: values for these options depends on which style of 68000 was selected ! 716: when the compiler was configured; the defaults for the most common ! 717: choices are given below. ! 718: ! 719: `-m68000' ! 720: `-mc68000' ! 721: Generate output for a 68000. This is the default when the ! 722: compiler is configured for 68000-based systems. ! 723: ! 724: `-m68020' ! 725: `-mc68020' ! 726: Generate output for a 68020. This is the default when the ! 727: compiler is configured for 68020-based systems. ! 728: ! 729: `-m68881' ! 730: Generate output containing 68881 instructions for floating point. ! 731: This is the default for most 68020 systems unless `-nfp' was ! 732: specified when the compiler was configured. ! 733: ! 734: `-m68030' ! 735: Generate output for a 68030. This is the default when the ! 736: compiler is configured for 68030-based systems. ! 737: ! 738: `-m68040' ! 739: Generate output for a 68040. This is the default when the ! 740: compiler is configured for 68040-based systems. ! 741: ! 742: This option inhibits the use of 68881/68882 instructions that have ! 743: to be emulated by software on the 68040. If your 68040 does not ! 744: have code to emulate those instructions, use `-m68040'. ! 745: ! 746: `-m68020-40' ! 747: Generate output for a 68040, without using any of the new ! 748: instructions. This results in code which can run relatively ! 749: efficiently on either a 68020/68881 or a 68030 or a 68040. The ! 750: generated code does use the 68881 instructions that are emulated ! 751: on the 68040. ! 752: ! 753: `-mfpa' ! 754: Generate output containing Sun FPA instructions for floating point. ! 755: ! 756: `-msoft-float' ! 757: Generate output containing library calls for floating point. ! 758: *Warning:* the requisite libraries are not part of GNU CC. ! 759: Normally the facilities of the machine's usual C compiler are ! 760: used, but this can't be done directly in cross-compilation. You ! 761: must make your own arrangements to provide suitable library ! 762: functions for cross-compilation. ! 763: ! 764: `-mshort' ! 765: Consider type `int' to be 16 bits wide, like `short int'. ! 766: ! 767: `-mnobitfield' ! 768: Do not use the bit-field instructions. The `-m68000' option ! 769: implies `-mnobitfield'. ! 770: ! 771: `-mbitfield' ! 772: Do use the bit-field instructions. The `-m68020' option implies ! 773: `-mbitfield'. This is the default if you use a configuration ! 774: designed for a 68020. ! 775: ! 776: `-mrtd' ! 777: Use a different function-calling convention, in which functions ! 778: that take a fixed number of arguments return with the `rtd' ! 779: instruction, which pops their arguments while returning. This ! 780: saves one instruction in the caller since there is no need to pop ! 781: the arguments there. ! 782: ! 783: This calling convention is incompatible with the one normally used ! 784: on Unix, so you cannot use it if you need to call libraries ! 785: compiled with the Unix compiler. ! 786: ! 787: Also, you must provide function prototypes for all functions that ! 788: take variable numbers of arguments (including `printf'); otherwise ! 789: incorrect code will be generated for calls to those functions. ! 790: ! 791: In addition, seriously incorrect code will result if you call a ! 792: function with too many arguments. (Normally, extra arguments are ! 793: harmlessly ignored.) ! 794: ! 795: The `rtd' instruction is supported by the 68010 and 68020 ! 796: processors, but not by the 68000. ! 797: ! 798: ! 799: File: gcc.info, Node: VAX Options, Next: SPARC Options, Prev: M680x0 Options, Up: Submodel Options ! 800: ! 801: VAX Options ! 802: ----------- ! 803: ! 804: These `-m' options are defined for the Vax: ! 805: ! 806: `-munix' ! 807: Do not output certain jump instructions (`aobleq' and so on) that ! 808: the Unix assembler for the Vax cannot handle across long ranges. ! 809: ! 810: `-mgnu' ! 811: Do output those jump instructions, on the assumption that you will ! 812: assemble with the GNU assembler. ! 813: ! 814: `-mg' ! 815: Output code for g-format floating point numbers instead of ! 816: d-format. ! 817: ! 818: ! 819: File: gcc.info, Node: SPARC Options, Next: Convex Options, Prev: VAX Options, Up: Submodel Options ! 820: ! 821: SPARC Options ! 822: ------------- ! 823: ! 824: These `-m' switches are supported on the SPARC: ! 825: ! 826: `-mfpu' ! 827: `-mhard-float' ! 828: Generate output containing floating point instructions. This is ! 829: the default. ! 830: ! 831: `-mno-fpu' ! 832: `-msoft-float' ! 833: Generate output containing library calls for floating point. ! 834: *Warning:* there is no GNU floating-point library for SPARC. ! 835: Normally the facilities of the machine's usual C compiler are ! 836: used, but this cannot be done directly in cross-compilation. You ! 837: must make your own arrangements to provide suitable library ! 838: functions for cross-compilation. ! 839: ! 840: `-msoft-float' changes the calling convention in the output file; ! 841: therefore, it is only useful if you compile *all* of a program with ! 842: this option. In particular, you need to compile `libgcc.a', the ! 843: library that comes with GNU CC, with `-msoft-float' in order for ! 844: this to work. ! 845: ! 846: `-mno-epilogue' ! 847: `-mepilogue' ! 848: With `-mepilogue' (the default), the compiler always emits code for ! 849: function exit at the end of each function. Any function exit in ! 850: the middle of the function (such as a return statement in C) will ! 851: generate a jump to the exit code at the end of the function. ! 852: ! 853: With `-mno-epilogue', the compiler tries to emit exit code inline ! 854: at every function exit. ! 855: ! 856: `-mv8' ! 857: `-msparclite' ! 858: These two options select variations on the SPARC architecture. ! 859: ! 860: By default (unless specifically configured for the Fujitsu ! 861: SPARClite), GCC generates code for the v7 variant of the SPARC ! 862: architecture. ! 863: ! 864: `-mv8' will give you SPARC v8 code. The only difference from v7 ! 865: code is that the compiler emits the integer multiply and integer ! 866: divide instructions which exist in SPARC v8 but not in SPARC v7. ! 867: ! 868: `-msparclite' will give you SPARClite code. This adds the integer ! 869: multiply, integer divide step and scan (`ffs') instructions which ! 870: exist in SPARClite but not in SPARC v7. ! 871: ! 872: ! 873: File: gcc.info, Node: Convex Options, Next: AMD29K Options, Prev: SPARC Options, Up: Submodel Options ! 874: ! 875: Convex Options ! 876: -------------- ! 877: ! 878: These `-m' options are defined for Convex: ! 879: ! 880: `-mc1' ! 881: Generate output for C1. The code will run on any Convex machine. ! 882: The preprocessor symbol `__convex__c1__' is defined. ! 883: ! 884: `-mc2' ! 885: Generate output for C2. Uses instructions not available on C1. ! 886: Scheduling and other optimizations are chosen for max performance ! 887: on C2. The preprocessor symbol `__convex_c2__' is defined. ! 888: ! 889: `-mc32' ! 890: Generate output for C32xx. Uses instructions not available on C1. ! 891: Scheduling and other optimizations are chosen for max performance ! 892: on C32. The preprocessor symbol `__convex_c32__' is defined. ! 893: ! 894: `-mc34' ! 895: Generate output for C34xx. Uses instructions not available on C1. ! 896: Scheduling and other optimizations are chosen for max performance ! 897: on C34. The preprocessor symbol `__convex_c34__' is defined. ! 898: ! 899: `-mc38' ! 900: Generate output for C38xx. Uses instructions not available on C1. ! 901: Scheduling and other optimizations are chosen for max performance ! 902: on C38. The preprocessor symbol `__convex_c38__' is defined. ! 903: ! 904: `-margcount' ! 905: Generate code which puts an argument count in the word preceding ! 906: each argument list. This is compatible with regular CC, and a few ! 907: programs may need the argument count word. GDB and other ! 908: source-level debuggers do not need it; this info is in the symbol ! 909: table. ! 910: ! 911: `-mnoargcount' ! 912: Omit the argument count word. This is the default. ! 913: ! 914: `-mvolatile-cache' ! 915: Allow volatile references to be cached. This is the default. ! 916: ! 917: `-mvolatile-nocache' ! 918: Volatile references bypass the data cache, going all the way to ! 919: memory. This is only needed for multi-processor code that does ! 920: not use standard synchronization instructions. Making ! 921: non-volatile references to volatile locations will not necessarily ! 922: work. ! 923: ! 924: `-mlong32' ! 925: Type long is 32 bits, the same as type int. This is the default. ! 926: ! 927: `-mlong64' ! 928: Type long is 64 bits, the same as type long long. This option is ! 929: useless, because no library support exists for it. ! 930: ! 931: ! 932: File: gcc.info, Node: AMD29K Options, Next: M88K Options, Prev: Convex Options, Up: Submodel Options ! 933: ! 934: AMD29K Options ! 935: -------------- ! 936: ! 937: These `-m' options are defined for the AMD Am29000: ! 938: ! 939: `-mdw' ! 940: Generate code that assumes the `DW' bit is set, i.e., that byte and ! 941: halfword operations are directly supported by the hardware. This ! 942: is the default. ! 943: ! 944: `-mnodw' ! 945: Generate code that assumes the `DW' bit is not set. ! 946: ! 947: `-mbw' ! 948: Generate code that assumes the system supports byte and halfword ! 949: write operations. This is the default. ! 950: ! 951: `-mnbw' ! 952: Generate code that assumes the systems does not support byte and ! 953: halfword write operations. `-mnbw' implies `-mnodw'. ! 954: ! 955: `-msmall' ! 956: Use a small memory model that assumes that all function addresses ! 957: are either within a single 256 KB segment or at an absolute ! 958: address of less than 256k. This allows the `call' instruction to ! 959: be used instead of a `const', `consth', `calli' sequence. ! 960: ! 961: `-mnormal' ! 962: Use the normal memory model: Generate `call' instructions only when ! 963: calling functions in the same file and `calli' instructions ! 964: otherwise. This works if each file occupies less than 256 KB but ! 965: allows the entire executable to be larger than 256 KB. This is ! 966: the default. ! 967: ! 968: `-mlarge' ! 969: Always use `calli' instructions. Specify this option if you expect ! 970: a single file to compile into more than 256 KB of code. ! 971: ! 972: `-m29050' ! 973: Generate code for the Am29050. ! 974: ! 975: `-m29000' ! 976: Generate code for the Am29000. This is the default. ! 977: ! 978: `-mkernel-registers' ! 979: Generate references to registers `gr64-gr95' instead of to ! 980: registers `gr96-gr127'. This option can be used when compiling ! 981: kernel code that wants a set of global registers disjoint from ! 982: that used by user-mode code. ! 983: ! 984: Note that when this option is used, register names in `-f' flags ! 985: must use the normal, user-mode, names. ! 986: ! 987: `-muser-registers' ! 988: Use the normal set of global registers, `gr96-gr127'. This is the ! 989: default. ! 990: ! 991: `-mstack-check' ! 992: Insert a call to `__msp_check' after each stack adjustment. This ! 993: is often used for kernel code. ! 994: ! 995: ! 996: File: gcc.info, Node: M88K Options, Next: RS/6000 and PowerPC Options, Prev: AMD29K Options, Up: Submodel Options ! 997: ! 998: M88K Options ! 999: ------------ ! 1000: ! 1001: These `-m' options are defined for Motorola 88k architectures: ! 1002: ! 1003: `-m88000' ! 1004: Generate code that works well on both the m88100 and the m88110. ! 1005: ! 1006: `-m88100' ! 1007: Generate code that works best for the m88100, but that also runs ! 1008: on the m88110. ! 1009: ! 1010: `-m88110' ! 1011: Generate code that works best for the m88110, and may not run on ! 1012: the m88100. ! 1013: ! 1014: `-mbig-pic' ! 1015: Obsolete option to be removed from the next revision. Use `-fPIC'. ! 1016: ! 1017: `-midentify-revision' ! 1018: Include an `ident' directive in the assembler output recording the ! 1019: source file name, compiler name and version, timestamp, and ! 1020: compilation flags used. ! 1021: ! 1022: `-mno-underscores' ! 1023: In assembler output, emit symbol names without adding an underscore ! 1024: character at the beginning of each name. The default is to use an ! 1025: underscore as prefix on each name. ! 1026: ! 1027: `-mocs-debug-info' ! 1028: `-mno-ocs-debug-info' ! 1029: Include (or omit) additional debugging information (about ! 1030: registers used in each stack frame) as specified in the 88open ! 1031: Object Compatibility Standard, "OCS". This extra information ! 1032: allows debugging of code that has had the frame pointer ! 1033: eliminated. The default for DG/UX, SVr4, and Delta 88 SVr3.2 is ! 1034: to include this information; other 88k configurations omit this ! 1035: information by default. ! 1036: ! 1037: `-mocs-frame-position' ! 1038: When emitting COFF debugging information for automatic variables ! 1039: and parameters stored on the stack, use the offset from the ! 1040: canonical frame address, which is the stack pointer (register 31) ! 1041: on entry to the function. The DG/UX, SVr4, Delta88 SVr3.2, and ! 1042: BCS configurations use `-mocs-frame-position'; other 88k ! 1043: configurations have the default `-mno-ocs-frame-position'. ! 1044: ! 1045: `-mno-ocs-frame-position' ! 1046: When emitting COFF debugging information for automatic variables ! 1047: and parameters stored on the stack, use the offset from the frame ! 1048: pointer register (register 30). When this option is in effect, ! 1049: the frame pointer is not eliminated when debugging information is ! 1050: selected by the -g switch. ! 1051: ! 1052: `-moptimize-arg-area' ! 1053: `-mno-optimize-arg-area' ! 1054: Control how function arguments are stored in stack frames. ! 1055: `-moptimize-arg-area' saves space by optimizing them, but this ! 1056: conflicts with the 88open specifications. The opposite ! 1057: alternative, `-mno-optimize-arg-area', agrees with 88open ! 1058: standards. By default GNU CC does not optimize the argument area. ! 1059: ! 1060: `-mshort-data-NUM' ! 1061: Generate smaller data references by making them relative to `r0', ! 1062: which allows loading a value using a single instruction (rather ! 1063: than the usual two). You control which data references are ! 1064: affected by specifying NUM with this option. For example, if you ! 1065: specify `-mshort-data-512', then the data references affected are ! 1066: those involving displacements of less than 512 bytes. ! 1067: `-mshort-data-NUM' is not effective for NUM greater than 64k. ! 1068: ! 1069: `-mserialize-volatile' ! 1070: `-mno-serialize-volatile' ! 1071: Do, or do not, generate code to guarantee sequential consistency of ! 1072: volatile memory references. ! 1073: ! 1074: GNU CC always guarantees consistency by default. ! 1075: ! 1076: The order of memory references made by the m88110 processor does ! 1077: not always match the order of the instructions requesting those ! 1078: references. In particular, a load instruction may execute before ! 1079: a preceding store instruction. Such reordering violates ! 1080: sequential consistency of volatile memory references, when there ! 1081: are multiple processors. ! 1082: ! 1083: The extra code generated to guarantee consistency may affect the ! 1084: performance of your application. If you know that you can safely ! 1085: forgo this guarantee, you may use the option ! 1086: `-mno-serialize-volatile'. ! 1087: ! 1088: `-msvr4' ! 1089: `-msvr3' ! 1090: Turn on (`-msvr4') or off (`-msvr3') compiler extensions related ! 1091: to System V release 4 (SVr4). This controls the following: ! 1092: ! 1093: 1. Which variant of the assembler syntax to emit (which you can ! 1094: select independently using `-mversion-03.00'). ! 1095: ! 1096: 2. `-msvr4' makes the C preprocessor recognize `#pragma weak' ! 1097: that is used on System V release 4. ! 1098: ! 1099: 3. `-msvr4' makes GNU CC issue additional declaration directives ! 1100: used in SVr4. ! 1101: ! 1102: `-msvr3' is the default for all m88k configurations except the ! 1103: SVr4 configuration. ! 1104: ! 1105: `-mversion-03.00' ! 1106: In the DG/UX configuration, there are two flavors of SVr4. This ! 1107: option modifies `-msvr4' to select whether the hybrid-COFF or ! 1108: real-ELF flavor is used. All other configurations ignore this ! 1109: option. ! 1110: ! 1111: `-mno-check-zero-division' ! 1112: `-mcheck-zero-division' ! 1113: Early models of the 88k architecture had problems with division by ! 1114: zero; in particular, many of them didn't trap. Use these options ! 1115: to avoid including (or to include explicitly) additional code to ! 1116: detect division by zero and signal an exception. All GNU CC ! 1117: configurations for the 88k use `-mcheck-zero-division' by default. ! 1118: ! 1119: `-muse-div-instruction' ! 1120: Do not emit code to check both the divisor and dividend when doing ! 1121: signed integer division to see if either is negative, and adjust ! 1122: the signs so the divide is done using non-negative numbers. ! 1123: Instead, rely on the operating system to calculate the correct ! 1124: value when the `div' instruction traps. This results in different ! 1125: behavior when the most negative number is divided by -1, but is ! 1126: useful when most or all signed integer divisions are done with ! 1127: positive numbers. ! 1128: ! 1129: `-mtrap-large-shift' ! 1130: `-mhandle-large-shift' ! 1131: Include code to detect bit-shifts of more than 31 bits; ! 1132: respectively, trap such shifts or emit code to handle them ! 1133: properly. By default GNU CC makes no special provision for large ! 1134: bit shifts. ! 1135: ! 1136: `-mwarn-passed-structs' ! 1137: Warn when a function passes a struct as an argument or result. ! 1138: Structure-passing conventions have changed during the evolution of ! 1139: the C language, and are often the source of portability problems. ! 1140: By default, GNU CC issues no such warning. ! 1141:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.