Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cc(1) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                    cc(1)



        _________________________________________________________________
        cc                                                        Command
        C language compiler
        _________________________________________________________________


        SYNTAX

        cc [ option ... ] filename ...  [ indirect filename ] [
        SYMBOL=VALUE ... ]


        DESCRIPTION

        The cc command invokes the C compiler and linker to create an
        executable module, which is called a.out by default.  It will
        compile any number of C source files into object files, then link
        these files to create the executable module.

        Cc assumes that files whose names end with .c contain C source
        programs.  A compiled source file is given the extension .o in
        place of .c.  The .o file is normally deleted if a single C
        program is compiled and loaded all at once.  Cc assumes that
        files whose names end with .s contain assembler source code;
        assembled output from .s files is left in a .o file.  Files
        without extensions are assumed to be indirect files containing
        ld(1) options, and are passed to ld(1).  Symbol assignments of
        the form SYMNAME=VALUE are also passed to ld(1).

        There must be only one main() function linked among the object
        files to successfully create an executable module.  Object files
        created by other language processors may be linked together with
        object files created by cc.

        Command-line options are handled by cc(1), the C compiler or
        macro assembler, or ld(1), the link editor.  They are passed
        through automatically, as required.


           Cc options

        Cc handles the following options:

        -B[path]      Construct pathnames for an alternate C compiler,
                      F77 compiler, Pascal compiler, assembler, and
                      linker by concatenating path with ccomp, f77,
                      pcomp, as, and ld, respectively.  The default path
                      is:
                           /usr/dgc/occomp
                           /usr/f77/ofcomp
                           /usr/pascal/opcomp



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



                           /lib/oas
                           /lib/old

        -c            Do not link object files.

        -C            Do not strip comments when producing preprocessor
                      output.

        -Coption      Specify an AOS/VS C option (see below for a list of
                      options).

        -Dname        Define name to be 1.

        -Dnm[=value]  Define name nm to be value.  Value can be integers
                      or character strings; the default for value is 1.

        -E            Put preprocessor output on the standard output.

        -f            Ignored.

        -F            Cause the compiler to generate code for single
                      precision arithmetic whenever an expression
                      contains float variables and no doubles (note,
                      floating point constants are double by default).

        -g            Produce information for the source-level debuggers.

        -H            Print out on the standard error file the pathname
                      of each file included during the current
                      compilation.

        -Idir         Search for include files in dir before searching
                      the /usr/include directory.

        -Jsystem      Reserved for specifying an alternate operating
                      system.

        -j[012]       Specify the error level that is acceptable [-j2 is
                      the default]
                      [-j0 delete object file on any error]
                      [-j1 Level 1 warnings are not considered a fatal
                      error]
                      [-j2 Level 1 warnings and Level 2 errors are not
                      fatal]
                      [note: level 3 warnings are always fatal]

        -O[level]     Specify the optimization level as follows:
                      none (0) -- No optimizations.
                      debug (1) -- Optimize and allow debugging.
                      nofloat (2) -- Don't reorder floating point.
                      all (3) -- All optimizations.



        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



        -p            Arrange for the compiler to produce code to count
                      the number of times each routine is called; also if
                      linking takes place, profiled versions of the C
                      libraries are linked in, and monitor(3C) is
                      automatically called.  A mon.out file will then be
                      produced at the normal termination of the object
                      program.  An execution profile can then be
                      generated by use of prof(1).

        -P            Put preprocessor output in a file named file.i.

        -qp           Arrange for profiled code to be produced where the
                      p argument produces identical results to the -p
                      option [allows profiling with prof(1)].

        -R            Put initialized variables into read-only memory.

        -S            After compilation, run a disassembler to produce an
                      assembly language file that can be assembled to
                      give an equivalent object file.  Note that the
                      object file produced by the compilers and that
                      produced by the assembler after assembling a file
                      produced with -S will not compare exactly.  This is
                      due to the fact that the compilers and the
                      assembler produce object blocks in different
                      orders.

        -t[opt...]    Find only the designated facility specified with
                      the -B option and indicated by opt:
                        a  assembler
                        c  C compiler
                        f  F77 compiler
                        l  linker
                        p  Pascal compiler
                      The default for opt is cfp.  If -B is omitted, the
                      following pathnames are used:
                           /usr/dgc/nccomp
                           /usr/f77/nfcomp
                           /usr/pascal/npcomp
                           /lib/nas
                           /lib/nld

        -Uname        Undefine the initial use of name (either defined
                      with -D or defined by the compiler, i.e., DGUX).

        -v            Operate verbosely:  Print the command lines of cc,
                      f77, pc, as, and ld as they are executed.

        -W,opt,arg... Pass each arg to the facility specified by the opt
                      letter, which is one of the following:
                        a  assembler



        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



                        c  C  compiler
                        f  F77 compiler
                        l  linker
                        p  Pascal compiler
        -Y0, dir      Find the C compiler (ccomp) in dir.
        -Yc, dir      Find the C compiler (ccomp) in dir.
        -Yl, dir      Find the linker in dir.
        -Yp, dir      Find an alternate C preprocessor in dir.
        -YI, dir      Use dir as the default include file directory
                      instead of /usr/include.


           Options for compatibility with AOS/VS

        -Coption  Specify an AOS/VS C option as follows:
                  backspace[=n] Define the backspace character to be
                                ASCII character n.
                  brieferror    Brief error messages.
                  checkoffset   Check that members with same name are at
                                the same offset
                  code          Write out code listing.
                  commonformat  Pass all pointers as byte pointers (see
                                "EXCEPTIONS" below).
                  e=file        Redirect error messages to file.
                  errorcount=n  Specify maximum number of errors (n) to
                                accept before stopping.
                  extl          Items declared with an explicit extern
                                storage class get compiled as references
                                instead of data definitions.  (In
                                Revision 4.00, this is the default; you
                                will have to use noextl to get the
                                current behavior.)
                  fixedoverflow Turn on fixed overflow checking.
                  flagdefines   Flag if a macro was used on current line.
                  framesize     Print out stack needed for each function.
                  l[=file]      Produce a listing file.
                  lineid        Print line number of statement in
                                tracebacks.
                  lowercase     Map identifiers to lower case.
                  ls            Produce listing file of form file.ls.
                  n             Do not produce an object file.
                  noextl        Starting with revision 4.00 items
                                declared with an explicit extern storage
                                class normally get compiled as references
                                instead of data definitions.  If you use
                                this option, the C compiler will create
                                storage definitions when an explicit
                                extern storage class is used, and the
                                item is not a function reference or an
                                array without bounds.
                  noincludes    Do not print include files on listing



        DG/UX 4.00                                                 Page 4
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



                                file.
                  nomap         Do not produce a storage map on listing
                                file.
                  optimize[=n]  Optimize (same as -O[n]).
                  partcode=name Specify the partition the code goes into.
                  partshort=name
                                Specify the partition name that $low32k
                                static goes into.
                  partstatic=name
                                Specify the partition name that static
                                goes into.
                  pointercheck[=flag]
                                Check pointers for validity.  Flag
                                values:
                                validity - check all pointers
                                cvalidity - check only at call
                                inline - inline byte/word pointer check
                                cinline - byte/word pointer check at call
                  procid        Print function name in tracebacks.
                  revision=rev  Specify module revision number rev.
                  sharedstring  Place strings in write-protected memory.
                  shortarithmetic
                                Use 16-bit and single precision
                                arithmetic if possible.
                  signedchar    Normal chars (not unsigned) produce ints
                                in range -128 to 127.
                  statistics    Generate compiler statistics.
                  subcheck      Turn on subscript checking.
                  tempdir=dir   Specify alternate directory dir for
                                temporary files.
                  unique=n      Truncate all identifiers to n characters;
                                n must be in the range 8 to 255.
                  warnings      Print warnings.
                  xref          Generate a cross reference.
        -Foption  Specify an F77 option (see f77(1) for the list and
                  descriptions).
        -Poption  Specify a Pascal option (see pc(1) for the list and
                  descriptions).
        -ps file  Passed to the assembler; specifies that file contains
                  the symbol table.
        Option for -C, -P, or -F may be uppercase or lowercase in DG/UX,
        as they can be in AOS/VS.


           Ld options

        Indirect files on the cc(1) command line must contain exactly one
        ld(1) option, object filename, or symbol assignment per line.
        Options that can be passed to ld(1) from the cc(1) command line
        are:
        -e symbol   Starting address is symbol.



        DG/UX 4.00                                                 Page 5
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



        -Jsystem    Reserved for specifying an alternate operating
                    system.
        -lname      Search for library libname.a.
        -L dir      Search for libraries in dir before searching /lib and
                    /usr/lib.
        -m          Produce a link map.
        -M          Warn about multiply-defined symbols.  At present,
                    this produces many errors for the current C and
                    common language libraries.
        -N          Compress text and data.
        -o file     Executable module is called file instead of a.out.
        -q          Don't squash the bss area.
        -r          Produce relocatable output which can be used as an
                    input file to a subsequent ld run.  The linker will
                    not complain about unresolved references, and the
                    output file will not be executable.  This requires
                    the revision 4.00 DG/UX linker.
        -RD num     Set beginning data address to num.
        -RT num     Set beginning text address to num.
        -s          Strip symbol table information.
        -u name     Add name as an external.
        -V          Print the revision number of ld and as.  Also print
                    the C header (which includes the C revision number).
        -VS rev     Set program's revision number to rev.
        -x          Strip out local symbols.
        -z          Ignored.  In other versions, this forces address zero
                    not to be bound to check for NULL pointers.  Since
                    users are always bound to ring 7 under DG/UX, address
                    zero is never valid.
        SYMNAME=VALUE
                    Assign DG/UX-format VALUE to symbol SYMNAME.  If
                    VALUE is to be 16, it would be 16 in decimal, 020 in
                    octal, and 0x10 in hexadecimal.  This option is
                    commonly used to change the symbol values that
                    control heap and stack areas (.RESERVE .STKSIZE
                    .HPSIZE .STORAAGE).  See the C Language Reference
                    Manualand Using the Standard C Runtime
                    Environmentmanual.



        _________________________________________________________________
        EXAMPLES

        $  cc -c prog.c 2> errorlist

        Compiles the program prog.c without invoking the linker and puts
        any compiler error messages in error_list.

        $ cc -O3 -o fastprog slow.c




        DG/UX 4.00                                                 Page 6
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



        Compiles and links slow.c.  The compiler will use it's highest
        level of optimization and the linker will put the executable file
        in fast_prog instead of the default file a.out.

        $ cc -RT 750000 bigprog

        This example sets the text boundary to 750000 (decimal).  If the
        program being compiled declares more variable space than provided
        by default, the -RT switch can be used to move the text boundary
        up which in turn creates more unshared data space (the executable
        image resides above the text boundary; unshared data and the
        stack and heap reside below).
        _________________________________________________________________


        FILES

        file.c                   C source files
        file.o                   Object files
        file.s                   Assembler
        a.out                    Linked output
        /tmp/ctm*                Temporary files
        /usr/dgc/ccomp           C compiler
        /usr/dgc/cdriver         Error messages for the C compiler
        /usr/dgc/briefcdriver   Brief error messages
        /bin/as                  Assembler, as(1)
        /bin/ld                  Linker, ld(1)
        /lib/libcrypt.a          crypt library
        /lib/libc.a              Standard C runtime library
        /usr/lib/proto/libc.a    Common language library


        SEE ALSO

        as(1), cc(1), cpp(1), dbx(1), f77(1), ld(1).
        The (3C) sections on the C runtime libraries, in the Programmer's
        Reference for the DG/UX System.
        C Language Referenceand Using the Standard C Runtime
        Environmentmanuals.
        AOS/VS  Link and LFE User's Manual, especially "Link Command
        Line."
        "The DG/UX Assembler: as" and "The DG/UX Linker: ld" in
        Programming on the DG/UX System.


        DIAGNOSTICS

        The diagnostics produced by C are intended to be self-
        explanatory.  Occasional messages may be produced by the link
        editor.




        DG/UX 4.00                                                 Page 7
               Licensed material--property of copyright holder(s)





                                                                    cc(1)



        The following values are returned to the parent process of the
        cc(1) command:
             0    No errors
             1    Warning message(s) produced (with -C warnings)
             2    Error(s) were corrected by the compiler
             3    Serious compiler error(s)
             4    Compiler aborted
             5    Assembler error(s)
             6    Reserved
             7    Reserved
             8    Ld error(s)
             9    Compiler trapped or terminated by a signal
             10   Error(s) in cc (f77, pc) command

        EXCEPTIONS

        In Data General's MV architecture the format of pointers to
        byte-aligned entities is not the same as the format of pointers
        to word-aligned entities.  This fact will not normally cause C
        programmers any difficulty.  However, some C programmers use
        pointers and integers interchangeably.  They pass them through
        arguments and assign them back and forth without using casts, as
        if they were the same.  This practice can cause problems when
        some of the pointers are to byte-aligned entities and some are to
        word-aligned entities.  Note that as long as programmers follow
        Appendix A, Section 14.4 of The C Programming Language by
        Kernighan and Ritchie, they will not be bothered by this problem.

        If code that does not obey Kernighan and Ritchie rules regarding
        pointers and integers must be ported to DG/UX, then you may use
        the commonformat feature of Data General C to port the code.
        Each source file that will be linked into such a program should
        be compiled using the -Ccommonformat option.  When all source
        files have been compiled, link them using ld(1).  The standard C
        libraries can be used, but for other libraries and programs, you
        must make sure that all modules are compiled with -Ccommonformat.
        Programmers should note that using this option reduces the
        performance of the program.

        Alternatively, you may wish to rewrite the code with the aid of
        the compiler option -Cpointercheck.













        DG/UX 4.00                                                 Page 8
               Licensed material--property of copyright holder(s)



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