Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cc(1) — Sun WorkShop 5.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

as(1)

dbx(1)

ild(1)

ld(1)

lint(1)

prof(1)

tmpnam(3S)

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=yes|no ] [ −fprecision=p ]

[ −fround=r ] [ −fsimple[=n] ] [ −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 ] [ −xcode=v ]
[ −xcrossfile[=n] ] [ −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 ] [ −xprefetch=yesno ] [ −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 ]

DESCRIPTION

The cc(1) manual page describes the ANSI/ISO C compiler options that are SVID compliant under Solaris versions 2.5.1, 2.6, Solaris 7. 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 process incorporates a preprocessor, compiler, code generator, optimizer, assembler, and link editor.  cc processes the supplied options and then executes the various components 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, .S or .i are passed 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/SC5.0/lib
/usr/ccs/lib
/usr/lib

COMPILING FOR 64-BIT SOLARIS 7:

This version of the compiler can produce 64-bit object binaries on 32-bit or 64-bit Solaris 7 SPARC Platform Edition.  The resulting executable will run only on 64-bit SPARC or UltraSPARC processors under Solaris 7 with the 64-bit kernel.  Compilation, linking, and execution of 64-bit objects can only take place in a Solaris 7 environment.  Compiling for 64-bit Solaris 7 is indicated by the -xarch=v9 and -xarch=v9a options. Note that one of these options must be specified even if -xtarget or -fast are also specified. In such a case, the -xarch=v9 (or -xarch=v9a) option must appear AFTER any -xtarget or other option that sets -xarch. For example:       -xtarget=ultra -xarch=v9 Note that -xtarget=ultra and -xtarget=ultra2 imply -xarch=v8 and do not automatically signal -xarch=v9 or v9a.  When building shared dynamic libraries with -xarch=v9 or v9a on 64-bit Solaris 7, the -xcode=pic13 or -xcode=pic32 option MUST also be specified.  See also the new -xcode=abs32|abs64|pic13|pic32 option for specifying code address sizes.  64-bit Solaris 7 not only enables 64-bit integer and pointer data, but also support for large files. For more details, see the README file:  <install-directory>/SUNWspro/READMEs/64bit_Compilers (where <install-directory> is usually /opt in a standard install.)  For general information on 64-bit Solaris for software developers, see the "Solaris 7 64-bit Developer’s Guide" in AnswerBook2
 

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) (x86)
cpu(sparc) (SPARC)
cpu(i386) (x86)

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 (x86)
sun

The above are not predefined in -Xc mode.

These predefinitions are valid in all modes:

__sun
__unix
__SUNPRO_C=0x500
__‘uname -s‘_‘uname -r‘
__sparc (SPARC)
__sparcv9 (SPARC with -xarch=v9|v9a)
__i386 (x86)
__BUILTIN_VA_ARG_INCR
__SVR4

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 contains preprocessing directives for use by the next pass of the compilation system.  See also −P option. 

−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.  Finer control over messages can be achieved with the use of the error_messages pragma. 

−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 . 

The −fast option is unsuitable for programs that are intended to run on a different target than the compilation machine. In such cases, follow −fast with the appropriate −xtarget option. For example:       % cc -fast -xtarget=ultra For C modules depending on exception handling specified by SUID, follow −fast by −xnolibmil The −fast option acts like a macro expansion on the command line. Therefore, you can override any of the expanded optionsby following −fast with the desired 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:

−xtarget=native

−xO4

−fns

−fsimple=1 (SPARC)

−dalign (SPARC)

−nofstore (x86)

−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[={no,yes}]
Select SPARC nonstandard floating point (SPARC Only).  Select the SPARC nonstandard floating-point mode. The default, -fns=no, is SPARC standard floating-point mode.  Optional use of =yes or =no provides a way of toggling the -fns flag following some other macro flag that includes -fns, such as -fast.  -fns is the same as -fns=yes. 
-fns=yes selects non-standard floating-point. 
-fns=no selects standard floating-point.  This flag causes the nonstandard floating point mode to be enabled when a program begins execution.  By default, the nonstandard floating point mode will not be enabled automatically. On some SPARC systems, the nonstandard floating point mode disables "gradual underflow", causing tiny results to be flushed to zero rather than producing subnormal numbers. It also causes subnormal operands to be silently replaced by zero.  On those SPARC systems that do not support gradual underflow and subnormal numbers in hardware, use of this option can significantly improve the performance of some programs. Warning: When nonstandard mode is enabled, floating point arithmetic may produce results that do not conform to the requirements of the IEEE 754 standard.  See the Numerical Computation Guide for more information. This option is effective only on SPARC systems and only if used when compiling the main program.  On x86 systems, the option is ignored.

