Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dbx(1)

ld(1)

pixie(1)

prof(1)

what(1)

monitor(3)

cc(1)  —  RISC

Name

cc − RISC C compiler

Syntax

cc [ option ] ...  file ... 

Description

The cc command invokes the RISC ucode C compiler.  It produces RISC object code in RISC extended coff format (the default), binary or symbolic ucode, ucode object files and binary or symbolic assembly language. 

The cc command accepts the following arguments:

•Arguments ending in .c are interpreted as C source programs.  They are compiled, and the resulting object file has the same name as the source program except .o is substituted for .c.  If a single C source program is compiled and loaded at once, the .o file is deleted. 

•Arguments ending in .s are interpreted as assembly source programs.  When they are assembled, they produce a .o file. 

•Arguments ending in .i are interpreted as C source after being processed by the C preprocessor.  They are compiled without being processed by the C preprocessor. 

If the highest level of optimization is specified (with the −O3 flag) or only ucode object files are to be produced (with the −j flag) each C source file is compiled into a ucode object file. The ucode object file is left in a file whose name consists of the last component of the source with .u substituted for .c. 

The following suffixes aid compiler development, but are not generally used: .B, .O., .S, and .M.  These arguments are interpreted as binary ucode, produced by the front end, optimizer, ucode object file splitter, and ucode merger respectively.  Arguments whose names end with .U are assumed to be symbolic ucode. Arguments whose names end with .G are assumed to be binary assembly language, which is produced by the code generator and the symbolic to binary assembler.

Files that are assumed to be binary ucode, symbolic ucode, or binary assembly language by the suffix conventions are also assumed to have their corresponding symbol table in a file with a .T suffix.

The cc command always defines the C preprocessor macros LANGUAGE_C and __LANGUAGE_C when a .c file is being compiled.  The cc command defines the C preprocessor macros LANGUAGE_ASSEMBLY and __LANGUAGE_ASSEMBLY when a .s file is compiled. 

Options

The following options are interpreted by cc(.). See ld() for load-time options.

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

−g0 Do not produce symbol table information for symbolic debugging.  This is the default. 

−g1 Produce debugger symbol table information. This option limits optimization, but some optimizations that affect debugger accuracy might be performed. The debugger symbol table is built before optimizations and cannot reflect the optimizations. 

−g or −g2 Produce debugger symbol table information and inhibit optimizations that limit full symbolic debugging. The debugger symbol table is accurate. 

−g3 Produce debugger symbol table. This option does not limit optimizations, so the symbol table may be inaccurate. The symbol table is built before optimizations and cannot reflect the optimizations. 

−L Change the algorithm of searching for libx.a or libx.b to never look in the default directories.  This is useful when the default directories for libraries should not be searched and only the directories specified by the ld() option −Ldir are to be searched. 

−w or −w1 Suppress warning messages. 

−w2 Abort on a warning message after printing it, as if an error occurred. 

−w3 Do not print warning messages.  Exit with nonzero status when a warning occurs. 

−p0 Do not permit profiling.  This is the default.  If loading happens, the standard runtime startup routine (crt0.o) is used and the profiling libraries are not searched. 

−p1 or −p Set up for profiling by periodically sampling the value of the program counter.  This option only affects the loading.  When loading happens, this option replaces the standard runtime startup routine with the profiling runtime startup routine (mcrt0.o) and searches the level 1 profiling library (libprof1.a).  When profiling happens, the startup routine calls monstartup() and produces a file mon.out that contains execution-profiling data for use with the postprocessor prof(.).

−O0 Turn off all optimizations. 

−O1 Turn on all optimizations that complete fast.  This is the default. 

−O or −O2 Invoke the global ucode optimizer. 

−O3 Perform all optimizations, including global register allocation.  This option must precede all source file arguments.  With this option, a ucode object file is created for each C source file and left in a .u file.  The newly created ucode object files, the ucode object files specified on the command line, the runtime startup routine, and all the runtime libraries are ucode linked.  Optimization is performed on the resulting ucode linked file and then it is linked as normal producing an a.out file.  A resulting .o file is not left from the ucode linked result.  In fact −c cannot be specified with −O3. 

−feedback file Use with the −cord , or −O2 , or −O3 options to specify the feedback file.  This file is produced by prof() with its −feedback option from an execution of the program produced by pixie(.).

−cord Run the procedure-rearranger on the resulting file after linking.  The rearrangement is performed to reduce the cache conflicts of the program’s text.  The output is left in the file specified by the −o output option or a.out by default.  At least one −feedback file must be specified. 

