Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cpp(1)

dbx(1)

dde(1)

gprof(1)

ld(1)

lint(1)

monitor(3C)

prof(1)

tmpnam(3S)

CC(1)                                SysV                                CC(1)



NAME
     cc - C compiler

SYNOPSIS
     cc [ options ] files

DESCRIPTION
     cc is an interface to the preprocessor (cpp), the Domain/C compiler, and
     the link editor (ld).  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 programs and may
     be preprocessed, compiled, 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 compiler, an
     object program is produced and is left in the file whose name is that of
     the source with .o substituted for .c.  However, the .o file is normally
     deleted if a single C program is compiled and then immediately link
     edited.  In this case, ld creates an executable object file with the
     default name a.out.  Files whose names end in .i are taken to be
     preprocessed C source programs and may be compiled and link edited. Files
     whose names do not end in .c or .i are handed to the link editor.

     Assembly source programs (files whose names end in .s) are not supported.

     You can typically improve run-time performance if you compile your code
     using the -A cpu,id 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,mathchip, for example, generates
     optimal code for the DSP90, DN330, DN560, DN570, DN580, DN2500, DN3000,
     DN3500, DN4000, and DN4500 processors, and for the HP Apollo 9000 Series
     400dl, 400s, and 400t.  Use the cpuhelp utility to help you choose the -A
     cpu argument best suited to your needs.  For information about this
     utility, type "man cpuhelp".

     Not all traditional UNIX options are available.  The Domain/OS cc command
     provides some unique options.  If the cc command does not recognize an
     option as a preprocessor or compiler option, it assumes that it is an
     option for the link editor (ld) and passes it along.  The options the cc
     interface recognizes as preprocessor options are: -C, -D, -H, -I, and -U.
     Commonly used link editor options are:  -a, -A, -l, -L, -m, -o, -r, -s,
     and -u.  Options that are recognized but ignored are: -ds, -dl, -f, -F,
     and -S.  When you use these options, you get a warning that they are not
     supported.