−fprecision=p
(x86) 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.  This option is effective only on x86 systems and only if used when compiling the main program.  On SPARC systems, the option is ignored.

−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. 

When r is "tozero", "negative", or "positive", this flag causes the rounding direction mode to be set to round-to-zero, round- to-negative-infinity, or round-to-positive-infinity respectively when a program begins execution.  When r is "nearest" or the -fround flag is not used, the rounding direction mode is not altered from its initial value (round-to-nearest by default).  This option is effective only if used when compiling the main program.

−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, -fsimple=2 permits the optimizer to attempt replacing computations of x/y in a given loop where y and z are known to have constant values, with x∗z, where z=1/y is computed once and saved in a temporary, thereby eliminating costly divide operations. 

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
(x86) 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 causes the invocation of the 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
The command is equivalent to -xcode=pic32.  See also -xcode. 

(x86) −KPIC is identical to −Kpic . 

−Kpic
The command is equivalent to -xcode=pic13.  See also -xcode. 

−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) 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) 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

This option is a synonym for −xtarget=native. 

−nofstore
(x86) 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, use profiled versions of system libraries.  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 #undef 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)(x86)

l link editor (ld)

m mcs

p preprocessor (cpp)

0 compiler (acomp and ssbd)

2 optimizer: (iropt) (SPARC); intermediate code translator: (cg386) (x86)

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.  manner. 

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

−w Suppress compiler warning messages.  The option overrides the error_messages pragma. 

−X[a|c|s|t]
Specifies the degree of conformance to the ANSI/ISO 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)
Strictly conformant ANSI/ISO C, without K&R C compatibility extensions. The compiler will issue errors and warnings for programs that use non-ANSI/ISO 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/ISO 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/ISO and K&R C.) 

t (transition)
ANSI/ISO C plus K&R C compatibility extensions, without semantic changes required by ANSI/ISO C.  Where K&R C and ANSI/ISO 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
(x86) Optimizes for the 80386 processor. 

−x486
(x86) 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 the following depending on platform.  On SPARC: generic, v7, v8a, v8, v8plus, v8plusa, v9, v9a.  On Intel: generic, 386, pentium_pro. 

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 User’s Guide for details. 

v9, and v9a are binary compatible with each other, but not backward compatible with the earlier architectures, and are available only on Solaris 7. 

The −xarch values are:

generic
Gets good performance on Intel and most SPARC processors, 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 and version 1.0 of the Visual Instruction Set (VIS).

v9 Limits the instruction set to the V9 architecture. 
The resulting .o object files are in 64-bit ELF format and can only be linked with other object files in the same format. The resulting executable can only be run on a 64-bit SPARC processor running 64-bit Solaris 7 with the 64-bit kernel.  Compiling with this option uses the best instruction set for good performance on the V9 SPARC architecture, but without the use of quad-precision floating-point instructions.
(Available only on 64-bit Solaris 7)

v9a Limits instruction set to the SPARC-V9 architecture, adding the Visual Instruction Set (VIS) and extensions specific to UltraSPARC processors. 
The resulting .o object files are in 64-bit ELF format and can only be linked with other object files in the same format. The resulting executable can only be run on a 64-bit SPARC processor running 64-bit Solaris 7 with the 64-bit kernel.  Compiling with this option uses the best instruction set for good performance on the V9 UltraSPARC architecture, but without the use of quad-precision floating-point instructions.
(Available only on 64-bit Solaris 7)

386 Limits the instruction set to Intel x86 architecture. 

pentium_pro
Limits the instruction set to the Intel pentium_pro architecture.

−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 Sun 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 link with cc -xautopar as well. 

−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, ultra2, ultra2i, 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:

