cc(1) CLIX cc(1)
NAME
cc - Runs the C program compiler
SYNOPSIS
cc [flag ... ] file ...
FLAGS
Many flags are intentionally undocumented. The undocumented flags are
disabled, obsolete, or for compiler debugging only. Using undocumented
flags may generate poor or incorrect code. Before the description of each
flag and enclosed in parentheses, there may be a restriction on the use of
the flag. They are only to be used when that restriction applies.
-B string
(Obsolete; use -Y instead) See the description of -t also.
Construct pathnames for substitute compiler, assembler, and link
editor passes by concatenating string with the suffixes comp, as,
and ld respectively. If string is empty, it is assumed to be
/lib/o.
-c Suppress the link edit phase of the compilation and force an object
file to be produced even if only one program is compiled.
-C Retain comments in the preprocessor output. The default is to
strip comments from the output.
-D name
Define name to the preprocessor with the value 1. This is
equivalent to putting the following at the top of the source file:
#define name 1
-D name=string
Define name to the preprocessor with the value string. This is
equivalent to putting the following at the top of the source file:
#define name string
-E See the description of -P also. Do not compile the program
instead, run only the preprocessor portion of the CLIPPER C
compiler and place the output on stdout. This is useful for
debugging preprocessor macros. When preprocessing for a purpose
other than debugging macros, use cpp(1) for best performance.
-f (Ignored) Link the object program with the floating-point
interpreter for systems without hardware floating-point.
2/94 - Intergraph Corporation 1
cc(1) CLIX cc(1)
-g Cause the compiler to generate additional information needed to use
source language debuggers like sdb(1) and force the compiler to
generate frame pointers for stack traces.
-ga Generate a frame pointer for stack traces. The flag -g in cc also
produces a frame pointer, but -ga does not produce the extra
debugging information.
-I string
Filenames in #include preprocessor directives that are not absolute
(do not start with /) are searched for in the directory string
before a default list of directories. Multiple -I flags can be
specified. They will be searched in the left to right order
encountered.
-o filename
Place the executable binary output from the link edit phase in the
file named filename. If this flag is not specified, the executable
file will be named a.out. This flag is ignored if -c or -S is
present.
-O The -O flag activates Green Hills optimizers that are safe to use
on all programs, except for the loop optimizer.
-OM This flag is equivalent to -O except that it also allows the
optimizer to assume that memory locations do not change except by
explicit stores. That is, the optimizer is guaranteed that no
memory locations are I/O device registers that can be changed by
external hardware and no memory locations are shared with other
processes that can change them asynchronously with respect to the
current process. This compile time flag must be used with extreme
caution (or not at all) in device drivers, operating systems,
shared memory environments, and when interrupts (or CLIX signals)
are present.
-OL Optimize the program to be as fast as possible even if the program
must be bigger. In particular, most of the available resources are
allocated to optimizations of the innermost loops. The -OL compile
time flag will perform optimizations that may make the program
faster but larger. It is counter-productive to specify -OL on code
that contains no loops or that is rarely executed as it will make
the whole program larger but no faster. After experimenting with a
program, it is possible to discover which modules benefit from -OL
and which ones do not.
-OLM This flag is equivalent to -OL and -OM.
-OML This flag is equivalent to -OLM.
-p Arranges for the compiler to produce code that counts the number of
times each function is called also, if link editing occurs, replace
2 Intergraph Corporation - 2/94
cc(1) CLIX cc(1)
the standard startup function with one that automatically calls
monitor at the start and arranges to write out a mon.out file at
normal object program termination. An execution profile can then
be generated by using prof.
-P See the description of -E also. Do not compile the program
instead, run just only preprocessor portion of the CLIPPER C
compiler and place the output in a corresponding file suffixed with
.i. Line control information for the next pass of the compiler is
not provided. This is useful for debugging preprocessor macros.
When preprocessing for a purpose other than debugging macros, use
cpp(1) for best performance.
-S Compile the named C programs and leave the assembly language output
on corresponding files suffixed with .s. The assembler and link
edit phases are suppressed.
-t [p012al]
Find only the designated phase(s) in the file whose name is
constructed by a -B flag. If an explicit -B flag is missing, -B
/lib/n is implied. The flag -t "" is equivalent to -tp012.
-U name
Undefine the predefined preprocessor symbol name. This is
equivalent to putting the following at the top of the source file:
#undef name
-w Suppress warning diagnostics.
-Wc,arg1[,arg2 ... ]
Pass the listed argument(s) argi to phase c where c is one of
[p012al] .
-Xa Enable ANSI-compliant compilation. With this flag enabled, source
code is compiled against the definition of the C language presented
in the draft ANSI standard. This flag causes the compiler to
enforce ANSI syntax and use ANSI semantics in cases where K&R C and
ANSI C conflict. The directory /usr/include/ansi is automatically
searched for include files and, when linking, the library
/usr/lib/libansi.a is automatically added to the default library
list.
-X n Turn on compile time flag number n. The available compile time
flags are listed below.
6 Allocate each enumerated type as the smallest size predefined
type that allows all listed values (char, short, int,
unsigned char, unsigned short, or unsigned) to be
represented. The default is to allocate as an int.
2/94 - Intergraph Corporation 3
cc(1) CLIX cc(1)
9 Disable the local (peephole) optimizer.
18 Do not allocate programmer-defined local variables to a
register unless the variables are declared register. This
flag suppresses optimizations that frustrate debuggers and
setjmp().
32 Display the names of files as they are opened. This is
useful for finding out why the compiler cannot find an
include file.
37 Emit a warning when dead code is eliminated.
39 Do not move frequently used procedure and data addresses to
registers.
50 Push arguments on the stack. The default is to pass the
first two arguments in registers. This flag is not
recommended because it produces a calling sequence
incompatible with the rest of the CLIX System.
54 Inform the optimizer that no memory locations can change
value asynchronously with respect to the running program. -
O2 sets this compile time flag. (See -O2 above).
55 Make fields of type int, short, and char be signed. The
default is for all fields to be unsigned.
58 Do not put an underscore in front of the names of global
variables and procedures. This flag is not recommended
because it produces symbols that are incompatible with the
rest of the CLIX System.
62 (Default) The target processor is a CLIPPER microprocessor.
74 (Default) The target system is CLIX System V.
80 Disable the code hoisting optimization. This can speed
compilation in some cases.
81 Allow external variables to be initialized (by turning off
extern). Ordinarily, initialized externs are an error.
83 (Default) Enable the va_type(), va_stkarg(), va_intreg()n,
va_dblreg()n, va_argnum(), va_regtyp(), and va_align()
intrinsic functions to support varargs. See the description
of varargs support in the the CLIPPER C Reference Manual.
84 Generate error messages for C anachronisms. By default, the
old assignment operators (such as =+ and =-), initialization
(int i 1), and references to members of other structures
4 Intergraph Corporation - 2/94
cc(1) CLIX cc(1)
compile correctly but generate warning messages.
85 Generate .bss assembler directives for uninitialized statics.
The default is to allocate initialized data.
87 Disable the optimization that deletes all code that stores
into or modifies variables that are never read from.
89 Pack structures with no space between members, even if
elements become inaccessible due to machine data alignment
constraints.
105 Allow #define symbols to be redefined to the preprocessor.
164 (Unsupported) Do not stop if a code generator abort occurs or
an ``Internal Compiler Error'' error message appears. This
is occasionally useful in determining the cause of a compiler
failure.
167 (Unsupported) Evaluate expressions involving only float
operands as float (not double). Do not expand float
arguments to double. Do not expand float return values to
double. This flag is not recommended because it produces
code incompatible with the rest of the CLIX System.
168 Do not move invariant floating-point expressions out of
loops.
176 Always convert computations involving floating-point values
to double. By default, the compiler tries to shorten
computations to float if the result would be the same.
190 Assume halfword objects are not aligned.
191 Assume word objects are not aligned.
192 Assume single-precision objects are not aligned.
193 Assume double-precision objects are not aligned.
194 Assume word objects are aligned only to halfword boundaries.
195 Assume single precision objects are aligned only to halfword
boundaries.
196 Assume double precision objects are aligned only to halfword
boundaries.
197 Assume double precision objects are aligned only to word
boundaries.
2/94 - Intergraph Corporation 5
cc(1) CLIX cc(1)
-Y [0alSILU], dirname
Use dirname to locate the phase(s) or directory(ies) specified by
the key letter(s). The key letters [0al] represent the phases
described in the DESCRIPTION section. The additional key letters
have the following meanings:
S The directory containing the startup functions.
I The default directory searched for the #include preprocessor
directives.
L The first default library directory searched (see ld(1)).
U The second default library directory searched (see ld(1)).
If the location of a phase is being specified, the new pathname for
the phase will be dirname/phasename. The exact name used for
phasename depends on the compiler driver used and the phase
involved. See FILES below. If more than one -Y flag is applied to
a phase or directory, the last specification is used.
-Z n Turn off flag number n. This is the reverse of the -X flag. This
flag is useful if a version of the compiler has an flag turned on
by default and the user wants to turn it off.
-# (Subject to change) Display the program name and command line
arguments as each phase is invoked.
-## (Subject to change) Verbose like -#, only more so.
-### (Subject to change) Display the program name and command line
arguments for each phase, but do not actually invoke the phase.
DESCRIPTION
The cc command controls compilation and link editing of C and assembler
source programs. The compilation process is divided into many phases.
Each phase is invoked with appropriate arguments and flags.
The cc command uses the high performance CLIPPER C compiler developed by
Green Hills Software under Intergraph® contract. The CLIPPER C compiler
performs optimizations not found in many other C compilers (such as the
portable C compiler).
Compilation Phases
The compilation phases and their names are largely historic. Each phase
is approximately implemented as a single command. There are a number of
flags that control the invocation of each phase. Such flags use key
letters to indicate a particular phase.
6 Intergraph Corporation - 2/94
cc(1) CLIX cc(1)
The phases and their key letters are as follows:
p The preprocessor phase. This phase processes the preprocessor
directives in a C source file. Preprocessor directives are
given on lines whose first character is the # symbol. The
preprocessor implements file inclusion, conditional code
inclusion, macro definition, and macro expansion (see cpp(1)).
0 (zero) The source analysis phase. This phase analyzes the
(preprocessed) source file according to the rules of the C
language proper. Syntax and semantic errors are detected here.
Typically, an internal or intermediate representation of the
source file is built.
1 The code generation phase. This phase generates assembler code
from the internal or intermediate representation.
2 The code improver phase. This optional phase examines the
assembler code generated and attempts a number of improvements.
a The assembler phase. The assembler phase translates the
assembler code into an object (or binary) file.
l The link edit phase. Startoff functions, generated objects,
and standard libraries are linked together into an image file
(see ld).
The CLIPPER C compiler implements the preprocessor, source analysis, and
code generation phases in one program (/lib/comp). For the flags that
take a phase key letter, 0 indicates this program, and the key letters p,
1, and 2 are ignored.
The assembler (/bin/as) and link editor (/bin/ld) implement the assembler
and link editor phases, respectively.
Each input file is processed by each phase in sequence. If an error
occurs in a phase, further processing of the input file that contained the
error is abandoned. (The assembler will not be invoked if a compiler
error occurred). Any remaining input files are compiled (or assembled),
but the link edit phase is not performed.
Command Arguments
Each argument represents a flag or a filename. Many flags (discussed
below) and three types of filenames are understood. All filenames and
flags not recognized are passed on to the link editor.
Filenames that end with .c are considered C source programs. They are
compiled by applying the preprocessor through the assembler phases. Each
object (relocatable binary) file is left in the current directory whose
name is that of the source with .o substituted for .c. For example,
2/94 - Intergraph Corporation 7
cc(1) CLIX cc(1)
compiling the file src/prog.c results in the file prog.o in the current
directory.
Similarly, filenames that end with .s are considered assembler source
programs. They are processed by the assembler phase. Each object file is
left in a file in the current directory whose name is that of the source
with .o substituted for .s.
Filenames that end with .o are considered object files. They are passed
directly to the link edit phase.
If only one .c or .s file is processed and no .o files are specified, the
object file is normally deleted after the link edit phase completes. The
object file is not deleted if the link edit phase is suppressed, an error
occurs during the link edit phase, or the generated object file already
existed before compilation.
The input files are processed in the left-to-right order in which they
appear on the command line. The generated object files are passed to the
link edit phase in the same order.
EXAMPLES
1. To compile prog.c with the standard C library libc.a, producing the
executable program a.out:
cc prog.c
2. To compile prog.c with the math library libm.a, producing the
executable program mathprog:
cc -o mathprog prog.c -Llibm
FILES
file.c C source input file
file.s Assembler source input file
file.o Object file; generated or input
a.out Linked output
/tmp/ctm* Temporary file
/usr/tmp/ctm* Temporary file
/lib/cpp C preprocessor cpp command
8 Intergraph Corporation - 2/94
cc(1) CLIX cc(1)
/lib/comp CLIPPER C compiler, cc
/bin/as Assembler, as command
/bin/ld link editor, ld command
/lib/crt[1n].o Runtime startoff
/lib/mcrt[1n].o Profiling startoff
/lib/libc.a Standard C library; see sections (3C) and (3S) in
the UNIX System V Programmer's Reference Manual
/usr/lib/libansi.a library of ANSI C support functions
/usr/include/ansi/*.h Include files containing macros and data structure
definitions specific to ANSI C.
/lib/libp/lib*.a Profiled versions of libraries
NOTES
By default, the return value from a C program is completely random. The
only two guaranteed ways to return a specific value are to explicitly call
exit(2) or to leave the function main() with a return expression;
construct.
CAUTIONS
If empty strings are given with the -B or -t flags, they must be specified
as separate command line arguments (for example, -t "", not -t"".
RETURN VALUES
The diagnostics produced by C are self-explanatory. Occasional messages
may be produced by the assembler or the link editor.
RELATED INFORMATION
Commands: adb(1), as(1), ld(1), sdb(1), , cpp(1), prof(1)
Functions: exit(2), monitor(3)
The C Programming Language by B. W. Kernighan.
Programming in C - A Tutorial by B. W. Kernighan.
C Reference Manual by D. M. Ritchie.
2/94 - Intergraph Corporation 9