cc(1) General Commands Manual cc(1)
cc - RISC C compiler
cc [ option ] ... file
The command invokes the RISC ucode C compiler. It produces RISC object code in RISC extended coff format (the default), binary or symbolic
ucode, ucode object files and binary or symbolic assembly language.
The command accepts the following arguments:
o Arguments ending in .c are interpreted as C source programs. They are compiled, and the resulting object file has the same name as
the source program except .o is substituted for .c. If a single C source program is compiled and loaded at once, the .o file is
o Arguments ending in .s are interpreted as assembly source programs. When they are assembled, they produce a .o file.
o Arguments ending in .i are interpreted as C source after being processed by the C preprocessor. They are compiled without being pro-
cessed by the C preprocessor.
If the highest level of optimization is specified (with the -O3 flag) or only ucode object files are to be produced (with the -j flag) each
C source file is compiled into a ucode object file. The ucode object file is left in a file whose name consists of the last component of
the source with .u substituted for .c.
The following suffixes aid compiler development, but are not generally used: .B, .O., .S, and .M. These arguments are interpreted as
binary ucode, produced by the front end, optimizer, ucode object file splitter, and ucode merger respectively. Arguments whose names end
with .U are assumed to be symbolic ucode. Arguments whose names end with .G are assumed to be binary assembly language, which is produced
by the code generator and the symbolic to binary assembler.
Files that are assumed to be binary ucode, symbolic ucode, or binary assembly language by the suffix conventions are also assumed to have
their corresponding symbol table in a file with a .T suffix.
The command always defines the C preprocessor macro LANGUAGE_C when a .c file is being compiled. The command defines the C preprocessor
macro LANGUAGE_ASSEMBLY when a .s file is compiled.
The following options are interpreted by See for load-time options.
-c Suppress the loading phase of the compilation and force an object file to be produced even if only one program is compiled.
-g0 Do not produce symbol table information for symbolic debugging. This is the default.
-g1 Produce debugger symbol table information. This option limits optimization, but some optimizations that affect debugger
accuracy might be performed. The debugger symbol table is built before optimizations and cannot reflect the optimizations.
-g or -g2 Produce debugger symbol table information and inhibit optimizations that limit full symbolic debugging. The debugger symbol
table is accurate.
-g3 Produce debugger symbol table. This option does not limit optimizations, so the symbol table may be inaccurate. The symbol
table is built before optimizations and cannot reflect the optimizations.
-L Change the algorithm of searching for libx.a or libx.b to never look in the default directories. This is useful when the
default directories for libraries should not be searched and only the directories specified by the option -Ldir are to be
-w Suppress warning messages.
-p0 Do not permit profiling. This is the default. If loading happens, the standard runtime startup routine (crt0.o) is used
and the profiling libraries are not searched.
-p1 or -p Set up for profiling by periodically sampling the value of the program counter. This option only affects the loading. When
loading happens, this option replaces the standard runtime startup routine with the profiling runtime startup routine
(mcrt0.o) and searches the level 1 profiling library (libprof1.a). When profiling happens, the startup routine calls and
produces a file mon.out that contains execution-profiling data for use with the postprocessor
-O0 Turn off all optimizations.
-O1 Turn on all optimizations that complete fast. This is the default.
-O or -O2 Invoke the global ucode optimizer.
-O3 Perform all optimizations, including global register allocation. This option must precede all source file arguments. With
this option, a ucode object file is created for each C source file and left in a .u file. The newly created ucode object
files, the ucode object files specified on the command line, the runtime startup routine, and all the runtime libraries are
ucode linked. Optimization is performed on the resulting ucode linked file and then it is linked as normal producing an
a.out file. A resulting .o file is not left from the ucode linked result. In fact -c cannot be specified with -O3.
-feedback file Use with the -cord option to specify the feedback file. This file is produced by with its -feedback option from an execu-
tion of the program produced by
-cord Run the procedure-rearranger on the resulting file after linking. The rearrangement is performed to reduce the cache con-
flicts of the program's text. The output is left in the file specified by the -o output option or a.out by default. At
least one -feedback file must be specified.
-j Compile the specified source programs, and leave the ucode object file output in corresponding files with the .u suffix.
-ko output Name the output file created by the ucode loader as output. This file is not removed. If this file is compiled, the object
file is left in a file whose name consists of output with the suffix changed to an .o. If output has no suffix, an .o suf-
fix is appended to output.
-k Pass options that start with a -k to the ucode loader. This option is used to specify ucode libraries (with -klx ) and
other ucode loader options.
-S Compile the specified source programs and leave the symbolic assembly language output in corresponding files suffixed with
-P Run only the C macro preprocessor and put the result for each source file using suffix convention (for example, .c and .s)
in a corresponding .i file. The .i file does not have number lines (#) in it. This sets the -cpp option.
-E Run only the C macro preprocessor on the files (regardless of any suffix or not), and send the result to the standard out-
put. This sets the -cpp option.
-Em Runs only the macro preprocessor on the named C programs and produces the makefile dependencies.
-o output Name the final output file output. If this option is used, the file a.out is unaffected.
-Dname Define the name to the C macro preprocessor, as if by `#define'. If a definition is not given, the name is defined as 1.
-Uname Remove any initial definition of name.
-Idir Search for #include files whose names do not begin with a slash (/) in the following order: (1) in the directory of the dir
argument, (2) in the directories specified by -I options, (3) in the standard directory (/usr/include).
-I Do not search for #include in the standard directory (/usr/include).
-M Specifies the floating point type to be used for double-precision floating point and is passed on to as the map option.
-W1,M Same a -M, except it is POSIX compliant.
-G num Specify the maximum size, in bytes, of a data item that is to be accessed from the global pointer. The num argument is
interpreted as a decimal number. If num is zero, data is not accessed from the global pointer. The default value for num
is 8 bytes.
-v Print the passes as they execute with their arguments and their input and output files. Also prints resource usage in the C
shell time format.
-V Print the version of the driver and the versions of all passes. This is done with the command.
-std Produce warnings for things that are not standard in the language.
-Yenvironment Compiles C programs for environment. If environment is SYSTEM_FIVE or is omitted, it defines SYSTEM_FIVE for the preproces-
sor, If the loader is invoked, it specifies that the System V version of the C runtime library is used. Also, if the math
library is specified with the -lm option, the System V version is used. If environment is POSIX, it defines POSIX for the
preprocessor. If the environment variable PROG_ENV has the value SYSTEM_FIVE or POSIX, the effect is the same as when spec-
ifying the corresponding -Yenvironment option to The -Y option overrides the PROG_ENV variable; -YBSD can be used to over-
ride all special actions.
-cpp Run the C macro preprocessor on C and assembly source files before compiling. This is the default for
-nocpp Do not run the C macro preprocessor on C and assembly source files before compiling.
-Olimit num Specify the maximum size, in basic blocks, of a routine that will be optimized by the global optimizer. If a routine has
more than the specified number of basic blocks, it cannot be optimized and a message is printed. A -O, -O2, or -O3 must be
used to specify the global optimizer. The argument must also be specified. The argument num is interpreted as a decimal
number. The default value for num is 500 basic blocks.
-signed Causes all char declarations to be signed char declarations. This is the default.
-unsigned Causes all char declarations to be unsigned char declarations.
-volatile Causes all variables to be treated as volatile.
-varargs Prints warnings for lines that may require the varargs.h macros.
-f Causes the compiler not to promote expressions of type float to type double.
-float Same as the -f option.
-fill number Set the fill pattern for ``holes'' within an output section. The number argument is a four byte hex constant. The -EB and
-EL options are needed only when compiling for RISC machines from vendors other than Digital. The default target byte
ordering matches the machine where the compiler is running. The options -EB and -EL specify the target byte ordering (big-
endian and little-endian, respectively). The compiler also defines a C preprocessor macro for the target byte ordering.
These C preprocessor macros are MIPSEB and MIPSEL for big-endian and little-endian byte ordering respectively.
If the specified target byte ordering does not match the machine where the compiler is running, then the runtime startups and libraries
come from /usr/libeb for big-endian runtimes on a little-endian machine and from /usr/libel for little-endian runtimes on a big-endian
-EB Produce object files targeted for big-endian byte ordering. The C preprocessor macro MIPSEB is defined by the compiler.
-EL Produce object files targeted for little-endian byte ordering. The C preprocessor macro MIPSEL is defined by the compiler.
The following options primarily aid compiler development and are not generally used:
-Hc Halt compiling after the pass specified by the character c, producing an intermediate file for the next pass. The c can be
[ fjusmoca ]. It selects the compiler pass in the same way as the -t option. If this option is used, the symbol table file
produced and used by the passes is the last component of the source file with the suffix changed to .T. It is not removed.
-K Build and use intermediate file names with the last component of the source file's name replacing its suffix with the con-
ventional suffix for the type of file (for example, .B file for binary ucode, produced by the front end). These intermedi-
ate files are never removed even when a pass encounters a fatal error. When ucode linking is performed and the -K option is
specified, the base name of the files created after the ucode link is u.out by default. If -ko output is specified, the
base name of the object file is output without the suffix. Suffixes are appended to output if it does not have a suffix.
-# Converts binary ucode files (.B) or optimized binary ucode files (.O) to symbolic ucode (a .U file). If a symbolic ucode
file is to be produced by converting the binary ucode from the C compiler front end then the front end option -Xu is used.
Pass the argument[s] argi to the compiler pass[es] c[c..]. The c's are one of [ pfjusmocablyz ]. The c's selects the com-
piler pass in the same way as the -t option.
The options -t[hpfjusmocablyzrnt], -hpath, and -Bstring select a name to use for a particular pass, startup routine, or standard library.
These arguments are processed from left to right so their order is significant. When the -B option is encountered, the selection of names
takes place using the last -h and -t options. Therefore, the -B option is always required when using -h or -t. Sets of these options can
be used to select any combination of names.
The -EB or -EL options and the -p options must precede all -B options because they can affect the location of runtime libraries and
which runtime libraries are used.
Select the names. The names must be selected from the options in the following table:
include h (see note below)
btou, utob t
If the character h is in the -t argument then a directory is added to the list of directories to be used in searching for
#include files. This directory name has the form COMP_TARGET_ROOT/usr/includestring . This directory is to contain the
include files for the string release of the compiler. The standard directory is still searched.
-hpath Use path rather than the directory where the name is normally found.
-Bstring Append string to all names specified by the -t option. If the -t option has not been processed before the -B, the -t option
is assumed to be the following: hpfjusmocablyzrnt. This list designates all names. If the -t argument has not been pro-
cessed before the -B argument, -Bstring is passed to the loader to use with its -lx arguments.
Invoking the compiler with a name of the form ccstring has the same effect as using a -Bstring option on the command line.
If the environment variable COMP_HOST_ROOT is set, the value is used as the root directory for all pass names rather than the default slash
(/). If the environment variable COMP_TARGET_ROOT is set, the value is used as the root directory for all include and library names rather
than the default slash (/). This affects the standard directory for #include files, /usr/include, and the standard library,
/usr/lib/libc.a. If this is set then the only directory that is searched for libraries, using the -lx option, is COMP_TARGET_ROOT/usr/lib
If the environment variable TMPDIR is set, the value is used as the directory to place any temporary files rather than the default /tmp/ .
If the environment variable RLS_ID_OBJECT is set, the value is used as the name of an object to link in if a link takes place. This is
used to add release identification information to objects. It is always the last object specified to the loader.
Other arguments are assumed to be either loader options or C-compatible object files, typically produced by an earlier run, or perhaps
libraries of C-compatible routines. These files, together with the results of any compilations specified, are loaded in the order given,
producing an executable program with the default name a.out.
The ULTRIX C compiler provides the following default symbols for your use. These symbols are useful in ifdef statements to isolate code
for one of the particular cases. Thus, these symbols can be useful for ensuring portable code.
unix Any UNIX system
bsd4_2 Berkeley UNIX Version 4.2
ultrix ULTRIX only
mips Any RISC architecture
MIPSEL Little endian variant of MIPS architecture
host_mips Native compilation environment (as opposed to cross-compiler)
The standard library, /usr/lib/libc.a, is loaded by using the -lc loader option and not a full path name. The wrong library may be loaded
if there are files with the name libc.astring in the directories specified with the -L loader option or in the default directories searched
by the loader.
The handling of include directories and libc.a is confusing.
file.c input file
file.o object file
a.out loaded output
/usr/lib/cpp C macro preprocessor
/usr/lib/ccom C front end
/usr/lib/ujoin binary ucode and symbol table joiner
/usr/bin/uld ucode loader
/usr/lib/usplit binary ucode and symbol table splitter
/usr/lib/umerge procedure intergrator
/usr/lib/uopt optional global ucode optimizer
/usr/lib/ugen code generator
/usr/lib/as0 symbolic to binary assembly language translator
/usr/lib/as1 binary assembly language assembler and reorganizer
/usr/lib/crt0.o runtime startup
/usr/lib/mcrt0.o startup for profiling
/usr/lib/libc.a standard library, see intro(3)
/usr/lib/libprof1.a level 1 profiling library
/usr/include standard directory for #include files
/usr/bin/ld MIPS loader
/usr/lib/ftoc interface between and cord
/usr/bin/btou binary to symbolic ucode translator
/usr/bin/utob symbolic to binary ucode translator
mon.out file produced for analysis by
Runtime startups and libraries for the opposite byte sex of machine the compiler is running on have the same names but are located in dif-
ferent directories. For big-endian runtimes on a little-endian machine the directory is /usr/libeb and for little-endian runtimes on a
big-endian machine the directory is /usr/libel.
dbx(1), ld(1), pixie(1), prof(1), what(1), monitor(3)