OPTIONS
     -#        Display the command lines passed to the three phases of cc
               (preprocessor, compiler, and linker).

     -##       Display the command lines passed to the three phases of cc
               (preprocessor, compiler, and linker), along with the pathnames
               of the cpp, cc, and ld commands invoked.

     -###      Display the command lines that would be passed to the three
               phases of cc (preprocessor, compiler, and linker), along with
               the pathnames of the cpp, cc, and ld commands invoked, but do
               not execute any of the commands.

     -a        Produce an object file for execution.  This option is in effect
               by default unless -r is specified.  The -a option removes
               relocation entries from the object module and allocates a .bss
               section for global symbols.  If you specify both -a and -r, the
               link editor preserves relocation entries and also allocates a
               .bss section.  (cc passes this option to ld.)

     -A ansi   Compile and link with full ANSI semantics, including expression
               evaluation that does not reorder across parentheses (Section
               3.3 of the ANSI standard).  (Available only at Domain/C Version
               6.8 and later.)

     -A cpu,id Generate code for a particular class of processors.  The
               default id is mathlib_sr10 if you are compiling for a 680x0-
               based workstation, and a88k if you are compiling for a Series
               10000 workstation.  Values for id are:

                    mathlib_sr10
                              Code for workstations with a 68020
                              or 68030 microprocessor and a
                              68881 or 68882 floating-point
                              coprocessor, or with a 68040
                              microprocessor.  Code compiled with this
                              argument runs on SR10.0, SR10.1, SR10.2,
                              SR10.3, and later versions of Domain/OS.

                    mathlib   Code for workstations with a 68020
                              or 68030 microprocessor and a
                              68881 or 68882 floating-point
                              coprocessor, or with a 68040
                              microprocessor.  It produces optimal
                              code for workstations with a 68040
                              microprocessor (425t, 433s, DN5500).
                              Code compiled with this argument runs only
                              on SR10.3 and later versions of Domain/OS.
                              Use mathlib_sr10 if your code must
                              also run on SR10.0, SR10.1, or SR10.2.

                    mathchip  Optimal code for 68020- or 68030-based
                    3000      workstations with a 6888x floating-
                    580       point coprocessor (400dl, 400t, 400s,
                    570       DN4500, DN4000, DN3500, DN3000, DN2500,
                    560       DN580, DN570, DN560, DN330, DSP90).  These
                    330       seven arguments generate identical code.
                    90        Use the mathchip argument; the other
                              arguments may become obsolete at a
                              future release.

                    a88k      Series 10000 code

                    fpa1      Code for DN3000, DN4000, or DN4500
                              workstations with an FPA1 floating-
                              point accelerator unit

                    fpx       Code for DN5xx workstations with an
                              FPX floating-point accelerator unit

                    peb       Code for workstations (including DN100,
                              DN320, DN400, DN600) with a Performance
                              Enhancement Board

                    160       Code for a DSP160, DN460, or DN660
                    460       workstation.  These three arguments
                    660       generate identical code.

                    any       Series 10000 code, if you are compiling
                              for a Series 10000 workstation, or
                              generic 680x0 code, if you are
                              compiling for a 680x0-based workstation

                    m68k      Generic 680x0-based code.  Same as
                              -A cpu,any for all machines other than
                              Series 10000 workstations

               Using a processor-specific code generation mode can result in
               programs that run faster.  Using an argument of mathlib_sr10 or
               any allows your program to run on a wider variety of platforms
               with some performance loss.  Use the cpuhelp utility to help
               you choose the -A cpu argument best suited to your needs.  For
               information about this utility, type "man cpuhelp".

               The mathlib_sr10, mathlib, and mathchip arguments are available
               only at Domain/C Version 6.8 and later.

     -A nansi  Do not compile with ANSI rules.  The default is -A xansi.

     -A runtype,sys
               Cause the compiler to use the run-time semantics of the
               specified systype, sys, regardless of the current environment
               setting.  For valid sys arguments, see the -A systype option.

     -A systype,sys
               Define the target system type (systype) for the compiled
               object. The sys argument may be one of the following:

                    TYPE           DESCRIPTION
                    bsd4.3         Berkeley version 4.3
                    sys5.3         UNIX System V.3
                    any            Program is independent of a particular UNIX
                                   system

               The -A systype option specifies which UNIX file system will be
               used at run-time (/bsd4.3 or /sys5.3).  It also specifies which
               run-time library (SysV or BSD) will be used at run-time if you
               do not specify the -A runtype option.  This option replaces the
               -T option.
               NOTE:  If you specify -A systype,any, calls that have different
               semantics in each UNIX environment may not work as expected.
               To insure proper behavior, specify a run-time environment with
               the -A runtype option.

     -A xansi  Support ANSI semantics except that the compiler may reorder
               expressions across parentheses (associative law).  Allow Domain
               extensions.  This mode is in effect by default unless -A ansi
               or -A nansi is specified.

     -c        Suppress the linking phase of the compilation and force an
               object file to be produced, even if only one program is
               compiled.

     -C        Pass along comments (except those found on preprocessor
               directive lines). By default, the preprocessor strips out
               comments.  (cc passes this option to cpp.)

     -Dname=def
     -Dname    Define the name to the preprocessor, as if by #define.  If you
               do not specify a definition, define name as 1.  If you use both
               -D and -U for the same name, the name is undefined, regardless
               of the order the options appear in. (cc passes this option to
               cpp.)

     -E        Run only the preprocessor on the named C programs, and send the
               result to standard output.

     -g        Generate full run-time debugging information needed for using
               dbx(1) or dde(1).  This option has the same effect as -W0,-dbs
               (that is, it does not affect the optimization level, which can
               be specified independently).

     -H        Print, one per line on standard error, the pathnames of
               included files.  With -A xansi (the default) or -A ansi, the
               list of included files is indented to show how the #include
               directives are nested; with -A nansi, the list is not indented.
               (cc passes this option to cpp.)

     -Idir     Change the search path for #include files with names not
               beginning with a slash (/) to look in dir before looking in the
               directories on the standard list.  Any #include files whose
               names are enclosed in double quotes ("") are searched for first
               in the directory of the file with the #include line, then in
               directories named in -I options, and last in directories on a
               standard list.  For #include files whose names are enclosed in
               angle brackets (<>), the directory of the file with the
               #include line is not searched.  (cc passes this option to cpp.)

     -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.  If the SYSTYPE environment variable is set
               to bsd4.3, ld also searches for libraries in /usr/local/lib.
               You can specify additional library directories with the -L
               option. (cc passes this option to ld.)

     -Ldir     Change the search path for libraries.  By default, the link
               editor 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 option is effective only if it
               precedes a -l option.  (cc passes this option to ld.)

     -m        Produce a map or listing of the input/output sections on
               standard input.  (cc passes this option to ld.)

     -o outfile
               Produce an output object file named outfile.  The name of the
               default file is a.out.  If you specify a different name, the
               system leaves any existing a.out file undisturbed.  (cc passes
               this option to ld.)

     -O        Turn on compiler optimizations (equivalent to -W0,-opt,3, the
               /com/cc default).  Level 0 optimization is the default for
               /bin/cc; therefore, use -O to get code of the same quality as
               /com/cc.

     -p        Arrange for the compiler to produce code that counts the number
               of times each routine is called.  If the cc command calls ld,
               replace the standard startup routine by one that 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. You can then use prof(1) to generate an execution
               profile.  (The -p option automatically activates the -W0,-
               ncompress option.  If you specify -W0,-compress in conjunction
               with -p, profiling will not work correctly.)

     -P        Run only the preprocessor on the named C programs, and leave
               the result in corresponding files suffixed with .i.  (cc passes
               this option to cpp.)

     -qg       Produce profiled code that allows profiling with gprof(1).
               Produce a gmon.out file at normal termination of execution of
               the object program.  (The -qg option automatically activates
               the -W0,-ncompress option.  If you specify -W0,-compress in
               conjunction with -qg, profiling will not work correctly.)

     -qp       Produce profiled code (identical to the -p option).

     -r        Preserve relocation entries in the output object module and
               suppress the allocation of a .bss section.  The output file is
               not executable unless -a is also specified.  Relocation entries
               must be preserved if the object file will be specified in a
               future ld command.  If you do not specify -r, ld removes
               relocation entries and allocates a .bss section.  To preserve
               relocation entries and also allocate a .bss section, specify
               both -r and -a.  (To generate position-independent code for a
               680x0 workstation, specify -W0,-pic, -r, and -a.)  (cc passes
               this option to ld.)

     -s        Strip line-number entries and symbol-table information from the
               output object file.  This option is equivalent to using the
               strip(1) utility and is useful if you want to reduce the size
               of the object module.  (cc passes this option to ld.)
               NOTES:  If you use the -s option, you cannot debug the
               resulting program with a source level debugger (dbx or dde).
               Also, you may not specify both the -s and -r options.

     -Uname    Remove any initial definition of name, where name is a reserved
               symbol that is predefined by the particular preprocessor.  On
               Apollo computers, unix, apollo, and aegis are defined.  (cc
               passes this option to cpp.)

     -Wc,arg1,[arg2...]
               Hand off the arguments argN to c, where c is one of p, 0, or l,
               indicating the preprocessor, compiler, or link editor,
               respectively.  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            Produce absolute code.  This option is the
                              default for compilers that generate 680x0 code,
                              and has no effect with compilers that generate
                              Series 10000 code.  The alternative option is
                              -pic, which causes the compiler to produce
                              position-independent code.

               -pic           Produce position-independent object code.  This
                              option is the default for compilers that
                              generate Series 10000 code.  For compilers that
                              generate 680x0 code, the default is -ac.

               -alnchk (D)    Display messages about alignment of structures.
                              Default for Series 10000 compilers.

               -nb            Do not generate an object file.  This option is
                              useful if you are compiling only to check for
                              errors in your program.

               -bx,pathname   Generate an object file that does not have the
                              default .o suffix.

               -bss (D)       Put uninitialized global variables in the .bss
                              section of the object file.
               -nbss          Put uninitialized global variables in named
                              sections.

               -cd            Compress debug information in the object file.
                              (Available only at Domain/C Version 6.9 and
                              later.)

               -ncd (D)       Do not compress debug information in the object
                              file.  (Available only at Domain/C Version 6.9
                              and later.)

               -comchk        Check for balanced comments and warn if comments
                              are not balanced.

               -ncomchk (D)   Suppress comment checking.

               -compress (D)  Store .data section object file data in
                              compressed form.

               -ncompress     Store .data section object file data in
                              uncompressed form.

               -db (D)        Generate minimal debugging information.

               -dbs           Generate full run-time debugging information
                              needed for using dbx(1) or dde(1).  Same as
                              /bin/cc -g option.

               -dba           Identical to -W0,-dbs except that no
                              optimization is performed (even less than with
                              -W0,-opt,0), even if you also specify -O or
                              -W0,-opt,n.

               -ndb           Do not generate any debugging information.

               -exp           Generate expanded code listing (implies -W0,-l).

               -nexp (D)      Suppress expanded code listing.

               -frnd          Rounds floating-point numbers at key points
                              during program execution.  Using this option may
                              result in a loss of performance.

               -nfrnd (D)     Optimizes execution by computing floating-point
                              expressions in greater precision than that
                              specified by the program, when the compiler
                              detects an opportunity to do so.

               -indexl        Use 32-bit indexing for all array references.

               -nindexl (D)   Use the 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 five informational levels are 0, 1, 2, 3,
                              and 4.  -W0,-info,0 is the default; it
                              suppresses informational messages.  If you
                              specify -W0,-info with no level argument, you
                              get level 2 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[,pathname]  Generate a compilation listing.  If no pathname
                              is specified, the listing is written to a file
                              with the same base name as the object file, but
                              with the suffix .lst replacing .c.

               -nl (D)        Suppress compilation listing.

               -map           Generate a symbol table map (implies -W0,-l).

               -nmap (D)      Suppress symbol table map.

               -msgs          Force compiler to print a final message listing
                              numbers of errors, warnings, and informational
                              messages, and the version of the compiler being
                              used.

               -nmsgs (D)     Suppress final compilation message.

               -natural       Use natural alignment for structures and array
                              elements that do not have alignment attributes.

               -nnatural (D)  Use word alignment for structures and array
                              elements that do not have alignment attributes.

               -nclines       Suppress the generation of COFF line number
                              tables.  This option has no effect on compilers
                              that generate code for Series 10000
                              workstations.

               -nfpra         Suppress the reordering of operands in
                              floating-point expressions at optimization level
                              4.

               -opt[,n]       Perform global optimization.  n is a single-
                              digit integer in the range 0 to 4, indicating
                              the level of optimization performed.  If n is
                              omitted, 3 is the default level.  If you do not
                              specify -W0,-opt, the default level of
                              optimization is 0.  Increasing the optimization
                              level results in faster execution of your
                              program, at the expense of longer compilation
                              time.  See the Domain/C Language Reference for
                              details.

               -prasm (D)     Use Series 10000 assembly language format for
                              the expanded listing generated by -exp.
                              NOTE:  This option has no effect if you use it
                              without the -W0,-exp option, or if you use it
                              with a compiler that generates code for 680x0-
                              based workstations.

               -nprasm        Use an alternate version of Series 10000
                              assembly language format for the expanded
                              listing generated by -W0,-exp.
                              NOTE:  This option has no effect if used without
                              the -W0,-exp option, or if you use it with a
                              compiler that generates code for 680x0-based
                              workstations.

               -std           Issue warning messages for some Domain
                              extensions to C.

               -nstd (D)      Do not issue warning messages for some Domain
                              extensions to C.

     -Y[p0lSILU],dirname
               Specify a new pathname, dirname, for the locations of the tools
               and directories designated by the first argument.  You can
               include only one letter or number per -Y option, but there is
               no limit to the number of -Y options per compilation.  The
               valid letters and numbers, and their meanings, are as follows:

                      p       Preprocessor (cpp).  Specify the pre-ANSI
                              preprocessor with -Yp,/usr/lib.
                      0       Compiler (cc)
                      l       Link editor (ld)
                      S       Directory containing start-up routine
                              (/usr/apollo/lib/crt0.o)
                      I       Default include directory searched
                              by preprocessor (/usr/include)
                      L       First default library directory
                              searched by link editor (/usr/lib)
                      U       Second default library directory searched
                              by link editor (no default)

               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
               specified for any one tool or directory, the last one listed is
               applied.  The following command tells cc to find the compiler
               in the directory /usr/lib/old:  cc -Y0,/usr/lib/old filename.c

     cc also recognizes -C, -D, -H (in conjunction with -A nansi), -I, and -U
     and passes these options and their arguments directly to the preprocessor
     without using the -W option.  Similarly, cc recognizes -a, -A, -l, -L,
     -m, -o, -r, -s, and -u, and passes these options and their arguments
     directly to the link editor.  See cpp(1) and ld(1).

     Other arguments are taken to be C compatible object programs, typically
     produced by an earlier cc run, or perhaps libraries of C compatible
     routines, and are passed directly to the link editor.  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 option of the link editor is used.

     If cc is put in the file prefixcc, the prefix will be parsed off the
     command and used to call the tools, that is, prefixtool.  For example,
     OLDcc will call OLDcpp, OLDcomp, and OLDld, and will link OLDcrt1.o.
     Therefore, you MUST be careful if you move cc around and rename it.  The
     prefix will apply to the preprocessor, compiler, link editor, and start-
     up routines.

