.\ " ====================== .\ " This version is 1.24. .\ " ====================== .TH GCC 1 "8 July 1988" "Version 1.24" .SH NAME gcc \- GNU project C Compiler .SH SYNOPSIS .B gcc [ option ] ... file ... .SH WARNING This man page is an extract of the documentation of the .I GNU\ C\ compiler and is limited to the meaning of the options. It is updated only occasionally, because the GNU project does not use nroff. For complete, current documentation, refer to the Info file .B internals or the DVI file .B internals.dvi which are made from the Texinfo source file .B internals.texinfo \. .SH DESCRIPTION The .I GNU\ C\ compiler uses a command syntax much like the Unix C compiler. The .I gcc program accepts options and file names as operands. Multiple single-letter options may .I not be grouped: `\fB\-dr\fR' is very different from `\fB\-d\ \-r\fR'. When you invoke .I GNU\ CC \, it normally does preprocessing, compilation, assembly and linking. File names which end in `\fB.c\fR' are taken as C source to be preprocessed and compiled; compiler output files plus any input files with names ending in `\fB.s\fR' are assembled; then the resulting object files, plus any other input files, are linked together to produce an executable. Command options allow you to stop this process at an intermediate stage. For example, the `\fB\-c\fR' option says not to run the linker. Then the output consists of object files output by the assembler. Other command options are passed on to one stage. Some options control the preprocessor and others the compiler itself. .SH OPTIONS Here are the options to control the overall compilation process, including those that say whether to link, whether to assemble, and so on. .TP .BI \-o "\ \ file" Place linker output in file \fIfile\fR. 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. If `\fB\-o\fR' is not specified, the default is to put an executable file in `\fBa.out\fR', the object file `\fIsource\fB.c\fR' in `\fIsource\fB.o\fR', an assembler file in `\fIsource\fB.s\fR', and preprocessed C on standard output. .TP .B \-c Compile or assemble the source files, but do not link. Produce object files with names made by replacing `\fB\.c\fR' or `\fB\.s\fR' with `\fB\.o\fR' at the end of the input file names. Do nothing at all for object files specified as input. .TP .B \-S Compile into assembler code but do not assemble. The assembler output file name is made by replacing `\fB\.c\fR' with `\fB\.s\fR' at the end of the input file name. Do nothing at all for assembler source files or object files specified as input. .TP .B \-E Run only the C preprocessor. Preprocess all the C source files specified and output the results to standard output. .TP .B \-v Compiler driver program prints the commands it executes as it runs the preprocessor, compiler proper, assembler and linker. Some of these are directed to print their own version numbers. .TP .BI \-B "prefix" Compiler driver program tries \fIprefix\fR as a prefix for each program it tries to run. These programs are `\fBcpp\fR', `\fBcc1\fR', `\fBas\fR' and `\fBld\fR'. For each subprogram to be run, the compiler driver first tries the `\fB\-B\fR' prefix, if any. If that name is not found, or if `\fB\-B\fR' was not specified, the driver tries two standard prefixes, which are `\fB/usr/lib/gcc-\fR' and `\fB/usr/local/lib/gcc-\fR'. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your `\fBPATH\fR' environment variable. The run-time support file `\fBgnulib\fR' is also searched for using the `\fB\-B\fR' prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means. Most of the time, on most machines, you can do without it. .PP These options control the C preprocessor, which is run on each C source file before actual compilation. If you use the `\fB\-E\fR' option, nothing is done except C preprocessing. Some of these options make sense only together with `\fB\-E\fR' because they request preprocessor output that is not suitable for actual compilation. .TP .B \-C Tell the preprocessor not to discard comments. Used with the `\fB\-E\fR' option. .TP .BI \-I "dir" Search directory .I dir for include files. .TP .B \-I\- Any directories specified with `\fB\-I\fR' options before the `\fB\-I\-\fR' option are searched only for the case of `\fB#include "\fIfile\fB"\fR'; they are not searched for `\fB#include <\fIfile\fB>\fR'. If additional directories are specified with `\fB\-I\fR' options after the `\fB\-I\-\fR', these directories are searched for all '\fB#include\fR' directives. (Ordinally \fIall\fR '\fB\-I\fR' directories are used this way.) In addition, the `\fB\-I\-\fR' option inhibits the use of the current directory as the first search directory for `\fB#include "\fIfile\fB"\fR'. Therefore, the current directory is searched only if it is requested explicitly with `\fB\-I.\fR'. Specifying both `\fB\-I\-\fR' and `\fB\-I.\fR' allows you to control precisely which directories are searched before the current one and which are searched after. .TP .B \-nostdinc Do not search the standard system directories for header files. Only the directories you have specified with `\fB\-I\fR' options (and the current directory, if appropriate) are searched. Between `\fB\-nostdinc\fR' and `\fB\-I-\fR', you can eliminate all directories from the search path except those you specify. .TP .B \-M Tell the preprocessor to output a rule suitable for \fBmake\fR describing the dependencies of each source file. For each source file, the preprocessor outputs one \fBmake\fR-rule whose target is the object file name for that source file and whose dependencies are all the files `\fB#include\fR'd in it. This rule may be a single line or may be continued `\fB\\\fR'-newline if it is long.`\fB\-M\fR' implies `\fB\-E\fR'. .TP .B \-MM Like `\fB\-M\fR' but the output mentions only the user-header files included with `\fB#include "\fIfile\fB"\fR'. System header files included with `\fB#include <\fIfile\fB>\fR' are omitted.`\fB\-MM\fR' implies `\fB\-E\fR'. .TP .BI \-D "macro" Define macro \fImacro\fR with the empty string as its definition. .TP .B \-D\fImacro=defn\fR Define macro \fImacro\fR as \fIdefn\fR. .TP .BI \-U "macro" Undefine macro \fImacro\fR. .TP .B \-T Support ANSI C trigraphs. You don't want to know about this brain-damage. The `\fB\-ansi\fR' option also has this effect. .PP These options control the details of C compilation itself. .TP .B \-ansi Support all ANSI standard C programs. This turns off certain features of GNU C that are incompatible with ANSI C, such as the \fBasm\fR, \fBinline\fR and \fBtypeof\fR keywords, and predefined macros such as \fBunix\fR and \fBvax\fR that identify the type of system you are using. It also enables the undesirable and rarely used ANSI trigraph feature. The `\fB\-ansi\fR' option does not cause non-ANSI programs to be rejected gratuitously. For that, `\fB\-pedantic\fR' is required in addition to `\fB\-ansi\fR'. The macro \fB__STRICT_ANSI__\fR is predefined when the `-ansi' option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ANSI standard doesn't call for; this is to avoid interfering with any programs that might use these names for other things. .TP .B \-traditional Attempt to support some aspects of traditional C compilers. Specifically: .br \(** All \fBextern\fR declarations take effect globally even if they are written inside of a function definition. This includes implicit declarations of functions. .br \(** The keywords \fBtypeof\fR, \fBinline\fR, \fBsigned\fR, \fBconst\fR and \fBvolatile\fR are not recognized. .br \(** Comparisons between pointers and integers are always allowed. .br \(** Integer types \fBunsigned short\fR and \fBunsigned char\fR promote to \fBunsigned int\fR. .br \(** In the preprocessor, comments convert to nothing at all, rather than to a space. This allows traditional token concatenation. .br \(** In the preprocessor, single and double quote characters are ignored when scanning macro definitions, so that macro arguments can be replaced even within a string or character constant. Quote characters are also ignored when skipping text inside a failing conditional directive. .TP .B \-pedantic Issue all the warnings demanded by strict ANSI standard C; reject all programs that use forbidden extensions. Valid ANSI standard C programs should compile properly with or without this option (though a rare few will require `\fB\-ansi\fR'. However, without this option, certain GNU extensions and traditional C features are supported as well. With this option, they are rejected. There is no reason to \fIuse\fR this option; it exists only to satisfy pedants. .TP .B \-O Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. Without `\fB\-O\fR', the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code. Without `\fB\-O\fR', only variables declared \fBregister\fR are allocated in registers. The resulting compiled code is a little worse than produced by PCC without `\fB\-O\fR'. With `\fB\-O\fR', the compiler tries to reduce code size and execution time. Some of the `\fB\-f\fR' options described below turn specific kinds of optimization on or off. .TP .B \-g Produce debugging information in DBX format. Unlike most other C compilers, GNU CC allows you to use `\fB\-g\fR' with `\fB\-O\fR'. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops. Nevertheless it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs. .TP .B \-gg Produce debugging information in GDB(GNU Debugger)'s own format. This requires the GNU assembler and linker in order to work. .TP .B \-w Inhibit all warning messages. .TP .B \-W Print extra warning messages for these events: .br \(** An automatic variable is used without first being initialized. These warnings are possible only in optimizing compilation, because they require data flow information that is computed only when optimizing. They occur only for variables that are candidates for register allocation. Therefore, they do not occur for a variable that is declared .B volatile, or whose address is taken, or whose size is other than 1,2,4 or 8 bytes. Also, they do not occur for structures, unions or arrays, even when they are in registers. Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by the flow analysis pass before the warnings are printed. These warnings are made optional because GNU CC is not smart enough to see all the reasons why the code might be correct despite appearing to have an error. .br \(** A nonvolatile automatic variable might be changed by a call to \fBlongjmp\fR. These warnings as well are possible only in optimizing compilation. The compiler sees only the calls to \fBsetjmp\fR. It cannot know where \fBlongjmp\fR will be called; in fact, a signal handler could call it at any point in the code. As a result, you may get a warning even when there is in fact no problem because \fBlongjmp\fR cannot in fact be called at the place which would cause a problem. .br \(** A function can return either with or without a value. (Falling off the end of the function body is considered returning without a value.) Spurious warning can occur because GNU CC does not realize that certain functions (including \fBabort\fR and \fBlongjmp\fR) will never return. .TP .B \-Wimplicit Warn whenever a function is implicitly declared. .TP .B \-Wreturn-type Warn whenever a function is defined with a return-type that defaults to \fBint\fR. Also warn about any \fBreturn\fR statement with no return-value in a function whose return-type is not \fBvoid\fR. .TP .B \-Wcomment Warn whenever a comment-start sequence `/*' appears in a comment. .TP .B \-p Generate extra code to write profile information suitable for the analysis program \fBprof\fR. .TP .B \-pg Generate extra code to write profile information suitable for the analysis program \fBgprof\fR. .TP .BI \-l "library" Search a standard list of directories for a library named \fIlibrary\fR, which is actually a file named `\fBlib\fIlibrary\fB.a\fR'. The linker uses this file as if it had been specified precisely by name. The directories searched include several standard system directories plus any that you specify with `\fB\-L\fR'. Normally the files found this way are library files - archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between an `\fB\-l\fR' option and specifying a file name is that `\fB-l\fR' searches several directories. .TP .BI \-L "dir" Add directory \fIdir\fR to the list of directories to be searched for `\fB\-l\fR'. .TP .B \-nostdlib Don't use the standard system libraries and startup files when linking. Only the files you specify (plus `\fBgnulib\fR') will be passed to the linker. .TP .BI \-m "machinespec" Machine-dependent option specifying something about the type of target machine. These options are defined by the macro \fBTARGET_SWITCHES\fR in the machine description. The default for the options is also defined by that macro, which enables you to change the defaults. .IP These are the `\fB\-m\fR' options defined in the 68000 machine description: .TP 10 .B \ \ \ \ \ \ \ \ \-m68020 Generate output for a 68020 (rather than a 68000). This is the default if you use the unmodified sources. .TP 10 .B \ \ \ \ \ \ \ \ \-m68000 Generate output for a 68000 (rather than a 68020). .TP 10 .B \ \ \ \ \ \ \ \ \-m68881 Generate output containing 68881 instructions for floating point. This is the default if you use the unmodified sources. .TP 10 .B \ \ \ \ \ \ \ \ \-msoft-float Generate output containing library calls for floating point. .TP 10 .B \ \ \ \ \ \ \ \ \-mshort Consider type \fBint\fR to be 16 bits wide, like \fBshort int\fR. .TP 10 .B \ \ \ \ \ \ \ \ \-mnobitfield Do not use the bit-field instructions. .B '\-m68000' implies .B '\-mnobitfield'. .TP 10 .B \ \ \ \ \ \ \ \ \-mbitfield Do use the bit-field instructions. .B '\-m68020' implies .B '\-mbitfield'. This is the default if you use the unmodified sources. .TP 10 .B \ \ \ \ \ \ \ \ \-mrtd Use a different function-calling convention, in which functions that take a fixed number of arguments return with the \fBrtd\fR instruction, which pops their arguments while returning. This saves one instruction in the caller since there is no need to pop the arguments there. This calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler. Also, you must provide function prototypes for all functions that take variable numbers of arguments (including \fBprintf\fR); otherwise incorrect code will be generated for calls to those functions. In addition, seriously incorrect code will result if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.) The \fBrtd\fR instruction is supported by the 68010 and 68020 processors, but not by the 68000. .IP These are the `\fB\-m\fR' options defined in the VAX machine description: .TP 10 .B \ \ \ \ \ \ \ \ \-munix Do not output certain jump instructions ( .B aobleq and so on) that the Unix assembler for the VAX cannot handle across long ranges. .TP 10 .B \ \ \ \ \ \ \ \ \-mgnu Do output those jump instructions, on the assumption that you will assemble with the GNU assembler. .TP 5 .BI \-f "flag" Specify machine-independent flags. These are the flags: .TP 10 .B \ \ \ \ \ \ \ \ \-ffloat-store Do not store floating-point variables in registers. This prevents undesirable excess precision on machines such as the 68000 where the floating registers (of the 68881) keep more precision than a \fBdouble\fR is supposed to have. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating point. Use ` .B \-ffloat-store' for such programs. .TP 10 .B \ \ \ \ \ \ \ \ \-fno-asm Do not recognize \fBasm\fR, \fBinline\fR or \fBtypeof\fR as a keyword. These words may then be used as identifiers. .TP 10 .B \ \ \ \ \ \ \ \ \-fno-defer-pop Always pop the arguments to each function call as soon as that function returns. Normally the compiler (when optimizing) lets arguments accumulate on the stack for several function calls and pops them all at once. .TP 10 .B \ \ \ \ \ \ \ \ \-fcombine-regs Allow the combine pass to combine an instruction that copies one register into another. This might or might not produce better code when used in addition to ` .B \-O'. .TP 10 .B \ \ \ \ \ \ \ \ \-fforce-mem Force memory operands to be copied into registers before doing arithmetic on them. This may produce better code by making all memory references potential common subexpressions. When they are not common subexpressions, instruction combination should eliminate the separate register-load. .TP 10 .B \ \ \ \ \ \ \ \ \-fforce-addr Force memory address constants to be copied into registers before doing arithmetic on them. This may produce better code just as ` .B \-fforce-mem' may. .TP 10 .B \ \ \ \ \ \ \ \ \-fomit-frame-pointer Don't keep the frame pointer in a register for functions that don't need one. This avoids the instructions to save, set up and restore frame pointers; it also makes an extra register available in many functions. \fBIt\ also\ makes\ debugging\ impossible.\fR On some machines, such as the VAX, this flag has no effect, because the standard calling sequence automatically handles the frame pointer and nothing is saved by pretending it doesn't exist. The machine-description macro \fBFRAME_POINTER_REQUIRED\fR controls whether a target machine supports this flag. .TP 10 .B \ \ \ \ \ \ \ \ \-finline-functions Integrate all simple functions into their callers. The compiler heuristically decides which functions are simple enough to be worth integrating in this way. If all calls to a given function are integrated, and the function is declared \fBstatic\fR, then the function is normally not output as assembler code in its own right. .TP 10 .B \ \ \ \ \ \ \ \ \-fkeep-inline-functions Even if all calls to a given function are integrated, and the function is declared \fBstatic\fR, nevertheless output a separate run-time callable version of the function. .TP 10 .B \ \ \ \ \ \ \ \ \-fwritable-strings Store string constants in the writable data segment and don't uniquize them. This is for compatibility with old programs which assume they can write into string constants. Writing into string constants is a very bad idea; ``constants'' should be constant. .TP 10 .B \ \ \ \ \ \ \ \ \-fno-function-cse Do not put function addresses in registers; make each instruction that calls a constant function contain the function's address explicitly. This option results in less efficient code, but some strange hacks that alter the assembler output may be confused by the optimizations performed when this option is not used. .TP 10 .B \ \ \ \ \ \ \ \ \-fvolatile Consider all memory references through pointers to be volatile. .TP 10 .B \ \ \ \ \ \ \ \ \-funsigned-char Let the type \fBchar\f be the unsigned, like \fBunsigned char\fR. Each kind of machine has a default for what \fBchar\fR should be. It is either like \fBunsigned char\fR by default of like \fBsigned char\fR by default. (Actually, at present, the default is always signed.) The type \fBchar\fR is always a distinct type from either \fBsigned char\fR or \fBunsigned char\fR, even though its behavior is always just like one of those two. .TP 10 .B \ \ \ \ \ \ \ \ \-fsigned-char Let the type \fBchar\fR be the same as \fBsigned char\fR. .TP 10 .B \ \ \ \ \ \ \ \ \-ffixed-\fIreg\fR Treat the register named \fIreg\fR as a fixed register; generated code should never refer to it (except perhaps as a stack pointer, frame pointer or in some other fixed role). \fIreg\fR must be the name of a register. The register names accepted are machine-specific and are defined in the \fBREGISTER_NAMES\fR macro in the machine description macro file. .TP 10 .B \ \ \ \ \ \ \ \ \-fcall-used-\fIreg\fR Treat the register named \fIreg\fR as an allocatable register that is clobbered by function calls. It may be allocated for temporaries or variables that do not live across a call. Functions compiled this way will not save and restore the register \fIreg\fR. Use of this flag for a register that has a fixed pervasive role in the machine's execution model, such as the stack pointer or frame pointer, will produce disastrous results. .TP 10 .B \ \ \ \ \ \ \ \ \-fcall-saved-\fIreg\fR Treat the register named \fIreg\fR as an allocatable register saved by functions. It may be allocated even for temporaries or variables that live across a call. Functions compiled this way will save and restore the register \fIreg\fR if they use it. Use of this flag for a register that has a fixed pervasive role in the machine's execution model, such as the stack pointer or frame pointer, will produce disastrous results. A different sort of disaster will result from the use of this flag for a register in which function values are may be returned. .TP .BI \-d "letters" Says to make debugging dumps at times specified by \fIletters\fR. Here are the possible letters: .TP 10 .B \ \ \ \ \ \ \ \ r Dump after RTL generation. .TP 10 .B \ \ \ \ \ \ \ \ j Dump after first jump optimization. .TP 10 .B \ \ \ \ \ \ \ \ J Dump after last jump optimization. .TP 10 .B \ \ \ \ \ \ \ \ s Dump after CSE (including the jump optimization that sometimes follows CSE). .TP 10 .B \ \ \ \ \ \ \ \ L Dump after loop optimization. .TP 10 .B \ \ \ \ \ \ \ \ f Dump after flow analysis. .TP 10 .B \ \ \ \ \ \ \ \ c Dump after instruction combination. .TP 10 .B \ \ \ \ \ \ \ \ l Dump after local register allocation. .TP 10 .B \ \ \ \ \ \ \ \ g Dump after global register allocation. .TP 10 .B \ \ \ \ \ \ \ \ m Print statistics on memory usage, at the end of the run. .SH FILES .ta \w'/usr/local/lib/gcc-gnulib 'u file.c input file .br file.o object file .br a.out loaded output .br /tmp/cc? temporary .br /usr/local/lib/gcc-cpp preprocessor .br /usr/local/lib/gcc-cc1 compiler .br /usr/local/lib/gcc-gnulib library need by GCC on some machines .br /lib/crt0.o runtime startoff .br /lib/libc.a standard library, see .IR intro (3) .br /usr/include standard directory for `#include' files .br .SH "SEE ALSO" adb(1), ld(1), dbx(1), as(1) .SH BUGS Bugs should be reported to bug-gcc@prep.ai.mit.edu. Bugs tend actually to be fixed if they can be isolated, so it is in your interest to report them in such a way that they can be easily reproduced according to get newer version. .SH COPYING Copyright (C) 1988 Richard M. Stallman. .br Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. .br Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled "GNU CC General Public License" is included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. .br Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled "GNU CC General Public License" may be included in a translation approved by the author instead of in the original English. .SH AUTHORS Richard M. Stallman