cc(1) DG/UX R4.11MU05 cc(1)
NAME
cc - C language compiler
SYNOPSIS
cc [ option ] filename ...
DESCRIPTION
The cc command is the interface to the C compilation system. The
system conceptually consists of a preprocessor, compiler, optimizer,
assembler, and link-editor. The cc command processes the supplied
options and then executes the various tools with the appropriate
arguments. By default the cc command supports all new features of
ANSI C.
The cc command accesses the GNU C compiler. Facilities unique to the
the GNU C compiler may not be accessible from the cc command; instead
you must use the gcc command. For a further description see gcc(1).
The suffix of a filename argument indicates how the file is to be
treated. Files whose names end with .c are taken to be C source
programs and may be preprocessed, compiled, optimized, assembled, and
link-edited. The compilation process may be stopped after the
completion of any pass if the appropriate options are supplied. If
the compilation process is allowed to complete the assembly phase,
then an object file is produced; the object file for a source file
called xyz.c is created in a file called xyz.o. However, the .o file
is normally deleted if a single C program is compiled and loaded all
at one go.
In the same way, arguments whose names end with .s are taken to be
assembly source programs, and may be assembled and link-edited.
Files with names ending in .i are taken to be preprocessed C source
programs and may be compiled, optimized, assembled, and link-edited.
Files whose names do not end in .c, .s, or .i are handed to the link-
editor.
By default, if an executable file is produced (i.e., the link-edit
phase is allowed to finish), the file is called a.out. This default
name can be changed with the -o option (see below).
Options
Some options to cc are sensitive to the sde target environment (see
sde(5), sde-target(1)). Options unique to ELF or COFF target
environments are so indicated in the following list.
These options are interpreted by cc:
-ansi Compile the source in accordance with rules for ANSI C and
flag violations (this is equivalent to the -Xc option).
-X [tac]
Specify the degree of conformance to the ANSI C standard. The
arguments have the following meanings:
t (transition)
The compiled language includes all new features compatible
with older (pre-ANSI) C (the default behavior). The
compiler warns about all language constructs that have
differing behavior between the new and old versions and uses
the pre-ANSI C interpretation. This includes, for example,
warning about the use of trigraphs, the new escape sequence
\a, and the changes to the integral promotion rules. Cc -Xt
has the same effect as gcc -traditional.
a (ANSI)
This is the default mode. The compiled language includes
all new features of ANSI C and uses the new interpretation
of constructs with differing behavior. The compiler
continues to warn about the integral promotion rule changes,
but does not warn about new escape sequences.
c (conformance)
The compiled language and associated header files are ANSI C
conforming, but include all conforming extensions of -Xa.
Warnings will be produced about some of these. Also, only
ANSI defined identifiers are visible in the standard header
files. (This is equivalent to the -ansi option.)
The predefined macro STDC has the value 1 for -Xa and -Xc.
All warning messages about differing behavior can be
eliminated in -Xa through appropriate coding; for example, use
of casts can eliminate the integral promotion change warnings.
These options also affect the behavior of libc and libm
routines if present on the command line at link time.
-O Do compilation-phase optimization on .c or .i files. This
option will not affect code produced from .s files.
-O2 Do aggressive compilation-phase optimization on .c or .i
files. All supported optimizations are performed. As
compared to -O, this option will increase both compilation
time and the performance of the generated code.
-g Cause the compiler to generate additional information needed
for the use of a debugger.
-p Arrange for the compiler to produce code that counts the
number of times each routine is called: also, if link-editing
takes place, a profiled version of the standard C library is
linked, and monitor (see monitor(3C)) is automatically called.
A mon.out file will then be produced on normal termination of
the program. An execution profile can then be generated by
use of prof.
-D name[=tokens]
Associate name with the specified tokens as if by a #define
preprocessor directive. If no =tokens is specified, the token
1 is supplied.
-U name
Cause any definition of name to be forgotten, as if by a
#undef preprocessor directive. If the same name is specified
for both -D and -U, name is not defined, regardless of the
order of the options.
-V Cause each invoked tool to print its version information on
the standard error output.
-v Print the invocation of each tool on the standard error
output.
-K [PIC [,Vversion [,Mmach]]]
-K PIC (ELF only)
Generate position-independent code (PIC).
-K Vversion
Select a version of the GNU C compiler. The command cc -KV
lists versions available on the system. (The command
default-gcc is used to determine or to change the system
default.)
-K Mmach
Generate code that is optimized for one or more models of
the MC88000 processor. Possible values of mach and their
meanings are:
88000 Generate code that runs well on all members of the
MC88000 family (this is the default).
88100 Generate code that is optimized for MC88100, but
also runs on MC88110.
88110 Generate code that is optimized for MC88110, and may
not run on MC88100.
The -K option can accept multiple arguments. For example,
-K PIC,V2 can be used instead of -K PIC -K V2.
-E Preprocess the named C programs and send the result to the
standard output.
-P Preprocess the named C programs and leave the result in
corresponding files suffixed .i.
-S Compile and do not assemble or link-edit the named C files.
The assembly language output is left in corresponding files
suffixed .s.
-C Cause the preprocessing phase to pass along all comments other
than those on preprocessing directive lines.
-H Cause pathnames of files included during preprocessing to be
printed on the standard error output.
-c Suppress the link edit phase of the compilation, and do not
remove any object files produced.
-o outfile
Use the name outfile, instead of the default a.out, for the
executable file produced. This is a link-editor option and
does not apply to files produced by the -S, -c, or -P options.
-d [y | n] (ELF only)
-dy specifies dynamic linking, which is the default, in the
link editor. -dn specifies static linking in the link editor.
This option and its argument are passed to ld.
-G (ELF only)
Direct the link editor to produce a shared object rather than
a dynamically linked executable. This option cannot be used
with the -dn option.
-B [dynamic | static] (ELF only)
-B dynamic causes the link editor to look for files named
libx.so and then for files named libx.a when given the -lx
option. -B static causes the link editor to look only for
files named libx.a. These options may be specified multiple
times on the command line as a toggle.
-B symbolic (ELF only)
Direct the link editor to bind references to global symbols to
their definitions within the object, if definitions are
available, when building a shared object. This option is
meaningful only in dynamic mode.
The -B option and its argument are passed to the link editor.
-Q [y | n] (ELF only)
-Qy directs the link editor to add identification information
to the output file (the default behavior); this can be useful
for software administration. -Qn suppresses this information.
-I dir Alter the search for included files whose names do not begin
with / to look in dir prior to the usual directories. The
directories for multiple -I options are searched in the order
specified.
-L dir Add dir to the list of directories searched for libraries by
ld. This option and its argument are passed to the link
editor.
-l name
Search the library libname.so or libname.a. Its placement on
the command line is significant as a library is searched at a
point in time relative to the placement of other libraries and
object files on the command line. This option and its
argument are passed to the link editor.
-W c,arg1[,arg2...]
Pass the argument list to phase c where c can be any of the
following:
p preprocessor
0 compiler
2 optimizer
a assembler
c Dwarf-to-legend translator
l link-editor
For example, -W a,-m passes -m to the assembler phase.
-Y items,dir
Specify a new directory dir for the location of the tools and
directories designated in the first argument. items can
consist of any grouping of the following characters:
p preprocessor
0 compiler
2 optimizer
a assembler
c Dwarf-to-legend translator
l link-editor
I directory searched last for include files (default
/usr/include)
L directory searched next to last for libraries (default
/usr/lib)
S directory containing the start-up object files (default
/usr/lib)
U directory searched last for libraries (default
/usr/lib)
If the location of a tool is being specified, then the new
pathname for the tool will be dir/tool. If more than one -Y
option is applied to any one item, the last occurrence holds.
-t items (COFF only)
Find only the tools designated by items in the file whose name
is constructed by a -Y option. In the absence of a -Y option,
the prefix is taken to be /lib/n. items can be zero or more
characters from [p02sacl], designating the preprocessor,
compiler, optimizer, assembler, legend converter, or link-
editor. If items is empty (as in `-t""'), all tools are
designated.
The cc command passes any unrecognized options to ld without any
diagnostic (see ld(1) for descriptions of ld options).
Other arguments are taken to be C-compatible object programs or
libraries of C-compatible routines and are passed directly to the
link-editor. These programs, together with the results of any
compilations specified, are linked (in the order given) to produce an
executable program with the name a.out (unless the -o link-editor
option is used).
The standard C library is automatically available to the C program.
Other libraries must be specified explicitly using the -l option with
cc (see ld(1) for details).
#define Statements
The following list provides the meaning of symbols that are defined
by default under cc. When defined, the value is 1.
m88k The target system is a Motorola 88100.
ix86 The target system is Intel.
unix Unix operating system.
DGUX DG/UX operating system.
STDC ANSI features are assumed. Defined when -ansi, -Xa or -Xc
is given.
STRICTANSI
Strict ANSI, no extensions. Defined when -ansi or -Xc is
given.
OPENNAMESPACE
Defined when -Xa is given. Non-ANSI C standard features in
header files are visible during compilation.
Additionally, when the compiler is not in strict ANSI mode (ANSI
prohibits predefined names that don't begin with either two `_'s, or
an `_' and an uppercase letter) the following are also available:
m88000 Deprecated alternative of m88k.
m88k Deprecated alternative of m88k.
unix Deprecated alternative of unix.
DGUX Deprecated alternative of DGUX.
i386 Deprecated alternative of ix86.
There are several macros you can define to control your source and
target environments when developing applications. These macros
control header files, function declarations, binary formats, and
other aspects of the source and target environments. The macros are
helpful when you are porting applications to or from non-DG/UX
systems such as BSD or AT&T systems. The macros can also make
development of POSIX- or BCS-conformant applications easier. For
developing BCS-conformant applications, the sde utility is also
helpful.
FILES
file.c C source file
file.i preprocessed C source file
file.o object file
file.s assembly language file
a.out link-edited output
$TMPDIR/ctm* temporary files. $TMPDIR is usually /tmp but
can be redefined by setting the environment
variable TMPDIR.
/usr/lib/gcc/gcc-cpp GNU preprocessor
/usr/lib/gcc/gcc-cc1 GNU C compiler
/bin/as assembler, as(1)
/bin/ld link editor, ld(1)
/bin/ctl COFF-to-legend converter, ctl(1)
/bin/dtl DWARF-to-legend converter, dtl(1)
/lib/crt*.o start-up routines
/lib/mcrt*.o profiling start-up routines
/lib/libc.a standard C library
SEE ALSO
as(1), ctl(1), dtl(1), gcc(1), ld(1), sde-target(1), sdetab(4),
sde(5), and info(1) (info gcc).
Licensed material--property of copyright holder(s)