up | Inhaltsverzeichniss | Kommentar

Manual page for CC(1V)

cc - C compiler


cc [ -a ] [ -align _block ] [ -Bbinding ] [ -c ] [ -C ] [ -dalign ] [ -dryrun ] [ -Dname [=def ] ] [ -E ]
          [ float_option ] [ -fsingle ] [ -g ] [ -go ] [ -help ] [ -Ipathname ] [ -J ] [ -Ldirectory ] [ -M ]
[ -misalign ] [ -o outputfile ] [ -O[level] ] [ -p ] [ -P ] [ -pg ] [ -pic ] [ -PIC ] [ -pipe ]
[ -Qoption prog opt ] [ -Qpath pathname ] [ -Qproduce sourcetype ] [ -R ] [ -S ] [ -sb ]
          [ -target target_arch ] [ -temp=directory ] [ -time ] [ -Uname ] [ -w ] sourcefile ...
          [ -llibrary ]


/usr/5bin/cc arguments

/usr/xpg2bin/cc arguments

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


The System V version of this command is available with the System V software installation option. Refer to [a manual with the abbreviation INSTALL] for information on how to install optional software.


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 link editor.

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 files. 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 code optimization is enabled. 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 file is compiled and loaded all at once, the intermediate file is deleted.

/usr/xpg2bin/cc is a shell script that should be used to compile X/Open compliant applications. /usr/5bin/cc and /usr/xpg2bin/cc accept the same arguments and options as cc. /usr/xpg2bin/cc searches /usr/xpg2include for #include files before /usr/include, and specifies /usr/xpg2lib/libxpg.a as an additional static library of object-library routines.


When debugging or profiling objects are compiled using the -g or -pg options, respectively, the ld command for linking them should also contain the appropriate option.

See ld.1 for link-time options.

Insert code to count how many times each basic block is executed. Invokes a run-time recording mechanism that creates a .d file for every .c file (at normal termination). 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. Since this option entails some optimization, it is incompatible with -g.
-align _block
Force the global uninitialized data symbol block to be page-aligned by increasing its size to a whole number of pages, and placing its first byte at the beginning of a page.
Specify whether bindings of libraries for linking are static or dynamic, indicating whether libraries are non-shared or shared, respectively.
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.
Prevent the C preprocessor, cpp.1 from removing comments.
-dalign (Sun-4 systems only.)
Generate double load/store instructions whenever possible for improved performance. Assumes that all double typed data are double aligned, and should not be used when correct alignment is not assured.
Show but do not execute the commands constructed by the compilation driver.
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'.
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.)
Floating-point code generation option. Can be one of:
Generate in-line code for Motorola MC68881 floating-point processor (supported only on Sun-3 systems).
Generate in-line code for Sun Floating Point Accelerator (supported only on Sun-3 systems).
Generate in-line code for Sky floating-point processor (supported only on Sun-2 systems).
Generate software floating-point calls. Supported only on Sun-2 and Sun-3 systems, for which it is the default.
Insure that expressions allocated to extended precision registers are rounded to storage precision whenever an assignment occurs in the source code. Only has effect when -f68881 is specified (Sun-3 systems only).
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 (supported only on Sun-2 and Sun-3 systems).
-fsingle (Sun-2, Sun-3 and Sun-4 systems)
Use single-precision arithmetic in computations involving only float expressions. Do not convert everything to double, which is the default. Note: 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.

