home *** CD-ROM | disk | FTP | other *** search
/ Monster Disc 2: The Best of 1992 / MONSTER2.ISO / prog / djgpp / djgcc222.a04 / DOCS / INVOKE.TEX < prev    next >
Encoding:
Text File  |  1992-07-06  |  92.9 KB  |  2,483 lines

  1. @c Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
  2. @c This is part of the GCC manual.
  3. @c For copying conditions, see the file gcc.texi.
  4.  
  5. @node Invoking GCC
  6. @chapter GNU CC Command Options
  7. @cindex GNU CC command options
  8. @cindex command options
  9. @cindex options, GNU CC command
  10.  
  11. When you invoke GNU CC, it normally does preprocessing, compilation,
  12. assembly and linking.  The ``overall options'' allow you to stop this
  13. process at an intermediate stage.  For example, the @samp{-c} option
  14. says not to run the linker.  Then the output consists of object files
  15. output by the assembler.
  16.  
  17. Other options are passed on to one stage of processing.  Some options
  18. control the preprocessor and others the compiler itself.  Yet other
  19. options control the assembler and linker; most of these are not
  20. documented here, since you rarely need to use any of them.
  21.  
  22. @cindex grouping options
  23. @cindex options, grouping
  24. The GNU C compiler uses a command syntax much like the Unix C compiler.
  25. The @code{gcc} program accepts options and file names as operands.
  26. Multiple single-letter options may @emph{not} be grouped: @samp{-dr} is
  27. very different from @w{@samp{-d -r}}.
  28.  
  29. @cindex order of options
  30. @cindex options, order
  31. You can mix options and other arguments.  For the most part, the order
  32. you use doesn't matter; @code{gcc} reorders the command-line options so
  33. that the choices specified by option flags are applied to all input
  34. files.  Order does matter when you use several options of the same kind;
  35. for example, if you specify @samp{-L} more than once, the directories
  36. are searched in the order specified.
  37.  
  38. Many options have long names starting with @samp{-f} or with
  39. @samp{-W}---for example, @samp{-fforce-mem},
  40. @samp{-fstrength-reduce}, @samp{-Wformat} and so on.  Most of
  41. these have both positive and negative forms; the negative form of
  42. @samp{-ffoo} would be @samp{-fno-foo}.  This manual documents
  43. only one of these two forms, whichever one is not the default.
  44.  
  45. Here is a summary of all the options, grouped by type.  Explanations are
  46. in the following sections.
  47.  
  48. @table @emph
  49. @item Overall Options
  50. @xref{Overall Options,,Options Controlling the Kind of Output}.
  51. @example
  52. -c  -S  -E  -o @var{file}  -pipe  -v  -x @var{language}
  53. @end example
  54.  
  55. @item Language Options
  56. @xref{Dialect Options,,Options Controlling Dialect}.
  57. @example
  58. -ansi  -fbuiltin  -fcond-mismatch  -fno-asm 
  59. -fsigned-bitfields  -fsigned-char 
  60. -funsigned-bitfields  -funsigned-char  -fwritable-strings
  61. -traditional  -traditional-cpp  -trigraphs
  62. @end example
  63.  
  64. @item Warning Options
  65. @xref{Warning Options,,Options to Request or Suppress Warnings}.
  66. @example
  67. -fsyntax-only  -pedantic  -pedantic-errors
  68. -w  -W  -Wall  -Waggregate-return 
  69. -Wcast-align  -Wcast-qual  -Wcomment  -Wconversion  -Werror
  70. -Wformat  -Wid-clash-@var{len}  -Wimplicit  -Wimport
  71. -Winline -Wmissing-prototypes
  72. -Wparentheses  -Wpointer-arith  -Wreturn-type  -Wshadow
  73. -Wstrict-prototypes  -Wswitch  -Wtraditional  -Wtrigraphs
  74. -Wuninitialized  -Wunused  -Wwrite-strings  -Wchar-subscripts
  75. @end example
  76.  
  77. @item Debugging Options
  78. @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
  79. @example
  80. -a  -d@var{letters}  -fpretend-float 
  81. -g  -g@var{level} -ggdb  -gdwarf
  82. -gstabs  -gstabs+  -gcoff -gxcoff
  83. -p  -pg  -save-temps
  84. @end example
  85.  
  86. @item Optimization Options
  87. @xref{Optimize Options,,Options that Control Optimization}.
  88. @example
  89. -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
  90. -fdelayed-branch   -fexpensive-optimizations  -ffast-math 
  91. -ffloat-store  -fforce-addr  -fforce-mem  -finline
  92. -finline-functions  -fkeep-inline-functions
  93. -fno-defer-pop  -fno-function-cse  -fomit-frame-pointer
  94. -frerun-cse-after-loop  -fschedule-insns  -fschedule-insns2
  95. -fstrength-reduce  -fthread-jumps
  96. -funroll-all-loops  -funroll-loops 
  97. -O  -O2
  98. @end example
  99.  
  100. @item Preprocessor Options
  101. @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
  102. @example
  103. -C  -dD  -dM  -dN
  104. -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H
  105. -include @var{file}  -imacros @var{file}
  106. -M  -MD  -MM  -MMD  -nostdinc  -P  -trigraphs  -U@var{macro}
  107. @end example
  108.  
  109. @item Linker Options
  110. @xref{Link Options,,Options for Linking}.
  111. @example
  112. @var{object-file-name}
  113. -l@var{library}  -nostdlib  -static
  114. @end example
  115.  
  116. @item Directory Options
  117. @xref{Directory Options,,Options for Directory Search}.
  118. @example
  119. -B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}
  120. @end example
  121.  
  122. @item Target Options
  123. @xref{Target Options,,Target Machine and Compiler Version}.
  124. @example
  125. -b @var{machine}  -V @var{version}
  126. @end example
  127.  
  128. @item Machine Dependent Options
  129. @xref{Submodel Options,,Hardware Models and Configurations}.
  130. @example
  131. @emph{M680x0 Options}
  132. -m68000 -m68020 -m68881 -mbitfield -mc68000 -mc68020 -mfpa
  133. -mnobitfield -mrtd -mshort -msoft-float
  134.  
  135. @emph{VAX Options}
  136. -mg -mgnu -munix
  137.  
  138. @emph{SPARC Options}
  139. -mforce-align -mfpu -mno-epilogue
  140.  
  141. @emph{Convex Options}
  142. -margcount -mc1 -mc2 -mnoargcount
  143.  
  144. @emph{AMD29K Options}
  145. -m29000 -m29050 -mbw -mdw -mkernel-registers -mlarge 
  146. -mnbw -mnodw -msmall -mstack-check -muser-registers
  147.  
  148. @emph{M88K Options}
  149. -m88000 -m88100 -m88110 -mbig-pic -mcheck-zero-division
  150. -mhandle-large-shift -midentify-revision
  151. -mno-check-zero-division -mno-ocs-debug-info
  152. -mno-ocs-frame-position -mno-optimize-arg-area -mno-underscores
  153. -mocs-debug-info -mocs-frame-position -moptimize-arg-area
  154. -mshort-data-@var{num} -msvr3 -msvr4 -mtrap-large-shift
  155. -muse-div-instruction -mversion-03.00 -mwarn-passed-structs
  156.  
  157. @emph{RS/6000 Options}
  158. -mfp-in-toc -mno-fop-in-toc
  159.  
  160. @emph{RT Options}
  161. -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
  162. -mfull-fp-blocks -mhc-struct-return -min-line-mul
  163. -mminimum-fp-blocks -mnohc-struct-return
  164.  
  165. @emph{MIPS Options}
  166. -mcpu=@var{cpu type} -mips2 -mips3 -mint64 -mlong64 -mlonglong128
  167. -mmips-as -mgas -mrnames -mno-rnames -mgpopt -mno-gpopt -mstats
  168. -mno-stats -mmemcpy -mno-memcpy -mno-mips-tfile -mmips-tfile
  169. -msoft-float -mhard-float -mabicalls -mno-abicalls -mhalf-pic
  170. -mno-half-pic -G @var{num} -nocpp
  171.  
  172. @emph{i386 Options}
  173. -m486 -msoft-float
  174. @end example
  175.  
  176. @item Code Generation Options
  177. @xref{Code Gen Options,,Options for Code Generation Conventions}.
  178. @example
  179. -fcall-saved-@var{reg}  -fcall-used-@var{reg}  -ffixed-@var{reg}
  180. -fno-common  -fpcc-struct-return  -fpic  -fPIC  -fshared-data
  181. -fshort-enums  -fshort-double  -fvolatile
  182. @end example
  183.  
  184. @end table
  185.  
  186. @menu
  187. * Overall Options::     Controlling the kind of output:
  188.                         an executable, object files, assembler files,
  189.                         or preprocessed source.
  190. * Dialect Options::     Controlling the variant of C language compiled.
  191. * Warning Options::     How picky should the compiler be?
  192. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  193. * Optimize Options::    How much optimization?
  194. * Preprocessor Options:: Controlling header files and macro definitions.
  195.                          Also, getting dependency information for Make.
  196. * Link Options::        Specifying libraries and so on.
  197. * Directory Options::   Where to find header files and libraries.
  198.                         Where to find the compiler executable files.
  199. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  200. * Submodel Options::    Specifying minor hardware or convention variations,
  201.                         such as 68010 vs 68020.
  202. * Code Gen Options::    Specifying conventions for function calls, data layout
  203.                         and register usage.
  204. * Environment Variables:: Env vars that affect GNU CC.
  205. @end menu
  206.  
  207. @node Overall Options, Dialect Options, Invoking GCC, Invoking GCC
  208. @section Options Controlling the Kind of Output
  209.  
  210. Compilation can involve up to four stages: preprocessing, compilation
  211. proper, assembly and linking, always in that order.  The first three
  212. stages apply to an individual source file, and end by producing an
  213. object file; linking combines all the object files (those newly
  214. compiled, and those specified as input) into an executable file.
  215.  
  216. @cindex file name suffix
  217. For any given input file, the file name suffix determines what kind of
  218. compilation is done:
  219.  
  220. @table @code
  221. @item @var{file}.c
  222. C source code which must be preprocessed.
  223.  
  224. @item @var{file}.i
  225. C source code which should not be preprocessed.
  226.  
  227. @item @var{file}.m
  228. Objective-C source code
  229.  
  230. @item @var{file}.h
  231. C header file (not to be compiled or linked).
  232.  
  233. @item @var{file}.cc
  234. @itemx @var{file}.cxx
  235. @itemx @var{file}.C
  236. C++ source code which must be preprocessed.
  237.  
  238. @item @var{file}.s 
  239. Assembler code.
  240.  
  241. @item @var{file}.S
  242. Assembler code which must be preprocessed.
  243.  
  244. @item @var{other}
  245. An object file to be fed straight into linking.
  246. Any file name with no recognized suffix is treated this way.
  247. @end table
  248.  
  249. You can specify the input language explicitly with the @samp{-x} option:
  250.  
  251. @table @code
  252. @item -x @var{language}
  253. Specify explicitly the @var{language} for the following input files
  254. (rather than choosing a default based on the file name suffix).
  255. This option applies to all following input files until
  256. the next @samp{-x} option.  Possible values of @var{language} are
  257. @samp{c}, @samp{objective-c}, @samp{c-header}, @samp{c++},
  258. @samp{cpp-output}, @samp{assembler}, and @samp{assembler-with-cpp}.
  259.  
  260. @item -x none
  261. Turn off any specification of a language, so that subsequent files are
  262. handled according to their file name suffixes (as they are if @samp{-x}
  263. has not been used at all).
  264. @end table
  265.  
  266. If you only want some of the stages of compilation, you can use
  267. @samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
  268. one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
  269. @code{gcc} is to stop.  Note that some combinations (for example,
  270. @samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
  271.  
  272. @table @code
  273. @item -c
  274. Compile or assemble the source files, but do not link.  The linking
  275. stage simply is not done.  The ultimate output is in the form of an
  276. object file for each source file.
  277.  
  278. By default, the object file name for a source file is made by replacing
  279. the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
  280.  
  281. Unrecognized input files, not requiring compilation or assembly, are
  282. ignored.
  283.  
  284. @item -S
  285. Stop after the stage of compilation proper; do not assemble.  The output
  286. is in the form of an assembler code file for each non-assembler input
  287. file specified.
  288.  
  289. By default, the assembler file name for a source file is made by
  290. replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
  291.  
  292. Input files that don't require compilation are ignored.
  293.  
  294. @item -E
  295. Stop after the preprocessing stage; do not run the compiler proper.  The
  296. output is in the form of preprocessed source code, which is sent to the
  297. standard output.
  298.  
  299. Input files which don't require preprocessing are ignored.
  300.  
  301. @cindex output file option
  302. @item -o @var{file}
  303. Place output in file @var{file}.  This applies regardless to whatever
  304. sort of output is being produced, whether it be an executable file,
  305. an object file, an assembler file or preprocessed C code.
  306.  
  307. Since only one output file can be specified, it does not make sense to
  308. use @samp{-o} when compiling more than one input file, unless you are
  309. producing an executable file as output.
  310.  
  311. If @samp{-o} is not specified, the default is to put an executable file
  312. in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
  313. @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
  314. all preprocessed C source on standard output.@refill
  315.  
  316. @item -v
  317. Print (on standard error output) the commands executed to run the stages
  318. of compilation.  Also print the version number of the compiler driver
  319. program and of the preprocessor and the compiler proper.
  320.  
  321. @item -pipe
  322. Use pipes rather than temporary files for communication between the
  323. various stages of compilation.  This fails to work on some systems where
  324. the assembler is unable to read from a pipe; but the GNU assembler has
  325. no trouble.
  326. @end table
  327.  
  328. @node Dialect Options, Warning Options, Overall Options, Invoking GCC
  329. @section Options Controlling Dialect
  330. @cindex dialect options
  331. @cindex language dialect options
  332. @cindex options, dialect
  333.  
  334. The following options control the dialect of C that the compiler
  335. accepts:
  336.  
  337. @table @code
  338. @cindex ANSI support
  339. @item -ansi
  340. Support all ANSI standard C programs.
  341.  
  342. This turns off certain features of GNU C that are incompatible with ANSI
  343. C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and
  344. predefined macros such as @code{unix} and @code{vax} that identify the
  345. type of system you are using.  It also enables the undesirable and
  346. rarely used ANSI trigraph feature, and disallows @samp{$} as part of
  347. identifiers.
  348.  
  349. The alternate keywords @code{__asm__}, @code{__extension__},
  350. @code{__inline__} and @code{__typeof__} continue to work despite
  351. @samp{-ansi}.  You would not want to use them in an ANSI C program, of
  352. course, but it useful to put them in header files that might be included
  353. in compilations done with @samp{-ansi}.  Alternate predefined macros
  354. such as @code{__unix__} and @code{__vax__} are also available, with or
  355. without @samp{-ansi}.
  356.  
  357. The @samp{-ansi} option does not cause non-ANSI programs to be
  358. rejected gratuitously.  For that, @samp{-pedantic} is required in
  359. addition to @samp{-ansi}.  @xref{Warning Options}.
  360.  
  361. The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
  362. option is used.  Some header files may notice this macro and refrain
  363. from declaring certain functions or defining certain macros that the
  364. ANSI standard doesn't call for; this is to avoid interfering with any
  365. programs that might use these names for other things.
  366.  
  367. The functions @code{alloca}, @code{abort}, @code{exit}, and
  368. @code{_exit} are not builtin functions when @samp{-ansi} is used.
  369.  
  370. @item -fno-asm
  371. Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
  372. keyword.  These words may then be used as identifiers.  You can
  373. use @code{__asm__}, @code{__inline__} and @code{__typeof__} instead.
  374. @samp{-ansi} implies @samp{-fno-asm}.
  375.  
  376. @item -fno-builtin
  377. Don't recognize built-in functions that do not begin with two leading
  378. underscores. Currently, the functions affected include @code{alloca},
  379. @code{abort}, @code{exit}, @code{_exit}, @code{abs}, @code{fabs},
  380. @code{labs}, @code{memcpy}, @code{memcmp}, @code{strcmp},
  381. @code{strcpy}, @code{strlen}, and @code{sqrt}.
  382.  
  383. The @samp{-ansi} option prevents @code{alloca} and @code{_exit} from
  384. being builtin functions.
  385.  
  386. @item -trigraphs
  387. Support ANSI C trigraphs.  You don't want to know about this
  388. brain-damage.  The @samp{-ansi} option implies @samp{-trigraphs}.
  389.  
  390. @cindex traditional C language
  391. @cindex C language, traditional
  392. @item -traditional
  393. Attempt to support some aspects of traditional C compilers.
  394. Specifically:
  395.  
  396. @itemize @bullet
  397. @item
  398. All @code{extern} declarations take effect globally even if they
  399. are written inside of a function definition.  This includes implicit
  400. declarations of functions.
  401.  
  402. @item
  403. The keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
  404. and @code{volatile} are not recognized.  (You can still use the
  405. alternative keywords such as @code{__typeof__}, @code{__inline__}, and
  406. so on.)
  407.  
  408. @item
  409. Comparisons between pointers and integers are always allowed.
  410.  
  411. @item
  412. Integer types @code{unsigned short} and @code{unsigned char} promote
  413. to @code{unsigned int}.
  414.  
  415. @item
  416. Out-of-range floating point literals are not an error.
  417.  
  418. @item
  419. String ``constants'' are not necessarily constant; they are stored in
  420. writable space, and identical looking constants are allocated
  421. separately.  (This is the same as the effect of
  422. @samp{-fwritable-strings}.)
  423.  
  424. @cindex @code{longjmp} and automatic variables
  425. @item
  426. All automatic variables not declared @code{register} are preserved by
  427. @code{longjmp}.  Ordinarily, GNU C follows ANSI C: automatic variables
  428. not declared @code{volatile} may be clobbered.
  429.  
  430. @item
  431. In the preprocessor, comments convert to nothing at all, rather than
  432. to a space.  This allows traditional token concatenation.
  433.  
  434. @item
  435. In the preprocessor, macro arguments are recognized within string
  436. constants in a macro definition (and their values are stringified,
  437. though without additional quote marks, when they appear in such a
  438. context).  The preprocessor always considers a string constant to end
  439. at a newline.
  440.  
  441. @item
  442. The predefined macro @code{__STDC__} is not defined when you use
  443. @samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
  444. which @code{__GNUC__} indicates are not affected by
  445. @samp{-traditional}).  If you need to write header files that work
  446. differently depending on whether @samp{-traditional} is in use, by
  447. testing both of these predefined macros you can distinguish four
  448. situations: GNU C, traditional GNU C, other ANSI C compilers, and
  449. other old C compilers.
  450. @end itemize
  451.  
  452. You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
  453. if your program uses names that are normally GNU C builtin functions for
  454. other purposes of its own.
  455.  
  456. @item -traditional-cpp
  457. Attempt to support some aspects of traditional C preprocessors.
  458. This includes the last three items in the table immediately above,
  459. but none of the other effects of @samp{-traditional}.
  460.  
  461. @item -fcond-mismatch
  462. Allow conditional expressions with mismatched types in the second and
  463. third arguments.  The value of such an expression is void.
  464.  
  465. @item -funsigned-char
  466. Let the type @code{char} be unsigned, like @code{unsigned char}.
  467.  
  468. Each kind of machine has a default for what @code{char} should
  469. be.  It is either like @code{unsigned char} by default or like
  470. @code{signed char} by default.
  471.  
  472. Ideally, a portable program should always use @code{signed char} or
  473. @code{unsigned char} when it depends on the signedness of an object.
  474. But many programs have been written to use plain @code{char} and
  475. expect it to be signed, or expect it to be unsigned, depending on the
  476. machines they were written for.  This option, and its inverse, let you
  477. make such a program work with the opposite default.
  478.  
  479. The type @code{char} is always a distinct type from each of
  480. @code{signed char} or @code{unsigned char}, even though its behavior
  481. is always just like one of those two.
  482.  
  483. @item -fsigned-char
  484. Let the type @code{char} be signed, like @code{signed char}.
  485.  
  486. Note that this is equivalent to @samp{-fno-unsigned-char}, which is
  487. the negative form of @samp{-funsigned-char}.  Likewise,
  488. @samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
  489.  
  490. @item -fsigned-bitfields
  491. @itemx -funsigned-bitfields
  492. @itemx -fno-signed-bitfields
  493. @itemx -fno-unsigned-bitfields
  494. These options control whether a bitfield is signed or unsigned, when the
  495. declaration does not use either @code{signed} or @code{unsigned}.  By
  496. default, such a bitfield is signed, because this is consistent: the
  497. basic integer types such as @code{int} are signed types.
  498.  
  499. However, when @samp{-traditional} is used, bitfields are all unsigned
  500. no matter what.
  501.  
  502. @item -fwritable-strings
  503. Store string constants in the writable data segment and don't uniquize
  504. them.  This is for compatibility with old programs which assume they
  505. can write into string constants.  @samp{-traditional} also has this
  506. effect.
  507.  
  508. Writing into string constants is a very bad idea; ``constants'' should
  509. be constant.
  510. @end table
  511.  
  512. @node Warning Options, Debugging Options, Dialect Options, Invoking GCC
  513. @section Options to Request or Suppress Warnings
  514. @cindex options to control warnings
  515. @cindex warning messages
  516. @cindex messages, warning
  517. @cindex suppressing warnings
  518.  
  519. Warnings are diagnostic messages that report constructions which
  520. are not inherently erroneous but which are risky or suggest there
  521. may have been an error.
  522.  
  523. You can request many specific warnings with options beginning @samp{-W},
  524. for example @samp{-Wimplicit} to request warnings on implicit
  525. declarations.  Each of these specific warning options also has a
  526. negative form beginning @samp{-Wno-} to turn off warnings;
  527. for example, @samp{-Wno-implicit}.  This manual lists only one of the
  528. two forms, whichever is not the default.
  529.  
  530. These options control the amount and kinds of warnings produced by GNU
  531. CC:
  532.  
  533. @table @code
  534. @cindex syntax checking
  535. @item -fsyntax-only
  536. Check the code for syntax errors, but don't emit any output.
  537.  
  538. @item -w
  539. Inhibit all warning messages.
  540.  
  541. @item -Wno_import
  542. Inhibit warning messages about the use of @samp{#import}.
  543.  
  544. @item -pedantic
  545. Issue all the warnings demanded by strict ANSI standard C; reject
  546. all programs that use forbidden extensions.  
  547.  
  548. Valid ANSI standard C programs should compile properly with or without
  549. this option (though a rare few will require @samp{-ansi}).  However,
  550. without this option, certain GNU extensions and traditional C features
  551. are supported as well.  With this option, they are rejected.
  552.  
  553. @samp{-pedantic} does not cause warning messages for use of the
  554. alternate keywords whose names begin and end with @samp{__}.  Pedantic
  555. warnings are also disabled in the expression that follows
  556. @code{__extension__}.  However, only system header files should use
  557. these escape routes; application programs should avoid them.
  558. @xref{Alternate Keywords}.
  559.  
  560. This option is not intended to be @i{useful}; it exists only to satisfy
  561. pedants who would otherwise claim that GNU CC fails to support the ANSI
  562. standard.
  563.  
  564. Some users try to use @samp{-pedantic} to check programs for strict ANSI
  565. C conformance.  They soon find that it does not do quite what they want:
  566. it finds some non-ANSI practices, but not all---only those for which
  567. ANSI C @emph{requires} a diagnostic.
  568.  
  569. A feature to report any failure to conform to ANSI C might be useful in
  570. some instances, but would require considerable additional work and would
  571. be quite different from @samp{-pedantic}.  We recommend, rather, that
  572. users take advantage of the extensions of GNU C and disregard the
  573. limitations of other compilers.  Aside from certain supercomputers and
  574. obsolete small machines, there is less and less reason ever to use any
  575. other C compiler other than for bootstrapping GNU CC.
  576.  
  577. @item -pedantic-errors
  578. Like @samp{-pedantic}, except that errors are produced rather than
  579. warnings.
  580.  
  581. @item -W
  582. Print extra warning messages for these events:
  583.  
  584. @itemize @bullet
  585. @cindex @code{longjmp} warnings
  586. @item
  587. A nonvolatile automatic variable might be changed by a call to
  588. @code{longjmp}.  These warnings as well are possible only in
  589. optimizing compilation.
  590.  
  591. The compiler sees only the calls to @code{setjmp}.  It cannot know
  592. where @code{longjmp} will be called; in fact, a signal handler could
  593. call it at any point in the code.  As a result, you may get a warning
  594. even when there is in fact no problem because @code{longjmp} cannot
  595. in fact be called at the place which would cause a problem.
  596.  
  597. @item
  598. A function can return either with or without a value.  (Falling
  599. off the end of the function body is considered returning without
  600. a value.)  For example, this function would evoke such a
  601. warning:
  602.  
  603. @example
  604. foo (a)
  605. @{
  606.   if (a > 0)
  607.     return a;
  608. @}
  609. @end example
  610.  
  611. @item
  612. An expression-statement contains no side effects.
  613.  
  614. @item
  615. An unsigned value is compared against zero with @samp{>} or @samp{<=}.
  616. @end itemize
  617.  
  618. @item -Wimplicit
  619. Warn whenever a function or parameter is implicitly declared.
  620.  
  621. @item -Wreturn-type
  622. Warn whenever a function is defined with a return-type that defaults
  623. to @code{int}.  Also warn about any @code{return} statement with no
  624. return-value in a function whose return-type is not @code{void}.
  625.  
  626. @item -Wunused
  627. Warn whenever a local variable is unused aside from its declaration,
  628. whenever a function is declared static but never defined, and whenever
  629. a statement computes a result that is explicitly not used.
  630.  
  631. @item -Wswitch
  632. Warn whenever a @code{switch} statement has an index of enumeral type
  633. and lacks a @code{case} for one or more of the named codes of that
  634. enumeration.  (The presence of a @code{default} label prevents this
  635. warning.)  @code{case} labels outside the enumeration range also
  636. provoke warnings when this option is used.
  637.  
  638. @item -Wcomment
  639. Warn whenever a comment-start sequence @samp{/*} appears in a comment.
  640.  
  641. @item -Wtrigraphs
  642. Warn if any trigraphs are encountered (assuming they are enabled).
  643.  
  644. @item -Wformat
  645. Check calls to @code{printf} and @code{scanf}, etc., to make sure that
  646. the arguments supplied have types appropriate to the format string
  647. specified.
  648.  
  649. @item -Wchar-subscripts
  650. Warn if an array subscript has type @code{char}.  This is a common cause
  651. of error, as programmers often forget that this type is signed on some
  652. machines.
  653.  
  654. @item -Wuninitialized
  655. An automatic variable is used without first being initialized.
  656.  
  657. These warnings are possible only in optimizing compilation,
  658. because they require data flow information that is computed only
  659. when optimizing.  If you don't specify @samp{-O}, you simply won't
  660. get these warnings.
  661.  
  662. These warnings occur only for variables that are candidates for
  663. register allocation.  Therefore, they do not occur for a variable that
  664. is declared @code{volatile}, or whose address is taken, or whose size
  665. is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  666. structures, unions or arrays, even when they are in registers.
  667.  
  668. Note that there may be no warning about a variable that is used only
  669. to compute a value that itself is never used, because such
  670. computations may be deleted by data flow analysis before the warnings
  671. are printed.
  672.  
  673. These warnings are made optional because GNU CC is not smart
  674. enough to see all the reasons why the code might be correct
  675. despite appearing to have an error.  Here is one example of how
  676. this can happen:
  677.  
  678. @example
  679. @{
  680.   int x;
  681.   switch (y)
  682.     @{
  683.     case 1: x = 1;
  684.       break;
  685.     case 2: x = 4;
  686.       break;
  687.     case 3: x = 5;
  688.     @}
  689.   foo (x);
  690. @}
  691. @end example
  692.  
  693. @noindent
  694. If the value of @code{y} is always 1, 2 or 3, then @code{x} is
  695. always initialized, but GNU CC doesn't know this.  Here is
  696. another common case:
  697.  
  698. @example
  699. @{
  700.   int save_y;
  701.   if (change_y) save_y = y, y = new_y;
  702.   @dots{}
  703.   if (change_y) y = save_y;
  704. @}
  705. @end example
  706.  
  707. @noindent
  708. This has no bug because @code{save_y} is used only if it is set.
  709.  
  710. Some spurious warnings can be avoided if you declare as
  711. @code{volatile} all the functions you use that never return.
  712. @xref{Function Attributes}.
  713.  
  714. @item -Wparentheses
  715. Warn if parentheses are omitted in certain contexts.
  716.  
  717. @item -Wall
  718. All of the above @samp{-W} options combined.  These are all the
  719. options which pertain to usage that we recommend avoiding and that we
  720. believe is easy to avoid, even in conjunction with macros.
  721. @end table
  722.  
  723. The remaining @samp{-W@dots{}} options are not implied by @samp{-Wall}
  724. because they warn about constructions that we consider reasonable to
  725. use, on occasion, in clean programs.
  726.  
  727. @table @code
  728. @item -Wtraditional
  729. Warn about certain constructs that behave differently in traditional and
  730. ANSI C.
  731.  
  732. @itemize @bullet
  733. @item
  734. Macro arguments occurring within string constants in the macro body.
  735. These would substitute the argument in traditional C, but are part of
  736. the constant in ANSI C.
  737.  
  738. @item
  739. A function declared external in one block and then used after the end of
  740. the block.
  741.  
  742. @item
  743. A @code{switch} statement has an operand of type @code{long}.
  744. @end itemize
  745.  
  746. @item -Wshadow
  747. Warn whenever a local variable shadows another local variable.
  748.  
  749. @item -Wid-clash-@var{len}
  750. Warn whenever two distinct identifiers match in the first @var{len}
  751. characters.  This may help you prepare a program that will compile
  752. with certain obsolete, brain-damaged compilers.
  753.  
  754. @item -Wpointer-arith
  755. Warn about anything that depends on the ``size of'' a function type or
  756. of @code{void}.  GNU C assigns these types a size of 1, for
  757. convenience in calculations with @code{void *} pointers and pointers
  758. to functions.
  759.  
  760. @item -Wcast-qual
  761. Warn whenever a pointer is cast so as to remove a type qualifier from
  762. the target type.  For example, warn if a @code{const char *} is cast
  763. to an ordinary @code{char *}.
  764.  
  765. @item -Wcast-align
  766. Warn whenever a pointer is cast such that the required alignment of the
  767. target is increased.  For example, warn if a @code{char *} is cast to
  768. an @code{int *} on machines where integers can only be accessed at
  769. two- or four-byte boundaries.
  770.  
  771. @item -Wwrite-strings
  772. Give string constants the type @code{const char[@var{length}]} so that
  773. copying the address of one into a non-@code{const} @code{char *}
  774. pointer will get a warning.  These warnings will help you find at
  775. compile time code that can try to write into a string constant, but
  776. only if you have been very careful about using @code{const} in
  777. declarations and prototypes.  Otherwise, it will just be a nuisance;
  778. this is why we did not make @samp{-Wall} request these warnings.
  779.  
  780. @item -Wconversion
  781. Warn if a prototype causes a type conversion that is different from what
  782. would happen to the same argument in the absence of a prototype.  This
  783. includes conversions of fixed point to floating and vice versa, and
  784. conversions changing the width or signedness of a fixed point argument
  785. except when the same as the default promotion.
  786.  
  787. @item -Waggregate-return
  788. Warn if any functions that return structures or unions are defined or
  789. called.  (In languages where you can return an array, this also elicits
  790. a warning.)
  791.  
  792. @item -Wstrict-prototypes
  793. Warn if a function is declared or defined without specifying the
  794. argument types.  (An old-style function definition is permitted without
  795. a warning if preceded by a declaration which specifies the argument
  796. types.)
  797.  
  798. @item -Wmissing-prototypes
  799. Warn if a global function is defined without a previous prototype
  800. declaration.  This warning is issued even if the definition itself
  801. provides a prototype.  The aim is to detect global functions that fail
  802. to be declared in header files.
  803.  
  804. @item -Wredundant-decls
  805. Warn if anything is declared more than once in the same scope, even in
  806. cases where multiple declaration is valid and changes nothing.
  807.  
  808. @item -Wnested-externs
  809. Warn if an @code{extern} declaration is encountered within an function.
  810.  
  811. @item -Winline
  812. Warn if a function can not be inlined, and either it was declared as inline,
  813. or else the @samp{-finline-functions} option was given.
  814.  
  815. @item -Werror
  816. Make all warnings into errors.
  817. @end table
  818.  
  819. @node Debugging Options, Optimize Options, Warning Options, Invoking GCC
  820. @section Options for Debugging Your Program or GNU CC
  821. @cindex options, debugging
  822. @cindex debugging information options
  823.  
  824. GNU CC has various special options that are used for debugging
  825. either your program or GCC:
  826.  
  827. @table @code
  828. @item -g
  829. Produce debugging information in the operating system's native format
  830. (stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
  831. information.
  832.  
  833. On most systems that use stabs format, @samp{-g} enables use of extra
  834. debugging information that only GDB can use; this extra information
  835. makes debugging work better in GDB but will probably make DBX crash or
  836. refuse to read the program.  If you want to control for certain whether
  837. to generate the extra information, use @samp{-gstabs+} or @samp{-gstabs}
  838. (see below).
  839.  
  840. Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
  841. @samp{-O}.  The shortcuts taken by optimized code may occasionally
  842. produce surprising results: some variables you declared may not exist
  843. at all; flow of control may briefly move where you did not expect it;
  844. some statements may not be executed because they compute constant
  845. results or their values were already at hand; some statements may
  846. execute in different places because they were moved out of loops.
  847.  
  848. Nevertheless it proves possible to debug optimized output.  This makes
  849. it reasonable to use the optimizer for programs that might have bugs.
  850.  
  851. The following options are useful when GNU CC is generated with the
  852. capability for more than one debugging format.
  853.  
  854. @item -ggdb
  855. Produce debugging information in the native format (if that is supported),
  856. including GDB extensions if at all possible.
  857.  
  858. @item -gstabs
  859. Produce debugging information in stabs format (if that is supported),
  860. without GDB extensions.  This is the format used by DBX on most BSD
  861. systems.
  862.  
  863. @item -gstabs+
  864. Produce debugging information in stabs format (if that is supported),
  865. using GDB extensions.  The use of these extensions is likely to make DBX
  866. crash or refuse to read the program.
  867.  
  868. @item -gcoff
  869. Produce debugging information in COFF format (if that is supported).
  870. This is the format used by SDB on COFF systems.
  871.  
  872. @item -gxcoff
  873. Produce debugging information in XCOFF format (if that is supported).
  874. This is the format used on IBM RS/6000 systems.
  875.  
  876. @item -gdwarf
  877. Produce debugging information in DWARF format (if that is supported).
  878. This is the format used by SDB on systems that use DWARF.
  879.  
  880. @item -g@var{level}
  881. @itemx -ggdb@var{level}
  882. @itemx -gstabs@var{level}
  883. @itemx -gcoff@var{level}
  884. @itemx -gxcoff@var{level}
  885. @itemx -gdwarf@var{level}
  886. Request debugging information and also use @var{level} to specify how
  887. much information.  The default level is 2.
  888.  
  889. Level 1 produces minimal information, enough for making backtraces in
  890. parts of the program that you don't plan to debug.  This includes
  891. descriptions of functions and external variables, but no information
  892. about local variables and no line numbers.
  893.  
  894. Level 3 includes extra information, such as all the macro definitions
  895. present in the program.  Some debuggers support macro expansion when
  896. you use @samp{-g3}.
  897.  
  898. @cindex @code{prof}
  899. @item -p
  900. Generate extra code to write profile information suitable for the
  901. analysis program @code{prof}.
  902. @c ??? looks like -p and -pg are now equivalent.  Are they? 11dec91
  903.  
  904. @cindex @code{gprof}
  905. @item -pg
  906. Generate extra code to write profile information suitable for the
  907. analysis program @code{gprof}.
  908.  
  909. @cindex @code{tcov}
  910. @item -a
  911. Generate extra code to write profile information for basic blocks,
  912. which will record the number of times each basic block is executed.
  913. This data could be analyzed by a program like @code{tcov}.  Note,
  914. however, that the format of the data is not what @code{tcov} expects.
  915. Eventually GNU @code{gprof} should be extended to process this data.
  916.  
  917. @item -d@var{letters}
  918. Says to make debugging dumps during compilation at times specified by
  919. @var{letters}.  This is used for debugging the compiler.  The file names
  920. for most of the dumps are made by appending a word to the source file
  921. name (e.g.  @file{foo.c.rtl} or @file{foo.c.jump}).  Here are the
  922. possible letters for use in @var{letters}, and their meanings:
  923.  
  924. @table @samp
  925. @item M
  926. Dump all macro definitions, at the end of preprocessing, and write no
  927. output.
  928. @item N
  929. Dump all macro names, at the end of preprocessing.
  930. @item D
  931. Dump all macro definitions, at the end of preprocessing, in addition to
  932. normal output.
  933. @item y
  934. Dump debugging information during parsing, to standard error.
  935. @item r
  936. Dump after RTL generation, to @file{@var{file}.rtl}.
  937. @item x
  938. Just generate RTL for a function instead of compiling it.  Usually used
  939. with @samp{r}.
  940. @item j
  941. Dump after first jump optimization, to @file{@var{file}.jump}.
  942. @item s
  943. Dump after CSE (including the jump optimization that sometimes
  944. follows CSE), to @file{@var{file}.cse}.
  945. @item L
  946. Dump after loop optimization, to @file{@var{file}.loop}.
  947. @item t
  948. Dump after the second CSE pass (including the jump optimization that
  949. sometimes follows CSE), to @file{@var{file}.cse2}.
  950. @item f
  951. Dump after flow analysis, to @file{@var{file}.flow}.
  952. @item c
  953. Dump after instruction combination, to @file{@var{file}.combine}.
  954. @item S
  955. Dump after the first instruction scheduling pass, to
  956. @file{@var{file}.sched}.
  957. @item l
  958. Dump after local register allocation, to @file{@var{file}.lreg}.
  959. @item g
  960. Dump after global register allocation, to @file{@var{file}.greg}.
  961. @item R
  962. Dump after the second instruction scheduling pass, to
  963. @file{@var{file}.sched2}.
  964. @item J
  965. Dump after last jump optimization, to @file{@var{file}.jump2}.
  966. @item d
  967. Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
  968. @item k
  969. Dump after conversion from registers to stack, to @file{@var{file}.stack}.
  970. @item a
  971. Produce all the dumps listed above.
  972. @item m
  973. Print statistics on memory usage, at the end of the run, to
  974. standard error.
  975. @item p
  976. Annotate the assembler output with a comment indicating which
  977. pattern and alternative was used.
  978. @end table
  979.  
  980. @item -fpretend-float
  981. When running a cross-compiler, pretend that the target machine uses the
  982. same floating point format as the host machine.  This causes incorrect
  983. output of the actual floating constants, but the actual instruction
  984. sequence will probably be the same as GNU CC would make when running on
  985. the target machine.
  986.  
  987. @item -save-temps
  988. Store the usual ``temporary'' intermediate files permanently; place them
  989. in the current directory and name them based on the source file.  Thus,
  990. compiling @file{foo.c} with @samp{-c -save-temps} would produce files
  991. @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
  992. @end table
  993.  
  994. @node Optimize Options, Preprocessor Options, Debugging Options, Invoking GCC
  995. @section Options That Control Optimization
  996. @cindex optimize options
  997. @cindex options, optimization
  998.  
  999. These options control various sorts of optimizations:
  1000.  
  1001. @table @code
  1002. @item -O
  1003. Optimize.  Optimizing compilation takes somewhat more time, and a lot
  1004. more memory for a large function.
  1005.  
  1006. Without @samp{-O}, the compiler's goal is to reduce the cost of
  1007. compilation and to make debugging produce the expected results.
  1008. Statements are independent: if you stop the program with a breakpoint
  1009. between statements, you can then assign a new value to any variable or
  1010. change the program counter to any other statement in the function and
  1011. get exactly the results you would expect from the source code.
  1012.  
  1013. Without @samp{-O}, only variables declared @code{register} are
  1014. allocated in registers.  The resulting compiled code is a little worse
  1015. than produced by PCC without @samp{-O}.
  1016.  
  1017. With @samp{-O}, the compiler tries to reduce code size and execution
  1018. time.
  1019.  
  1020. When @samp{-O} is specified, @samp{-fthread-jumps} and
  1021. @samp{-fdelayed-branch} are turned on.  On some machines other
  1022. flags may also be turned on.
  1023.  
  1024. @item -O2
  1025. Optimize even more.  Nearly all supported optimizations that do not
  1026. involve a space-speed tradeoff are performed.  As compared to @samp{-O},
  1027. this option increases both compilation time and the performance of the
  1028. generated code.
  1029.  
  1030. @samp{-O2} turns on all @samp{-f@var{flag}} options that enable more
  1031. optimization, except for @samp{-funroll-loops},
  1032. @samp{-funroll-all-loops} and @samp{-fomit-frame-pointer}.
  1033. @end table
  1034.  
  1035. Options of the form @samp{-f@var{flag}} specify machine-independent
  1036. flags.  Most flags have both positive and negative forms; the negative
  1037. form of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below,
  1038. only one of the forms is listed---the one which is not the default.
  1039. You can figure out the other form by either removing @samp{no-} or
  1040. adding it.
  1041.  
  1042. @table @code
  1043. @item -ffloat-store
  1044. Do not store floating point variables in registers.  This
  1045. prevents undesirable excess precision on machines such as the
  1046. 68000 where the floating registers (of the 68881) keep more
  1047. precision than a @code{double} is supposed to have.
  1048.  
  1049. For most programs, the excess precision does only good, but a few
  1050. programs rely on the precise definition of IEEE floating point.
  1051. Use @samp{-ffloat-store} for such programs.
  1052.  
  1053. @item -fno-defer-pop
  1054. Always pop the arguments to each function call as soon as that function
  1055. returns.  For machines which must pop arguments after a function call,
  1056. the compiler normally lets arguments accumulate on the stack for several
  1057. function calls and pops them all at once.
  1058.  
  1059. @item -fforce-mem
  1060. Force memory operands to be copied into registers before doing
  1061. arithmetic on them.  This may produce better code by making all
  1062. memory references potential common subexpressions.  When they are
  1063. not common subexpressions, instruction combination should
  1064. eliminate the separate register-load.  I am interested in hearing
  1065. about the difference this makes.
  1066.  
  1067. @item -fforce-addr
  1068. Force memory address constants to be copied into registers before
  1069. doing arithmetic on them.  This may produce better code just as
  1070. @samp{-fforce-mem} may.  I am interested in hearing about the
  1071. difference this makes.
  1072.  
  1073. @item -fomit-frame-pointer
  1074. Don't keep the frame pointer in a register for functions that
  1075. don't need one.  This avoids the instructions to save, set up and
  1076. restore frame pointers; it also makes an extra register available
  1077. in many functions.  @strong{It also makes debugging impossible on
  1078. some machines.}
  1079.  
  1080. @ifset INTERNALS
  1081. On some machines, such as the Vax, this flag has no effect, because
  1082. the standard calling sequence automatically handles the frame pointer
  1083. and nothing is saved by pretending it doesn't exist.  The
  1084. machine-description macro @code{FRAME_POINTER_REQUIRED} controls
  1085. whether a target machine supports this flag.  @xref{Registers}.@refill
  1086. @end ifset
  1087. @ifclear INTERNALS
  1088. On some machines, such as the Vax, this flag has no effect, because
  1089. the standard calling sequence automatically handles the frame pointer
  1090. and nothing is saved by pretending it doesn't exist.  The
  1091. machine-description macro @code{FRAME_POINTER_REQUIRED} controls
  1092. whether a target machine supports this flag.  @xref{Registers,,Register
  1093. Usage, gcc.info, Using and Porting GCC}.@refill
  1094. @end ifclear
  1095.  
  1096. @item -fno-inline
  1097. Don't pay attention to the @code{inline} keyword.  Normally this option
  1098. is used to keep the compiler from expanding any functions inline.
  1099.   
  1100. @item -finline-functions
  1101. Integrate all simple functions into their callers.  The compiler
  1102. heuristically decides which functions are simple enough to be worth
  1103. integrating in this way.
  1104.  
  1105. If all calls to a given function are integrated, and the function is
  1106. declared @code{static}, then the function is normally not output as
  1107. assembler code in its own right.
  1108.  
  1109. @item -fkeep-inline-functions
  1110. Even if all calls to a given function are integrated, and the function
  1111. is declared @code{static}, nevertheless output a separate run-time
  1112. callable version of the function.
  1113.  
  1114. @item -fno-function-cse
  1115. Do not put function addresses in registers; make each instruction that
  1116. calls a constant function contain the function's address explicitly.
  1117.  
  1118. This option results in less efficient code, but some strange hacks
  1119. that alter the assembler output may be confused by the optimizations
  1120. performed when this option is not used.
  1121.  
  1122. @item -ffast-math
  1123. This option allows GCC to violate some ANSI or IEEE rules/specifications
  1124. in the interest of optimizing code for speed.  For example, it allows
  1125. the compiler to assume arguments to the @code{sqrt} function are 
  1126. non-negative numbers.  
  1127.  
  1128. This option should never be turned on by any @samp{-O} option since 
  1129. it can result in incorrect output for programs which depend on 
  1130. an exact implementation of IEEE or ANSI rules/specifications for
  1131. math functions.
  1132. @end table
  1133.  
  1134.  
  1135.  
  1136. The following options control specific optimizations.  The @samp{-O2}
  1137. option turns on all of these optimizations except @samp{-funroll-loops}
  1138. and @samp{-funroll-all-loops}.  The @samp{-O} option usually turns on
  1139. the @samp{-fthread-jumps} and @samp{-fdelayed-branch} options, but
  1140. specific machines may change the default optimizations.
  1141.  
  1142. You can use the following flags in the rare cases when ``fine-tuning''
  1143. of optimizations to be performed is desired.
  1144.  
  1145. @table @code
  1146. @item -fstrength-reduce
  1147. Perform the optimizations of loop strength reduction and
  1148. elimination of iteration variables.
  1149.  
  1150. @item -fthread-jumps
  1151. Perform optimizations where we check to see if a jump branches to a
  1152. location where another comparison subsumed by the first is found.  If
  1153. so, the first branch is redirected to either the destination of the
  1154. second branch or a point immediately following it, depending on whether
  1155. the condition is known to be true or false.
  1156.  
  1157. @item -fcse-follow-jumps
  1158. In common subexpression elimination, scan through jump instructions
  1159. when the target of the jump is not reached by any other path.  For
  1160. example, when CSE encounters an @code{if} statement with an
  1161. @code{else} clause, CSE will follow the jump when the condition
  1162. tested is false.
  1163.  
  1164. @item -fcse-skip-blocks
  1165. This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
  1166. follow jumps which conditionally skip over blocks.  When CSE
  1167. encounters a simple @code{if} statement with no else clause,
  1168. @samp{-fcse-skip-blocks} causes CSE to follow the jump around the
  1169. body of the @code{if}.
  1170.  
  1171. @item -frerun-cse-after-loop
  1172. Re-run common subexpression elimination after loop optimizations has been
  1173. performed.  
  1174.  
  1175. @item -fexpensive-optimizations
  1176. Perform a number of minor optimizations that are relatively expensive.
  1177.  
  1178. @item -fdelayed-branch
  1179. If supported for the target machine, attempt to reorder instructions
  1180. to exploit instruction slots available after delayed branch
  1181. instructions.
  1182.  
  1183. @item -fschedule-insns
  1184. If supported for the target machine, attempt to reorder instructions to
  1185. eliminate execution stalls due to required data being unavailable.  This
  1186. helps machines that have slow floating point or memory load instructions
  1187. by allowing other instructions to be issued until the result of the load
  1188. or floating point instruction is required.
  1189.  
  1190. @item -fschedule-insns2
  1191. Similar to @samp{-fschedule-insns}, but requests an additional pass of
  1192. instruction scheduling after register allocation has been done.  This is
  1193. especially useful on machines with a relatively small number of
  1194. registers and where memory load instructions take more than one cycle.
  1195.  
  1196. @item -fcaller-saves
  1197. Enable values to be allocated in registers that will be clobbered by
  1198. function calls, by emitting extra instructions to save and restore the
  1199. registers around such calls.  Such allocation is done only when it
  1200. seems to result in better code than would otherwise be produced.
  1201.  
  1202. This option is enabled by default on certain machines, usually those
  1203. which have no call-preserved registers to use instead.
  1204.  
  1205. @item -funroll-loops
  1206. Perform the optimization of loop unrolling.  This is only done for loops
  1207. whose number of iterations can be determined at compile time or run time.
  1208. @samp{-funroll-loop} implies @samp{-fstrength-reduce} and
  1209. @samp{-frerun-cse-after-loop}.
  1210.  
  1211. @item -funroll-all-loops
  1212. Perform the optimization of loop unrolling.  This is done for all loops
  1213. and usually makes programs run more slowly.  @samp{-funroll-all-loops}
  1214. implies @samp{-fstrength-reduce} and @samp{-frerun-cse-after-loop}.
  1215.  
  1216. @item -fno-peephole
  1217. Disable any machine-specific peephole optimizations.
  1218. @end table
  1219.  
  1220. @node Preprocessor Options, Link Options, Optimize Options, Invoking GCC
  1221. @section Options Controlling the Preprocessor
  1222. @cindex preprocessor options
  1223. @cindex options, preprocessor
  1224.  
  1225. These options control the C preprocessor, which is run on each C source
  1226. file before actual compilation.
  1227.  
  1228. If you use the @samp{-E} option, nothing is done except preprocessing.
  1229. Some of these options make sense only together with @samp{-E} because
  1230. they cause the preprocessor output to be unsuitable for actual
  1231. compilation.
  1232.  
  1233. @table @code
  1234. @item -include @var{file}
  1235. Process @var{file} as input before processing the regular input file.
  1236. In effect, the contents of @var{file} are compiled first.  Any @samp{-D}
  1237. and @samp{-U} options on the command line are always processed before
  1238. @samp{-include @var{file}}, regardless of the order in which they are
  1239. written.  All the @samp{-include} and @samp{-imacros} options are
  1240. processed in the order in which they are written.
  1241.  
  1242. @item -imacros @var{file}
  1243. Process @var{file} as input, discarding the resulting output, before
  1244. processing the regular input file.  Because the output generated from
  1245. @var{file} is discarded, the only effect of @samp{-imacros @var{file}}
  1246. is to make the macros defined in @var{file} available for use in the
  1247. main input.
  1248.  
  1249. Any @samp{-D} and @samp{-U} options on the command line are always
  1250. processed before @samp{-imacros @var{file}}, regardless of the order in
  1251. which they are written.  All the @samp{-include} and @samp{-imacros}
  1252. options are processed in the order in which they are written.
  1253.  
  1254. @item -nostdinc
  1255. Do not search the standard system directories for header files.  Only
  1256. the directories you have specified with @samp{-I} options (and the
  1257. current directory, if appropriate) are searched.  @xref{Directory
  1258. Options}, for information on @samp{-I}.
  1259.  
  1260. By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
  1261. search path to only those directories you specify explicitly.
  1262.  
  1263. @item -nostdinc++
  1264. Do not search for header files in the C++-specific standard directories,
  1265. but do still search the other standard directories.
  1266. (This option is used when building @samp{libg++}.)
  1267.  
  1268. @item -undef
  1269. Do not predefine any nonstandard macros.  (Including architecture flags).
  1270.  
  1271. @item -E
  1272. Run only the C preprocessor.  Preprocess all the C source files
  1273. specified and output the results to standard output or to the
  1274. specified output file.
  1275.  
  1276. @item -C
  1277. Tell the preprocessor not to discard comments.  Used with the
  1278. @samp{-E} option.
  1279.  
  1280. @item -P
  1281. Tell the preprocessor not to generate @samp{#line} commands.
  1282. Used with the @samp{-E} option.
  1283.  
  1284. @cindex make
  1285. @cindex dependencies, make
  1286. @item -M
  1287. Tell the preprocessor to output a rule suitable for @code{make}
  1288. describing the dependencies of each object file.  For each source file,
  1289. the preprocessor outputs one @code{make}-rule whose target is the object
  1290. file name for that source file and whose dependencies are all the files
  1291. @samp{#include}d in it.  This rule may be a single line or may be
  1292. continued with @samp{\}-newline if it is long.  The list of rules is
  1293. printed on standard output instead of the preprocessed C program.
  1294.  
  1295. @samp{-M} implies @samp{-E}.
  1296.  
  1297. Another way to specify output of a @code{make} rule is by setting
  1298. the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
  1299. Variables}).
  1300.  
  1301. @item -MM
  1302. Like @samp{-M} but the output mentions only the user header files
  1303. included with @samp{#include "@var{file}"}.  System header files
  1304. included with @samp{#include <@var{file}>} are omitted.
  1305.  
  1306. @item -MD
  1307. Like @samp{-M} but the dependency information is written to files with
  1308. names made by replacing @samp{.c} with @samp{.d} at the end of the
  1309. input file names.  This is in addition to compiling the file as
  1310. specified---@samp{-MD} does not inhibit ordinary compilation the way
  1311. @samp{-M} does.
  1312.  
  1313. The Mach utility @samp{md} can be used to merge the @samp{.d} files
  1314. into a single dependency file suitable for using with the @samp{make}
  1315. command.
  1316.  
  1317. @item -MMD
  1318. Like @samp{-MD} except mention only user header files, not system
  1319. header files.
  1320.  
  1321. @item -H
  1322. Print the name of each header file used, in addition to other normal
  1323. activities.
  1324.  
  1325. @item -D@var{macro}
  1326. Define macro @var{macro} with the string @samp{1} as its definition.
  1327.  
  1328. @item -D@var{macro}=@var{defn}
  1329. Define macro @var{macro} as @var{defn}.  All instances of @samp{-D} on
  1330. the command line are processed before any @samp{-U} options.
  1331.  
  1332. @item -U@var{macro}
  1333. Undefine macro @var{macro}.  @samp{-U} options are evaluated after all
  1334. @samp{-D} options, but before any @samp{-include} and @samp{-imacros}
  1335. options.
  1336.  
  1337. @item -dM
  1338. Tell the preprocessor to output only a list of the macro definitions
  1339. that are in effect at the end of preprocessing.  Used with the @samp{-E}
  1340. option.
  1341.  
  1342. @item -dD
  1343. Tell the preprocessing to pass all macro definitions into the output, in
  1344. their proper sequence in the rest of the output.
  1345.  
  1346. @item -dN
  1347. Like @samp{-dD} except that the macro arguments and contents are omitted.
  1348. Only @samp{#define @var{name}} is included in the output.
  1349.  
  1350. @item -trigraphs
  1351. Support ANSI C trigraphs.  You don't want to know about this
  1352. brain-damage.  The @samp{-ansi} option also has this effect.
  1353. @end table
  1354.  
  1355. @node Link Options, Directory Options, Preprocessor Options, Invoking GCC
  1356. @section Options for Linking
  1357. @cindex link options
  1358. @cindex options, linking
  1359.  
  1360. These options come into play when the compiler links object files into
  1361. an executable output file.  They are meaningless if the compiler is
  1362. not doing a link step.
  1363.  
  1364. @table @code
  1365. @cindex file names
  1366. @item @var{object-file-name}
  1367. A file name that does not end in a special recognized suffix is
  1368. considered to name an object file or library.  (Object files are
  1369. distinguished from libraries by the linker according to the file
  1370. contents.)  If linking is done, these object files are used as input
  1371. to the linker.
  1372.  
  1373. @item -c
  1374. @itemx -S
  1375. @itemx -E
  1376. If any of these options is used, then the linker is not run, and
  1377. object file names should not be used as arguments.  @xref{Overall
  1378. Options}.
  1379.  
  1380. @cindex Libraries
  1381. @item -l@var{library}
  1382. Search the library named @var{library} when linking.
  1383.  
  1384. It makes a difference where in the command you write this option; the
  1385. linker searches processes libraries and object files in the order they
  1386. are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
  1387. after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
  1388. to functions in @samp{z}, those functions may not be loaded.
  1389.  
  1390. The linker searches a standard list of directories for the library,
  1391. which is actually a file named @file{lib@var{library}.a}.  The linker
  1392. then uses this file as if it had been specified precisely by name.
  1393.  
  1394. The directories searched include several standard system directories
  1395. plus any that you specify with @samp{-L}.
  1396.  
  1397. Normally the files found this way are library files---archive files
  1398. whose members are object files.  The linker handles an archive file by
  1399. scanning through it for members which define symbols that have so far
  1400. been referenced but not defined.  But if the file that is found is an
  1401. ordinary object file, it is linked in the usual fashion.  The only
  1402. difference between using an @samp{-l} option and specifying a file name
  1403. is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
  1404. and searches several directories.
  1405.  
  1406. @item -nostdlib
  1407. Don't use the standard system libraries and startup files when linking.
  1408. Only the files you specify will be passed to the linker.
  1409.  
  1410. @item -static
  1411. On systems that support dynamic linking, this prevents linking with the shared
  1412. libraries.  On other systems, this
  1413. option has no effect.
  1414.  
  1415. @item -shared
  1416. Produce a shared object which can then be linked with other objects to
  1417. form an executable.  Only a few systems support this option.
  1418.  
  1419. @item -symbolic
  1420. Bind references to global symbols when building a shared object.  Warn
  1421. about any unresolved references (unless overridden by the link editor
  1422. option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
  1423. this option.
  1424.  
  1425. @item -Xlinker @var{option}
  1426. Pass @var{option} as an option to the linker.  You can use this to
  1427. supply system-specific linker options which GNU CC does not know how to
  1428. recognize.
  1429.  
  1430. If you want to pass an option that takes an argument, you must use
  1431. @samp{-Xlinker} twice, once for the option and once for the argument.
  1432. For example, to pass @samp{-assert definitions}, you must write
  1433. @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
  1434. @samp{-Xlinker "-assert definitions"}, because this passes the entire
  1435. string as a single argument, which is not what the linker expects.
  1436. @end table
  1437.  
  1438. @node Directory Options, Target Options, Link Options, Invoking GCC
  1439. @section Options for Directory Search
  1440. @cindex directory options
  1441. @cindex options, directory search
  1442. @cindex search path
  1443.  
  1444. These options specify directories to search for header files, for
  1445. libraries and for parts of the compiler:
  1446.  
  1447. @table @code
  1448. @item -I@var{dir}
  1449. Append directory @var{dir} to the list of directories searched for
  1450. include files.
  1451.  
  1452. @item -I-
  1453. Any directories you specify with @samp{-I} options before the @samp{-I-}
  1454. option are searched only for the case of @samp{#include "@var{file}"};
  1455. they are not searched for @samp{#include <@var{file}>}.
  1456.  
  1457. If additional directories are specified with @samp{-I} options after
  1458. the @samp{-I-}, these directories are searched for all @samp{#include}
  1459. directives.  (Ordinarily @emph{all} @samp{-I} directories are used
  1460. this way.)
  1461.  
  1462. In addition, the @samp{-I-} option inhibits the use of the current
  1463. directory (where the current input file came from) as the first search
  1464. directory for @samp{#include "@var{file}"}.  There is no way to
  1465. override this effect of @samp{-I-}.  With @samp{-I.} you can specify
  1466. searching the directory which was current when the compiler was
  1467. invoked.  That is not exactly the same as what the preprocessor does
  1468. by default, but it is often satisfactory.
  1469.  
  1470. @samp{-I-} does not inhibit the use of the standard system directories
  1471. for header files.  Thus, @samp{-I-} and @samp{-nostdinc} are
  1472. independent.
  1473.  
  1474. @item -L@var{dir}
  1475. Add directory @var{dir} to the list of directories to be searched
  1476. for @samp{-l}.
  1477.  
  1478. @item -B@var{prefix}
  1479. This option specifies where to find the executables, libraries and
  1480. data files of the compiler itself.
  1481.  
  1482. The compiler driver program runs one or more of the subprograms
  1483. @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
  1484. @var{prefix} as a prefix for each program it tries to run, both with and
  1485. without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
  1486.  
  1487. For each subprogram to be run, the compiler driver first tries the
  1488. @samp{-B} prefix, if any.  If that name is not found, or if @samp{-B}
  1489. was not specified, the driver tries two standard prefixes, which are
  1490. @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
  1491. those results in a file name that is found, the unmodified program
  1492. name is searched for using the directories specified in your
  1493. @samp{PATH} environment variable.
  1494.  
  1495. @samp{-B} prefixes that effectively specify directory names also apply
  1496. to libraries in the linker, because the compiler translates these
  1497. options into @samp{-L} options for the linker.
  1498.  
  1499. The run-time support file @file{libgcc.a} can also be searched for using
  1500. the @samp{-B} prefix, if needed.  If it is not found there, the two
  1501. standard prefixes above are tried, and that is all.  The file is left
  1502. out of the link if it is not found by those means.
  1503.  
  1504. Another way to specify a prefix much like the @samp{-B} prefix is to use
  1505. the environment variable @code{GCC_EXEC_PREFIX}.  @xref{Environment
  1506. Variables}.
  1507. @end table
  1508.  
  1509. @node Target Options, Submodel Options, Directory Options, Invoking GCC
  1510. @section Specifying Target Machine and Compiler Version
  1511. @cindex target options
  1512. @cindex cross compiling
  1513. @cindex specifying machine version
  1514. @cindex specifying compiler version and target machine
  1515. @cindex compiler version, specifying
  1516. @cindex target machine, specifying
  1517.  
  1518. By default, GNU CC compiles code for the same type of machine that you
  1519. are using.  However, it can also be installed as a cross-compiler, to
  1520. compile for some other type of machine.  In fact, several different
  1521. configurations of GNU CC, for different target machines, can be
  1522. installed side by side.  Then you specify which one to use with the
  1523. @samp{-b} option.
  1524.  
  1525. In addition, older and newer versions of GNU CC can be installed side
  1526. by side.  One of them (probably the newest) will be the default, but
  1527. you may sometimes wish to use another.
  1528.  
  1529. @table @code
  1530. @item -b @var{machine}
  1531. The argument @var{machine} specifies the target machine for compilation.
  1532. This is useful when you have installed GNU CC as a cross-compiler.
  1533.  
  1534. The value to use for @var{machine} is the same as was specified as the
  1535. machine type when configuring GNU CC as a cross-compiler.  For
  1536. example, if a cross-compiler was configured with @samp{configure
  1537. i386v}, meaning to compile for an 80386 running System V, then you
  1538. would specify @samp{-b i386v} to run that cross compiler.
  1539.  
  1540. When you do not specify @samp{-b}, it normally means to compile for
  1541. the same type of machine that you are using.
  1542.  
  1543. @item -V @var{version}
  1544. The argument @var{version} specifies which version of GNU CC to run.
  1545. This is useful when multiple versions are installed.  For example,
  1546. @var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0.
  1547.  
  1548. The default version, when you do not specify @samp{-V}, is controlled
  1549. by the way GNU CC is installed.  Normally, it will be a version that
  1550. is recommended for general use.
  1551. @end table
  1552.  
  1553. The @samp{-b} and @samp{-V} options actually work by controlling part of
  1554. the file name used for the executable files and libraries used for
  1555. compilation.  A given version of GNU CC, for a given target machine, is
  1556. normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
  1557.  
  1558. It follows that sites can customize the effect of @samp{-b} or @samp{-V}
  1559. either by changing the names of these directories or adding
  1560. alternate names (or symbolic links).  Thus, if
  1561. @file{/usr/local/lib/gcc-lib/80386} is a link to
  1562. @file{/usr/local/lib/gcc-lib/i386v}, then @samp{-b 80386} will be an alias
  1563. for @samp{-b i386v}.@refill
  1564.  
  1565. In one respect, the @samp{-b} or @samp{-V} do not completely change
  1566. to a different compiler: the top-level driver program @code{gcc}
  1567. that you originally invoked continues to run and invoke the other
  1568. executables (preprocessor, compiler per se, assembler and linker)
  1569. that do the real work.  However, since no real work is done in the
  1570. driver program, it usually does not matter that the driver program
  1571. in use is not the one for the specified target and version.
  1572.  
  1573. The only way that the driver program depends on the target machine is
  1574. in the parsing and handling of special machine-specific options.
  1575. However, this is controlled by a file which is found, along with the
  1576. other executables, in the directory for the specified version and
  1577. target machine.  As a result, a single installed driver program adapts
  1578. to any specified target machine and compiler version.
  1579.  
  1580. The driver program executable does control one significant thing,
  1581. however: the default version and target machine.  Therefore, you can
  1582. install different instances of the driver program, compiled for
  1583. different targets or versions, under different names.
  1584.  
  1585. For example, if the driver for version 2.0 is installed as @code{ogcc}
  1586. and that for version 2.1 is installed as @code{gcc}, then the command
  1587. @code{gcc} will use version 2.1 by default, while @code{ogcc} will use
  1588. 2.0 by default.  However, you can choose either version with either
  1589. command with the @samp{-V} option.
  1590.  
  1591. @node Submodel Options, Code Gen Options, Target Options, Invoking GCC
  1592. @section Specifying Hardware Models and Configurations
  1593. @cindex submodel options
  1594. @cindex specifying hardware config
  1595. @cindex hardware models and configurations, specifying
  1596. @cindex machine dependent options
  1597.  
  1598. Earlier we discussed the standard option @samp{-b} which chooses among
  1599. different installed compilers for completely different target
  1600. machines, such as Vax vs. 68000 vs. 80386.
  1601.  
  1602. In addition, each of these target machine types can have its own
  1603. special options, starting with @samp{-m}, to choose among various
  1604. hardware models or configurations---for example, 68010 vs 68020,
  1605. floating coprocessor or none.  A single installed version of the
  1606. compiler can compile for any model or configuration, according to the
  1607. options specified.
  1608.  
  1609. @ifset INTERNALS
  1610. These options are defined by the macro @code{TARGET_SWITCHES} in the
  1611. machine description.  The default for the options is also defined by
  1612. that macro, which enables you to change the defaults.
  1613. @end ifset
  1614.  
  1615. @menu
  1616. * M680x0 Options::
  1617. * VAX Options::
  1618. * SPARC Options::
  1619. * Convex Options::
  1620. * AMD29K Options::
  1621. * M88K Options::
  1622. * RS/6000 Options::
  1623. * RT Options::
  1624. * MIPS Options::
  1625. * i386 Options::
  1626. @end menu
  1627.  
  1628. @node M680x0 Options, Vax Options, Submodel Options, Submodel Options
  1629. @subsection M680x0 Options
  1630. @cindex M680x0 options
  1631.  
  1632. These are the @samp{-m} options defined for the 68000 series.  The default
  1633. values for these options depends on which style of 68000 was selected when
  1634. the compiler was configured; the defaults for the most common choices are
  1635. given below.
  1636.  
  1637. @table @code
  1638. @item -m68020
  1639. @itemx -mc68020
  1640. Generate output for a 68020 (rather than a 68000).  This is the
  1641. default when the compiler is configured for 68020-based systems.
  1642.  
  1643. @item -m68000
  1644. @itemx -mc68000
  1645. Generate output for a 68000 (rather than a 68020).  This is the default
  1646. when the compiler is configured for a 68000-based systems.
  1647.  
  1648. @item -m68881
  1649. Generate output containing 68881 instructions for floating point.
  1650. This is the default for most 68020 systems unless @samp{-nfp} was
  1651. specified when the compiler was configured.
  1652.  
  1653. @item -mfpa
  1654. Generate output containing Sun FPA instructions for floating point.
  1655.  
  1656. @item -msoft-float
  1657. Generate output containing library calls for floating point.
  1658. @strong{Warning:} the requisite libraries are not part of GNU CC.
  1659. Normally the facilities of the machine's usual C compiler are used, but
  1660. this can't be done directly in cross-compilation.  You must make your
  1661. own arrangements to provide suitable library functions for
  1662. cross-compilation.
  1663.  
  1664. @item -mshort
  1665. Consider type @code{int} to be 16 bits wide, like @code{short int}.
  1666.  
  1667. @item -mnobitfield
  1668. Do not use the bit-field instructions.  @samp{-m68000} implies
  1669. @samp{-mnobitfield}.
  1670.  
  1671. @item -mbitfield
  1672. Do use the bit-field instructions.  @samp{-m68020} implies
  1673. @samp{-mbitfield}.  This is the default if you use the unmodified
  1674. sources configured for a 68020.
  1675.  
  1676. @item -mrtd
  1677. Use a different function-calling convention, in which functions
  1678. that take a fixed number of arguments return with the @code{rtd}
  1679. instruction, which pops their arguments while returning.  This
  1680. saves one instruction in the caller since there is no need to pop
  1681. the arguments there.
  1682.  
  1683. This calling convention is incompatible with the one normally
  1684. used on Unix, so you cannot use it if you need to call libraries
  1685. compiled with the Unix compiler.
  1686.  
  1687. Also, you must provide function prototypes for all functions that
  1688. take variable numbers of arguments (including @code{printf});
  1689. otherwise incorrect code will be generated for calls to those
  1690. functions.
  1691.  
  1692. In addition, seriously incorrect code will result if you call a
  1693. function with too many arguments.  (Normally, extra arguments are
  1694. harmlessly ignored.)
  1695.  
  1696. The @code{rtd} instruction is supported by the 68010 and 68020
  1697. processors, but not by the 68000.
  1698. @end table
  1699.  
  1700. @node VAX Options, Sparc Options, M680x0 Options, Submodel Options
  1701. @subsection VAX Options
  1702. @cindex VAX options
  1703.  
  1704. These @samp{-m} options are defined for the Vax:
  1705.  
  1706. @table @code
  1707. @item -munix
  1708. Do not output certain jump instructions (@code{aobleq} and so on)
  1709. that the Unix assembler for the Vax cannot handle across long
  1710. ranges.
  1711.  
  1712. @item -mgnu
  1713. Do output those jump instructions, on the assumption that you
  1714. will assemble with the GNU assembler.
  1715.  
  1716. @item -mg
  1717. Output code for g-format floating point numbers instead of d-format.
  1718. @end table
  1719.  
  1720. @node Sparc Options, Convex Options, Vax Options, Submodel Options
  1721. @subsection SPARC Options
  1722. @cindex SPARC options
  1723.  
  1724. These @samp{-m} switches are supported on the Sparc:
  1725.  
  1726. @table @code
  1727. @ignore
  1728. @item -mfpu
  1729. Generate output containing floating point instructions.  This is the
  1730. default if you use the unmodified sources.
  1731.  
  1732. @item -msoft-float
  1733. Generate output containing library calls for floating point.
  1734. @strong{Warning:} the requisite libraries are not part of GNU CC.
  1735. Normally the facilities of the machine's usual C compiler are used, but
  1736. this can't be done directly in cross-compilation.  You must make your
  1737. own arrangements to provide suitable library functions for
  1738. cross-compilation.
  1739. @end ignore
  1740.  
  1741. @item -mforce-align
  1742. Make sure all objects of type @code{double} are 8-byte aligned in memory
  1743. and use double-word instructions to reference them.
  1744.  
  1745. @item -mno-epilogue
  1746. Generate separate return instructions for @code{return} statements.
  1747. This has both advantages and disadvantages; I don't recall what they
  1748. are.
  1749. @end table
  1750.  
  1751. @node Convex Options, AMD29K Options, SPARC Options, Submodel Options
  1752. @subsection Convex Options
  1753. @cindex Convex options
  1754.  
  1755. These @samp{-m} options are defined for the Convex:
  1756.  
  1757. @table @code
  1758. @item -mc1
  1759. Generate output for a C1.  This is the default when the compiler is
  1760. configured for a C1.
  1761.  
  1762. @item -mc2
  1763. Generate output for a C2.  This is the default when the compiler is
  1764. configured for a C2.
  1765.  
  1766. @item -margcount
  1767. Generate code which puts an argument count in the word preceding each
  1768. argument list.  Some nonportable Convex and Vax programs need this word.
  1769. (Debuggers don't, except for functions with variable-length argument
  1770. lists; this info is in the symbol table.)
  1771.  
  1772. @item -mnoargcount
  1773. Omit the argument count word.  This is the default if you use the
  1774. unmodified sources.
  1775. @end table
  1776.  
  1777. @node AMD29K Options, M88K Options, Convex Options, Submodel Options
  1778. @subsection AMD29K Options
  1779. @cindex AMD29K options
  1780.  
  1781. These @samp{-m} options are defined for the AMD Am29000:
  1782.  
  1783. @table @code
  1784. @item -mdw
  1785. Generate code that assumes the @code{DW} bit is set, i.e., that byte and
  1786. halfword operations are directly supported by the hardware.  This is the
  1787. default.
  1788.  
  1789. @item -mnodw
  1790. Generate code that assumes the @code{DW} bit is not set.
  1791.  
  1792. @item -mbw
  1793. Generate code that assumes the system supports byte and halfword write
  1794. operations.  This is the default.
  1795.  
  1796. @item -mnbw
  1797. Generate code that assumes the systems does not support byte and
  1798. halfword write operations.  @samp{-mnbw} implies @samp{-mnodw}.
  1799.  
  1800. @item -msmall
  1801. Use a small memory model that assumes that all function addresses are
  1802. either within a single 256 KB segment or at an absolute address of less
  1803. than 256K.  This allows the @code{call} instruction to be used instead
  1804. of a @code{const}, @code{consth}, @code{calli} sequence.
  1805.  
  1806. @item -mlarge
  1807. Do not assume that the @code{call} instruction can be used; this is the
  1808. default.
  1809.  
  1810. @item -m29050
  1811. Generate code for the Am29050.
  1812.  
  1813. @item -m29000
  1814. Generate code for the Am29000.  This is the default.
  1815.  
  1816. @item -mkernel-registers
  1817. Generate references to registers @code{gr64-gr95} instead of
  1818. @code{gr96-gr127}.  This option can be used when compiling kernel code
  1819. that wants a set of global registers disjoint from that used by
  1820. user-mode code.
  1821.  
  1822. Note that when this option is used, register names in @samp{-f} flags
  1823. must use the normal, user-mode, names.
  1824.  
  1825. @item -muser-registers
  1826. Use the normal set of global registers, @code{gr96-gr127}.  This is the
  1827. default.
  1828.  
  1829. @item -mstack-check
  1830. Insert a call to @code{__msp_check} after each stack adjustment.  This
  1831. is often used for kernel code.
  1832. @end table
  1833.  
  1834. @node M88K Options, RS/6000 Options, AMD29K Options, Submodel Options
  1835. @subsection M88K Options
  1836. @cindex M88k options
  1837.  
  1838. These @samp{-m} options are defined for Motorola 88K architectures:
  1839.  
  1840. @table @code
  1841. @item -m88000
  1842. @kindex -m88000
  1843. Generate code that works well on both the m88100 and the
  1844. m88110.
  1845.  
  1846. @item -m88100
  1847. @kindex -m88100
  1848. Generate code tha
  1849. Generate code that works best for the m88100, but that also
  1850. runs on the m88110.
  1851.  
  1852. @item -m88110
  1853. @kindex -m88110
  1854. Generate code that works best for the m88110, and may not run
  1855. on the m88100.
  1856.  
  1857. @item -midentify-revision
  1858. @kindex -midentify-revision
  1859. @kindex ident
  1860. @cindex identifying source, compiler (88k)
  1861. Include an @code{ident} directive in the assembler output recording the
  1862. source file name, compiler name and version, timestamp, and compilation
  1863. flags used.
  1864.  
  1865. @item -mno-underscores
  1866. @kindex -mno-underscores
  1867. @cindex underscores, avoiding (88k)
  1868. In assembler output, emit symbol names without adding an underscore
  1869. character at the beginning of each name.  The default is to use an
  1870. underscore as prefix on each name.
  1871.  
  1872. @item -mocs-debug-info
  1873. @itemx -mno-ocs-debug-info
  1874. @kindex -mocs-debug-info
  1875. @kindex -mno-ocs-debug-info
  1876. @cindex OCS (88k)
  1877. @cindex debugging, 88k OCS
  1878. Include (or omit) additional debugging information (about registers used
  1879. in each stack frame) as specified in the 88open Object Compatibility
  1880. Standard, ``OCS''.  This extra information allows debugging of code that
  1881. has had the frame pointer eliminated.  The default for DG/UX, SVr4, and
  1882. Delta 88 SVr3.2 is to include this information; other 88k configurations
  1883. omit this information by default.
  1884.  
  1885. @item -mocs-frame-position
  1886. @kindex -mocs-frame-position
  1887. @cindex register positions in frame (88k)
  1888. When emitting COFF debugging information for automatic variables and
  1889. parameters stored on the stack, use the offset from the canonical frame
  1890. address, which is the stack pointer (register 31) on entry to the
  1891. function.  The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
  1892. @samp{-mocs-frame-position}; other 88k configurations have the default
  1893. @samp{-mno-ocs-frame-position}.
  1894.  
  1895. @item -mno-ocs-frame-position
  1896. @kindex -mno-ocs-frame-position
  1897. @cindex register positions in frame (88k)
  1898. When emitting COFF debugging information for automatic variables and
  1899. parameters stored on the stack, use the offset from the frame pointer
  1900. register (register 30).  When this option is in effect, the frame
  1901. pointer is not eliminated when debugging information is selected by the
  1902. -g switch.
  1903.  
  1904. @item -moptimize-arg-area
  1905. @itemx -mno-optimize-arg-area
  1906. @kindex -moptimize-arg-area
  1907. @kindex -mno-optimize-arg-area
  1908. @cindex arguments in frame (88k)
  1909. Control how to store function arguments in stack frames.
  1910. @samp{-moptimize-arg-area} saves space, but was ruled illegal by 88open.
  1911. @samp{-mno-optimize-arg-area} conforms to the 88open standards.  By
  1912. default GNU CC does not optimize the argument area.
  1913.  
  1914. @item -mshort-data-@var{num}
  1915. @kindex -mshort-data-@var{num}
  1916. @cindex smaller data references (88k)
  1917. @cindex r0-relative references (88k)
  1918. Generate smaller data references by making them relative to @code{r0},
  1919. which allows loading a value using a single instruction (rather than the
  1920. usual two).  You control which data references are affected by
  1921. specifying @var{num} with this option.  For example, if you specify
  1922. @samp{-mshort-data-512}, then the data references affected are those
  1923. involving displacements of less than 512 bytes.
  1924. @samp{-mshort-data-@var{num}} is not effective for @var{num} greater
  1925. than 64K.
  1926.  
  1927. @item -msvr4
  1928. @itemx -msvr3
  1929. @kindex -msvr4
  1930. @kindex -msvr3
  1931. @cindex assembler syntax, 88k
  1932. @cindex SVr4
  1933. Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
  1934. related to System V release 4 (SVr4).  This controls the following:
  1935.  
  1936. @enumerate
  1937. @item 
  1938. Which variant of the assembler syntax to emit (which you can select
  1939. independently using @samp{-mversion-03.00}).  
  1940. @item
  1941. @samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
  1942. that is used on System V release 4.
  1943. @item
  1944. @samp{-msvr4} makes GNU CC issue additional declaration directives used in
  1945. SVr4.  
  1946. @end enumerate
  1947.  
  1948. @samp{-msvr3} is the default for all m88K configurations except
  1949. the SVr4 configuration.
  1950.  
  1951. @item -mversion-03.00
  1952. @kindex -mversion-03.00
  1953. In the DG/UX configuration, there are two flavors of SVr4.  This option
  1954. modifies @samp{-msvr4} to select whether the hybrid-COFF or real-ELF
  1955. flavor is used.  All other configurations ignore this option.
  1956. @c ??? which asm syntax better for GAS?  option there too?
  1957.  
  1958. @item -mno-check-zero-division
  1959. @itemx -mcheck-zero-division
  1960. @kindex -mno-check-zero-division
  1961. @kindex -mcheck-zero-division
  1962. @cindex zero division on 88k
  1963. Early models of the 88K architecture had problems with division by zero;
  1964. in particular, many of them didn't trap.  Use these options to avoid
  1965. including (or to include explicitly) additional code to detect division
  1966. by zero and signal an exception.  All GNU CC configurations for the 88K use
  1967. @samp{-mcheck-zero-division} by default.
  1968.  
  1969. @item -muse-div-instruction
  1970. @kindex -muse-div-instruction
  1971. @cindex divide instruction, 88k
  1972. Do not emit code to check both the divisor and dividend when doing
  1973. signed integer division to see if either is negative, and adjust the
  1974. signs so the divide is done using non-negative numbers.  Instead, rely
  1975. on the operating system to calculate the correct value when the
  1976. @code{div} instruction traps.  This results in different behavior when
  1977. the most negative number is divided by -1, but is useful when most or
  1978. all signed integer divisions are done with positive numbers.
  1979.  
  1980. @item -mtrap-large-shift
  1981. @itemx -mhandle-large-shift
  1982. @kindex -mtrap-large-shift
  1983. @kindex -mhandle-large-shift
  1984. @cindex bit shift overflow (88k)
  1985. @cindex large bit shifts (88k)
  1986. Include code to detect bit-shifts of more than 31 bits; respectively,
  1987. trap such shifts or emit code to handle them properly.  By default GNU CC
  1988. makes no special provision for large bit shifts.
  1989.  
  1990. @item -mwarn-passed-structs
  1991. @kindex -mwarn-passed-structs
  1992. @cindex structure passing (88k)
  1993. Warn when a function passes a struct as an argument or result.
  1994. Structure-passing conventions have changed during the evolution of the C
  1995. language, and are often the source of portability problems.  By default,
  1996. GNU CC issues no such warning.
  1997. @end table
  1998.  
  1999. @node RS/6000 Options, RT Options, M88K Options, Submodel Options
  2000. @subsection IBM RS/6000 Options
  2001. @cindex RS/6000 Options
  2002. @cindex IBM RS/6000 Options
  2003.  
  2004. Only one pair of @samp{-m} options is defined for the IBM RS/6000:
  2005.  
  2006. @table @code
  2007. @item -mfp-in-toc
  2008. @itemx -mno-fp-in-toc
  2009. Control whether or not floating-point constants go in the Table of
  2010. Contents (TOC), a table of all global variable and function addresses.  By
  2011. default GNU CC puts floating-point constants there; if the TOC overflows,
  2012. @samp{-mno-fp-in-toc} will reduce the size of the TOC, which may avoid
  2013. the overflow.
  2014. @end table
  2015.  
  2016. @node RT Options, MIPS Options, RS/6000 Options, Submodel Options
  2017. @subsection IBM RT Options
  2018. @cindex RT options
  2019. @cindex IBM RT options
  2020.  
  2021. These @samp{-m} options are defined for the IBM RT PC:
  2022.  
  2023. @table @code
  2024. @item -min-line-mul
  2025. Use an in-line code sequence for integer multiplies.  This is the
  2026. default.
  2027.  
  2028. @item -mcall-lib-mul
  2029. Call @code{lmul$$} for integer multiples.
  2030.  
  2031. @item -mfull-fp-blocks
  2032. Generate full-size floating point data blocks, including the minimum
  2033. amount of scratch space recommended by IBM.  This is the default.
  2034.  
  2035. @item -mminimum-fp-blocks
  2036. Do not include extra scratch space in floating point data blocks.  This
  2037. results in smaller code, but slower execution, since scratch space must
  2038. be allocated dynamically.
  2039.  
  2040. @cindex @file{varargs.h} and RT PC
  2041. @cindex @file{stdarg.h} and RT PC
  2042. @item -mfp-arg-in-fpregs
  2043. Use a calling sequence incompatible with the IBM calling convention in
  2044. which floating point arguments are passed in floating point registers.
  2045. Note that @code{varargs.h} and @code{stdargs.h} will not work with
  2046. floating point operands if this option is specified.
  2047.  
  2048. @item -mfp-arg-in-gregs
  2049. Use the normal calling convention for floating point arguments.  This is
  2050. the default.
  2051.  
  2052. @item -mhc-struct-return
  2053. Return structures of more than one word in memory, rather than in a
  2054. register.  This provides compatibility with the MetaWare HighC (hc)
  2055. compiler.  Use @samp{-fpcc-struct-return} for compatibility with the
  2056. Portable C Compiler (pcc).
  2057.  
  2058. @item -mnohc-struct-return
  2059. Return some structures of more than one word in registers, when
  2060. convenient.  This is the default.  For compatibility with the
  2061. IBM-supplied compilers, use either @samp{-fpcc-struct-return} or
  2062. @samp{-mhc-struct-return}.
  2063. @end table
  2064.  
  2065. @node MIPS Options, i386 Options, RT Options, Submodel Options
  2066. @subsection MIPS Options
  2067. @cindex MIPS options
  2068.  
  2069. These @samp{-m} options are defined for the MIPS family of computers:
  2070.  
  2071. @table @code
  2072. @item -mcpu=@var{cpu type}
  2073. Assume the defaults for the machine type @var{cpu type} when
  2074. scheduling instructions.  The default @var{cpu type} is
  2075. @samp{default}, which picks the longest cycles times for any of the
  2076. machines, in order that the code run at reasonable rates on all MIPS
  2077. cpu's.  Other choices for @var{cpu type} are @samp{r2000},
  2078. @samp{r3000}, @samp{r4000}, and @samp{r6000}.  While picking a
  2079. specific @var{cpu type} will schedule things appropriately for that
  2080. particular chip, the compiler will not generate any code that does not
  2081. meet level 1 of the MIPS ISA (instruction set architecture) without
  2082. the @samp{-mips2} or @samp{-mips3} switches being used.
  2083.  
  2084. @item -mips2
  2085. Issue instructions from level 2 of the MIPS ISA (branch likely, square
  2086. root instructions).  The @samp{-mcpu=r4000} or @samp{-mcpu=r6000}
  2087. switch must be used in conjunction with @samp{-mips2}.
  2088.  
  2089. @item -mips3
  2090. Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
  2091. You must use the @samp{-mcpu=r4000} switch along with @samp{-mips3}.
  2092.  
  2093. @item -mint64
  2094. @item -mlong64
  2095. @item -mlonglong128
  2096. These options don't work at present.
  2097.  
  2098. @item -mmips-as
  2099. Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
  2100. add normal debug information.  This is the default for all
  2101. platforms except for the OSF/1 reference platform, using the OSF/rose
  2102. object format.  If the either of the @samp{-gstabs} or @samp{-gstabs+}
  2103. switches are used, the @file{mips-tfile} program will encapsulate the
  2104. stabs within MIPS ECOFF.
  2105.  
  2106. @item -mgas
  2107. Generate code for the GNU assembler.  This is the default on the OSF/1
  2108. reference platform, using the OSF/rose object format.
  2109.  
  2110. @item -mrnames
  2111. @itemx -mno-rnames
  2112. The @samp{-mrnames} switch says to output code using the MIPS software
  2113. names for the registers, instead of the hardware names (ie, @var{a0}
  2114. instead of @var{$4}).  The GNU assembler does not support the
  2115. @samp{-mrnames} switch, and the MIPS assembler will be instructed to
  2116. run the MIPS C preprocessor over the source file.  The
  2117. @samp{-mno-rnames} switch is default.
  2118.  
  2119. @item -mgpopt
  2120. @itemx -mno-gpopt
  2121. The @samp{-mgpopt} switch says to write all of the data declarations
  2122. before the instructions in the text section, this allows the MIPS
  2123. assembler to generate one word memory references instead of using two
  2124. words for short global or static data items.  This is on by default if
  2125. optimization is selected.
  2126.  
  2127. @item -mstats
  2128. @itemx -mno-stats
  2129. For each non-inline function processed, the @samp{-mstats} switch
  2130. causes the compiler to emit one line to the standard error file to
  2131. print statistics about the program (number of registers saved, stack
  2132. size, etc.).
  2133.  
  2134. @item -mmemcpy
  2135. @itemx -mno-memcpy
  2136. The @samp{-mmemcpy} switch makes all block moves call the appropriate
  2137. string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
  2138. generating inline code.
  2139.  
  2140. @item -mmips-tfile
  2141. @itemx -mno-mips-tfile
  2142. The @samp{-mno-mips-tfile} switch causes the compiler not
  2143. postprocess the object file with the @file{mips-tfile} program,
  2144. after the MIPS assembler has generated it to add debug support.  If
  2145. @file{mips-tfile} is not run, then no local variables will be
  2146. available to the debugger.  In addition, @file{stage2} and
  2147. @file{stage3} objects will have the temporary file names passed to the
  2148. assembler embedded in the object file, which means the objects will
  2149. not compare the same.  The @samp{-mno-mips-tfile} switch should only
  2150. be used when there are bugs in the @file{mips-tfile} program that
  2151. prevents compilation.
  2152.  
  2153. @item -msoft-float
  2154. Generate output containing library calls for floating point.
  2155. @strong{Warning:} the requisite libraries are not part of GNU CC.
  2156. Normally the facilities of the machine's usual C compiler are used, but
  2157. this can't be done directly in cross-compilation.  You must make your
  2158. own arrangements to provide suitable library functions for
  2159. cross-compilation.
  2160.  
  2161. @item -mhard-float
  2162. Generate output containing floating point instructions.  This is the
  2163. default if you use the unmodified sources.
  2164.  
  2165. @item -mfp64
  2166. Assume that the @var{FR} bit in the status word is on, and that there
  2167. are 32 64-bit floating point registers, instead of 32 32-bit floating
  2168. point registers.  You must also specify the @samp{-mcpu=r4000} and
  2169. @samp{-mips3} switches.
  2170.  
  2171. @item -mfp32
  2172. Assume that there are 32 32-bit floating point registers.  This is the
  2173. default.
  2174.  
  2175. @item -mabicalls
  2176. @itemx -mno-abicalls
  2177. Emit the @samp{.abicalls}, @samp{.cpload}, and @samp{.cprestore}
  2178. pseudo operations that some System V.4 ports use for position
  2179. independent code.
  2180.  
  2181. @item -mhalf-pic
  2182. @itemx -mno-half-pic
  2183. Put pointers to extern references into the data section and load them
  2184. up, rather than put the references in the text section.  These options
  2185. do not work at present.
  2186.  
  2187. @item -G @var{num}
  2188. @cindex smaller data references (MIPS)
  2189. @cindex gp-relative references (MIPS)
  2190. Put global and static items less than or equal to @var{num} bytes into
  2191. the small data or bss sections instead of the normal data or bss
  2192. section.  This allows the assembler to emit one word memory reference
  2193. instructions based on the global pointer (@var{gp} or @var{$28}),
  2194. instead of the normal two words used.  By default, @var{num} is 8 when
  2195. the MIPS assembler is used, and 0 when the GNU assembler is used.  The
  2196. @samp{-G @var{num}} switch is also passed to the assembler and linker.
  2197. All modules should be compiled with the same @samp{-G @var{num}}
  2198. value.
  2199.  
  2200. @item -nocpp
  2201. Tell the MIPS assembler to not run it's preprocessor over user
  2202. assembler files (with a @samp{.s} suffix) when assembling them.
  2203. @end table
  2204.  
  2205. @ifset INTERNALS
  2206. These options are defined by the macro
  2207. @code{TARGET_SWITCHES} in the machine description.  The default for the
  2208. options is also defined by that macro, which enables you to change the
  2209. defaults.
  2210. @end ifset
  2211.  
  2212. @node i386 Options, , MIPS Options, Submodel Options
  2213. @subsection Intel 386 Options
  2214. @cindex i386 Options
  2215. @cindex Intel 386 Options
  2216.  
  2217. These @samp{-m} options are defined for the i386 family of computers:
  2218.  
  2219. @table @code
  2220. @item -m486
  2221. @itemx -mno486
  2222. Control whether or not code is optimized for a 486 instead of an
  2223. 386.  Code generated for an 486 will run on a 386 and vice versa.
  2224.  
  2225. @item -msoft-float
  2226. Generate output containing library calls for floating point.
  2227. @strong{Warning:} the requisite libraries are not part of GNU CC.
  2228. Normally the facilities of the machine's usual C compiler are used, but
  2229. this can't be done directly in cross-compilation.  You must make your
  2230. own arrangements to provide suitable library functions for
  2231. cross-compilation.
  2232.  
  2233. On machines where a function returnings float point results in the 80387
  2234. register stack, some floating point opcodes may be emitted even if
  2235. @samp{-msoft-float} is used.
  2236. @end table
  2237.  
  2238. @node Code Gen Options, Environment Variables, Submodel Options, Invoking GCC
  2239. @section Options for Code Generation Conventions
  2240. @cindex code generation conventions
  2241. @cindex options, code generation 
  2242. @cindex run-time options
  2243.  
  2244. These machine-independent options control the interface conventions
  2245. used in code generation.
  2246.  
  2247. Most of them have both positive and negative forms; the negative form
  2248. of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below, only
  2249. one of the forms is listed---the one which is not the default.  You
  2250. can figure out the other form by either removing @samp{no-} or adding
  2251. it.
  2252.  
  2253. @table @code
  2254. @item -fpcc-struct-return
  2255. Use the same convention for returning @code{struct} and @code{union}
  2256. values that is used by the usual C compiler on your system.  This
  2257. convention is less efficient for small structures, and on many
  2258. machines it fails to be reentrant; but it has the advantage of
  2259. allowing intercallability between GNU CC-compiled code and PCC-compiled
  2260. code.
  2261.  
  2262. @item -fshort-enums
  2263. Allocate to an @code{enum} type only as many bytes as it needs for the
  2264. declared range of possible values.  Specifically, the @code{enum} type
  2265. will be equivalent to the smallest integer type which has enough room.
  2266.  
  2267. @item -fshort-double
  2268. Use the same size for @code{double} as for @code{float}.
  2269.  
  2270. @item -fshared-data
  2271. Requests that the data and non-@code{const} variables of this
  2272. compilation be shared data rather than private data.  The distinction
  2273. makes sense only on certain operating systems, where shared data is
  2274. shared between processes running the same program, while private data
  2275. exists in one copy per process.
  2276.  
  2277. @item -fno-common
  2278. Allocate even uninitialized global variables in the bss section of the
  2279. object file, rather than generating them as common blocks.  This has the
  2280. effect that if the same variable is declared (without @code{extern}) in
  2281. two different compilations, you will get an error when you link them.
  2282. The only reason this might be useful is if you wish to verify that the
  2283. program will work on other systems which always work this way.
  2284.  
  2285. @item -fno-ident
  2286. Ignore the @samp{#ident} directive.
  2287.  
  2288. @item -fno-gnu-linker
  2289. Don't output global initializations such as C++ constructors and
  2290. destructors in the form used by the GNU linker (on systems where the GNU
  2291. linker is the standard method of handling them).  Use this option when
  2292. you want to use a ``collect'' program and a non-GNU linker.
  2293.  
  2294. @item -finhibit-size-directive
  2295. Don't output a @code{.size} assembler directive, or anything else that
  2296. would cause trouble if the function is split in the middle, and the 
  2297. two halves are placed at locations far apart in memory.  This option is
  2298. used when compiling @file{crtstuff.c}; you should not need to use it
  2299. for anything else.
  2300.  
  2301. @item -fverbose-asm
  2302. Put extra commentary information in the generated assembly code to
  2303. make it more readable.  This option is generally only of use to those
  2304. who actually need to read the generated assembly code (perhaps while
  2305. debugging the compiler itself).
  2306.  
  2307. @item -fvolatile
  2308. Consider all memory references through pointers to be volatile.
  2309.  
  2310. @item -fpic
  2311. @cindex global offset table
  2312. If supported for the target machines, generate position-independent
  2313. code, suitable for use in a shared library.  All addresses will be
  2314. accessed through a global offset table (GOT).  If the GOT size for the
  2315. linked executable exceeds a machine-specific maximum size, you will get
  2316. an error message from the linker indicating that @samp{-fpic} does not
  2317. work; recompile with @samp{-fPIC} instead.  (These maximums are 16k on
  2318. the m88k, 8k on the Sparc, and 32k on the m68k and RS/6000.  The 386 has
  2319. no such limit.)
  2320.  
  2321. Position-independent code requires special support, and therefore works
  2322. only on certain machines.  Code generated for the IBM RS/6000 is always
  2323. position-independent.
  2324.  
  2325. The GNU assembler does not fully support PIC.  Currently, you must use
  2326. some other assembler in order for PIC to work.  We would welcome
  2327. volunteers to upgrade GAS to handle this; the first part of the job is
  2328. to figure out what the assembler must do differently.
  2329.  
  2330. @item -fPIC
  2331. If supported for the target machine, emit position-independent code,
  2332. suitable for dynamic linking and avoiding any limit on the size of the
  2333. global offset table.  This option makes a difference on the m68k, m88k
  2334. and the Sparc.
  2335.  
  2336. Position-independent code requires special support, and therefore works
  2337. only on certain machines.
  2338.  
  2339. @item -ffixed-@var{reg}
  2340. Treat the register named @var{reg} as a fixed register; generated code
  2341. should never refer to it (except perhaps as a stack pointer, frame
  2342. pointer or in some other fixed role).
  2343.  
  2344. @var{reg} must be the name of a register.  The register names accepted
  2345. are machine-specific and are defined in the @code{REGISTER_NAMES}
  2346. macro in the machine description macro file.
  2347.  
  2348. This flag does not have a negative form, because it specifies a
  2349. three-way choice.
  2350.  
  2351. @item -fcall-used-@var{reg}
  2352. Treat the register named @var{reg} as an allocatable register that is
  2353. clobbered by function calls.  It may be allocated for temporaries or
  2354. variables that do not live across a call.  Functions compiled this way
  2355. will not save and restore the register @var{reg}.
  2356.  
  2357. Use of this flag for a register that has a fixed pervasive role in the
  2358. machine's execution model, such as the stack pointer or frame pointer,
  2359. will produce disastrous results.
  2360.  
  2361. This flag does not have a negative form, because it specifies a
  2362. three-way choice.
  2363.  
  2364. @item -fcall-saved-@var{reg}
  2365. Treat the register named @var{reg} as an allocatable register saved by
  2366. functions.  It may be allocated even for temporaries or variables that
  2367. live across a call.  Functions compiled this way will save and restore
  2368. the register @var{reg} if they use it.
  2369.  
  2370. Use of this flag for a register that has a fixed pervasive role in the
  2371. machine's execution model, such as the stack pointer or frame pointer,
  2372. will produce disastrous results.
  2373.  
  2374. A different sort of disaster will result from the use of this flag for
  2375. a register in which function values may be returned.
  2376.  
  2377. This flag does not have a negative form, because it specifies a
  2378. three-way choice.
  2379. @end table
  2380.  
  2381. @node Environment Variables,, Code Gen Options, Invoking GCC
  2382. @section Environment Variables Affecting GNU CC
  2383. @cindex environment variables
  2384.  
  2385. This section describes several environment variables that affect how GNU
  2386. CC operates.  They work by specifying directories or prefixes to use
  2387. when searching for various kinds of files.
  2388.  
  2389. @ifclear INTERNALS
  2390. Note that you can also specify places to search using options such as
  2391. @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
  2392. take precedence over places specified using environment variables, which
  2393. in turn take precedence over those specified by the configuration of GNU
  2394. CC. 
  2395. @end ifclear
  2396. @ifset INTERNALS
  2397. Note that you can also specify places to search using options such as
  2398. @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
  2399. take precedence over places specified using environment variables, which
  2400. in turn take precedence over those specified by the configuration of GNU
  2401. CC.  @xref{Driver}.
  2402. @end ifset
  2403.  
  2404. @table @code
  2405. @item TMPDIR
  2406. @findex TMPDIR
  2407. If @code{TMPDIR} is set, it specifies the directory to use for temporary
  2408. files.  GNU CC uses temporary files to hold the output of one stage of
  2409. compilation which is to be used as input to the next stage: for example,
  2410. the output of the preprocessor, which is the input to the compiler
  2411. proper.
  2412.  
  2413. @item GCC_EXEC_PREFIX
  2414. @findex GCC_EXEC_PREFIX
  2415. If @code{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
  2416. names of the subprograms executed by the compiler.  No slash is added
  2417. when this prefix is combined with the name of a subprogram, but you can
  2418. specify a prefix that ends with a slash if you wish.
  2419.  
  2420. If GNU CC cannot find the subprogram using the specified prefix, it
  2421. tries looking in the usual places for the subprogram.
  2422.  
  2423. Other prefixes specified with @samp{-B} take precedence over this prefix.
  2424.  
  2425. This prefix is also used for finding files such as @file{crt0.o} that are
  2426. used for linking.
  2427.  
  2428. In addition, the prefix is used in an unusual way in finding the
  2429. directories to search for header files.  For each of the standard
  2430. directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
  2431. (more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries
  2432. replacing that beginning with the specified prefix to produce an
  2433. alternate directory name.  Thus, with @samp{-Bfoo/}, GNU CC will search
  2434. @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
  2435. These alternate directories are searched first; the standard directories
  2436. come next.
  2437.  
  2438. @item COMPILER_PATH
  2439. @findex COMPILER_PATH
  2440. The value of @code{COMPILER_PATH} is a colon-separated list of
  2441. directories, much like @code{PATH}.  GNU CC tries the directories thus
  2442. specified when searching for subprograms, if it can't find the
  2443. subprograms using @code{GCC_EXEC_PREFIX}.
  2444.  
  2445. @item LIBRARY_PATH
  2446. @findex LIBRARY_PATH
  2447. The value of @code{LIBRARY_PATH} is a colon-separated list of
  2448. directories, much like @code{PATH}.  GNU CC tries the directories thus
  2449. specified when searching for special linker files, if it can't find them
  2450. using @code{GCC_EXEC_PREFIX}.  Linking using GNU CC also uses these
  2451. directories when searching for ordinary libraries for the @samp{-l}
  2452. option (but directories specified with @samp{-L} come first).
  2453.  
  2454. @item C_INCLUDE_PATH
  2455. @itemx CPLUS_INCLUDE_PATH
  2456. @itemx OBJC_INCLUDE_PATH
  2457. @findex C_INCLUDE_PATH
  2458. @findex CPLUS_INCLUDE_PATH
  2459. @findex OBJC_INCLUDE_PATH
  2460. @c @itemx OBJCPLUS_INCLUDE_PATH
  2461. These environment variables pertain to particular languages.  Each
  2462. variable's value is a colon-separated list of directories, much like
  2463. @code{PATH}.  When GNU CC searches for header files, it tries the
  2464. directories listed in the variable for the language you are using, after
  2465. the directories specified with @samp{-I} but before the standard header
  2466. file directories.
  2467.  
  2468. @item DEPENDENCIES_OUTPUT
  2469. @findex DEPENDENCIES_OUTPUT
  2470. @cindex dependencies for make as output 
  2471. If this variable is set, its value specifies how to output dependencies
  2472. for Make based on the header files processed by the compiler.  This
  2473. output looks much like the output from the @samp{-M} option
  2474. (@pxref{Preprocessor Options}), but it goes to a separate file, and is
  2475. in addition to the usual results of compilation.
  2476.  
  2477. The value of @code{DEPENDENCIES_OUTPUT} can be just a file name, in
  2478. which case the Make rules are written to that file, guessing the target
  2479. name from the source file name.  Or the value can have the form
  2480. @samp{@var{file} @var{target}}, in which case the rules are written to
  2481. file @var{file} using @var{target} as the target name.
  2482. @end table
  2483.