cc(1) — USER COMMANDS
NAME
cc − configurable C compiler
SYNOPSIS
cc [options] file . . .
DESCRIPTION
The cc command is the interface to a choice of C compilation systems. Regardless of which compilation system is used, the command line options described below will have the same effect.
The active compilation system is chosen by setting the environment variable CCCOMPILER. If the environment variable is not set, the default entry gnu is used. The other entry in the configurable compiler driver file, abi, may be selected for compiling ABI (Application Binary Interface) applications.
A compiler configuration file other than the default may be selected by setting the environment variable CCMAP. Other compilation system entries within a compiler configuration file may also be used. Please see the C Programming guide for further information on using the configurable cc command.
Because cc usually creates files in the current directory during the compilation process, it is necessary to run cc in a directory in which the output files can be created.
Components
The compilation tools conceptually consist of a preprocessor, compiler, optimizer, basic block analyzer, assembler, and link editor. cc processes the supplied options and then executes the various tools with the proper arguments. cc accepts several types of files as arguments.
Files whose names end with .c are taken to be C source files and may be preprocessed, compiled, optimized, instrumented for profiling, 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 runs through the assembler, then an object file is produced whose name is that of the source with .o substituted for .c. However, the .o file is normally deleted if a single C file is compiled and then immediately link edited. In the same way, files whose names end in .s are taken to be assembly source files; they may be assembled and link edited. Files whose names end in .i are taken to be preprocessed C source files, and they may be compiled, optimized, instrumented for profiling, assembled, and link edited. Files whose names do not end in .c, .s, or .i are handed to the link editor, which produces a dynamically linked executable whose name by default is a.out.
When cc is put in a file prefixcc, the prefix will be recognized and used to prefix the names of each tool executed. For example, OLDcc will execute OLDacomp, OLDnewoptim, OLDbasicblk, OLDas, and OLDld. Therefore, be careful when moving cc around, and be sure you already have in place the prefixed versions of the compilation components. The prefix applies to the compiler, optimizer, basic block analyzer, assembler, and link editor.
Options
The following options are interpreted by cc:
−A name[(tokens)]
Associate name as a predicate with the specified tokens as if by a #assert preprocessing directive.
Preassertions:system(unix)
cpu (m68k or m88k)
machine(m68k or m88k)
−A− Cause all predefined macros (other than those required by the ANSI C standard, e.g __LINE__) and predefined assertions to be forgotten.
−B c c can be either dynamic or static. −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. This option may be specified multiple times on the command line as a toggle. This option and its argument are passed to ld.
−C Cause the preprocessing phase to pass along all comments other than those on preprocessing directive lines.
−c Suppress the link editing phase of the compilation and do not remove any produced object files.
−D name[=tokens]
Associate name with the specified tokens as if by a #define preprocessing directive. If no =tokens is specified, the token 1 is supplied.
Predefinitions:__m68k__ or __m88k__
__unix__
−d c c can be either y or n. −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.
−E Only preprocess the named C files and send the result to the standard output. The output will contain preprocessing directives for use by the next pass of the compilation system.
−f This option is obsolete and will be ignored.
−Fflag
Specify code generation options. flag can be one of the following:
88000 [default]
Produce code optimized for the MC88110 that also executes on an MC88100.
88100
Produce code optimized for the MC88100.
88110
Produce code optimized for the MC88110. The resulting code may not run on an MC88100.
short-data-num
Use short addressing for data references. num is an integral value that may range between 1 and 65536 (64K). This value specifies the maximum size (bytes) data object for which to attempt short addressing. If the number of data objects exceeds that which can be addressed by a base register and a 16-bit offset, the loader will fail and the code must be recompiled with a smaller value for num.
−G Direct the link editor to produce a shared object rather than a dynamically linked executable. This option is passed to ld. It cannot be used with the −dn option.
−g Cause the compiler to generate additional information needed for the use of tbx. Use of tbx on a program compiled with both the −g and −O options is not recommended unless you understand the behavior of optimization.
−H Print, one per line, the path name of each file included during the current compilation on the standard error output.
−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.
−J sfm
Not supported on Motorola 68000 and 88000 systems. A warning to this effect will be printed.
−K [mode,goal, PIC, minabi]
−K mode Not supported on Motorola 68000 and 88000 systems. A warning to this effect will be printed.
−K goal Not supported on Motorola 68000 and 88000 systems. A warning to this effect will be printed.
−K PIC Cause position-independent code (PIC) to be generated.
−K minabi
Direct the compilation system to use a version of the C library that minimizes dynamic linking, without changing the application’s ABI conformance (or non-conformance, as the case may be). Applications that use the Network Services Library or the X library may not use −K minabi.
The −K option can accept multiple arguments. For example, -K PIC, minabi can be used instead of -K PIC -K minabi.
−L dir
Add dir to the list of directories searched for libraries by ld. This option and its argument are passed to ld.
−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 ld.
−O Arrange for compilation phase optimization. This option has no effect on .s files.
−o pathname
Produce an output object file pathname, instead of the default a.out. This option and its argument are passed to ld.
−P Only preprocess the named C files and leave the result in corresponding files suffixed .i. The output will not contain any preprocessing directives, unlike −E.
−p Arrange for the compiler to produce code that counts the number of times each routine is called; also, if link editing takes place, profiled versions of libc.a and libm.a (with the −lm option) are linked if the −dn option is used. A mon.out file will then be produced at normal termination of execution of the object program. An execution profile can then be generated by use of prof.
−Q c c can be either y or n. If c is y, identification information about each invoked compilation tool will be added to the output files (the default behavior). This can be useful for software administration. Giving n for c suppresses this information.
−q c c can be either l or p. −ql causes the invocation of the basic block analyzer and arranges for the production of code that counts the number of times each source line is executed. A listing of these counts can be generated by use of lprof. −qp is a synonym for −p.
−S Compile, optimize (if −O is present), and do not assemble or link edit the named C files. The assembler-language output is left in corresponding files suffixed .s.
−U name
Cause any definition of name to be forgotten, as if by a #undef preprocessing 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 Cause the compiler to perform more and stricter semantic checks, and to enable certain lint-like checks on the named C files.
−W tool,arg1[,arg2 . . .]
Hand off the argument(s) argi each as a separate argument to tool. Each argument must be separated from the preceding by only a comma. (A comma can be part of an argument by escaping it by an immediately preceding backslash (\) character; the backslash is removed from the resulting argument.) tool can be one of the following:
p preprocessor
0 compiler
2 optimizer
b basic block analyzer
a assembler
l link editor
For example, −Wa,−o,objfile passes −o and objfile to the assembler, in that order; also −Wl,−I,name causes the linking phase to override the default name of the dynamic linker, /usr/lib/libc.so.1.
The order in which the argument(s) are passed to a tool with respect to the other specified command line options may change.
−xflag
Specify extra optimization(s) to perform during compilation. flag can be one of the following:
unroll-loops
Perform loop unrolling for loops whose number of iterations can be determined at compile time or run time.
tail-merge
Convert tail calls such that the callee returns directly to the parent of the caller.
pre Perform the optimization of partial redundancy elimination.
inline-functions
Attempt to integrate functions into their callers.
fallthrough-branch
Heuristically predict branches and rearrange them such that the least taken path follows the branch while the most likely path is the ‘fall through’ case.
All of these flags require the −O option to be specified as well.
−X c Specify the degree of conformance to the ANSI C standard. c can be one of the following:
t (transition) [default]
The compiled language is compatible with ANSI C with extensions which aid in the transition from pre-ANSI C interpretation. Pre-ANSI C functionality is supported when no conflict exists with existing ANSI C features. In addition to the ANSI C reserved words, inline, asm, and typeof are also reserved. When possible their use should be replaced with __inline__, __asm__, and __typeof__ for upward compatibility. The predefines m68k or m88k and unix are available, however, their use should be replaced with __m68k__ or __m88k__ and __unix__.
a (ANSI)
The compiled language is ANSI C conforming without restrictions on the name space of identifiers in header files. Warnings or errors may be issued when non-ANSI C extensions are used.
c (conformance)
The compiled language and associated header files are ANSI C conforming. Only ANSI C defined identifiers are visible in the standard’s header files. Warnings or errors may be issued when non-ANSI C extensions are used.
The predefined macro __STDC__ has the value 1 for all -X options since the compiled language always conforms to the ANSI C standard.
An additional option, −Xn, is also recognized. This option is identical to −Xt except that the application is required to provide the definition of the run-time variable _lib_version. The provision of this option is to accommodate test suites. The usage of the −Xn option by applications is not encouraged, because it may not be portable to other Release 4 systems.
−Y item,dir
Specify a new directory dir for the location of item. item can consist of any of the characters representing tools listed under the −W option or the following characters representing directories containing special files:
F obsolete. Use −YP instead.
I directory searched last for include files: INCDIR (see −I)
S directory containing the start-up object files: LIBDIR
L obsolete. Use −YP instead.
U obsolete. Use −YP instead.
P Change the default directories used for finding libraries. dir is a colon-separated path list.
If the location of a tool is being specified, then the new path name for the tool will be dir/tool. If more than one −Y option is applied to any one item, then the last occurrence holds.
cc recognizes -a, −B, -e, -h -m, -o, -r, -s, -t, -u, and -z and passes these options and their arguments to ld. cc also passes any unrecognized options to ld without any diagnostic.
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
LIBDIR/∗crti.o startup initialization code
LIBDIR/∗crt1.o startup routine
LIBDIR/∗crtn.o last startup routine
TMPDIR/∗ temporary files
BINDIR/cc configurable compiler driver
LIBDIR/.compilerc default compiler configuration file
BINDIR/gcc GNU C compiler driver
LIBDIR/gcc2/cpp GNU C preprocessor
LIBDIR/gcc2/cc1 GNU C compiler
LIBDIR/gcc2/include GNU C include directory
LIBDIR/gcc2/libgcc.a GNU C library
LIBDIR/cpp USL CI4 preprocessor}
LIBDIR/basicblk basic block analyzer
BINDIR/as assembler
BINDIR/ld link editor
LIBDIR/libc.so shared standard C library
LIBDIR/libc.a archive standard C library
INCDIR usually /usr/include
LIBDIR usually /usr/ccs/lib
BINDIR usually /usr/ccs/bin
TMPDIR usually /var/tmp but can be redefined by setting the environment variable TMPDIR (see tempnam in tmpnam(3S)). Kernighan, B. W., and Ritchie, D. M., The C Programming Language, Second Edition, Prentice-Hall, 1988 American National Standard for Information Systems − Programming Language C, X3.159-1989
NOTES
The -ql and -O options do not work together; -O will be ignored.
SEE ALSO
as(1), ld(1), lint(1), lprof(1), prof(1), tbx(1) monitor(3C), tmpnam(3S).
— C Programming Language Utilities