CC(1) — Silicon Graphics
NAME
cc, pc, f77 − C, Pascal and FORTRAN compilers for the 68000
SYNOPSIS
cc [ options ] files ...
pc [ options ] files ...
f77 [ options ] files ...
DESCRIPTION
Cc is the UNIX C, Pascal and Fortran compiler for the 68000. 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 the language’s intermediate format (68000 assembler (.s), in the case of C, and a special object format (.j), in the case of FORTRAN and Pascal), then to UNIX object files (.o), and finally to an executable file, usually 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. 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 objects (.o).
c) Preprocessed FORTRAN (.f) and Pascal (.p) files are run through the appropriate SVS front end, fortran or pascal, then through the code generator code, producing special object files (.j). All special object files are combined with the FORTRAN/Pascal library and passed to an object file formatter ulinker, producing a single UNIX object file (.o).
d) Finally, all UNIX object files are passed to ld(1), along with the UNIX startup file /lib/crt0.o, to produce a single executable named a.out.
Preprocessed source files and assembler files are usually removed. All C objects (.o) and special object files (.j) are preserved, unless there was only a single input .c file.
If C and FORTRAN files are mixed in a single executable, special interface routines must be generated as described in Appendix D of the IRIS Workstation Guide. 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. Currently, this does not have meaning when C is intermixed with another language. For FORTRAN and Pascal files, the appropriate compiler will be called with the +d switch and the symbol table produced by the pre-linker will be placed in x.dbg, where x is the name of the final program. For pure C programs, additional symbol table information will be generated for dbx(1).
−lx Include libx.a as a library 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 until it finds it. The string x may be more than one character.
−−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 instead of a.out.
−p Tell ccom to generate code to count subroutine calls for use with prof. Neither FORTRAN nor Pascal support profiling.
−−x By default, cc passes a −x flag to ld, in order to suppress local symbols from the final symbol table. The −−x flag inhibits this default. Note that there are two dashes.
−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 name to the preprocessor, as if by #define. 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 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 sought first in the directory of the input file, then in directories named in −I options, then in /usr/include, and finally in /usr/local/include. Include files names beginning with ’/’ are treated as absolute paths. Include files whose names are surrounded by angle brackets ( < ) and ( > ) are not looked for in the directory of the input file.
−L Produce an assembly listing for each C or assembler source file, and a FORTRAN listing of each FORTRAN source file. Assembler listings have the suffix .lst and FORTRAN listings have the suffix .l.
−Oxx Invoke an object-code optimizer on each C file. xx are optional flags to c2. Possible options are S (perform stack optimizations), P (remove stackprobes), K (omit kernel optimizations). Use of these options is not recommended for the standard compilation environment.
−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 files, leaving the C assembly language output in files suffixed .s, and the FORTRAN and Pascal objects in files suffixed .j.
−Uname
Remove any initial definition of name.
−Zf Cause instructions for the Sky floating point processor to be generated. When this switch is used, the Sky math library −lmsky will be substituted for the standard math library −lm if it is specified. Use of this switch on systems which do NOT have the floating point unit installed will cause a run time abort.
−Zg Load the program with the special files and libraries necessary for IRIS graphics programs. When this switch is used, the graphics library −lg and the math library −lm (or −lmsky if the −Zf flag has also been specified) 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 and the FORTRAN object file containing the block data initialization of the common areas DEVICE and GL (/usr/lib/fgldat.j). 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 jump table (/usr/lib/pjmptbl.o), and ld is told to make only eight characters significant in function names during calls to the graphics library.
−Zi filename
Use the file named filename as the run time startup, rather than the standard C run time startup. This is useful for generating standalone programs.
−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. If the source contains FORTRAN or .j files, the FORTRAN remote graphics library will be loaded, 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 (−lm or −lmsky) to be loaded. If the program is a C program, the directory /usr/include/rgl will 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−q will pass as the switch −q.
−ZC pass the remainder of the string to ccom. Thus, the cc switch −ZC−v will pass ccom the switch −v.
−ZF pass the remainder of the string to the FORTRAN compiler front-end fortran. Thus, the cc switch −ZF+d will pass fortran the switch +d. 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.
−ZM Cause the FORTRAN pre-linker to generate a load map of the FORTRAN program. This will be placed in a file by the same name as the executable file with the added extension .fmap.
−ZP Pascal files are present in this compilation. cc cannot determine this unless it sees a .p file or the name pc is used.
−ZZ Load the program for the standalone environment. This causes substitutions to be made for the C library and the C run time startup.
Other flags are passed to ld. The files may consist of any mix of C, object, FORTRAN, assembler, object or library files. The files are passed to ld, if opted, in the order given, to produce an executable program named a.out or that specified by the −o option.
FILES
| file.c | C source file |
| file.f | FORTRAN source file |
| file.p | Pascal source file |
| file.j | Pascal and FORTRAN object files |
| file.o | object (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/paslib.obj | FORTRAN library |
| /usr/lib/fortran | FORTRAN front-end |
| /usr/lib/pascal | Pascal front-end |
| /usr/lib/code | FORTRAN code-generator |
| /usr/lib/ulinker | FORTRAN pre-linker |
| /bin/as | assembler |
| /bin/ld | linking loader |
| /usr/include | default include directory |
| /usr/lib/fgldat.j | block data routine for graphics commons |
| /usr/lib/pjmptbl.o | Pascal graphics jump table and C string converter |
SEE ALSO
IRIS Workstation Guide Appendices D and E
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 FORTRAN Reference Manual
SVS Pascal Reference Manual
as(1), ccom(1), cpp(1), ld(1), extcentry(1), mkf2c(1), a.out(5)
BUGS
Two 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 as junk[c].i += a 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 less.
The second bug occurs when using the optimizer, c2. In certain situations, the optimizer gets confused as to the boundary between functions when optimizing functions which are declared as static. This can result in optimizing away necessary register save/restore code at function entry and exit. Although the problem occurs rarely even in conjunction with such declarations, users are currently warned against declaring functions as static when using the optimizer.
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.1 — January 02, 1985