SPARC accepts:

Generic Optimize for good performance on most SPARC processors. 

old Optimize for pre-SuperSPARC(TM) processors. 

super Optimize for the SuperSPARC chip. 

super2 Optimize for the SuperSPARC II(TM) chip. 

micro Optimize for the microSPARC(TM) chip. 

micro2 Optimize for the microSPARC II(TM) chip. 

hyper Optimize for the hyperSPARC(TM) chip. 

hyper2 Optimize for the hyperSPARC II(TM) chip. 

powerup
Optimize for the Weitek(R) PowerUp(TM) chip.

ultra Optimize for the UltraSPARC(TM) chip. 

ultra2 Optimize for the UltraSPARC II(TM) chip. 

ultra2i Optimize for the UltraSPARC IIi(TM) chip. 

Intel accepts:

Generic Optimize for good performance on most Intel processors. 

386 Optimize for the Intel 386 architecture. 

486 Optimize for the Intel 486 architecture. 

pentium
Optimize for the Intel pentium architecture.

pentium_pro
Optimize for the Intel pentium_pro architecture.

−xcode=v
Specify code address space (SPARC Only).  The following values for -xcode are:

abs32 Generate 32-bit absolute addresses. 
Code + data + bss size is limited to 2∗∗32 bytes. This is the default on 32-bit architectures:

abs44 Generate 44-bit absolute addresses. 
Code + data + bss size is limited to 2∗∗44 bytes. Available only on 64-bit architectures: -xarch=v9,v9a

abs64 Generate 64-bit absolute addresses. 
Available only on 64-bit architectures:
-xarch=v9,v9a

pic13 Generate position-independent code for use in shared libraries (small model). 
Equivalent to -Kpic.  Permits references to at most 2∗∗11 unique external symbols on 32-bit architectures, 2∗∗10 on 64-bit. 

pic32 Generate position-independent code for use in shared libraries (large model). 
Equivalent to -KPIC.  Permits references to at most 2∗∗30 unique external symbols on 32-bit architectures, 2∗∗29 on 64-bit. 

The default is -xcode=abs32 for SPARC V8 and V7.  The default is -xcode=abs64 for SPARC and UltraSPARC V9 (with -xarch=v9|v9a).  When building shared dynamic libraries with -xarch=v9 or v9a on 64-bit Solaris 7, a -xcode=pic13 or -xcode=pic32 option MUST also be specified. 

-xcrossfile[=n]
Enable optimization and inlining across source files (SPARC Only).  If specified, n may be 0, or 1.  Normally, the scope of the compiler’s analysis is limited to each separate file on the command line. For example, −xO4’s automatic inlining is limited to subprograms defined and referenced within the same source file.  With −xcrossfile, the compiler analyzes all the files named on the command line as if they had been concatenated into a single source file.  −xcrossfile is only effective when used with −xO4 or −xO5.  The files produced from this compilation are interdependent (due to possible inlining) must be used as a unit when linking into a program. If any one routine is changed and the files recompiled, they must all be recompiled. As a result, use of this option will affect how makefiles are constructed. The default, if not specified on the command line, is -xcrossfile=0 and no cross file optimizations are performed.  -xcrossfile is equivalent to -xcrossfile=1. 

−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 Sun 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 cc -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.  Use the −xildoff option to override this default. 

−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
Returns information about the licensing system. This option does not request a compilation nor check out a license.
 

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

−xM Runs the ANSI/ISO 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/ISO 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. 

−xmaxopt=[off, 1, 2, 3, 4, 5]
This command limits the level of pragma opt to the level specified. The default value is -xmaxopt=off which causes pragma opt to be ignored. If you specify -xmaxopt without supplying an argument, that is the equivalent of specifying -xmaxopt=5.

−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. 

(x86)

−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 Sun 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
(x86) 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). 

−xprefetch[={yes|no}]
Use prefetch instructions on UltraSPARC II processors. (SPARC Only).  With -xprefetch=yes, the compiler is free to insert prefetch instructions into the code it generates. This may result in a performance improvement on UltraSPARC II processors.  The default if not specified is -xprefetch=no. Specifying -xprefetch alone is equivalent to -xprefetch=yes. 

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

