cc(1)

NAME
cc - C compiler

SYNOPSIS
cc [ -# ] [ -### ] [ -Aname [(tokens) ] ]
[ -B [static|dynamic] ] [ -C ] [ -c ] [ -Dname [=tokens ] ]
[ -d [y|n] ] [ -dalign ] [ -E ] [ -erroff=t ] [ -errtags=a ] [ -fast ] [ -fd ] [ -flags ] [ -fnonstd ] [ -fns ]
[ -fprecision=p ] [ -fround=r ] [ -fsimple ] [ -fsingle ]
[ -fstore ] [ -ftrap=t ] [ -G ] [ -g ] [ -H ]
[ -h name ] [ -Idir ] [ -i ] [ -keeptmp ] [ -KPIC ]
[ -Kpic ] [ -Ldir ] [ -lname ] [ -mc ] [ -misalign ]
[ -misalign2 ] [ -mr ] [ -mr,string ] [ -mt ] [ -native ]
[ -nofstore ] [ -noqueue ] [ -O ] [ -o filename ] [ -P ]
[ -p ] [ -Q [y|n] ] [ -qp ] [ -Rdir[:dir] ] [ -S ] [ -s ]
[ -Uname ] [ -V ] [ -v ] [ -Wc,arg ] [ -w ]
[ -X [a |c |s |t ]] [ -x386 ] [ -x486 ] [ -xa ] [ -xarch=a ] [ -xautopar ] [ -xcache=c ]
[ -xCC ] [ -xcg89 ] [ -xcg92 ] [ -xchip=c ] [ -xcrossfile ] [ -xdepend ]
[ -xe ] [ -xexplicitpar ] [ -xF ] [ -xhelp=f ]
[ -xildoff ] [ -xildon ] [ -xinline=[f1,...,fn] ]
[ -xlibmieee ] [ -xlibmil ] [ -xlic_lib_=l ] [ -xlicinfo ]
[ -xloopinfo ]
[ -xM ] [ -xM1 ] [ -xMerge ] [ -xnolib ] [ -xnolibmil ]
[ -xO[1|2|3|4|5] ] [ -xP ] [ -xparallel ] [ -xpentium ]
[ -xpg ] [ -xprofile=p ] [ -xreduction ] [ -xregs=r ]
[ -xrestrict=f ] [ -xs ]
[ -xsafe=mem ] [ -xsb ] [ -xsbfast ] [ -xsfpconst ]
[ -xspace ] [ -xstrconst ] [ -xtarget=t ] [ -xtemp=dir ]
[ -xtime ] [ -xtransition ] [ -xunroll =n ] [ -xvpara ]
[ -Yc,dir ] [ -YA,dir ] [ -YI,dir ] [ -YP,dir ] [ -YS,dir ] [ -Zll ] [ -Zlp ] [ -Ztha ]

DESCRIPTION
The cc(1) manual page describes the ANSI C compiler options that are SVID compliant under Solaris 2.x. cc uses getopt to parse command-line options. Options are treated as a single letter or as a single letter followed by an argument. See getopt(3c).

cc is the interface to the C compilation system. The compilation tools conceptually consist of a preprocessor, compiler, code generator, optimizer, basic block analyzer, assembler, and link editor. cc processes the supplied options and then executes the various tools with the proper arguments. cc accepts several types of files as arguments.

Files with .c suffix are taken to be C source files and may be preprocessed, compiled, optimized, instrumented for profiling, assembled, and link edited. Although the preprocessor can be used as a macro processor, this is not recommended, as its output is geared toward that which would be acceptable as input to a valid C compiler. The compilation process may be stopped after the completion of any pass if the appropriate options are supplied. If the compilation process runs through the assembler, then an object file is produced with .o suffix substituted for .c. However, the .o file is normally deleted if a single C file is compiled and then immediately link edited. Files with .s suffix are taken to be assembly source files; they may be assembled and link edited. Files with a .S suffix are treated as -Xs mode of the compiler and passed to usr/ccs/lib/cpp for preprocessing before being passed to the assembler. Files with an .i are taken to be preprocessed C source files, and may be compiled, optimized, instrumented for profiling, assembled, and link edited. Files whose names do not end in .c, .s, -f4.S or .i are handed to the link editor, which produces a dynamically linked executable whose name by default is a.out.

Incremental Link Editor (ild) is used in place of linker ld for incremental linking. See -xildon and -xildoff for more information.

See option -Yc, dir to change the default directories used for finding libraries. dir is a colon-separated path list. The default library search order for cc is:
	/opt/SUNWspro/SC4.2/lib
	/usr/ccs/lib
	/usr/lib

OPTIONS

All platform-specific options are "silently accepted" on all platforms. Any exceptions to this rule are noted under the specific option.

The following options are interpreted by cc:

-#  Show each component as it is invoked (verbose mode).

-###
    Show each component as it is invoked, but, unlike the -# option, do not actually execute.

-Aname[(tokens)]
    Associate name as a predicate with the specified tokens as if by a #assert preprocessing directive.
    Preassertions:	system(unix)
    		machine(sparc) (SPARC)
    		machine(i386) (Intel)
    		cpu(sparc) (SPARC)
    		cpu(i386) (Intel)
    		cpu(ppc) (PowerPC)

    The above are not predefined in -Xc mode.

    If -A is followed by a dash (-) only, it causes all predefined macros (other than those that begin with __) and predefined assertions to be forgotten.

-B [static|dynamic]
    Specifies whether bindings of libraries for linking are static or dynamic, indicating whether libraries are non-shared or shared, respectively. -B dynamic causes the link editor to look for files named libx.so and then for files named libx.a when given the -lx option. -B static causes the link editor to look only for files named libx.a. This option may be specified multiple times on the command line as a toggle. This option and its argument are passed to ld.

-C  Prevents the C preprocessor from removing comments, other than those on preprocessing directive lines.

-c  Suppresses the link editing phase of the compilation and produces a .o file for each source file.

-Dname[=token]
    Associates name with the specified token as if by a #define preprocessing directive. If no =token is specified, the token 1 is supplied.
    Predefinitions:	unix
    		sparc (SPARC)
    		i386 (Intel)
    		sun

    The above are not predefined in -Xc mode.
    These predefinitions are valid in all modes:
    __sun
    __unix
    __SUNPRO_C=0x420
    __`uname -s`_`uname -r`
    __sparc (SPARC)
    __i386 (Intel)
    __BUILTIN_VA_ARG_INCR
    __SVR4
    __LITTLE ENDIAN (PowerPC)
    __ppc (PowerPC)
    The following is predefined in -Xa and -Xt modes only:
    __RESTRICT
    The compiler also predefines the object-like macro
    __PRAGMA_REDEFINE_EXTNAME,
    to indicate the pragma will be recognized.

-d [y|n]
    -dy
    specifies dynamic linking, which is the default, in the link editor.
    -dn
    specifies static linking in the link editor.

    This option and its argument are passed to ld.

-dalign
    (SPARC) Allows the compiler to generate
     double-word load/store instructions wherever profitable
    for improved performance.  Assumes that all double and long long type
    data are double-word
    aligned, and should not be used when correct alignment is not assured.

-E  Preprocesses only the named C files and sends the result to the standard output.
    The output will contain preprocessing directives
    for use by the next pass of the compilation system.

-erroff=t
    Suppresses cc warning messages. Has no effect on error messages.

    The -erroff values are members of a comma-separated list that consists of one or more of the following:

    tag Suppresses the warning message specified by this tag. You can display the tag for a message by using the -errtags=yes option.

    no%tag
        Enables the warning message specified by this tag.

    %all
        Suppresses all warning messages.

    %none
        Enables all warning messages. This is the default.

    Order is important; for example, %all,no%tag suppresses all warning messages except tag.

The default is
    -erroff=%none. Specifying -erroff is equivalent to specifying -erroff=%all.

-errtags=a
    Displays the message tag for each error message. a can be either yes or no. The default is -errtags=no. Specifying -errtags is equivalent to specifying -errtags=yes.

-fast
    Selects the optimum combination of compilation options for speed. This should provide close to the maximum performance for most realistic applications. Modules compiled with -fast , must also be linked with -fast .

    It is a convenience option, and it chooses the fastest code generation option available on the compile-time hardware, the optimization level
    -xO4, a set of inline expansion templates, the -fns option (SPARC), the -ftrap=%none option, the -dalign option.

    If you combine -fast with other options, the last specification applies. The code generation option, the optimization level and using inline template files can be overridden by subsequent switches. For example, although the optimization part of -fast is -xO4, the optimization part of -fast -xO1 is -xO1.

    These options are turned on for -fast:

    -xO4

    -fns

    -fsimple (SPARC, PPC)

    -dalign (SPARC)

    -nofstore (Intel)

    -ftrap=%none

    -xlibmil

    -fsingle

    Do not use this option for programs that depend on IEEE standard exception handling; you can get different numerical results, premature program termination, or unexpected SIGFPE signals.

-fd Reports K&R function declarations and definitions.

-flags
    Prints a one-line summary of available options.

-fnonstd
    Causes nonstandard initialization of floating-point arithmetic hardware. In addition, the -fnonstd option causes hardware traps to be enabled for floating-point overflow, division by zero, and invalid operations exceptions. These are converted into SIGFPE signals; if the program has no SIGFPE handler, it terminates with a memory dump (see ieee_handler(3m)). By default, IEEE 754 floating-point arithmetic is nonstop, and underflows are gradual.

    -fnonstd is a macro for -fns and -ftrap=common.

-fns
    Turns on the nonstandard floating-point mode.

    The default is the standard floating-point mode.

    If you compile one routine with -fns, then compile all the program routines with the -fns option; otherwise, you can get unexpected results.

-fprecision=p
    (Intel) Initializes the rounding precision mode bits in the Floating-point Control Word to p, which is one of single (24 bits), double (53 bits), or extended (64 bits) respectively. The default floating-point rounding-precision mode is extended.

    Note that on Intel, only the precision, not exponent, range is affected by the setting of floating-point rounding precision mode.

-fround=r
    Sets the IEEE 754 rounding mode that is established at runtime during the program initialization.

    r must be one of: nearest, tozero, negative, positive.

    The default is -fround=nearest.

    The meanings are the same as those for the ieee_flags subroutine.

    If you compile one routine with -fround=r, compile all the program routines with the same -fround=r option; otherwise, you can get unexpected results.

-fsimple[=n]
    Allows the optimizer to make simplifying assumptions concerning floating-point arithmetic. If n is present, it must be 0, 1, or 2.

    The defaults are:
    o With no -fsimple[=n], the compiler uses -fsimple=0.
    o With only -fsimple, no =n, the compiler uses -fsimple=1.

    -fsimple=0
    Permits no simplifying assumptions. Preserves strict IEEE 754 conformance.

    -fsimple=1
    Allows conservative simplifications. The resulting code does not strictly conform to IEEE 754, but numeric results of most programs are unchanged.

    With -fsimple=1, the optimizer can assume the following:
    o The IEEE 754 default rounding/trapping modes do not change after process initialization.
    o Computations producing no visible result other than potential floating- point exceptions may be deleted.
    o Computations with Infinity or NaNs as operands need not propagate NaNs to their results. For example, x*0 may be replaced by 0.
    o Computations do not depend on sign of zero.

    With -fsimple=1, the optimizer is not allowed to optimize completely without regard to roundoff or exceptions. In particular, a floating-point computation cannot be replaced by one that produces different results with rounding modes held constant at run time. -fast implies -fsimple=1.

    -fsimple=2
    Permits aggressive floating point optimizations that may cause many programs to produce different numeric results due to changes in rounding. For example, permits the optimizer to replace all computations of x/y in a given loop with x*z, where x/y is guaranteed to be evaluated at least once in the loop, z=1/y, and the values of y and z are known to have constant values during execution of the loop.

    Even with -fsimple=2, the optimizer still is not permitted to introduce a floating point exception in a program that otherwise produces none.

-fsingle
    (-Xt and -Xs modes only) Causes the compiler to evaluate float expressions as single precision, rather than double precision. (This option has no effect if the compiler is used in either -Xa or -Xc modes, as float expressions are already evaluated as single precision.)

-fstore
    (Intel) Causes the compiler to convert the value of a floating-point expression or function to the type on the left-hand side of an assignment, when that expression or function is assigned to a variable, or when the expression is cast to a shorter floating-point type, rather than leaving the value in the register. Due to roundoffs and truncation, the results may be different from those generated from the register value. This is the default mode.

-ftrap=t
    Sets the IEEE 754 trapping mode in effect at startup.

    t is a comma-separated list that consists of one or more of the following: %all, %none, common, [no%]invalid, [no%]overflow, [no%]underflow, [no%]division, [no%]inexact.

    The default is -ftrap=%none.

    This option sets the IEEE 754 trapping modes that are established at program initialization. Processing is left-to-right. The common exceptions, by definition, are invalid, division by zero, and overflow.

    Example: -ftrap=%all,no%inexact means set all traps, except inexact.

    The meanings are the same as for the ieee_flags subroutine, except that:
    o %all turns on all the trapping modes.
    o %none, the default, turns off all trapping modes.
    o A no% prefix turns off that specific trapping mode.

    If you compile one routine with -ftrap=t, compile all routines of the program with the same -ftrap=t option; otherwise, you can get unexpected results.

-G  Directs the link editor to produce a shared object rather than a dynamically linked executable. This option is passed to ld. It cannot be used with the -dn option.

-g  Produces additional symbol table information for dbx(1).

    The -g option makes -xildon the default incremental linker option. See -xildon. Invoke ild in place of ld unless any of the following are true: The -G option is present, the -xildoff option is present, any source files are named on the command line.

    When used with the -O option, a limited amount of debugging is available. The combination, -xO4 -g, turns off the inlining that you usually get with -xO4.

-H  Prints, one per line, the path name of each file included during the current compilation to standard output.

-h name
    Assigns a name to a shared dynamic library; allows you to keep different versions of a library.

    In general, the name after -h should be the same as the file name given in the -o option. The space between -h and name is optional.

    The linker assigns the specified name to the library and records the name in the library file as the intrinsic name of the library. If there is no -h name option, then no intrinsic name is recorded in the library file.

    When the runtime linker loads the library into an executable file, it copies the intrinsic name from the library file into the executable, into a list of needed shared library files. Every executable has such a list. If there is no intrinsic name of a shared library, then the linker copies the path of the shared library file instead.

-Idir
    Looks in dir, prior to usr/include, for included files whose names do not begin with slash (/). Directories for multiple -I options are searched in the order specified.

-i  Ignores the LD_LIBRARY_PATH setting.

-keeptmp
    Retains temporary files created during compilation, instead of deleting them automatically.

-KPIC
    Produces position-independent code for use in shared libraries. Each reference to a global datum is generated as a de-reference of a pointer in the global offset table. Each function call is generated in pc-relative addressing mode through a procedure linkage table.

    (SPARC) (PowerPC) With this option, the global offset table spans the range of 32-bit addresses in those rare cases where there are too many global data objects for -Kpic

    (Intel) -KPIC is identical to -Kpic .

-Kpic
    Produces position-independent code for use in shared libraries.

    (SPARC) (PowerPC) It is similar to -KPIC , except that the size of the global offset table is limited to 8K.

-Ldir
    Adds dir to the list of directories searched for libraries by ld. This option and its arguments are passed to ld.

-lname
    Links with object library libname.so or libname.a (for ld(1)). The order of libraries in the command line is important, as symbols are resolved from left to right. This option must follow the sourcefile.

-mc Removes duplicate strings from the .comment section of an object file. When you use the -mc flag, -mcs -c is invoked.

-misalign
    (SPARC, PowerPC) Informs the compiler that data is not properly aligned and thus very conservative loads and stores must be used for data, that is, one byte at a time. Using this option can cause significant performance degradation when running the program. If you compile and link in separate steps, this option must appear on both the compile and link command lines.

-misalign2
    (SPARC, PowerPC) Assumes that data is not properly aligned, but that data is at least half-word aligned. Though conservative uses of loads and stores must be used for data, the performance degradation when running a program is less than that seen for -misalign. If you compile and link in separate steps, this option must appear on both the compile and link command lines.

-mr Removes all strings from the .comment section of an object file. When you use the -mr flag, mcs -d is invoked.

-mr,string
    Removes all strings from the .comment section and inserts string in the .comment section of the object file. If string contains embedded blanks, it must be enclosed in quotation marks. If string is null, the .comment section will be empty. When you use this flag, mcs -d -a is invoked.

-mt Passes D_REENTRANT to preprocessor. Appends -lthread. If you are doing your own multithread coding, you must use this option in the compile and link steps. To obtain faster execution, this option requires a multiprocessor system. On a single-processor system, the resulting executable usually runs more slowly with this option.

-native
    Ascertains which code-generation options (SPARC) or which processor (Intel) (PowerPC) are available on the machine running the compiler, and directs the compiler to generate code targeted for that machine.

    This option is a synonym for -xtarget=native .

    The -fast macro includes -native in its expansion.

-nofstore
    (Intel) Does not convert the value of a floating-point expression or function to the type on the left-hand side of an assignment, when that expression or function is assigned to a variable, or is cast to a shorter floating-point type; rather, it leaves the value in a register.

-noqueue
    Disables queueing of compiler license requests.

-O  Equivalent to -xO2 .

-o filename
    Names the output file filename, instead of the default a.out. filename cannot be the same as sourcefile since cc does not overwrite the source file. This option and its argument are passed to ld.

-P  Preprocesses only the named C files and leaves the result in corresponding files suffixed .i. The output will not contain any preprocessing line directives, unlike -E.

-p  Prepares the object code to collect data for profiling with prof(1); also, if link editing takes place, links profiled versions of libc.a and libm.a (with the -lm option). A mon.out file will then be produced at normal termination of execution of the object program. An execution profile can then be generated by use of prof.

-Q[y|n]
    Emits or does not emit identification information to the output file. If y is used, identification information about each invoked compilation tool will be added to the output files (the default behavior). This can be useful for software administration. -Qn suppresses this information.

-qp Same as -p.

-Rdir[:dir]
    A colon-separated list of directories used to specify library search directories to the runtime linker. If present and not null, it is recorded in the output object file and passed to the runtime linker.

    If both LD_RUN_PATH and the -R option are specified, the -R option takes precedence.

-S  Compiles, but does not assemble or link edit the named C files. The assembler-language output is left in corresponding files suffixed .s.

-s  Removes all symbolic debugging information from the output object file. This option is passed to ld(1). This option cannot be specified with -g.

-Uname
    Causes any definition of name to be undefined, as if by a preprocessing directive. If the same name is specified for both -D and -U, name is not defined, regardless of the order of the options. You can give multiple -Uname options.

-V  Causes each invoked tool to print its version information on the standard error output.

-v  Causes the compiler to perform more and stricter semantic checks, and to enable certain lint-like checks on the named C files.

-Wc,arg
    Passes the argument arg to c. Each argument must be separated from the preceding by only a comma. (A comma can be part of an argument by escaping it by an immediately preceding backslash (\) character; the backslash is removed from the resulting argument.) All -W arguments are passed after the regular command-line arguments.

c can be one of the following:

    a   assembler: (fbe) (gas)
    c   C code generator: (cg)(SPARC), (codegen)(Intel) (PowerPC)
    l   link editor (ld)
    m   mcs
    p   preprocessor (cpp)
    0   compiler (acomp and ssbd)
    2   optimizer: (iropt) (SPARC); intermediate code translator: (cg386) (Intel), (cgppc) (PowerPC)

    For example, -Wa,-o,objfile passes -o and objfile to the assembler, in that order; also -Wl,-I,name causes the linking phase to override the default name of the dynamic linker, /usr/lib/ld.so.1.

    The order in which the argument(s) are passed to a tool with respect to the other specified command line options may change.

-w  Does not print compiler warning messages.

-X[a|c|s|t]
    Specifies the degree of conformance to the ANSI C standard. Specifies one of the following:

    a (ANSI)
        ANSI C plus K&R C compatibility extensions, with semantic changes required by ANSI C. Where K&R C and ANSI C specify different semantics for the same construct, the compiler will issue warnings about the conflict and use the ANSI C interpretation. This is the default compiler mode.

    c (conformance)
        Maximally conformant ANSI C, without K&R C compatibility extensions. The compiler will issue errors and warnings for programs that use non-ANSI C constructs.

    s (K&R C)
        The compiled language includes all features compatible with (pre-ANSI) K&R C. The compiler tries to warn about all language constructs that have differing behavior between Sun ANSI C and the K&R C. Invokes cpp for processing. __STDC__ is not defined in this mode. (See the C Transition Guide for differences between ANSI and K&R C.)

    t (transition)
        ANSI C plus K&R C compatibility extensions, without semantic changes required by ANSI C. Where K&R C and ANSI C specify different semantics for the same construct, the compiler will issue warnings about the conflict and use the K&R C interpretation.

    The predefined macro __STDC__ has the value 0 for -Xt and -Xa, and 1 for -Xc. (It is not defined for -Xs.) All warning messages about differing behavior can be eliminated through appropriate coding; for example, use of casts can eliminate the integral promotion change warnings.

-x386
    (Intel) Optimizes for the 80386 processor.

-x486
    (Intel) Optimizes for the 80486 processor.

-xa Inserts code to count how many times each basic block is executed. This is the old style of basic block profiling for tcov. See -xprofile=tcov for information on the new style of profiling and the tcov(1) man page for more details.

    Invokes a runtime 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. This option is incompatible with -g .

    If set at compile-time, the TCOVDIR environment variable specifies the directory where the .d files are located. If this variable is not set, the .d files remain in the same directory as the .c files.

    The -xprofile=tcov and the -xa options are compatible in a single executable. That is, you can link a program that contains some files which have been compiled with -xprofile=tcov, and others with -xa. You cannot compile a single file with both options.

-xarch=a
    Specifies the set of instructions the compiler may use.

    a must be one of: generic, v7, v8a, v8, v8plus, v8plusa, 386, pentium_pro, ppc. ppc_nofma

    Although this option can be used alone, it is part of the expansion of the -xtarget option; its primary use is to override a value supplied by the -xtarget option.

    This option limits the instructions generated to those of the specified architecture, and allows the specified set of instructions. The option does not guarantee the specified set is used; however, under optimization, the set is usually used.

    If this option is used with optimization, the appropriate choice can provide good performance of the executable on the specified architecture. An inappropriate choice can result in serious degradation of performance.

    v7, v8, and v8a are all binary compatible. v8plus and v8plusa are binary compatible with each other and forward, but not backward. For any particular choice, the generated executable can run much more slowly on earlier architectures (to the left in the above list). See the C 4.2 User's Guide for details.

    The -xarch values are:

    generic
        Gets good performance on Intel, PowerPC, and most SPARCs, and major degradation on none. This is the default.

    v7  Limits the instruction set to V7 architecture.

    v8a Limits the instruction set to the V8a version of the V8 architecture.

    v8  Limits the instruction set to V8 architecture.

    v8plus
        Limits the instruction set to the V8plus version of the V9 architecture.

    v8plusa
        Limits the instruction set to the V8plusa version of the V9 architecture.

    386 Limits the instruction set to Intel x86 architecture.

    pentium_pro
        Limits the instruction set to the Intel pentium_pro architecture.

    ppc Limits the instruction set to the PowerPC architecture.

    ppc_nofma
        Same as ppc, but will not issue "fused multiply-add" instruction.

-xautopar
    (SPARC) Turns on automatic parallelization for multiple processors. Does dependence analysis (analyze loops for inter- iteration data dependence) and loop restructuring. If optimization is not at -xO3 or higher, optimization is raised to -xO3 and a warning is emitted.

    Avoid -xautopar if you do your own thread management.

    The SunSoft Workshop includes the license required to use multiprocessor C. To get faster execution, this option requires a multiple processor system. On a single-processor system, the resulting binary usually runs slower.

    To determine how many processors you have, use the prsinfo command.

    To request a number of processors, set the PARALLEL environment variable. The default is 1.

    o   Do not request more processors than are available.

    o   If N is the number of processors on the machine, then for a one-user, multiprocessor system, try PARALLEL=N-1.

    If you use -xautopar and compile and link in one step, then linking automatically includes the microtasking library and the threads-safe C runtime library. If you use -xautopar and compile and link in separate steps, then you must also link with -xautopar.

-xcache=c
    Defines the cache properties for use by the optimizer.

    c must be one of the following:

    o   generic

    o   s1/l1/a1

    o   s1/l1/a1:s2/l2/a2

    o   s1/l1/a1:s2/l2/a2:s3/l3/a3

    The si/li/ai are defined as follows:

    si  The size of the data cache at level i, in kilobytes

    li  The line size of the data cache at level i, in bytes

    ai  The associativity of the data cache at level i

    Although this option can be used alone, it is part of the expansion of the -xtarget option; its primary use is to override a value supplied by the -xtarget option.

    This option specifies the cache properties that the optimizer can use. It does not guarantee that any particular cache property is used.

    The -xcache values are:

    generic
        Defines the cache properties for good performance on most SPARCs. This is the default.

    s1/l1/a1
        Defines level 1 cache properties.

    s1/l1/a1:s2/l2/a2
        Defines levels 1 and 2 cache properties.

    s1/l1/a1:s2/l2/a2:s3/l3/a3
        Defines levels 1, 2, and 3 cache properties.

Example:-xcache=16/32/4:1024/32/1 specifies the following:

    Level 1 cache has: Level 2 cache has:

    16K bytes
        1024K bytes

    32 bytes line size
        32 bytes line size

    4-way associativity
        Direct mapping associativity.

-xCC
    Accepts the C++-style comments. In particular, the "//" can be used to indicate the start of a comment.

-xcg89
    (SPARC) This option is a macro for:
    -xarch=v7 -xchip=old -xcache=64/32/1.

-xcg92
    (SPARC) This option is a macro for:
    -xarch=v8 -xchip=super -xcache=16/32/4:1024/32/1.

-xchip=c
    Specifies the target processor for use by the optimizer.

    c must be one of: generic, old, super, super2, micro, micro2, hyper, hyper2, powerup, ultra, 386, 486, pentium, pentium_pro, 603, 604.

    Although this option can be used alone, it is part of the expansion of the -xtarget option; its primary use is to override a value supplied by the -xtarget option.

    This option specifies timing properties by specifying the target processor.

    Some effects are:

    o   The ordering of instructions, that is, scheduling

    o   The way the compiler uses branches

    o   The instructions to use in cases where semantically equivalent alternatives are available

    The -xchip values are:

    generic
        Uses timing properties for good performance on most SPARCs.

    old Uses timing properties of pre-SuperSPARC processors.

    super
        Uses timing properties of the SuperSPARC chip.

    super2
        Uses timing properties of the SuperSPARC II chip.

    micro
        Uses timing properties of the microSPARC chip.

    micro2
        Uses timing properties of the microSPARC II chip.

    hyper
        Uses timing properties of the hyperSPARC chip.

    hyper2
        Uses timing properties of the hyperSPARC II chip.

    powerup
        Uses timing properties of the Weitek PowerUp chip.

    ultra
        Uses timing properties of the UltraSPARC chip.

    386 Uses timing properties of the Intel 386 architecture.

    486 Uses timing properties of the Intel 486 architecture.

    pentium
        Uses timing properties of the Intel pentium architecture.

    pentium_pro
        Uses timing properties of the Intel pentium_pro architecture.

    603 Uses timing properties of the PowerPC 603 chip.

    604 Uses timing properties of the PowerPC 604 chip.

    Values for Intel and PowerPC are shown here:

    Intel accepts:

        generic

        386

        486

        pentium

        pentium_pro

    PowerPC accepts:

        generic

-xcrossfile
    (SPARC) Enables optimization and inlining across source files.

    Only effective with -xO4 or -xO5, the compiler is allowed to analyze all the files on the command line as if they had been concatenated into a single file.

-xdepend
    (SPARC) Analyzes loops for inter-iteration data dependencies and does loop restructuring.

    Loop restructuring includes loop interchange, loop fusion, scalar replacement, and elimination of "dead" array assignments. If optimization is not at -xO3 or higher, optimization is raised to -xO3 and a warning is issued.

    Dependency analysis is included in -xautoparor-xparallel. The dependency analysis is done at compile time.

    Dependency analysis may help on single-processor systems. However, if you try -xdepend on single-processor systems, you should not use either -xautopar or -xexplicitpar. If either of them is on, the -xdepend optimization is done for multiple-processor systems.

-xe Performs only syntax and semantic checking on the source file, but does not produce any object or executable file.

-xexplicitpar
    (SPARC) Parallelizes the loops that are specified. You do the dependency analysis: analyze and specify loops for inter-iteration and data dependencies. The software parallelizes the specified loops. If optimization is not at -xO3 or higher, then it is raised to -xO3 and a warning is issued.

    Avoid -xexplicitpar if you do your own thread management.

    The SunSoft WorkShop includes the license required to use multiprocessor C options. To get faster code, use this option on a multiprocessor system. On a single-processor system, the generated code usually runs slower.

    If you identify a loop for parallelization, and the loop has dependencies, you can get incorrect results, possibly different ones with each run, and with no warnings. Do not apply an explicit parallel pragma to a reduction loop. The explicit parallelization is done, but the reduction aspect of the loop is not done, and the results can be incorrect.

    If you use -xexplicitpar and compile and link in one step, then linking automatically includes the microtasking library and the threads-safe C runtime library. If you use -xexplicitpar and compile and link in separate steps, then you must also link with -xexplicitpar.

-xF Enables performance analysis of the executable using the WorkShop Analyzer. (See analyzer(1) man pages.) Produces code that can be reordered at the function level. Each function in the file is placed in a separate section; for example, functions foo() and bar() will be placed in the sections .text%foo and .text%bar , respectively. Function ordering in the executable can be controlled by using -xF in conjunction with the -M option to ld (see ld(1)).

    This option also causes the assembler to generate some debugging information necessary for data collection in the object file.

-xhelp=f
    Displays on-line help information.

    f must be one of flags, readme or errors.

    -xhelp=flags displays a summary of the compiler options; -xhelp=readme displays the readme file; -xhelp=errors displays the Error and Warning Messages file.

-xildoff
    Turns off the incremental linker and forces the use of ld. This option is the default if you do not use the -g option, or if you do use the -G option, or any source files are present on the command line. Override this default by using the -xildon option.

-xildon
    Turns on the incremental linker and forces the use of ild in incremental mode. This option is the default if you use the -g option, and you do not use the -G option, and there are no source files present on the command line. Override this default by using the -xildoff option.

-xinline=[f1,...,fn]
    For user-written routines, tries to inline only those named in the list f1 to fn. It tries routines only in the file being compiled. The list is a comma-separated list of functions and subroutines.

    If compiling with -xO3, you can use this option to increase optimization by inlining some routines. The -xO3 option does not inline by itself.

    If compiling with -xO4, you can use this option to decrease optimization by restricting inlining to only those routines in the list. With -xO4, the compiler normally tries to inline all user-written subroutines and functions. When xinline= is specified with an empty rlist, it indicates that none of the routines in the source file are to be inlined.

    A routine is not inlined if any of the following apply (no warning is issued):
    o Optimization is less than -xO3
    o The routine cannot be found
    o Inlining the routine does not look profitable or safe to iropt
    o The source for the routine is not in the file being compiled (however, see -xcrossfile).

-xlibmieee
    Forces IEEE 754 style return values for math routines in exceptional cases. In such cases, no exeception message will be printed, and errno should not be relied on.

-xlibmil
    Inlines some library routines for faster execution.

-xlic_lib_=l
    (SPARC, Intel) Links in the Sun supplied licensed libraries specified in l, where l is a comma-separated list of libraries.

-xlicinfo
    Does not check out a license but returns information on the status of licensing.

-xloopinfo
    (SPARC) Shows which loops are parallelized and which are not. This option is normally for use with the -xautopar and -xexplicitpar options. The SunSoft WorkShop includes the license required to use multiprocessor C options.

-xM Runs the ANSI preprocessor on the named C programs, generates makefile dependencies and sends the result to the standard output (see make(1) for details about makefiles and dependencies). Specifying -xM with -Xs runs the pre-ANSI preprocessor, /usr/ccs/lib/cpp .

-xM1
    Same as -xM except that -xM1 does not report dependencies for /usr/include header files. For example:
        more hello.c
        #include <stdio.h>
        main()
        {
            (void) printf ("hello\n");
        }
        cc -xM hello.c
        hello.o: hello.c
        hello.o: /usr/include/stdio.h
    Compiling with -xM1 does not report header file dependencies:
        cc -xM1 hello.c
        hello.o: hello.c

-xMerge
    (SPARC) Directs cc to merge the data segment with the text segment. Data initialized in the object file produced by this compilation is read-only and (unless linked with ld -N) is shared between processes.

-xnolib
    Does not link any libraries by default; that is, no -l options are passed to ld . Normally, the cc driver passes -lc to ld .

    When you use -xnolib , you have to pass all -l options yourself. For example:
        cc test.c -xnolib -Bstatic -lm -Bdynamic -lc
    links libm statically and the other libraries dynamically.

-xnolibmil
    Does not inline math library routines. Use this after the -fast option:
    cc –fast –xnolibmil ...

-xO [1|2|3|4|5]
    Optimizes the object code. Specifying -xO is equivalent to specifying -xO2.

    The levels (1, 2, 3, 4, or 5) you can use differ according to the platform you are using.

        ( SPARC)

        -xO1
            Does basic local optimization (peephole).

        -xO2
            Does basic local and global optimization. This is induction variable elimination, local and global common subexpression elimination, algebraic simplification, copy propagation, constant propagation, loop-invariant optimization, register allocation, basic block merging, tail recursion elimination, dead code elimination, tail call elimination and complex expression expansion.

            The -xO2 level does not assign global, external, or indirect references or definitions to registers. It treats these references and definitions as if they were declared "volatile." In general, the -xO2 level results in minimum code size.

        -xO3
            Performs like -xO2 but, also optimizes references or definitions for external variables. Loop unrolling and software pipelining are also performed. The -xO3 level does not trace the effects of pointer assignments. When compiling either device drivers, or programs that modify external variables from within signal handlers, you may need to use the volatile type qualifier to protect the object from optimization. In general, the -xO3 level results in increased code size.

        -xO4
            Performs like -xO3 but, also does automatic inlining of functions contained in the same file; this usually improves execution speed. The -xO4 level does trace the effects of pointer assignments. In general, the -xO4 level results in increased code size.

        -xO5
            Generates the highest level of optimization. Uses optimization algorithms that take more compilation time or that do not have as high a certainty of improving execution time. Optimization at this level is more likely to improve performance if it is done with profile feedback.

        (Intel) (PowerPC)

        -xO1
            Preloads arguments from memory, cross jumping (tail merging), as well as the single pass of the default optimization.

        -xO2
            Schedules both high- and low-level instructions and performs improved spill analysis, loop memory-reference elimination, register lifetime analysis, enhanced register allocation, and elimination of global common subexpression.

        -xO3
            Performs loop strength reduction, induction variable elimination, as well as the optimization done by level 2.

        -xO4
            Performs loop unrolling, avoids creating stack frames when possible, and automatically inlines functions contained in the same file, as well as the optimization done by levels 2 and 3. Note that this optimization level can cause stack traces from adb and dbx to be incorrect.

        -xO5
            Generates the highest level of optimization. Uses optimization algorithms that take more compilation time or that do not have as high a certainty of improving execution time. Some of these include generating local calling convention entry points for exported functions, further optimizing spill code, and added analysis to improve instruction scheduling.

        If the optimizer runs out of memory, it tries to recover by retrying the current procedure at a lower level of optimization and resumes subsequent procedures at the original level specified in the command-line option.

        If you optimize at -xO3 or -xO4 with very large procedures (thousands of lines of code in the same procedure), the optimizer may require a large amount of virtual memory. In such cases, machine performance may degrade.

-xP Prints prototypes for K&R C function definitions.

-xparallel
    (SPARC) Parallelizes loops both automatically (by the compiler) and explicitly (as specified by the programmer). This option is a macro and is equivalent to specifying all three of -xautopar, -xdepend, and
    -xexplicitpar. With explicit parallelization, there is a risk of producing incorrect results.

    If optimization is not at -xO3 or higher, optimization is raised to and a warning is issued.

    Avoid -xparallel if you do your own thread management.

    The SunSoft WorkShop includes the license required to use the multiprocessor C options. To get faster code, use this option on a multiprocessor SPARC system. On a single-processor system, the generated code usually runs more slowly.

    If you compile and link in one step, -xparallel links with the microtasking library and the threads-safe C runtime library. If you compile and link in separate steps, and you compile with -xparallel, then link with -xparallel.

-xpentium
    (Intel) Generates code for the Pentium processor.

-xpg
    Prepares the object code to collect data for profiling with gprof(1). Invokes a runtime recording mechanism that produces a gmon.out file (at normal termination).

-xprofile=p
    Collects data for a profile or use a profile to optimize.

    (SPARC) p must be collect[:name], use[:name], or tcov; (Intel) (PowerPC) p must be tcov.

    This option causes execution frequency data to be collected and saved during execution, then the data can be used in subsequent runs to improve performance. This option is only valid when a level of optimization is specified.

    collect[:name]
        Collects and saves execution frequency for later use by the optimizer with -xprofile=use. The compiler generates code to measure statement execution frequency.

        The name is the name of the program that is being analyzed. This name is optional. If name is not specified, a.out is assumed to be the name of the executable.

        At runtime, a program compiled with
        -xprofile=collect:name will create the subdirectory name.profile to hold the runtime feedback information. Data is written to the file feedback in this subdirectory. If you run the program several times, the execution frequency data accumulates in the feedback file; that is, output from prior runs is not lost.

    use[:name]
        Uses execution frequency data to optimize strategically. The name is the name of the executable that is being analyzed. This name is optional. If name is not specified, a.out is assumed to be the name of the executable.

        The program is optimized by using the execution frequency data previously generated and saved in the feedback files written by a previous execution of the program compiled with -xprofile=collect.

        The source files and other compiler options must be exactly the same as those used for the compilation that created the compiled program that generated the feedback file If compiled with -xprofile=collect:name, the same program name name must appear in the optimizing compilation: -xprofile=use:name.

    tcov
        Basic block coverage analysis using "new" style tcov.

        The -xprofile=tcov option is the new style of basic block profiling for tcov. It has similar functionality to the -xa option, but correctly collects data for programs that have source code in header files. See also -xa for information on the old style of prfiling, the tcov(1) man page, and the Performance Profiling Tools manual for more details.

        Code instrumentation is performed similarly to that of the -xa option, but .d files are no longer generated. instead, a single file is generated, the name of which is based on the final executable. for example, if the program is run out of /foo/bar/myprog.profile, the data file is stored in /foo/bar/myprog.profile/myprog.tcovd.

        The -xprofile=tcov and the -xa options are compatible in a single executable, that is, you can link a program that contains some files that have been compiled with -xprofile=tcov, and others with -xa. You cannot compile a single file with both options.

        When running tcov, you must pass it the -x option to make it use the new style of data. If not, tcov uses the old .d files, if any, by default for data, and produces unexpected output.

        Unlike the -xa option, the TCOVDIR environment variable has no effect at compile-time. However, its value is used at program runtime. See tcovf1(1) and the Performance Profiling Tools manual for more details.

-xreduction
    (SPARC) Analyzes loops for reduction in automatic parallelization. This option is valid only if -xreduction one of -xautopar or -xparallel is also specified. Otherwise the compiler issues a warning.

    Parallelization options require a WorkShop license.

    When a reduction recognition is enabled, the compiler parallelizes reductions such as dot products, maximum and minimum finding. These reductions yield different roundoffs from those obtained by unparallelized code.

-xregs=r
    (SPARC) Specifies the usage of registers for the generated code.

    r is a comma-separated list that consists of one or more of the following: [no%]appl, [no%]float.

    Example: -xregs=appl,no%float

    The -xregs= values are:

    appl
        Allows using the registers g2, g3, and g4.

    no%appl
        Does not use the appl registers.

    float
        Allows using the floating-point registers as specified in the SPARC ABI.

    no%float
        Does not use the floating-point registers.

    The default is: -regs=appl,float.

-xrestrict=f
    (SPARC) Treats pointer-valued function parameters as restricted pointers. f is a comma-separated list that consists of one or more function parameters, %all, %none. This command-line option can be used on its own, but is best used with optimization of -xO3 or greater.

    The default is %none. Specifying -xrestrict is equivalent to specifying -xrestrict=%all.

-xs Disables Auto-Read for dbx. Use this option in case you cannot keep the .o files around. It passes the -s option to the assembler.

    No Auto-Read is the older way of loading symbol tables. It places all symbol tables for dbx in the executable file. The linker links more slowly and dbx initializes more slowly.

    Auto-Read is the newer and default way of loading symbol tables. With Auto-Read, the information is distributed in the .o files, so that dbx loads the symbol table information only if and when it is needed. Hence, the linker links faster, and dbx initializes faster.

    With -xs, if you move the executables to another directory, then to use dbx, you can ignore the object (.o) files.

    Without -xs, if you move the executables, you must move both the source files and the object (.o) files, or set the path with the dbx pathmap or use command.

-xsafe=mem
    (SPARC) Allows the compiler to assume no memory-based traps occur.

    This option grants permission to use the speculative load instruction on V9 machines.

-xsb
    Generates data in the .sb(5) directory for the sbrowser(1) program, part of the SourceBrowser. This option is not valid with the -Xs mode of the compiler.

-xsbfast
    Generates data in the .sb(5) directory for the sbrowser(1) program, part of the SourceBrowser. Does not compile source into an object file. This option is not valid with the -Xs mode of the compiler.

-xsfpconst
    Represents unsuffixed floating-point constants as single precision, instead of the default mode of double precision. Not valid with -Xc.

-xspace
    Does no optimizations that increase code size. Does not parallelize loops if it increases code size. Example: Does not unroll loops.

-xstrconst
    Inserts string literals into the read-only data section of the text segment instead of the default data segment.

-xtarget=t
    Specifies the target system for the instruction set and optimization.

    t must be one of: native, generic, system-name.

    The -xtarget option permits a quick and easy specification of the -xarch, -xchip, and -xcache combinations that occur on real systems. The only meaning of -xtarget is in its expansion.

    The -xtarget values are:

    native
        Gets the best performance on the host system.

    generic
        Gets the best performance for generic architecture, chip, and cache. This is the default.

    system-name
        Get the best performance for the specified system.
        Valid system names are: sun4/15, sun4/20, sun4/25, sun4/30, sun4/40, sun4/50, sun4/60, sun4/65, sun4/75, sun4/110, sun4/150, sun4/260, sun4/280, sun4/330, sun4/370, sun4/390, sun4/470, sun4/490, sun4/630, sun4/670, sun4/690, sselc, ssipc, ssipx, sslc, sslt, sslx, sslx2, ssslc, ss1, ss1plus, ss2, ss2p, ss4, ss5, ssvyger, ss10, ss10/hs11, ss10/hs12, ss10/hs14, ss10/20, ss10/hs21, ss10/hs22, ss10/30, ss10/40, ss10/41, ss10/50, ss10/51, ss10/61, ss10/71, ss10/402, ss10/412, ss10/512, ss10/514, ss10/612, ss10/712, ss20/hs11, ss20/hs12, ss20/hs14, ss20/hs21, ss20/hs22, ss20/51, ss20/61, ss20/71, ss20/91, ss20/502, ss20/514, ss20/612, ss20/712, ss20/912, ss600/41, ss600/51, ss600/61, ss600/120, ss600/140, ss600/412, ss600/612, ss1000, sc2000, cs6400, solb5, solb6, ultra, ultra1/140, ultra1/170, ultra1/1170, ultra1/2170, ultra1/2200.

    On Intel:
        -xtarget= accepts

    o generic or native.

    o 386 (equivalent to -386 option) or
        486 (equivalent to -486 option).

    o pentium (equivalent to -pentium option) or
        pentium_pro.

    on PowerPC:
        -xtarget= accepts generic or native.

    See the section on
        -xtarget=t in the C 4.2 User's Guide for the -xtarget expansions that show the mnemonic encodings of the actual system names and numbers.

    This option is a macro. Each specific value for
    -xtarget expands into a specific set of values for the -xarch, -xchip, and -xcache options. For example:
    -xtarget=sun4/15 is equivalent to:
    -xarch=v8a -xchip=micro -xcache=2/16/1

-xtemp=dir
    Sets directory for temporary files used by cc to dir. No space is allowed within this option string. Without this option, temporary files go to tmp. -xtemp has precedence over the TMPDIR environment variable.

-xtime
    Reports the time and resources used by each compilation.

-xtransition
    Issues warnings for differences between K&R C and ANSI C.

-xunroll=n
    Specifies whether or not the compiler optimizes (unrolls) loops. n is a positive integer. When n is 1, it is a command and the compiler unrolls no loops. When n is greater than 1, -xunroll=n merely suggests to the compiler that it unroll loops n times.

-xvpara
    (SPARC) Issues warnings about loops that have the loop may not be properly specified for parallelization.. For example, when the compiler detects data dependencies between loop iterations, it issues a warning.

    Use the -xexplicitpar or the -xparallel option and the MP directive.

    The SunSoft WorkShop includes the license required to use multiprocessor C options.

-Yc, dir
    Specifies a new directory dir for the location of component c. c can consist of any of the characters representing tools listed under the -W option.

    If the location of a tool is being specified, then the new path name for the tool will be dir/tool. If more than one -Y option is applied to any one item, then the last occurrence holds.

-YA, dir
    Specifies a directory dir to search for all compiler components. If a component is not found in dir, the search reverts to the directory where the compiler is installed.

-YI, dir
    Changes default directory searched for include files.

-YP, dir
    Changes default directory for finding libraries files.

-YS, dir
    Changes default directory for startup object files.

-Zll
    (SPARC) Creates the lock_lint database files (.ll files), one per each .c file compiled for the lock_lint(1) program, which is included in the iMPact product. Does not actually compile.

-Zlp
    (SPARC) Prepares object files for the loop profiler, looptool. The looptool(1) utility can then be run to generate loop statistics about the program. Use this option with -xdepend; if -xdepend is not explicitly or implicitly specified, turns on -xdepend and issues a warning. If optimization is not at -xO3 or higher, optimization is raised to -xO3 and a warning is issued.

    The SunSoft WorkShop includes the license required to use the MPC options.

-Ztha
    (SPARC) Prepares code for analysis by the thread analyzer, the performance analysis tool for multithreaded code.
    cc recognizes -a, -e, -r, -t, -u, and -z and passes these options and their arguments to ld. cc also passes any unrecognized options to ld with a warning.

  PRAGMAS

The following
taskloop, (SPARC) no_side_effect,

Refer to the Sunsoft C: User's Guide for more information on these pragmas.

ENVIRONMENT

TMPDIR
    cc normally creates temporary files in the directory tmp. You may specify another directory by setting the environment variable TMPDIR to your chosen directory. (If TMPDIR isn't a valid directory, then cc will use tmp). The -xtemp option has precedence over the TMPDIR environment variable.

SUNPRO_SB_INIT_FILE_NAME
    The absolute path name of the directory containing the .sbinit(5) file. This variable is used only if the -xsb or -xsbfast flag is used.

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
file.il
    inline(1) expansion file
file.o
    object file
file.s
    assembler source file
file.tcov
    output from tcov(1)
acomp
    compiler front end
cc  compiler command line driver
cg  code generator
crt1.o
    runtime startup code
crti.o
    runtime startup code
crtn.o
    runtime startup code
fbe assembler
gcrt1.o
    startup for profiling with gprof(1)
gmon.out
    default profile file for -xpg
iropt
    global optimizer
mcrt1.o
    start-up for profiling with prof(1) and intro(3)
mon.out
    default profile file for -p
.sb The directory used to store sbrowser(1) data when the -xsb or -xsbfast flag is used.
.sbinit
    A file containing commands which can be used to specify the location of the .sb directory and to control the execution of sbcleanup
sbcleanup
    deletes obsolete files in the .sb directory and creates an up-to-date .sb/Index file

SEE ALSO
as(1), dbx(1), ild(1), ld(1), lint(1), prof(1), sbrowser(1), .sb(5), .sbinit(5), tmpnam(3S)
The SunSoft C: User's Guide.

SunSoft C: Making the Transition to ANSI C.

Incremental Link Editor (ild) manual

American National Standard for Programming Language--C, ANSI/ISO 9899-1990.