Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cc(1) — GL2 W2.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

as(1)

cpp(1)

ld(1)

extcentry(1)

mkf2c(1)

dbx(1)

a.out(4)

CC(1)  —  Silicon Graphics

 

NAME

cc, pc, f77 − C, Pascal and FORTRAN compilers for the 68010/68020

SYNOPSIS

cc [ options ] files ... 
pc [ options ] files ... 
f77 [ options ] files ... 

DESCRIPTION

cc is a general driver for the UNIX C, Pascal and FORTRAN compilers for the 68010/68020.  It is also available under the names f77 and pc.  The names are synonymous except during the linking phase, when it is used to create the appropriate run-time environment.  cc accepts many types of input files, determined by the file’s suffix.  The highest form of input is language source: C (.c), Pascal (.p) or FORTRAN (.f). These are translated to assembler (in the case of C), to UNIX object files (.o), and finally to an executable file called a.out.  Input to cc may consist of any of these types of files and translation may be stopped at any point. 

Translation proceeds as follows:

a) Each .c, .p and .f input is run through the C macro preprocessor cpp(1).  In the case of Pascal source, cpp is given the −p switch. This switch tells cpp to ignore Pascal-style comments and do the correct things with preprocessor control lines so that the line numbers in the resultant Pascal file will be the same as the original. 

b) The preprocessed C files are then run through the C compiler ccom and, if specified, the C optimizer c2.  The resulting .s files are then assembled, producing UNIX binaries (.o). 

c) Preprocessed FORTRAN (.f) and Pascal (.p) files are run through the appropriate front end, fortran or pascal, then through the code generator code, and object code formatter jlinker, to produce a UNIX binary (.o). 

d) Finally, all UNIX object files are passed to ld(1), along with the UNIX startup file /lib/crt0.o, and the appropriate libraries, to produce a single executable named a.out. 

Preprocessed source files and assembler files are usually removed.  All UNIX binaries (.o) are preserved, unless there was a single source (.f, .p, or .c) file being compiled, no previously-compiled binaries are being loaded, and the compilation is continuing to an executable.  In this case, the single binary file is not saved. 

If C and FORTRAN files are mixed in a single executable, special interface routines may need to be generated as described in the “C/FORTRAN Interface” section of the FORTRAN Reference Manual. If C and Pascal procedures are mixed, the user should consult the SVS Pascal Reference Manual for instructions on altering the external procedure declarations in Pascal. 

OPTIONS

The following options are interpreted by cc (f77,pc).  Some options have meaning for only one of these languages.  (see ld(1) for load-time options):

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

−g Generate debugging information.  For C and  FORTRAN files, this causes additional symbol table information to be generated for dbx(1).

−lx Include libx.a as a library which ld should search for undefined references.  ld will look for the library first in the directory lib, then in usr/lib, and finally in usr/local/lib relative to the root of the library tree.  The root of the library tree defaults to /, but may be set using the −ZR switch.  The string x may be more than one letter. 

−−n Normally, cc passes the −n switch to ld, which causes it to load the program with shared text.  The −−n switch suppresses the passing of −n to ld. 

−o output
Name the final output file output.  output is normally an executable; however, if a single input file is being translated to a .s or a .o file, the final output file will be named output, regardless of its type.  This provides a facility for naming an output file by other than the default method of suffix-replacement. 

−p Tell ccom to generate code to count subroutine calls for use with prof(1). FORTRAN and Pascal do not support profiling.

−−x By default, cc passes the −x flag to ld, in order to suppress local symbols from the final symbol table.  The −−x flag inhibits this default.  The −−x switch should not be used in conjunction with the −r switch. 

−C Prevent the macro preprocessor from removing C style comments found in the source.  Such comments are always removed from Pascal programs. 

−Dname=def

−Dname
Define the name to the preprocessor, as if by #define.  (There should be no blanks between the D and the symbol to be defined.)  If no definition is given, the name is defined as “1”. 

−E Run only the macro preprocessor on the named C, Pascal and FORTRAN source and send the result to the standard output. 

−Idir Look in directory dir for missing #include files.  Include files whose names are surrounded by double quotes and do not begin with ‘/’ are always first sought in the directory of the input file, then in directories named in −I options, then in /usr/include.  Include files with names beginning with ‘/’ are treated as absolute paths.  The directory of the input file is not used as a search path for include files whose names are surrounded by pointed brackets.  (There should be no blanks between the directory name and the switch.) 