p must be collect[:name], use[:name], or 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.  If compilation and linking are performed in separate steps, the same -xprofile option must appear on the compile as well as the link step. 

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 Analyzing Program Performance With Sun WorkShop 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 Analyzing Program Performance With Sun WorkShop 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
Specify register usage (SPARC Only).  Specify usage of registers in generated code. r is a comma-separated list of one or more of the following: [no%]appl, [no%]float.  Example: −xregs=appl,no%float

The −xregs values are for specific −xarch values):

appl Allow using registers g2, g3, and g4.  (v8, v8a)
Allow using registers g2, g3, g4, and g5.  (v8plus, v8plusa)
Allow using registers g2, g3.  (v9, v9a)

no%appl Do not use appl registers. 

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

no%float Do not use floating-point registers. 

The default is: −xregs=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. It is only effective when used with -xO5 optimization and −xarch=v8plus|v8plusa|v9|v9a is specified. 

−xsb Generates data for the WorkShop browser 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 for the Workshop browser 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 −fast macro option includes −xtarger=native in its expansion. 

−xtarget itself is a macro option which acts like a macro expansion on the command line for the −xarch −xchip and −xcache options. Therefore, you can override any of the expanded options by following −xtarget with the desired option. 

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 on SPARC 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, ss4/85, ss4/110, ss5, ss5/85, ss5/110, 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, ss20/hs11, ss20/hs12, ss20/hs14, ss20/hs21, ss20/hs22, ss20/50, ss20/51, ss20/61, ss20/71, ss20/151, ss20/152, ss20/502, ss20/512, ss20/514, ss20/612, ss20/712, ss600/41, ss600/51, ss600/61, ss600/120, ss600/140, ss600/412, ss600/512, ss600/514, ss600/612, ss1000, sc2000, cs6400, solb5, solb6, ultra, ultra2, ultra2i, ultra1/140, ultra1/170, ultra1/200, ultra2/1170, ultra2/1200, ultra2/1300, ultra2/2170, ultra2/2200, ultra2/2300, ultra2i, entr2, entr2/1170, entr2/2170, entr2/1200, entr2/2200, entr150, entr3000, entr4000, entr5000, entr6000.

Compiling for 64-bit Solaris 7 on SPARC or UltraSPARC V9 is indicated by the -xarch=v9 or -xarch=v9a flag. Setting -xtarget=ultra or ultra2 is not necessary or sufficient. 

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.

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

−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 #pragma MP directives specified when 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 #pragma MP directive. 

The Sun 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 Sun WorkShop includes the license required to use the MPC options. 

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 #pragmas are recognized by the compilation system:

#pragma align
#pragma does_not_read_global_data
#pragma does_not_return
#pragma does_not_write_global_data
#pragma error_messages
#pragma fini
#pragma ident
#pragma init
#pragma inline
#pragma int_to_unsigned
#pragma no_inline
#pragma opt
#pragma pack
#pragma rarely_called
#pragma redefine_extname
#pragma returns_new_memory
#pragma unknown_control_flow
#pragma weak
SPARC Only:
 #pragma MP serial_loop
 #pragma MP serial_loop_nested
 #pragma MP taskloop
 #pragma nomemorydepend
 #pragma no_side_effect
 #pragma pipeloop
 #pragma unroll

Refer to the 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. 

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 (SPARC)

cg386 optimizer (Intel)

codegen code generator (Intel)

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

mwinline optimizer (Intel)

SunWS_cache The directory used to store sbrowser(1) data when the −xsb or −xsbfast flag is used. 

sbcleanup deletes obsolete files in the .sb directory and creates an up-to-date .sb/Index file

ssbd compiler front end for Zll option (SPARC)
values: xa.o runtime startup code

SEE ALSO

as(1), dbx(1), ild(1), ld(1), lint(1), prof(1), tmpnam(3S)
The C User’s Guide. Debugging a Program With dbx manual American National Standard for Programming Language--C, ANSI/ISO 9899-1990. The math_libraries README file in
  <install_path>/SUNWspro/READMEs
where <install_path> is usually  /opt   .

  —  Last change: 98/12/14 Sun Workshop Compiler C 5.0

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