NOTES
     By default, the return value from a compiled C program is completely
     random. The only two guaranteed ways to return a specific value are to
     explicitly call exit(2) or to leave the function main() by means of a
     return statement with an expression.

FILES
     file.c                     C source file
     file.i                     Preprocessed C source file
     file.o                     Object file
     a.out                      Link edited output
     LIBDIR/crt0.o              Start-up routine
     LIBDIR/mcrt0.o             Start-up routine for profiling
     LIBDIR/mcrt0.o             Start-up routine for gprof profiling
     TMPDIR/ctm*                Temporary files
     /sys5.3/usr/apollo/lib/cpp ANSI C preprocessor, cpp(1)
     /sys5.3/usr/lib/cpp        Pre-ANSI C preprocessor, cpp(1)
     /sys5.3/usr/apollo/lib/cc  Compiler
     /sys5.3/bin/ld             Link editor, ld(1)

     LIBDIR is /sys5.3/usr/apollo/lib if you compile with -A xansi (the
     default) or -A ansi; it is /sys5.3/usr/lib if you compile with -A nansi.

     TMPDIR is usually /tmp but can be redefined by setting the environment
     variable TMPDIR [see tempnam() in tmpnam(3S)].

SEE ALSO
     cpp(1), dbx(1), dde(1), gprof(1), ld(1), lint(1), monitor(3C), prof(1),
     tmpnam(3S).
     Domain/C Language Reference
     The C Programming Language (Second Edition), B. W. Kernighan and D. M.
     Ritchie.  Prentice-Hall, 1988.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026