−L Produce a FORTRAN listing of each FORTRAN source file.  FORTRAN listings have the suffix .l . 

−M Run only the macro preprocessor on the named C programs, requesting it to generate Makefile dependencies and send the result to the standard output. 

−O Invoke a peephole optimizer on each C file. 

−P Run only the macro preprocessor on the named C, FORTRAN, and Pascal files, and place the results on file.i . 

−S Compile the named C files, leaving the C assembly language output in files suffixed .s . 

−Uname
Remove any initial definition of name to the preprocessor. (There should be no blanks between U and the name to be undefined.) 

−Zf Cause instructions for the floating-point accelerator to be generated.  Use of this switch on systems which do NOT have the floating-point accelerator installed will cause a run-time abort.  Programs which expect to use the floating point accelerator must be both compiled and loaded with −Zf . 

−Zg Load the program with the special files and libraries necessary for IRIS graphics programs.  When this switch is used, the Graphics Library −lgl and the appropriate math library are given by default.  Special files must be loaded for using graphics with each source language.  Hence, cc must be able to determine the combination of languages involved in the link step.  If the compilation line specified f77, a FORTRAN source file (with the extension .f) or the switch −ZF is given, cc assumes that FORTRAN routines are present. In this case, the program is also loaded with the FORTRAN graphics interface library −lfgl .  If the compilation line specified pc, a Pascal source file (with the extension .p) or the switch −ZP is given, cc assumes that Pascal routines are present.  The program is loaded with the special Pascal routine /usr/lib/pzcstr.o. 

−Zifilename
Use the file named filename as the run-time startup, rather than the standard C run-time startup.  This may be useful for generating stand-alone programs.  (There should be no blanks between the filename and the switch.) 

−Zq Time all subprocesses, and report these times on stdout at the end of the compilation. 

−Zr Load the program for the remote graphics environment.  Since the remote graphics environment is only supported in C, this option is disallowed if the source contains FORTRAN or Pascal, or if f77 or pc has been invoked.  Otherwise, the C remote Graphics Library will be loaded.  As does loading  the standard Graphics Library, loading the remote Graphics Library automatically causes the math library to be loaded.  This program also causes the directory /usr/include/rgl to be searched prior to /usr/include for graphics header files. 

−Zv Turn on verbose mode. In verbose mode, the C compiler ccom will give additional diagnostics.  This includes such things as flagging any use of the C type double, and complaining about too many register declarations. 

−Zz Print a trace of all exec() calls. 

−ZA Pass the remainder of the string to as.  Thus, the cc switch −ZA−j will pass as the switch −j. 

−ZC Pass the remainder of the string to ccom.  Thus, the cc switch −ZC−l will pass ccom the switch −l, that causes the C compiler to place comments indicating line number changes in the assembler (.s) file. 

−ZD On systems on which the hardware supporting division provides less precision than the standard specifies, emulate hardware division using other hardware floating-point operations.  This mechanism for division affords more precision than the simple hardware version while maintaining a speed advantage over pure software floating-point.  This option is only available from FORTRAN and Pascal. 

−ZF Pass the remainder of the string to the FORTRAN compiler front-end fortran.  Thus, the cc switch −ZF+s will pass fortran the switch +s.  This switch (with or without a switch to pass to the FORTRAN front-end) also informs cc that FORTRAN files were present in the compilation. 

−ZN Pass the −N switch to cpp.  This switch causes cpp to NOT look in /usr/include for include files. 

−ZP Pass the remainder of the string to the Pascal compiler front-end pascal.  Thus, the cc switch −ZP+p will pass pascal the switch +p.  This switch (with or without a switch to pass to the Pascal front-end) also informs cc that Pascal files were present in the compilation.  cc cannot determine this unless it sees a .p file or the name pc is used. 

−ZR libroot
Pass the -R libroot switch to the loader (ld).  This causes it to use the directory libroot as the root of the tree for its search to find libraries specified by the −lx method.  Relative to this library root, ld will successively search for libx.a in lib, usr/lib, and usr/local/lib.  If no −ZR switch is given, the loader will use / as its default libroot.  The −ZR switch will also cause libroot/lib/crt0.o as its runtime startup. 

