[Main]
Title=Options Controlling the Kind of Output

[Top]
Compilation can involve up to four stages: preprocessing, compilation
proper, assembly and linking, always in that order.  The first three
stages apply to an individual source file, and end by producing an
object file; linking combines all the object files (those newly
compiled, and those specified as input) into an executable file.
<BR><BR>
For any given input file, the file name suffix determines what kind of
compilation is done (some of these apply only to TIGCC):
<DL>
<DT><B><I>file</I>.c</B>
<DD>C source code which must be preprocessed.
<BR><BR>
<DT><B><I>file</I>.s</B>
<DD>GNU Assembler code.
<BR><BR>
<DT><B><I>file</I>.S</B>
<DD>GNU Assembler code which must be preprocessed.
<BR><BR>
<DT><B><I>file</I>.asm</B>
<DD>A68k Assembler code.
<BR><BR>
<DT><B><I>file</I>.o</B>
<DD>COFF object file to be linked using <CODE>ld</CODE>.
<BR><BR>
<DT><B><I>file</I>.a</B>
<DD>Static library (function archive) to be linked using <CODE>ld</CODE>.
</DL>
You can specify the input language explicitly with the <B>'-x'</B> option:
<DL>
<DT><B>-x <I>language</I></B>
<DD>Specify explicitly the <I>language</I> for the following input files
(rather than letting the compiler choose a default based on the file
name suffix).  This option applies to all following input files until
the next <B>'-x'</B> option.  Possible values for <I>language</I> are:
<BR>
<CODE>
c  c-header  cpp-output
c++  c++-cpp-output
objective-c  objc-cpp-output
assembler  assembler-with-cpp
ada
f77  f77-cpp-input  ratfor
java
treelang
</CODE>
<DT><B>-x none</B>
<DD>Turn off any specification of a language, so that subsequent files are
handled according to their file name suffixes (as they are if <B>'-x'</B>
has not been used at all).
<BR><BR>
<DT><B>-pass-exit-codes</B>
<DD>Normally the <CODE>gcc</CODE> program will exit with the code of 1 if any
phase of the compiler returns a non-success return code.  If you specify
<B>'-pass-exit-codes'</B>, the <CODE>gcc</CODE> program will instead return with
numerically highest error produced by any phase that returned an error
indication.
</DL>
If you only want some of the stages of compilation, you can use
<B>'-x'</B> (or filename suffixes) to tell <CODE>gcc</CODE> where to start, and
one of the options <B>'-c'</B>, <B>'-S'</B>, or <B>'-E'</B> to say where
<CODE>gcc</CODE> is to stop.  Note that some combinations (for example,
<B>'-x cpp-output -E'</B>) instruct <CODE>gcc</CODE> to do nothing at all.
<DL>
<DT><B>-c</B>
<DD>Compile or assemble the source files, but do not link.  The linking
stage simply is not done.  The ultimate output is in the form of an
object file for each source file.
<BR><BR>
By default, the object file name for a source file is made by replacing
the suffix <CODE>.c</CODE>, <CODE>.i</CODE>, <CODE>.s</CODE>, etc., with <CODE>.o</CODE>.
<BR><BR>
Unrecognized input files, not requiring compilation or assembly, are
ignored.
<BR><BR>
<DT><B>-S</B>
<DD>Stop after the stage of compilation proper; do not assemble.  The output
is in the form of an assembler code file for each non-assembler input
file specified.
<BR><BR>
By default, the assembler file name for a source file is made by
replacing the suffix <CODE>.c</CODE>, <CODE>.i</CODE>, etc., with <CODE>.s</CODE>.
<BR><BR>
Input files that don't require compilation are ignored.
<BR><BR>
<DT><B>-E</B>
<DD>Stop after the preprocessing stage; do not run the compiler proper.  The
output is in the form of preprocessed source code, which is sent to the
standard output.
<BR><BR>
Input files which don't require preprocessing are ignored.
<BR><BR>
<DT><B>-o <I>file</I></B>
<DD>Place output in file <I>file</I>.  This applies regardless to whatever
sort of output is being produced, whether it be an executable file,
an object file, an assembler file or preprocessed C code.
<BR><BR>
Since only one output file can be specified, it does not make sense to
use <B>'-o'</B> when compiling more than one input file, unless you are
producing an executable file as output.
<BR><BR>
If <B>'-o'</B> is not specified, the default is to put an executable file
in <CODE>a.out</CODE>, the object file for <CODE><I>source</I>.<I>suffix</I></CODE> in
<CODE><I>source</I>.o</CODE>, its assembler file in <CODE><I>source</I>.s</CODE>, and
all preprocessed C source on standard output.
<BR><BR>
<DT><B>-v</B>
<DD>Print (on standard error output) the commands executed to run the stages
of compilation.  Also print the version number of the compiler driver
program and of the preprocessor and the compiler proper.
<BR><BR>
<DT><B>-###</B>
<DD>Like <B>'-v'</B> except the commands are not executed and all command
arguments are quoted.  This is useful for shell scripts to capture the
driver-generated command lines.
<BR><BR>
<DT><B>-pipe</B>
<DD>Use pipes rather than temporary files for communication between the
various stages of compilation.  This fails to work on some systems where
the assembler is unable to read from a pipe; but the GNU assembler has
no trouble.
<BR><BR>
<DT><B>--help</B>
<DD>Print (on the standard output) a description of the command line options
understood by <CODE>gcc</CODE>.  If the <B>'-v'</B> option is also specified
then <B>'--help'</B> will also be passed on to the various processes
invoked by <CODE>gcc</CODE>, so that they can display the command line options
they accept.  If the <B>'-W'</B> option is also specified then command
line options which have no documentation associated with them will also
be displayed.
<BR><BR>
<DT><B>--target-help</B>
<DD>Print (on the standard output) a description of target specific command
line options for each tool.
<BR><BR>
<DT><B>--version</B>
<DD>Display the version number and copyrights of the invoked GCC.
</DL>
