Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

monitor(3)

prof(1)

gprof(1)

tcov(1)

adb(1)

ar(1)

ld(1)

dbx(1)

as(1)

cpp(1)

make(1)

CC(1V)  —  USER COMMANDS

NAME

cc − C compiler

SYNOPSIS

cc [ −a ] [ −align _block ] [ −c ] [ −C ] [ −dryrun ] [ −Dname[=def ] ] [ −E ] [ float_option ]

[ −fsingle ] [ −g ] [ −go ] [ −help ] [ −Ipathname ] [ −J ] [ −llib ]

[ −Ldir [ −M ] [ −o outfile ] [ −O ] [ −p ] [ −pg ] [ −pipe ] [ −P ]

[ −Qoption prog opt ] [ −Qpath pathname ] [ −Qproduce sourcetype ] [ −R ] [ −S ]

[ −temp=dir ] [ −time ] [ −Uname ] [ −v ] [ −w ] sourcefile ...

SYSTEM V SYNOPSIS

/usr/5bin/cc arguments

Note:arguments to /usr/5bin/cc are identical to those listed above. 

DESCRIPTION

cc is the C compiler.  It translates programs written in the C programming language into executable load modules, or into relocatable binary programs for subsequent loading with the ld(1) linker.

In addition to the many options, cc accepts several types of filename arguments.  For instance, files with names ending in .c are taken to be C source programs.  They are compiled, and each resulting object program is placed in the current directory.  The object file is named after its source file — the suffix .o replacing .c in the name of the object.  In the same way, files whose names end with .s are taken to be assembly source programs.  They are assembled, and produce .o file.  Filenames ending in .il are taken to be inline expansion code template files; these are used to expand calls to selected routines in-line when the -O option is in effect.  See FILES, below for a complete list of compiler-related filename suffixes. 

Other arguments refer to assembler or loader options, object programs, or object libraries.  Unless −c, −S, −E −P or −Qproduce is specified, these programs and libraries, together with the results of any specified compilations or assemblies, are loaded (in the order given) to produce an output file named a.out.  You can specify a name for the executable by using the −o option. 

If a single C program is compiled and loaded all at once, the intermediate file is deleted. 

OPTIONS

See ld(1) for link-time options.

−a Insert code to count how many times each basic block is executed.  Creates a .d file for every .f file compiled.  The .d file accumulates execution data for the corresponding source file.  The tcov(1) utility can then be run on the source file to generate statistics about the program.

−align Cause the global symbol block to be page-aligned: its size is increased to a whole number of pages, and its first byte is placed at the beginning of a page. 

−c Suppress linking with ld(1) and produce a .o file for each source file.  A single object file can be named explicitly using the −o option. 

−C Prevent the C preprocessor, cpp(1), from removing comments.

−dryrun Show but do not execute the commands constructed by the compilation driver. 

−Dname[=def ]
Define a symbol name to the C preprocessor (cpp(1)). Equivalent to a #define directive in the source.  If no def is given, name is defined as ‘1’. 

−E Run the source file through cpp(1), the C preprocessor, only.  Sends the output to the standard output, or to a file named with the −o option.  Includes the cpp line numbering information.  (See also, the −P option.) 

float_option Floating-point code generation option.  Can be one of:

−f68881
Generate in-line code for Motorola MC68881 floating-point processor (supported only on Sun-3 systems).

−ffpa Generate in-line code for Sun Floating Point Accelerator (supported only on Sun-3 systems). 

−fsky Generate in-line code for Sky floating-point processor (supported only on Sun-2). 

−fsoft
Generate software floating-point calls (this is the default).

−fswitch
Run-time-switched floating-point calls. The compiled object code is linked at runtime to routines that support one of the above types of floating point code.  This was the default in previous releases. Only for use with programs that are floating-point intensive, and must be portable to machines with various floating-point hardware options.

−fsingle Use single-precision arithmetic in computations involving only float expressions — that is, do not convert everything to double, which is the default.  Note that floating-point parameters are still converted to double precision, and functions returning values still return double-precision values. 

Although not standard C, certain programs run much faster using this option.  Be aware that some significance can be lost due to lower-precision intermediate values. 

−g Produce additional symbol table information for dbx(1) and dbxtool(1) and pass the −lg flag to ld(1). When this option is given, the −O and −R options are suppressed. 

−go Produce additional symbol table information for adb(1). When this option is given, the −O and −R options are suppressed. 

−help Display helpful information about cc. 

−Ipathname Add pathname to the list of directories in which to search for #include files with relative filenames (not beginning with slash /).  The preprocessor first searches for #include files in the directory containing sourcefile, then in directories named with −I options (if any), and finally, in /usr/include . 

−J Generate 32-bit offsets in switch statement labels. 

−llib Link with object library lib (for ld(1)).

−Ldir Add dir to the list of directories containing object-library routines (for linking using ld(1).

−M Run only the macro preprocessor on the named C programs, requesting that it generate makefile dependencies and send the result to the standard output (see make(1) for details about makefiles and dependencies).

−o outfile Name the output file outfile.  outfile must have the appropriate suffix for the type of file to be produced by the compilation (see FILES, below).  outfile cannot be the same as sourcefile (the compiler will not overwrite the source file). 

−O Optimize the object code.  Ignored when either −g or −go is used. 

−p Prepare the object code to collect data for profiling with prof(1). Invokes a run-time recording mechanism that produces a mon.out file (at normal termination). 

−pg Prepare the object code to collect data for profiling with gprof(1). Invokes a run-time recording mechanism that produces a gmon.out file (at normal termination). 

−pipe Use pipes, rather than intermediate files, between compilation stages.  (Very cpu-intensive.) 

−P Run the source file through cpp(1), the C preprocessor, only.  Puts the output in a file with a .i suffix.  Does not include cpp-type line number information in the output.

−Qoption prog opt
Pass the option opt to the program prog.  The option must be appropriate to that program and may begin with a minus sign.  prog can be one of: as, cpp, inline, or ld. 

−Qpath pathname
Insert a directory pathname into the compilation search path (to use alternate versions of programs invoked during compilation). 

−Qproduce sourcetype
Produce source code of the type sourcetype.  sourcetype can be one of:

.c C source (from bb_count). 

.i Preprocessed C source from cpp(1).

.o Object file from as(1).

.s Assembler source (from ccom, inline or c2).

−R Merge data segment with text segment for as(1). Data initialized in the object file produced by this compilation is read-only, and (unless linked with ld -N) is shared between processes.  Ignored when either −g or −go is used. 

−S Do not assemble the program but produce an assembly source file. 

−temp=dir Set directory for temporary files to be dir. 

−time Report execution times for the various compilation passes. 

−Uname Remove any initial definition of the cpp(1) symbol name.  (Inverse of the −D option.) 

−v Verbose.  Print the version number of the compiler and the name of each program it executes. 

−w Do not print warnings. 

ENVIRONMENT

FLOAT_OPTION
When no floating-point option is specified, the compiler uses the value of this environment variable (if set).  Recognized values are: f68881, ffpa, fsky, fswitch and fsoft. 

FILES

a.out executable output file

file.a library of object files

file.c C source file

file.d tcov(1) test coverage input file

file.i C source file after preprocessing with cpp(1)

file.f FORTRAN 77 source file

file.F FORTRAN 77 source file for cpp(1)

file.il inline expansion file

file.o object file

file.p Pascal source file

file .r Ratfor source file

file.s assembler source file

file.S assembler source for cpp(1)

file.tcov output from tcov(1)

/lib/c2 object code optimizer

/lib/ccom compiler

/lib/compile compiler command-line processing driver

/lib/cpp macro preprocessor

/lib/crt0.o runtime startoff

/lib/Fcrt1.o startup code for −fsoft option

/lib/gcrt0.o startoff for profiling with gprof(1)

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

/lib/mcrt0.o startoff for profiling with prof(1) intro(3)

/lib/Mcrt1.o startup code for −f68881 option

/lib/Scrt1.o startup code for −fsky option

/lib/Wcrt1.o startup code for −ffpa option

/usr/include standard directory for #include files

/usr/lib/bb_count
block counting preprocessor

/usr/lib/bb_link.o
basic block counting routine

/usr/lib/libc_p.a profiling library, see gprof(1) or prof(1)

/usr/lib/libF77.a FORTRAN 77 library

/usr/lib/inline inline expander of library calls

/usr/lib/libI77.a FORTRAN 77 library

/usr/lib/libm.a math library

/usr/lib/libU77.a
FORTRAN 77 library

/usr/5lib/libc.a System V standard compatibility library, see intro(3V)

/usr/5lib/libc_p.a
System V profiling library, see gprof(1) or prof(1)

/tmp/∗ compiler temporary files

mon.out file produced for analysis by prof(1)

gmon.out file produced for analysis by gprof(1)

SEE ALSO

monitor(3), prof(1), gprof(1), tcov(1), adb(1), ar(1), ld(1), dbx(1), as(1), cpp(1), make(1)

B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978

UNIX Programming in Programming Utilities for the Sun Workstation

Floating-Point Programmer’s Guide for the Sun Workstation

UNIX Interface Overview

DIAGNOSTICS

The diagnostics produced by C itself are intended to be self-explanatory.  Occasional obscure messages may be produced by the preprocessor, assembler, or loader. 

BUGS

The program context given in syntax error messages is taken from the input text after the C preprocessor has performed substitutions.  Therefore, error messages involving syntax errors in or near macro references or manifest constants may be misleading. 

Sun Release 3.2  —  Last change: 20 August 1986

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