−ZU Preserve the intermediate binary files produced during the compilation of Pascal source files.  These intermediate binary files (named by suffixing the file name with .j) are necessary if routines in the file are referenced in another Pascal file as being ’used’ (i.e., in the uses section).  See the Pascal Release Notes for further information. 

Other flags are passed to ld.  The files may consist of any mix of C, object, FORTRAN, assembler, binary or library files.  The files are passed to ld, if opted, after rearranging according to the file type, to produce an executable program named a.out or that specified by the −o option.  Files of unknown type (i.e., with an extension other than .c, .f, .o, .a, .p, or .s) are given to ld as if they had been previously loaded (i.e., are in a.out format). The order of files of unknown type in the load step is indeterminate. 

FILES

file.c C source file
file.f FORTRAN source file
file.p Pascal source file
file.o binary (relocatable) file
file.s assembly file
a.out executable file
/lib/ccom C compiler
/lib/cpp C preprocessor
/lib/crt0.o run time startup
/lib/libc.a C library
/usr/lib/libf10.a FORTRAN library (68010 version)
/usr/lib/libf20.a FORTRAN library (68020 version)
/usr/lib/libfhw10.a FORTRAN library (68010 version) using hardware
floating-point
/usr/lib/libfhw20.a FORTRAN library (68020 version) using hardware
floating-point
/usr/lib/libp10.a FORTRAN and Pascal library (68010 version)
/usr/lib/libp20.a FORTRAN and Pascal library (68020 version)
/usr/lib/libphw10.a FORTRAN and Pascal library (68010 version)
using hardware floating-point
/usr/lib/libphw20.a FORTRAN and Pascal library (68020 version)
using hardware floating-point
/usr/lib/fortran20 FORTRAN front-end for 68020-based systems
/usr/lib/fortran10 FORTRAN front-end for 68010-based systems
/usr/lib/pascal20 Pascal front-end for 68020-based systems
/usr/lib/pascal10 Pascal front-end for 68010-based systems
/usr/lib/code20 FORTRAN code-generator for 68020-based systems
/usr/lib/code10 FORTRAN code-generator for 68010-based systems
/usr/lib/jlinker20 FORTRAN pre-linker for 68020-based systems
/usr/lib/jlinker10 FORTRAN pre-linker for 68010-based systems
/bin/as 68010/68020 assembler
/bin/ld linking loader
/usr/include default include directory
/usr/lib/p2cstr.o Pascal-C string convert routine

SEE ALSO

UNIX Programmer’s Manual, Volume IIB, “as20 Reference Manual”, “IRIS Floating Point”, “FORTRAN Reference Manual”. 
FORTRAN Reference Manual, Appendix G, “The C/FORTRAN Interface”. 
as(1), cpp(1), ld(1), extcentry(1), mkf2c(1), dbx(1), a.out(4)
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978
B. W. Kernighan, Programming in C—a Tutorial
D. M. Ritchie, C Reference Manual
SVS Pascal Reference Manual

BUGS

Three bugs are currently outstanding in the C compiler system.  The first bug is the result of the compiler running out of temporary registers when compiling an expression.  This bug can occur in assign-op statements with complex left-hand-sides such as junk[c].i += a and in certain bitfield assignment expressions in a function which contains many register variables.  The compiler aborts with the message “expression causes compiler loop, try simplifying”.  Rather than to reserve an additional register for the compiler’s internal use, it has been left to the user to alleviate this problem by reducing the number of data registers being used in this instance to five or fewer. 

The second bug occurs when using hardware floating-point and autoincrementing (or autodecrementing) a pointer to a float which is declared as register.  The problem does not occur if the reigister declaration is removed. 

The third bug occurs when passing an autoincremented (or autodecremented) bit field to a function, as in foo(a.i++), where i is a bitfield element of structure foo.  In some cases, the compiler will autoincrement the bitfield correctly, but pass the incorrect value to foo.  The value may have little or no relationship to the true value of a.i either before or after autoincrementing. 

DIAGNOSTICS

The diagnostics produced by C, FORTRAN, and Pascal are intended to be self-explanatory.  Occasional messages may be produced by the assembler or loader. 
 
 
 

Version 2.5  —  April 22, 1987

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