SEC4.hss 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. [Main]
  2. Title=Options Controlling the Kind of Output
  3. [Top]
  4. Compilation can involve up to four stages: preprocessing, compilation
  5. proper, assembly and linking, always in that order. The first three
  6. stages apply to an individual source file, and end by producing an
  7. object file; linking combines all the object files (those newly
  8. compiled, and those specified as input) into an executable file.
  9. <BR><BR>
  10. For any given input file, the file name suffix determines what kind of
  11. compilation is done (some of these apply only to TIGCC):
  12. <DL>
  13. <DT><B><I>file</I>.c</B>
  14. <DD>C source code which must be preprocessed.
  15. <BR><BR>
  16. <DT><B><I>file</I>.s</B>
  17. <DD>GNU Assembler code.
  18. <BR><BR>
  19. <DT><B><I>file</I>.S</B>
  20. <DD>GNU Assembler code which must be preprocessed.
  21. <BR><BR>
  22. <DT><B><I>file</I>.asm</B>
  23. <DD>A68k Assembler code.
  24. <BR><BR>
  25. <DT><B><I>file</I>.o</B>
  26. <DD>COFF object file to be linked using <CODE>ld</CODE>.
  27. <BR><BR>
  28. <DT><B><I>file</I>.a</B>
  29. <DD>Static library (function archive) to be linked using <CODE>ld</CODE>.
  30. </DL>
  31. You can specify the input language explicitly with the <B>'-x'</B> option:
  32. <DL>
  33. <DT><B>-x <I>language</I></B>
  34. <DD>Specify explicitly the <I>language</I> for the following input files
  35. (rather than letting the compiler choose a default based on the file
  36. name suffix). This option applies to all following input files until
  37. the next <B>'-x'</B> option. Possible values for <I>language</I> are:
  38. <BR>
  39. <CODE>
  40. c c-header cpp-output
  41. c++ c++-cpp-output
  42. objective-c objc-cpp-output
  43. assembler assembler-with-cpp
  44. ada
  45. f77 f77-cpp-input ratfor
  46. java
  47. treelang
  48. </CODE>
  49. <DT><B>-x none</B>
  50. <DD>Turn off any specification of a language, so that subsequent files are
  51. handled according to their file name suffixes (as they are if <B>'-x'</B>
  52. has not been used at all).
  53. <BR><BR>
  54. <DT><B>-pass-exit-codes</B>
  55. <DD>Normally the <CODE>gcc</CODE> program will exit with the code of 1 if any
  56. phase of the compiler returns a non-success return code. If you specify
  57. <B>'-pass-exit-codes'</B>, the <CODE>gcc</CODE> program will instead return with
  58. numerically highest error produced by any phase that returned an error
  59. indication.
  60. </DL>
  61. If you only want some of the stages of compilation, you can use
  62. <B>'-x'</B> (or filename suffixes) to tell <CODE>gcc</CODE> where to start, and
  63. one of the options <B>'-c'</B>, <B>'-S'</B>, or <B>'-E'</B> to say where
  64. <CODE>gcc</CODE> is to stop. Note that some combinations (for example,
  65. <B>'-x cpp-output -E'</B>) instruct <CODE>gcc</CODE> to do nothing at all.
  66. <DL>
  67. <DT><B>-c</B>
  68. <DD>Compile or assemble the source files, but do not link. The linking
  69. stage simply is not done. The ultimate output is in the form of an
  70. object file for each source file.
  71. <BR><BR>
  72. By default, the object file name for a source file is made by replacing
  73. the suffix <CODE>.c</CODE>, <CODE>.i</CODE>, <CODE>.s</CODE>, etc., with <CODE>.o</CODE>.
  74. <BR><BR>
  75. Unrecognized input files, not requiring compilation or assembly, are
  76. ignored.
  77. <BR><BR>
  78. <DT><B>-S</B>
  79. <DD>Stop after the stage of compilation proper; do not assemble. The output
  80. is in the form of an assembler code file for each non-assembler input
  81. file specified.
  82. <BR><BR>
  83. By default, the assembler file name for a source file is made by
  84. replacing the suffix <CODE>.c</CODE>, <CODE>.i</CODE>, etc., with <CODE>.s</CODE>.
  85. <BR><BR>
  86. Input files that don't require compilation are ignored.
  87. <BR><BR>
  88. <DT><B>-E</B>
  89. <DD>Stop after the preprocessing stage; do not run the compiler proper. The
  90. output is in the form of preprocessed source code, which is sent to the
  91. standard output.
  92. <BR><BR>
  93. Input files which don't require preprocessing are ignored.
  94. <BR><BR>
  95. <DT><B>-o <I>file</I></B>
  96. <DD>Place output in file <I>file</I>. This applies regardless to whatever
  97. sort of output is being produced, whether it be an executable file,
  98. an object file, an assembler file or preprocessed C code.
  99. <BR><BR>
  100. Since only one output file can be specified, it does not make sense to
  101. use <B>'-o'</B> when compiling more than one input file, unless you are
  102. producing an executable file as output.
  103. <BR><BR>
  104. If <B>'-o'</B> is not specified, the default is to put an executable file
  105. in <CODE>a.out</CODE>, the object file for <CODE><I>source</I>.<I>suffix</I></CODE> in
  106. <CODE><I>source</I>.o</CODE>, its assembler file in <CODE><I>source</I>.s</CODE>, and
  107. all preprocessed C source on standard output.
  108. <BR><BR>
  109. <DT><B>-v</B>
  110. <DD>Print (on standard error output) the commands executed to run the stages
  111. of compilation. Also print the version number of the compiler driver
  112. program and of the preprocessor and the compiler proper.
  113. <BR><BR>
  114. <DT><B>-###</B>
  115. <DD>Like <B>'-v'</B> except the commands are not executed and all command
  116. arguments are quoted. This is useful for shell scripts to capture the
  117. driver-generated command lines.
  118. <BR><BR>
  119. <DT><B>-pipe</B>
  120. <DD>Use pipes rather than temporary files for communication between the
  121. various stages of compilation. This fails to work on some systems where
  122. the assembler is unable to read from a pipe; but the GNU assembler has
  123. no trouble.
  124. <BR><BR>
  125. <DT><B>--help</B>
  126. <DD>Print (on the standard output) a description of the command line options
  127. understood by <CODE>gcc</CODE>. If the <B>'-v'</B> option is also specified
  128. then <B>'--help'</B> will also be passed on to the various processes
  129. invoked by <CODE>gcc</CODE>, so that they can display the command line options
  130. they accept. If the <B>'-W'</B> option is also specified then command
  131. line options which have no documentation associated with them will also
  132. be displayed.
  133. <BR><BR>
  134. <DT><B>--target-help</B>
  135. <DD>Print (on the standard output) a description of target specific command
  136. line options for each tool.
  137. <BR><BR>
  138. <DT><B>--version</B>
  139. <DD>Display the version number and copyrights of the invoked GCC.
  140. </DL>