cc(1) cc(1)
NAME
cc - C compiler
SYNOPSIS
cc [-B string] [-c] [-C] [-D symbol=[def]] [-E] [-f] [-g]
[-I dir] [-L dir] [-l x] [-n] [-o outfile] [-O] [-p] [-P]
[-R] [-s] [-S] [-t [p012al]] [-T] [-U symbol] [-v] [-V]
[-W c,arg1[,arg2...] [-X] [-Z flags] [-#] ... files ...
DESCRIPTION
The cc command is a front-end program that invokes the
preprocessor, compiler, assembler and linkage editor, as
appropriate. (The default is to do them all). It generates
assembly instructions. cc accepts the following types of
arguments:
Arguments whose names end with .c are taken to be C source
programs; they are compiled, and each object program is left
in a file whose name is that of the source, with .o
substituted for .c. The .o file is normally deleted;
however, if a single C program is compiled and loaded all at
one go, no .o is produced. In the same way, arguments whose
names end with .s are taken to be assembly source programs
and are assembled to produce a .o file.
The following flag options are interpreted by cc. (Other
flag options may be passed to the assembler and the linker.
See ld(1) for link editor flag options and as(1) for
assembler options.)
-c Suppress the link-editing phase of the compilation,
and force an object file to be produced even if only
one program is compiled.
-C Pass along all all comments except those found on
cpp(1) directive lines. The default strips out all
comments.
-p Arrange for the compiler to produce code which
counts the number of times each routine is called.
Also, if link editing takes place, replace the
standard startoff routine by one which automatically
calls monitor(3C) at the start and arranges to write
out a mon.out file at normal termination of
execution of the object program.
-f Do not generate inline code for MC68881 floating
point coprocessor. To link a program that does not
have floating point code, the libraries -lcno881,
and -lmno881 must be included on the command line.
-g Generate additional information needed for the use
Page 1 (last mod. 1/16/87)
cc(1) cc(1)
of sdb(1).
-l x Same as -l in ld(1). Search a library, libx.a,
where x is up to seven characters. A library is
searched when its name is encountered, so the
placement of a -l is significant. By default,
libraries are located in LIBDIR. If you plan to use
the -L (see below) option, that option must precede
-l on the command line.
-L dir Same as -L in ld(1). Change the algorithm of
searching for libx.a to look in dir before looking
in LIBDIR. This option is effective only if it
precedes the -l option on the command line.
-o outfile
Same as -o in ld(1). Produce an output object file,
outfile. The default name of the object file is
a.out.
-O Invoke an object-code optimizer. The optimizer
moves, merges, and deletes code, so symbolic
debugging with line numbers could be confusing when
the optimizer is used.
-R Have assembler remove its input file when done.
-Wc,arg1[,arg2...]
Hand off the argument(s) argi (where i = 1,2, . . .
n) to pass c, where c is one of [p012al] indicating
preprocessor, compiler first pass, compiler second
pass, optimizer, assembler, or link editor,
respectively. For example:
-Wa,-m
Invoke the m4 macro preprocessor on the input
to the assembler. (The -m flag option to as
causes it to go through m4.) This must be done
for a source file that contains assembler
escapes.
-s Same as -s in ld(1). Strip line number entries and
symbol table information from the output of object
file.
-S Compile the named C programs, and leave the
assembler-language output on corresponding files
suffixed .s.
-t [p012al]
Find only the designated prprocessor (p), compiler
(0 and 1), optimizer (2), assembler (a) and link
Page 2 (last mod. 1/16/87)
cc(1) cc(1)
editor (1) passes whose names are constructed with
the string argument to the -B flag option. In the
absence of a -B option and its argument, string is
taken to be /lib/n. The value of -t "" is
equivalent to -tp012.
-T Truncate symbol names to 8 significant characters.
-E Run only cpp(1) on the named C programs, and send
the result to the standard output.
-P Run only cpp(1) on the named C programs, and leave
the result on corresponding files suffixed .i.
-Dsymbol=[def]
Define the external symbol to the preprocessor and
give it the value def (if specified). If not def is
given, symbol is defined as 1. This mechanism is
useful with the conditional statements in the
preprocessor by allowing symbols to be defined
external to the source file.
-Usymbol
Undefine symbol to the preprocessor.
-Idir Search for #include files (whose names do not begin
with /) in dir before looking in the directories on
the standard list. Thus, #include files whose names
are enclosed in double quotes are searched for first
in the directory of the file argument, then in
directories named in -I flag options, and last in
directories on a standard list. For #include files
whose names are enclosed in <>, the directory of the
file argument is not searched.
-Bstring
Construct pathnames for substitute preprocessor,
compiler, assembler, and link editor passes by
concatenating string with the suffixes cpp, comp,
optim, as, and ld. If string is empty it is taken
to be /lib/o.
-v Print the command line for each subprocess executed.
-V Print the version of the assembler that is invoked.
-X Ignored by Oreo for 68020.
-n Arrange for the loader to produce an executable
which is linked in such a manner that the text can
be made read-only and shared (non-virtual) or paged
(virtual).
Page 3 (last mod. 1/16/87)
cc(1) cc(1)
-# Special debug option which, without actually
starting the program, echoes the names and arguments
of subprocesses which would have started.
-Zflags Special flags to override the default behavior (see
NOTES). Currently recognized flags are:
c suppress returning pointers in both a0 and d0
n emit no code for stack growth
m use Motorola SGS compatible stack growth code
p use tst.b stack probes
E ignore all environment variables
I emit inline code for MC68881 floating point
coprocessor
l suppress selection of a loader command file
t do not delete temporary files
Other arguments are taken to be either link editor flag
option arguments or C-compatible object programs, typically
produced by an earlier cc run, or perhaps libraries of C-
compatible routines. These programs, together with the
results of any compilations specified, are link-edited (in
the order given) to produce an executable program with the
name a.out unless the -o flag option of the link editor is
used.
The C language standard was extended after UNIX ® version V
to allow arbitrary length variable names. This standard is
supported on the MC68000 family of processors. The -T flag
option causes cc to truncate variable names to provide
backward compatibility with earlier systems.
FILES
/usr/bin/cc
file.c input file
file.o object file
file.s assembly language file
a.out link-edited output
/usr/tmp/mc68? temporary
/lib/cpp preprocessor
/lib/ccom compiler
/lib/optim optimizer
/bin/as assembler, as(1)
/bin/ld link editor, ld(1)
/lib/libc.a standard library, see (3)
/usr/lib/shared.ld loader command file for shared text or
paged programs
/usr/lib/unshared.ld
loader command file for unshared text
programs
SEE ALSO
as(1), dis(1), ld(1).
Page 4 (last mod. 1/16/87)
cc(1) cc(1)
The C Programming Language by B. W. Kernighan and D. M.
Ritchie, Prentice-Hall, 1978.
``C compiler command syntax'' in Oreo Programming Languages
and Tools, Volume 1.
DIAGNOSTICS
The diagnostics produced by the C compiler are sometimes
cryptic. Occasional messages may be produced by the
assembler or link editor.
WARNING
By default, the return value from a C program is completely
random. The only two guaranteed ways to return a specific
value are to call exit(2) explicitly or to leave the
function main() with a return expression; construct.
NOTES
This version of cc is based on the cc released with the
Motorola SGS. It has been changed in the following ways:
o The -Z flag option has been added to explicitly
control generation of stack growth code for cross
development environments or generation of standalone
code. The Motorola SGS looks for an environment
variable called M68000 and generates stack growth
code if the variable is set to STACKCHECK. This cc
defaults to stack probes on 68000 host processors
and no stack growth code on the Macintosh 2's 68020
processors.
o The default is to produce nonshared text programs
unless the -n flag option is used, in which case
shared text (non-virtual) or paged (virtual only)
programs are produced. This cc takes care of
generating the appropriate combination of -N flag
option and loader command file names for the load
phase. The Motorola SGS defaults to shared text
unless the appropriate -N flag option is used. In
addition, with the Motorola SGS, an explicit loader
command file must be specified.
o When used with the -g flag option, the arguments
-u dbargs -lg will be inserted in the command line
for the link phase. This causes the contents of
libg.a to be linked in. Note that the Motorola SGS
only generates the loader argument -lg, which is not
sufficient to cause loading of the library's
contents.
o The -v (verbose) flag option has been added to print
the command line for each subprocess executed. This
helps to isolate problems to a specific phase of the
compilation process by showing exactly what cc is
doing, so that each phase can be run by hand if
necessary.
o The Motorola SGS compiler expects functions
returning pointers or structures to return their
values in a0, and other functions to return their
Page 5 (last mod. 1/16/87)
cc(1) cc(1)
values in d0/d1. Because of the large body of
existing code that has inconsistent type
declarations, the version of the compiler released
with the generic 68000 port emits code to return
pointers in both a0 and d0 by copying a0 to d0 just
prior to returning. This copy operation can be
suppressed with the -Zc flag option, thus generating
slightly smaller code.
Page 6 (last mod. 1/16/87)