CC(1) BSD CC(1)
NAME
cc - C compiler
SYNOPSIS
cc [ options ] file ...
DESCRIPTION
cc is the Domain/OS BSD interface to the preprocessor (cpp), the Domain C
compiler, and the link editor (ld). cc accepts several types of
arguments. It interprets arguments with names ending in .c as C source
programs, compiles them, and leaves each object program on the file whose
name is that of the source, with .o substituted for .c. However, cc
normally deletes the .o file if a single C program is compiled and loaded
all at one go. Assembly source programs (arguments whose names end with
.s) are not supported.
You can typically improve run-time performance if you compile your code
using the -A cpu option with a processor-specific id. Use an argument
appropriate to the CPU type of the machine(s) on which you will run the
executable file. The option -A cpu 3000, for example, generates optimal
code for the DSP90, DN330, DN560, DN570, DN580, DN3000, DN3500, DN4000,
and DN4500 processors.
Not all standard UNIX options are available. The Domain/OS BSD cc command
provides some unique options. The cc command will interpret any command
line argument beginning with a dash (-), as a compiler or a preprocessor
option. If cc doesn't recognize an option, it assumes that it is an
option for the link editor ld(1) and passes it along. cc recognizes the
following as preprocessor options: -C, -D, -H, -I, and -U. The following
are link editor options: -a, -l, -m, -o, -r, -s, -t, -u, -x, -z, -L, -M,
-V, and -A.
OPTIONS
-a Produce an object file for execution. This is the default.
Use -r to retain relocation information in the object module.
If you specify both -a and -r, the link editor retains
relocation information for all data except common symbols,
which it allocates. (ld switch)
-Bstring Prefix pathname to cpp, cc, and ld for substitute preprocessor,
compiler, and linker passes. If name is empty it is taken to be
/usr/lib/o.
-c Suppress the linking phase of the compilation and force an
object file to be produced, even if only one program is
compiled.
-C Prevent the preprocessor from stripping comments. (cpp switch)
-Dname=def
-Dname Define the name to the preprocessor, as if by #define. Ifyou
do not specify a definition, define name as 1. The -D switch
has lower precedence than -U; if you use both for the same
name, the name is undefined, regardless of the order the
switches appear in. (cpp switch)
-E Run only the macro preprocessor on the named C programs, and
send the result to the standard output.
-g Generate full run-time debugger information. This is the same
as the Aegis -dbs option to the Domain C compiler.
-H Print to stderr the pathname of every file included during this
compilation. (cpp switch)
-Idir Change the search path for #include files with names not
beginning with a slash (/). Look first in the directory of
the source file; then in directories named in this option; and
finally, in directories on a standard list.
-lx Search the library named libx.a. cc searches libraries in the
order that they appear on the command line. By default, the
link editor searches for libraries first in the directory /lib,
then in /usr/lib. You can specify additional library
directories with the -L switch. (ld switch)
-Ldir Change the search path for libraries. By default, the compiler
looks for libx.a libraries in the directories specified by
/lib and /usr/lib. This option allows you to specify a
different directory before searching these standard
directories. This is useful if you have different versions of
a library and you want to specify which one the link editor
should use. Note that this switch is effective only if it
precedes a -l switch. (ld switch)
-m Produce a map or listing of the input/output sections on
standard input. (ld switch)
-M Run only the macro preprocessor on the named C programs,
requesting it to generate Makefile dependencies and send the
result to the standard output.
-o output Name the final output file output. By default, output is
a.out. If you specify a different name, the system leaves any
existing a.out file undisturbed.
-O Turn on compiler optimizations.
-p Arrange for the compiler to produce code which counts the
number of times each routine is called. If the command does
load, replace the standard startup routine by one which
automatically calls monitor(1) at the start and arranges to
write out a mon.out file at normal termination of execution of
the object program. An execution profile can then be generated
by use of prof(1).
-P Run only the macro preprocessor on the named C program, and
leave the result on corresponding files suffixed with .i.
-pg Causes the compiler to produce counting code in the manner of
-p, but invokes a run-time recording mechanism that keeps more
extensive statistics and produces a gmon.out file at normal
termination. An execution profile can then be generated by use
of gprof(1).
-r Retain relocation entries in the output object module.
Relocation entries must be preserved if the object file will be
specified in a future ld or bind command. The default is -a.
(ld switch)
-s Strip line-number entries and symbol-table information from the
output object file. The switch is equivalent to using the
strip(1) utility and is useful if you want to reduce the size
of the object module. Note, however, that removing this
information from a program makes it impossible to debug the
program with a source level debugger (dbx or dde). (ld switch)
-t[p0l] Find only the designated preprocessor (p), compiler passes (0),
or linker (l) in the files whose names are constructed by a -B
option. In the absence of a -B option, the name is taken to be
/usr/lib/n. The value -t "" is equivalent to -t0l. The -Y
option performs the same function and is easier to use.
-Tsystype Define the target system type (systype) for the compiled
object; see the -A sys[type],sys option for a list of valid
systype values.
-u symname
Enters symname as an undefined symbol in the symbol table.
This switch is useful if you are using the cc command to load a
library. The symbol table is initially empty and needs an
unresolved reference to force ld to load the first routine. (ld
flag)
-Uname Remove any initial definition of name. (cpp switch)
-V Output a message giving information about the version of ld
being used. (ld switch)
-w Suppress warning diagnostics.
-Wc,arg1[,arg2]
Hand off the arguments argi to pass c where c is one of p, 0,
or l, indicating the preprocessor, compiler, or linker. Using
-W0 enables you to use /com/cc options that are not available
with /bin/cc. For example: -W0,-opt,1 passes -opt 1 to the
compiler.
The following /com/cc options can be used in this manner with the
-W0 option:
Default options are indicated by "(D)".
-ac (D) Produce absolute code. The alternative option is
-pic, which forces the compiler to produce
position-independent code.
-alnchk (D) Display messages about alignment of structures.
-nalnchk Suppress alignment messages.
-nansi (No ANSI) Do not use any ANSI features.
-bss Put uninitialized global variables in the .bss
section of the object file.
-nbss (D) Put uninitialized global variables in named
sections.
-comchk Check for balanced comments and warn if comments
are not balanced.
-ncomchk (D) Suppress comment checking.
-compress Store object file data in compressed form. If
neither -compress nor -ncompress is specified,
the compiler will compress all data sections
except the one called ".data".
-ncompress (D) Store object file data in uncompressed form. If
neither -compress nor -ncompress is specified,
the compiler compresses all data sections except
the one called ".data".
-cond Compile lines prefixed with "#debug".
-ncond (D) Ignore lines prefixed with "#debug".
-exp Generate expanded code listing (implies -l).
-nexp (D) Suppress expanded code listing.
-frnd Force the compiler to write all floating-point
operands to memory and then fetch the memory
contents before evaluating the expression.
This ensures that each operand will have the
same amount of precision so that floating-point
comparisons will produce correct results. If
you do not compile with -frnd, floating-
point operands may be kept in registers, which
support more accuracy than memory.
Consequently, when a register operand is
compared with a memory operand, the result may
not be what is expected. This is particularly
true of equality comparisons.
-indexl Use 32-bit indexing for all array references.
-nindexl (D) Use source code's array dimension information to
determine whether to use 16-bit or 32-bit
indexing.
-info level Control the output of informational messages.
The four informational levels are 0, 1, 2 and 3.
-info 0 is the default; it suppresses
informational messages.
-inlib [pathname]
Specify one or more libraries that are not
currently installed but should be installed
when the program is executed. These
libraries are searched at compile time to
determine whether indirect or absolute
references should be generated.
-l [file] Generate compilation listing. If no pathname is
specified, the listing is written to a file with
the same name as the source file, but with the
suffix .lst replacing .c.
-nl (D) Suppress compilation listing.
-map Generate symbol table map (implies -l).
-nmap (D) Suppress symbol table map.
-mgbl (D) Map global names on output to maintain case
sensitivity.
-nmgbl Do not map global names; output all names in
uppercase.
-msgs Force compiler to print final message
summarizing listing number of errors and
warnings.
-nmsgs (D) Suppresses final compilation message.
-natural Use natural alignment for structures and array
elements that do not have alignment attributes.
-nnatural (D) Suppress natural alignment for structures and
array elements that do not have alignment
attributes.
-nclines Suppress the generation of COFF line number
tables.
-opt [n] (D) Perform global optimization. 'n' is a single-
digit integer in the range 0 to 4, indicating
the level of optimization performed. -opt 0 is
identical to the obsolete switch -nopt.
If 'n' is omitted, 3 is the default
level. Increasing the optimization level
results in faster execution of your
program, at the expense of longer
compilation time. See the Domain C Language
Reference manual for details.
-pic Produce position-independent object code. The
default is to produce absolute code.
-prasm (D) Use Series 10000 assembly language format for
the expanded listing generated by -exp. Note:
this option has no effect if used without the
-exp option.
-nprasm Use 68000 assembly language format for the
expanded listing generated by -exp. Note: this
option has no effect if used without the -exp
option.
-prof Produce code that, when executed, produces a
".mon" file that can be used by the
prof utility to evaluate performance.
-std Flag usage of nonstandard features with
warnings.
-nstd (D) Do not generate warnings for usage of
nonstandard features.
-nstdc Set the value of __STDC__ to 0. Use this option
along with -xansi if portions of your code use
ANSI features not yet implemented by Domain C
and the unimplemented ANSI features are
contingent on __STDC__ being defined.
-type (D) Obsolete option. Use -xansi.
-ntype Obsolete option. Use -nansi.
-uline (D) Recognize #line preprocessor options for source
file line numbering. The compiler will report
errors in terms of the line numbers set by this
option. The debugger line number table will be
built with these line numbers.
-nuline Ignore #line preprocessor options.
-xansi (Extended ANSI) Use all ANSI features currently
available; also use all Domain extensions. The
ANSI features currently implemented are:
function prototyping, const,volatile, and signed
qualifiers, __STDC__ macro defined as 1.
-Y[p0lSILU], dir
Specify a new pathname and directory for the locations of the
tools and directories designated by the first argument. You
can include only one letter or number per -Y switch, but there
is no limit to the number of -Y switches per compilation. The
valid letters and numbers, and their meanings, are as follows:
p Preprocessor (cpp)
0 Compiler (cc)
l Link editor (ld)
S Directory containing the startup routine
(/usr/lib/crt0.o)
I Default include directory searched by the
preprocessor (/usr/include)
L First default library directory searched by
the link editor
U Second default library searched
by the link editor
If the location of a tool is being specified, the new pathname
for the tool is /dir/tool. If more than one -Y option is
applied to any one tool or directory, the last occurrence
holds.
The Domain/OS BSD version of cc does not support the following options:
-go, -lg, -R, -S, -f.
Domain/OS BSD EXTENSIONS
The -A option identifies Domain/OS BSD extensions to cc and ld; see ld(1)
for additional information about this option.
-A nansi Do not compile with ANSI rules. Same as -nansi /com/cc option.
-A cpu,id Generate code for a particular class of processor; the default
id is any. Values for id are as follows:
any Series 10000 code, if you're
compiling on a Series 10000
workstation, or 680x0 code, if
you're compiling on a
680x0-based workstation
a88k Series 10000 code
m68k 680x0-based code
160 DSP160 code
460 DSP460 code
660 660 code
90 DSP90 code
330 DN330 code
560 DN560 code
570 DN570 code
580 DN580 code
3000 DN3000 code and DN4000 code
FPA1 Floating-Point Accelerator
FPX Floating-Point Accelerator Board
PEB Performance Enhancement Board
The following values for id are synonyms: 160, 460, and 660.
Also, the following values for id are synonyms: 90, 330, 560,
570, 580, and 3000. Using a processor-specific code generation
mode can result in programs that run faster.
-A sys[type],sys
Define the target system type (sys) for the compiled object;
sys may be one of the following:
any Version independent
bsd4.2 Berkeley version 4.2
bsd4.3 Berkeley version 4.3
sys5 UNIX System V
sys5.3 UNIX System V Release 3
This option replaces the -Tsystype option (which is supplied
for backwards compatibility).
-A run[type],sys
Like -A sys[type],sys this option passes runtype information to
the compiler and linker.
Other arguments are taken to be loader 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 loaded (in the order given) to
produce an executable program with name a.out.
EXAMPLE
The following example compiles filename.c using the compiler in
/usr/lib/old/cc
cc -Y0,/usr/lib/old filename.c
DIAGNOSTICS
The diagnostics produced by C itself are intended to be self-explanatory.
The loader may produce occasional messages.
FILES
file.c Input file
file.o Object file
a.out Loaded output (default)
/tmp/ctm? Temporary
/usr/lib/cpp Preprocessor
/usr/apollo/lib/cc Compiler
/bin/ld Link editor
/usr/lib/crt0.o Runtime startoff
/usr/lib/mcrt0.o Startoff for profiling
/usr/lib/gcrt0.o Startoff for gprof-profiling
/usr/include Standard directory for #include files
mon.out File produced for analysis by prof(1)
gmon.out File produced for analysis by gprof(1)
The following files are not supported:
/lib/ccom Compiler
/lib/sccom Compiler for single precision floats
/usr/c/occom Backup compiler
/usr/c/ocpp Backup preprocessor
/lib/c2 Optional optimizer
/lib/libc.a Standard library
/usr/lib/libcp.a Profiling library
SEE ALSO
dbx(1), dde(1), gprof(1), ld(1), prof(1), monitor(3)
Domain C Language Reference
Domain/OS Programming Environment Reference
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-
Hall, 1978
B. W. Kernighan, Programming in C-a tutorial
D. M. Ritchie, C Reference Manual