Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cc(CP) — Xenix 2.3.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(CP)

ld(CP)

lint(CP)

machine(M)

masm(CP)

ranlib(CP)



     CC(CP)                   XENIX System V                    CC(CP)



     Name
          cc - Invokes the C compiler.

     Syntax
          cc [ option ... ] filename ...

     Description
          cc is the XENIX C compiler command.  It creates executable
          programs by compiling and linking the files named by the
          filename arguments.  cc copies the resulting program to the
          file a.out.

          The filename can name any C or assembly language source file
          or any object or library file.  C source files must have a
          .c filename extension.  Assembly language source files must
          have .s, object files .o, and library files .a extensions.
          cc invokes the C compiler for each C source file and copies
          the result to an object file whose basename is the same as
          the source file but whose extension is .o.  cc invokes the
          XENIX assembler, masm , for each assembly source file and
          copies the result to an object file with extension .o.  cc
          ignores object and library files until all source files have
          been compiled or assembled. It then invokes the XENIX link
          editor, ld , and combines all the object files it has
          created together with object files and libraries given in
          the command line to form a single program.

          Files are processed in the order they are encountered in the
          command line, so the order of files is important.  Library
          files are examined only if functions referenced in previous
          files have not yet been defined.  Library files must be in
          ranlib(CP) format, that is, the first member must be named
          __.SYMDEF, which is a dictionary for the library.  Only
          those functions that define unresolved references are
          concatenated.  A number of ``standard'' libraries are
          searched automatically.  These libraries support the
          standard C library functions and program startup routines.
          Which libraries are used depends on the program's memory
          model (see ``Memory Models'' below).  The entry point of the
          resulting program is set to the beginning of the standard
          startup code which then calls the ``main()'' function of the
          program.

          There are the following options:

          -c
               Creates a linkable object file for each source file but
               does not link these files.  No executable program is
               created.

          -C   Preserves comments when preprocessing a file with -E ,
               -P , or -EP.  That is, comments are not removed from



     Page 1                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



               the preprocessed source.  This option may only be used
               in conjunction with -E , -P , or -EP.

          -compat
               Makes an executable file that is binary compatible
               across the following systems (as distributed by certain
               vendors):

               -286 System V
               -386 System V
               -286 3.0
               -8086 System V

          -CSON,  -CSOFF
               When optimization (-O) is also specified, these options
               enable or disable ``common sub-expression''
               optimization.  The default is disabled for the small
               model passes and enabled for the large (with -LARGE).

          -d   Displays the various passes and their arguments before
               they are executed.

          -Dname[=string ]
               Defines name to the preprocessor as if defined by
               #define in each source file.  The form ``-Dname'' sets
               name to 1.  The form ``-Dname=string'' sets name to the
               given string.

          -dos Directs cc to create an executable program for MS-DOS
               systems.

          -E   Preprocesses each source file as described for -P, but
               copies the result to the standard output. The option
               also places a #line directive with the current input
               line number and source file name at the beginning of
               output for each file.

          -EP  Preprocesses each source file as described for -E, but
               does not place a #line directive at the beginning of
               the file.

          -F num
               Sets the size of the program stack to num bytes.  The
               value of num must be given in hexadecimal.  The default
               stack for the 8086 is variable, starting at the top of
               a full 64 Kbyte data segment that grows down until it
               reaches data.  The default stack for the 80286 is 1000
               bytes (hexadecimal).  This option does not apply to the
               80386, which has a variable stack.

          -Fa, -Faname
               Create an assembly source listing in source.s or the



     Page 2                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



               named file.  Continues with the link if requested.

          -Fc, -Fcname
               Create a merged assembler and C listing in source.L or
               in the named file.

          -Fename
               Names the executable program file name.

          -Fl, -Flname
               Create a listing file in source.L (or the named file)
               with assembly source and object code.  Continues with
               the link if requested.

          -Fm, -Fmname
               Instruct the linker to create a map listing in a file
               called a.map (or the named file).  This file contains
               the names of all segments in order of their appearance
               in the load module.

          -Foname
               The object filename will be name instead of source.o.

          -FPa, -FPc, -FPc87, -FPi, -FPi87
               When used in conjunction with -dos these options
               control the type of floating point code generated and
               which library support to use.  The default is -FPi.
               For more information see Appendix A, of the C Library
               Guide .

          -Fs, -Fsname
               Creates a C source listing in source.S or the named
               file.

          -g
               Includes information for the symbolic debugger. (This
               is equivalent to the -Zi option.)

          -i
               Creates separate instruction and data spaces for small
               model programs. When the output file is executed, the
               program text and data areas are allocated separate
               physical segments.  The text portion will be read-only
               and may be shared by all users executing the file.
               This option is implied when creating middle or large
               model programs.  (Not implemented on all machines.)

          -I pathname
               Adds pathname to the list of directories to be searched
               when an #include file is not found in the directory
               containing the current source file or whenever angle
               brackets (< >) enclose the filename.  If the file



     Page 3                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



               cannot be found in directories in this list,
               directories in a standard list are searched.

          -K   Removes stack probes from a program. Stack probes are
               used to detect stack overflow on entry to program
               routines.  Code
               generated for the 80386 processor does not require
               stack probes, therefore this option has no effect if
               -M3 is specified.

          -lname
               Searches library name for unresolved function
               references.

          -L   Creates an assembler listing file containing assembled
               code and assembly source instructions.  The listing is
               made in a file whose basename is the same as the source
               but whose extension is .L.  This option suppresses the
               -S option.

          -LARGE
               Invokes the large model passes of the compiler
               (executable on 286 and 386 processors only).  Using
               large model passes is advised when ``Out of heap
               space'' errors are encountered.

          -M string
               Sets the program configuration.  This configuration
               defines the program's memory model, word order, and
               data threshold.  It also enables C language
               enhancements such as advanced instruction set and
               keywords. The string may be any combination of the
               following (``s'', ``m'', ``l'', and ``h'' are mutually
               exclusive):

               s    Creates a small model program (default).
               m    Creates a middle model program.
               l    Creates a large model program.
               h    Creates a huge model program.
               e    Enables the far, near, huge, pascal, and fortran
                    keywords.  Also enables certain non-ANSI
               entensions
                    necessary to ensure compatibility with existing
                    versions of the C compiler (applies only to
               versions
                    of the C compiler that support ANSI C).
               0    Enables 8086 code generation for compiled C source
                    files. Default is 8086 code generation.
               1    Enables 186 code generation for compiled C source
                    files.
               2    Enables 286 code generation for compiled C source
                    files.



     Page 4                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



               3    Enables 386 code generation for compiled C source
                    files (80386 processors only).
               b    Reverses the word order for long types.  High
               order
                    word is first.  Default is low order word first.
               tnum    Causes all data items greater than num bytes
                    to be allocated to a new data segment. Num,
                    the  data threshold, defaults to 32,767. This
               option
                    can only be used in large model 8086/80286
               programs
                    (Ml0 or Ml2).
               d    Instructs the compiler to not assume SS=DS.
                    Warning: This option has no practical use on
               XENIX.
                    It will not cause the stack to be put in a
               separate
                    segment. It may be used for DOS cross development.


          -n   Sets pure text model. This option is equivalent to the
               -i option. Gives a warning that it is setting -i when
               used.

          -ND name
               Sets the data segment name for each compiled or
               assembled source file to name. If -ND is not given, the
               name ``_DATA'' is used.

               In large model programs (-Ml) the -ND option can only
               be used on "leaf modules" - those that make no calls to
               routines in another segment.

          -nl num
               Sets the maximum length of external symbols to num.
               Names longer than num are truncated before being copied
               to the external symbol table.

          -NM name
               Sets the module name for each compiled or assembled
               source file to name. If not given, the filename of each
               source file is used.

          -NT name
               Sets the text segment name for each compiled or
               assembled source file to name. If not given, the name
               ``module_TEXT'' is used for middle model and ``_TEXT''
               for small model programs.  This option should not be
               used on 386 code.

          -o filename
               Defines filename to be the name of the final executable



     Page 5                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



               program.  This option overrides the default name a.out.
               Filename can not end in .o or .c.

          -O string
               Invokes the object code optimizer. The string consists
               of one or more of the following characters:
               d    Default. Disables optimization
               a    Relaxes alias checking
               s    Optimizes code for space
               t    Default. Optimizes code for speed. Equivalent to
               -O
               x    Performs maximum optimization. Equivalent to
               -Oactl
               c    Eliminates common expressions
               l    Performs various loop optimizations.


          -p
               Adds code for program profiling.  Profiling code counts
               the number of calls to each routine in the program and
               copies this information to the mon.out file.  This file
               can be examined using the prof(CP) command.

          -P
               Preprocesses each source file and copies the result to
               a file whose basename is the same as the source but
               whose extension is .i.

          -pack
               Packs structures.  Each structure member is stored at
               the first available byte, without regard to int
               boundaries.  Although this will save space, execution
               will be slower because of the extra time required to
               access 16 bit members that begin on odd boundaries.

          -r   Invokes the incremental linker, /lib/ldr , for the link
               step.

          -s   Instructs the linker to strip the symbol table
               information from the executable output file.

          -S
               Creates an assembly source listing in a file whose
               basename is the same as the source but whose extension
               is .s.  It should be noted that this file is not
               suitable for assembly.  This option provides code for
               reading only.

          -SEG num
               Sets the maximum number of segments that the linker can
               handle to num, which can range from 1 to 1024.  If 1024
               is too small, use the -NT option to reduce the number



     Page 6                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



               of different segment names.

          -u   Eliminates all manifest defines.  Also see -U.

          -U definition
               Removes or undefines the given manifest define.  The
               manifest defines are as follows:

               M_I86
               M_XENIX
               M_SYS3 or M_SYSIII
               M_SYS5 or M_SYSV
               M_BITFIELDS
               M_WORDSWAP
               M_SDATA or M_LDATA
               M_STEXT or M_LTEXT
               M_I8086 or M_I186 or M_I286 or M_I386
               M_I86SM or M_I86MM or M_I86LM

          -V string
               Copies string to the object file created from the given
               source file.  This option can be used for version
               control.

          -w   Prevents compiler warning messages from being issued.
               Same as ``-W 0''.

          -W num
               Sets the output level for compiler warning messages.
               If num is 0, no warning messages are issued.  If 1,
               only warnings about program structure and overt type
               mismatches are issued. If 2, warnings about strong
               typing mismatches are issued. If 3, warnings for all
               automatic conversions are issued.  This option does not
               affect compiler error message output.

          -X   Removes the standard directories from the list of
               directories to be searched for #include files.

          -z   Displays the various passes and their arguments but
               does not execute them.

          -Zp1, -Zp2, -Zp4
               Aligns data structures on one, two or four-byte
               boundaries (80386 only).

          -Zi  Includes information used by the symbolic debugger
               (sdb) in the output file.  (This is equivalent to the
               -g option.)

          Many options (or equivalent forms of these options) are
          passed to the link editor as the last phase of compilation.



     Page 7                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



          The -M option with the ``s'', ``m'', and ``l'' configuration
          options are passed to specify memory requirements.  The -i,
          -F, and -p are passed to specify other characteristics of
          the final program.

          The -D and -I options may be used several times on the
          command line.  The -D option must not define the same name
          twice.  These options affect subsequent source files only.


     Memory Models
          cc can create programs for four different memory models:
          small, middle, large, and huge.  In addition, small model
          programs can be pure or impure.  On the 8086 and 80286
          processors, these various segmentation models allow programs
          with code or data larger than 64K bytes.  Since the 80386
          can address segments larger than 64K bytes, the middle,
          large and huge models are not supported on the 80386.

          Impure-Text Small Model
               These programs occupy one 64K byte physical segment in
               which both text and data are combined.  cc creates
               impure small model programs by default.  They can also
               be created using the -Ms option.

          Pure-Text Small Model
               These programs occupy two 64K byte physical segments.
               Text and data are in separate segments. The text is
               read-only and may be shared by several processes at
               once.   The maximum program size is 128 Kbytes.  Pure
               small model programs are created using the -i and -Ms
               options.

          Middle Model
               These programs occupy several physical segments, but
               only one segment contains data.  Text is divided among
               as many segments as required.  Special calls and
               returns are used to access functions in other segments.
               Text can be any size. Data must not exceed 64K bytes.
               Middle models programs are created using the -Mm
               option.  These programs are always pure.

          Large Model
               These programs occupy several physical segments with
               both text and data in as many segments as required.
               Special calls and returns are used to access functions
               in other segments.  Special addresses are used to
               access data in other segments.  Text and data may be
               any size, but no data item may be larger than 64K
               bytes.  Large model programs are created using the -Ml
               option.  These programs are always pure.




     Page 8                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



          Huge Model
               These programs occupy several physical segments with
               both text and data in as many segments as required. It
               is possible to allow a data construct that spans 64K
               byte segments. This implementation imposes limits on
               the way the data construct is put together and where it
               is located in memory.  Huge model programs are created
               using the -Mh option.  These programs are always pure.

            Small, middle, large and huge model object files can only
            be linked with object and library files of the same model.
            It is not possible to combine small, medium, large, and
            huge model object files in one executable program.  cc
            automatically selects the correct small, middle, large, or
            huge versions of the standard libraries based on the
            configuration option.  It is up to users to make sure that
            all of their own object files and private libraries are
            properly compiled in the appropriate model.

            The special calls and returns used in middle, large, and
            huge model programs may affect execution time.  In
            particular, the execution time of a program which makes
            heavy use of functions and function pointers may differ
            noticably from small model programs.

            In middle, large, and huge model programs, function
            pointers are 32 bits long.   In large and huge model
            programs, data pointers are 32 bits long.  Programs making
            use of such pointers must be written carefully to avoid
            incorrect declaration and use of these variables.

            The -NM, -NT, and -ND options may be used with middle,
            large, and huge model programs to direct the text and data
            of specific object files to named physical segments.  All
            text having the same text segment name is placed in a
            single physical segment.  Similarly, all data having the
            same data segment name is placed in a single physical
            segment.

          cc reads /etc/default/cc to obtain information about default
          options and libraries. The default file may contain lines
          beginning with the following patterns:

               FLAGS=
          and
               LIBS=

          Any parameters following the FLAGS= pattern are treated by
          cc as if they had been specified at the start of the cc
          command line. Parameters following the LIBS= pattern are
          treated as if they had been specified at the end of the
          command line. This option is intended for, but not



     Page 9                                           (printed 8/7/87)





     CC(CP)                   XENIX System V                    CC(CP)



          restricted to, the specification of additional libraries.
          cc always searches for a file in /etc/default that matches
          the last component of the pathname by which cc was invoked.
          Thus by linking cc to several different names and invoking
          it by those names, different defaults can be selected.

          An example /etc/default/cc file follows:

          FLAGS= -LARGE -M2e

          LIBS= -lx

          This invokes the large model versions of the compiler passes
          to generate 286 code with far and near keywords enabled, and
          includes libx.a on all links.


     Files
          /bin/cc                  Driver
          /lib/p0, p1, p2, p3      Small model passes
          /lib/p1L, p2L, p3L       Large model passes
          /lib/*.a                 Standard libraries
          /etc/default/cc               Default options and libraries


     See Also
          ar(CP), ld(CP), lint(CP), machine(M), masm(CP), ranlib(CP)
          XENIX C User's Guide, C Library Guide, and C Language
          Reference

     Notes
          Error messages are produced by the program that detects the
          error.  These messages are usually produced by the C
          compiler, but may occasionally be produced by the assembler
          or the link loader.

          All object module libraries must have a current ranlib
          directory. The user must make sure that the most recent
          library versions have been processed with ranlib(CP) before
          linking.  If this is not done, ld cannot create executable
          programs using these libraries.














     Page 10                                          (printed 8/7/87)



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