−j Compile the specified source programs, and leave the ucode object file output in corresponding files with the .u suffix. 

−noinline Disable the inlining optimization performed under the −O3 option.  This flag is meaningful only when the −O3 option is also specified. 

−ko output Name the output file created by the ucode loader as output.  This file is not removed.  If this file is compiled, the object file is left in a file whose name consists of output with the suffix changed to an .o.  If output has no suffix, an .o suffix is appended to output. 

−k Pass options that start with a −k to the ucode loader.  This option is used to specify ucode libraries (with −klx ) and other ucode loader options. 

−S Compile the specified source programs and leave the symbolic assembly language output in corresponding files suffixed with .s. 

−P Run only the C macro preprocessor and put the result for each source file using suffix convention (for example, .c and .s) in a corresponding .i file.  The .i file does not have number lines (#) in it.  This sets the −cpp option. 

−E Run only the C macro preprocessor on the files (regardless of any suffix or not), and send the result to the standard output.  This sets the −cpp option. 

−Em or −M Runs only the macro preprocessor on the named C programs and produces the makefile dependencies. 

−C or −Q Options passed directly to cpp. See cpp() for details.

−o output Name the final output file output.  If this option is used, the file a.out is unaffected.

−Dname=def

−Dname Define the name to the C macro preprocessor, as if by ‘#define’.  If a definition is not given, the name is defined as 1. 

−Uname Remove any initial definition of name.

−Idir Search for #include files whose names do not begin with a slash (/) in the following order: (1) in the directory of the file argument, (2) in the directories specified by −I options, (3) in the standard directory, /usr/include.

−I Do not search for #include in the standard directory, /usr/include.

−Wl,−M Specifies the map option for ld.

−Gnum Specify the maximum size, in bytes, of a data item that is to be accessed from the global pointer.  The num argument is interpreted as a decimal number.  If num is zero, data is not accessed from the global pointer.  The default value for num is 8 bytes. 

−v Print the passes as they execute with their arguments and their input and output files.  Also prints resource usage in the C shell time format. 

−V Print the version of the driver and the versions of all passes.  This is done with the what() command.

−std[0,1] Have the compiler produce warnings for language constructs that are not standard in the language.  −std0 enforces the K&R standard, with some ANSI extensions; −std1 enforces the ANSI C standard; and −std enforces the ANSI C standard with popular extensions.  The −std option causes the macro __STDC__=0 to be passed to the preprocessor; −std1 causes the macro __STDC__=1 to be passed to the preprocessor; and −std0 causes the macro __STDC__ to be undefined.  The default is −std0 . 

−Zpn Align structure members on the alignment specified by the integer n.

−proto[is] Extract prototype declarations for function definitions into a .H suffixed file.  The option i is to used to include identifiers in the prototype and the option s is used to generate prototypes for static functions. 

−edit[0-9] Invoke the editor defined by the EDITOR environment variable or the vi editor, if no EDITOR environment variable is defined, when syntax or semantic errors are detected by the compiler’s front end.  When compiling on a character-based terminal, the compile job has to be in the foreground for this option to take effect.  For compile jobs done on a RISC window-based terminal, this option will take effect when the job is in the foreground or the background. The editor is invoked with two files:  the error message file and the source file.  Use the error message file to locate the line numbers of all the errors.  Then, use the source file to make the corrections. When you exit from the editor, the compile job restarts.  This process is repeated from 1 to 9 times, depending on the single-digit number specified in the option.  If no number (or zero) is specified in the option, this compile:edit:compile process repeats until all errors are corrected.

−edit0 turns off this feature. 

−oldcomment In the preprocessor, delete comments (that is, replace comments with nothing at all), rather than replacing them with space characters.  This option allows traditional token concatenation, and is the default with the −std0 option. 

−oldc Use the old C Preprocessor, cpp, and front end, ccom. Use this option when the new preprocessor and front end, cfe, which is the default, fails to compile or correctly execute your code when you use the −std0 option.

−Yenvironment Compiles C programs for environment.  If environment is SYSTEM_FIVE or is omitted, it defines SYSTEM_FIVE for the preprocessor, cpp. If the loader is invoked, it specifies that the System V version of the C runtime library is used.  Also, if the math library is specified with the −lm option, the System V version is used.  If environment is POSIX, it defines POSIX for the preprocessor.  If the environment variable PROG_ENV has the value SYSTEM_FIVE or POSIX, the effect is the same as when specifying the corresponding −Yenvironment option to cc. The −Y option overrides the PROG_ENV variable; −YBSD can be used to override all special actions. 

−cpp Run the C macro preprocessor on C and assembly source files before compiling.  This is the default for cc(.).

−nocpp Do not run the C macro preprocessor on C and assembly source files before compiling. 

−Olimit num Specify the maximum size, in basic blocks, of a routine that will be optimized by the global optimizer.  If a routine has more than the specified number of basic blocks, it cannot be optimized and a message is printed.  A −O, −O2, or −O3 must be used to specify the global optimizer.  The argument must also be specified. The argument num is interpreted as a decimal number.  The default value for num is 500 basic blocks. 

−signed Causes all char declarations to be signed char declarations. This is the default. 

−unsigned Causes all char declarations to be unsigned char declarations. 

−volatile Causes all variables to be treated as volatile. 

−varargs Prints warnings for lines that may require the varargs.h macros. 

−f Causes the compiler not to promote expressions of type float to type double. 

−float Same as the −f option. 

−fill number Set the fill pattern for “holes” within an output section.  The number argument is a four byte hex constant. 

Note

The −EB and −EL options are needed only when compiling for RISC machines from vendors other than Digital. 

The default target byte ordering matches the machine where the compiler is running.  The options −EB and −EL specify the target byte ordering (big-endian and little-endian, respectively).  The compiler also defines a C preprocessor macro for the target byte ordering.  These C preprocessor macros are MIPSEB and __MIPSEB , for big-endian byte ordering, and MIPSEL and __MIPSEL for little-endian byte ordering. 

−EB Produce object files targeted for big-endian byte ordering.  The C preprocessor macro MIPSEB is defined by the compiler. 

−EL Produce object files targeted for little-endian byte ordering.  The C preprocessor macro MIPSEL is defined by the compiler. 

−mips1 Generate code using the instructions set of the R2000/R3000 RISC architecture.  This is the default for all MIPS systems. 

−mips3 Generate code using the instruction set of the R4000 RISC architecture. 

The following options primarily aid compiler development and are not generally used:

−Hc Halt compiling after the pass specified by the character c, producing an intermediate file for the next pass.  The c can be [ fjusmoca ].  It selects the compiler pass in the same way as the −t option.  If this option is used, the symbol table file produced and used by the passes is the last component of the source file with the suffix changed to .T.  It is not removed. 

−K Build and use intermediate file names with the last component of the source file’s  name replacing its suffix with the conventional suffix for the type of file (for example, .B file for binary ucode, produced by the front end).  These intermediate files are never removed even when a pass encounters a fatal error.  When ucode linking is performed and the −K option is specified, the base name of the files created after the ucode link is u.out by default.  If −ko output is specified, the base name of the object file is output without the suffix.  Suffixes are appended to output if it does not have a suffix. 

−# Converts binary ucode files (.B) or optimized binary ucode files (.O) to symbolic ucode (a .U file).  If a symbolic ucode file is to be produced by converting the binary ucode from the C compiler front end then the front end option −Xu is used. 

−Wc[c...],arg1[,arg2...]
Pass the argument[s] argi to the compiler pass[es] c[c..].  The c’s are one of [ pfjusmocablyz ].  The c’s selects the compiler pass in the same way as the −t option. 

The options −t[hpfjusmocablyzrnt], −hpath, and −Bstring select a name to use for a particular pass, startup routine, or standard library.  These arguments are processed from left to right so their order is significant.  When the −B option is encountered, the selection of names takes place using the last −h and −t options.  Therefore, the −B option is always required when using −h or −t.  Sets of these options can be used to select any combination of names. 

The −EB or −EL options and the −p[01] options must precede all −B options because they can affect the location of runtime libraries and which runtime libraries are used. 

−t[hpfjusmocablyzrnt] Select the names.  Select options that relate to the names in the following list:

include h (see note below)

cfe p,f

cpp p

ccom f

ujoin j

uld u

usplit s

umerge m

uopt o

ugen c

as0 a

as1 b

ld l

ftoc y

cord z

[m]crtO.o r

libprof1.a n

btou, utob t

If the character h is in the −t argument then a directory is added to the list of directories to be used in searching for #include files.  This directory name has the form COMP_TARGET_ROOT/usr/includestring. This directory is to contain the include files for the string release of the compiler.  The standard directory is still searched. 

−hpath Use path rather than the directory where the name is normally found. 

−Bstring Append string to all names specified by the −t option.  If the −t option has not been processed before the −B, the −t option is assumed to be the following: hpfjusmocablyzrnt.  This list designates all names.  If the −t argument has not been processed before the −B argument, −Bstring is passed to the loader to use with its −lx arguments. 

Invoking the compiler with a name of the form ccstring has the same effect as using a −Bstring option on the command line. 

If the environment variable COMP_HOST_ROOT is set, the value is used as the root directory for all pass names rather than the default slash (/). If the environment variable COMP_TARGET_ROOT is set, the value is used as the root directory for all include and library names rather than the default slash (/). This affects the standard directory for #include files, /usr/include, and the standard library, /usr/lib/libc.a. If this is set then the only directory that is searched for libraries, using the −lx option, is COMP_TARGET_ROOT/usr/lib.

If the environment variable TMPDIR is set, the value is used as the directory to place any temporary files rather than the default /tmp/.

If the environment variable RLS_ID_OBJECT is set, the value is used as the name of an object to link in if a link takes place.  This is used to add release identification information to objects. It is always the last object specified to the loader.

The user can choose which error message file to use at the time the compiler is invoked.  The following locations are searched (in order):

1.  A filename specified on the command line

2.  A file specified by the environment variable __ERROR_FILE

3.  A file in the same directory as the resulting binary, with a filename in the format: err.$__LANG.cc. The value of $__LANG is set by the environment variable __LANG or is (by default) English.

4.  A file in the format: err$__LANG.cc in the current directory

5.  If none of the above are present, the /usr/lib/cmplrs/err.cc file is used.

Other arguments are assumed to be either loader options or C−compatible object files, typically produced by an earlier cc run, or perhaps libraries of C−compatible routines.  These files, together with the results of any compilations specified, are loaded in the order given, producing an executable program with the default name a.out.

Default Symbols

The ULTRIX C compiler provides the following default symbols for your use.  These symbols are useful in #ifdef statements to isolate code for one of the particular cases.  Thus, these symbols can be useful for ensuring portable code.  Symbols beginning with two underscore characters are default with all −std settings.  Symbols not beginning with two underscore characters are the default with both −std and −stdO settings. 

unix  and __unix
Any UNIX system

bsd4_2 and __bsd4_2
Berkeley UNIX Version 4.2

ultrix and __ultrix
ULTRIX only

mips and __mips
Any RISC architecture

MIPSEL and __MIPSEL
Little endian variant of MIPS architecture

host_mips and __host_mips
Native compilation environment (as opposed to cross-compiler)

LANGUAGE_C and __LANGUAGE_C
Compiling a .c file

LANGUAGE_ASSEMBLY and __LANGUAGE_ASSEMBLY
Assembling a .s file

Restrictions

The standard library, /usr/lib/libc.a, is loaded by using the −lc loader option and not a full path name. The wrong library may be loaded if there are files with the name libc.astring in the directories specified with the −L loader option or in the default directories searched by the loader. 

Files

file.c
input file

file.o
object file

a.out
loaded output

err.english.cc
compiler error messages in English

/tmp/ctm?
temporary

/usr/lib/cmplrs/cc/comp.config
compiler configuration file (optional)

/usr/lib/cmplrs/cc/cfe
C front end

/usr/lib/cmplrs/cc/cpp
C macro preprocessor

/usr/lib/cmplrs/cc/oldc/cpp
C macro preprocessor ( −oldc )

/usr/lib/cmplrs/cc/ccom
C front end ( −oldc )

/usr/lib/cmplrs/cc/ujoin
binary ucode and symbol table joiner

usr/bin/cmplrs/cc/uld
ucode loader

/usr/lib/cmplrs/cc/usplit
binary ucode and symbol table splitter

/usr/lib/cmplrs/cc/umerge
procedure intergrator

/usr/lib/cmplrs/cc/uopt
optional global ucode optimizer

/usr/lib/cmplrs/cc/ugen
code generator

/usr/lib/cmplrs/cc/as0
symbolic to binary assembly language translator

/usr/lib/cmplrs/cc/as1
binary assembly language assembler and reorganizer

/usr/lib/cmplrs/cc/crt0.o
runtime startup

/usr/lib/cmplrs/cc/mcrtO.o
startup for profiling

/usr/lib/libc.a
standard library, see intro()

/usr/lib/cmplrs/cc/libprof1.a
level 1 profiling library

/usr/include
standard directory for #include files

/usr/bin/ld
loader

/usr/lib/cmplrs/cc/ftoc
interface between prof() and cord

/usr/lib/cmplrs/cc/cord
procedure-rearranger

/usr/bin/btou
binary to symbolic ucode translator

/usr/bin/utob
symbolic to binary ucode translator

mon.out
file produced for analysis by prof()

See Also

dbx(1), ld(1), pixie(1), prof(1), what(1), monitor(3)

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