Produce additional symbol table information for dbx.1 and dbxtool.1 and pass -lg option to ld.1 (so as to include the g library, that is: /usr/lib/libg.a). When this option is given, the -O and -R options are suppressed.
Produce additional symbol table information for adb.1 When this option is given, the -O and -R options are suppressed.
Display helpful information about cc.
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.
Generate 32-bit offsets in switch statement labels (supported only on Sun-2 and Sun-3 systems).
Link with object library library (for ld.1 This option must follow the sourcefile arguments.
Add directory to the list of directories containing object-library routines (for linking using ld.1
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).
Generate code to allow loading and storage of misaligned data (Sun-4 systems only).
-o outputfile
Name the output file outputfile. outputfile must have the appropriate suffix for the type of file to be produced by the compilation (see FILES, below). outputfile cannot be the same as sourcefile (the compiler will not overwrite the source file).
Optimize the object code. Ignored when either -g, -go, or -a is used. -O with the level omitted is equivalent to -O2. On Sun386i systems, any level supplied is treated as level 1. level is one of:
Do postpass assembly-level optimization only.
Do global optimization prior to code generation, including loop optimizations, common subexpression elimination, copy propagation, and automatic register allocation. -O2 does not optimize references to or definitions of external or indirect variables.
Same as -O2, but optimize uses and definitions of external variables. -O3 does not trace the effects of pointer assignments. Neither -O3 nor -O4 should be used when compiling either device drivers, or programs that modify external variables from within signal handlers.
Same as -O3, but trace the effects of pointer assignments.
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).
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.
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).
Produce position-independent code. Each reference to a global datum is generated as a dereference of a pointer in the global offset table. Each function call is generated in pc-relative addressing mode through a procedure linkage table. The size of the global offset table is limited to 64K on MC68000-family processors, or to 8K on SPARC processors.
Like -pic, but allows the global offset table to span the range of 32-bit addresses in those rare cases where there are too many global data objects for -pic.
Use pipes, rather than intermediate files, between cpp.1 and ccom compilation stages. Very cpu-intensive.
-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 directory pathname into the compilation search path. pathname will be searched for alternate versions of the compilation programs, such as cpp.1 and ld.1 This path will also be searched first for certain relocatable object files that are implicitly referenced by the compiler driver, for example *crt*.o and bb_link.o.
-Qproduce sourcetype
Produce source code of the type sourcetype. sourcetype can be one of:
C source (from bb_count).
Preprocessed C source from cpp.1
Object file from as.1
Assembler source (from inline, or c2).
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.
Do not assemble the program but produce an assembly source file.
Generate extra symbol table information for the Sun Source Code Browser. This is an unbundled product that will be released based on 4.1.
Compile object files for the specified processor architecture.
Unless used in conjunction with one of the Sun Cross-Compilers, correct programs can be generated only for the architecture of the host on which the compilation is performed. target_arch can be one of:
Produce object files for a Sun-2 system.
Produce object files for a Sun-3 system.
Produce object files for a Sun-4 system.
Set directory for temporary files to be directory.
Report execution times for the various compilation passes.
Remove any initial definition of the cpp.1 symbol name. Inverse of the -D option.
Do not print warnings.


(Sun-2, Sun-3, Sun-4 systems only.) 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.


executable output file
library of object files
C source file
tcov.1 test coverage input file (Sun-2, Sun-3, Sun-4 systems only)
C source file after preprocessing with cpp.1
inline expansion file
object file
assembler source file
assembler source for cpp.1
output from tcov.1 (Sun-2, Sun-3, Sun-4 systems only)
object code optimizer
compiler command-line processing driver
macro preprocessor
runtime startup code
startup code for -fsoft option (Sun-2, Sun-3, Sun-4 systems only)
startup for profiling with gprof.1
standard library, see intro.3
startup for profiling with prof.1 intro.3
startup code for -f68881 option (for Sun-3 systems)
Sun386i code optimizer
startup code for -fsky option (for Sun-2 systems)
startup code for -ffpa option (for Sun-3 systems)
standard directory for #include files
basic block counting routine
code generator used with /usr/lib/iropt
profiling library, see gprof.1 or prof.1
inline expander of library calls
intermediate representation optimizer
math library
System V standard compatibility library, see intro.3
System V profiling library, see gprof.1 or prof.1
compiler temporary files
directory for X/Open #include files
X/Open XPG2 compatibility library
Profiled version of X/Open XPG2 compatibility library
file produced for analysis by prof.1
file produced for analysis by gprof.1
subdirectory that holds the information generated by the -cb option


adb.1 ar.1v as.1 cflow.1v cpp.1 ctags.1 cxref.1v dbx.1 dbxtool.1 gprof.1 inline.1 ld.1 lint.1v m4.1v make.1 prof.1 tcov.1 intro.3 monitor.3

[a manual with the abbreviation FPOINT]
[a manual with the abbreviation PUL]
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978


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


While the compiler allows 8-bit strings and comments, 8-bits are not allowed anywhere else. The cc command does not generate or support 8-bit symbol names because, until ANSI C, non-ASCII support was not expected. The ANSI C specification now suggests that string literals and comments can contain any characters from any character code set.

The following commands are affected by this lack of support for 8-bit characters: cflow.1v cpp.1 ctags.1 cxref.1v dbx.1 lint.1v m4.1v and yacc.1


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.

Compiling with optimization level 2 or greater may produce incorrect object code if tail-recursion elimination is applied to functions called with fewer actual parameters (arguments) than the number of formal parameters in the function's definition. Such parameter-count mismatches can be detected using lint.1v

index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97