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.
−w Tell ccom to suppress issuing warning messages. Messages describing unrecoverable errors will still appear.
−−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/p2cstr.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.
−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. If ld is called, the files are passed in the order specified in the command line. This produces an executable program named a.out or a name 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 |
| file.a | library file |
| a.out | executable file |
| /lib/ccom | C compiler |
| /lib/cpp | C preprocessor |
| /lib/crt0.o | run time startup |
| /lib/libc.a | C library |
| /bin/as | 68010/68020 assembler |
| /bin/ld | linking loader |
| /usr/include | default include directory |
| /usr/lib/code | FORTRAN code-generator |
| /usr/lib/ftncterrs | FORTRAN compile-time error message file |
| /usr/lib/ftnrterrs | FORTRAN run-time error message file |
| /usr/lib/fortran | FORTRAN front-end |
| /usr/lib/jlinker | FORTRAN pre-linker |
| /usr/lib/libf.a | FORTRAN library |
| /usr/lib/libfhw.a | FORTRAN library using hardware floating-point |
| /usr/lib/libp.a | FORTRAN and Pascal library |
| /usr/lib/libphw.a | FORTRAN and Pascal library |
| using hardware floating-point | |
| /usr/lib/pascal | Pascal front-end |
| /usr/lib/pascterrs | Pascal compile-time error message file |
| /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
Under certain circumstances, the compiler runs out of temporary address-type registers when compiling an expression in a function with four or more register pointer variables. The compiler aborts with the message “no table entry for op REG”. Rather than to reserve an additional address register for the compiler’s internal use, it has been left to the user to alleviate this problem by reducing the number of pointer register variables in the function to three or fewer.
When performing operations on bitfields within the parameter list of a function, the result passed to the function may be incorrect. This has been seen to occur under several circumstances: 1) if the operation involves assignment of a bitfield (although the value assigned is correct), or 2) if the operation involves negation or taking the complement of a bitfield. Perform operations on bitfields outside of the parameter list, and pass the result.
a bug exists which causes incorrect code to be generated for the autoincrementation of some register pointer variables which have been CAST. In the code fragment
register char *p;
*(int *)p++;
the compiler increments p by sizeof(int), rather than the correct sizeof(char). Due to the reliance of existing code on this (incorrect) behavior, the bug has not been fixed. Instead, ccom will print a warning message indicating that the pointer has been incremented by the incorrect value.
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 3.6 — December 20, 1987