C User's Guide HomeContentsPreviousNextIndex


Chapter 2

cc Compiler Options

This chapter describes the C compiler options and is organized into the following sections:

If you are porting a K&R C program to ANSI/ISO C, make special note of the section on compatibility flags, -X[a|c|s|t]. Using them makes the transition to ANSI/ISO C easier. Also refer to the discussion on the transition in Transitioning to ANSI/ISO C.

Option Syntax

The syntax of the cc command is:

% cc [options] filenames [libraries]...


where:

See option -YP, 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:

  1. /opt/SUNWspro/WS6/lib

  2. /usr/ccs/lib

  3. /usr/lib

cc uses getopt to parse command-line options. Options are treated as a single letter or a single letter followed by an argument. See getopt(3c).

Options Summary

In this section, the compiler options are grouped by function to provide an easy reference. The details are in the sections of the following pages. The following table summarizes the cc compiler options by functionality. Some flags serve more than one purpose and appear more than once.

TABLE 2-1   Compiler Options Grouped by Functionality  
Function Option Flag
Licensing

Instructs the compiler not to queue this compile request if a license is not available. -noqueue

Returns information about the licensing system. -xlicinfo
Optimization and Performance

Selects the optimum combination of compilation options for speed. -fast

Prepares the object code to collect data for profiling -p

Optimizes for the 80386 processor. -x386

Optimizes for the 80486 processor. -x486

Inserts code to count how many times each basic block is executed. -xa

Enables optimization and inlining across source files. -xcrossfile=[n]

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

Enables performance analysis of the executable using the Analyzer. -xF

Tries to inline only those functions specified. -xinline

Inlines some library routines for faster execution. -xlibmil

Links in the Sun-supplied performance libraries. -xliclib=sunperf

This command limits the level of pragma opt to the level specified. -xmaxopt=off,1,2,3,4,5

Optimizes the object code. -xo[1|1|2|3|4|5]

Optimizes for the PentiumTM processor. -xpentium

Enable prefetch instructions. -xprefetch

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

Treats pointer-valued function parameters as restricted pointers. -xrestrict=f

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

Does no optimizations or parallelization of loops that increase code size. -xspace

Suggests to the optimizer to unroll loops n times. -xunroll=n
Data Alignment

Produce an integer constant by placing the characters of a multi-character character-constant in the specified byte order. -xchar_byte_order=o

Specify maximum assumed memory alignment and behavior of misaligned data accesses. -xmemalign=ab

Does not inline math library routines. -xnolibmil
Numerics and Floating-Point

Causes nonstandard initialization of floating-point arithmetic hardware. -fnonstd

Turns on the SPARC nonstandard floating-point mode. -fns[={no,yes}]

Initializes the rounding-precision mode bits in the Floating-point Control Word -fprecision=p

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

Allows the optimizer to make simplifying assumptions concerning floating-point arithmetic. -fsimple=n

Causes the compiler to evaluate float expressions as single precision rather than double precision. -fsingle

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 -fstore

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

Does not convert the value of a floating-point expression or function to the type on the left-hand side of an assignment -nofstore

Forces IEEE 754 style return values for math routines in exceptional cases. -xlibmieee

Represents unsuffixed floating-point constants as single precision -xsfpconst

Enable automatic generation of calls to the vector library functions. -xvector=[{yes|no}]
Parallelization

Macro option that expands to -D_REENTRANT -lthread. -mt

Turns on automatic parallelization for multiple processors. -xautopar

Generates parallelized code based on specification of #pragma MP directives. -xexplicitpar

Shows which loops are parallelized and which are not. -xloopinfo

Parallelizes loops both automatically by the compiler and explicitly specified by the programmer. -xparallel

Turns on reduction recognition during automatic parallelization. -xreduction

Warns about loops that have #pragma MP directives specified but may not be properly specified for parallelization. -xvpara

Creates the program database for lock_lint, but does not actually compile. -Zll

Prepares object files for the loop profiler, looptool. -Zlp
Source Code

Associates name as a predicate with the specified tokens as if by a #assert preprocessing directive. -Aname[(tokens)]

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

Associates name with the specified tokens as if by a #define preprocessing directive. -Dname[=tokens]

Runs the source file through the preprocessor only and sends the output to stdout. -E

Reports K&R-style function definitions and declarations. -fd

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

Adds directories to the list that is searched for #include files with relative file names. -Idir

Runs the source file through the C preprocessor only. -P

Removes any initial definition of the preprocessor symbol name. -Uname

Accepts the C++-style comments. -xCC

Runs only the preprocessor on the named C programs, requesting that it generate makefile dependencies and send the result to the standard output -xM

Collects dependencies like -xM, but excludes /usr/include files. -xM1

Prints prototypes for all K&R C functions defined in this module -xP

Prepares the object code to collect data for profiling with gprof(1). -xpg

Generates extra symbol table information for the Source Browser. -xsb

Creates the database for the Source Browser. -xsbfast
Compiled Code

Directs the compiler to suppress linking with ld(1) and to produce a .o file for each source file -c

Names the output file -o filename

Directs the compiler to produce an assembly source file but not to assemble the program. -S
Compilation Mode

Turns on verbose mode, showing each component as it is invoked. -#

Shows each component as it would be invoked, but does not actually execute it. -###

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

Directs cc to print the name and version ID of each component as the compiler executes. -V

The -X options specify varying degrees of compliance to the ANSI/ISO C standard. -X[a|c|s|t]

Displays on-line help information. -xhelp=f

Sets the directory for temporary files used by cc to dir. -xtemp=dir

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

Suppresses compiler warning messages. -erroff=t

Displays the message tag for each warning message. -errtags=a

If the indicated warning message is issued, cc exits with a failure status. -errwarn=t

Directs the compiler to perform stricter semantic checks and to enable other lint-like checks. -v

Suppresses compiler warning messages. -w

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

Issues warnings for the differences between K&R C and Sun ANSI/ISO C. -xtransition

Warns about loops that have #pragma MP directives specified but may not be properly specified for parallelization. -xvpara
Debugging

Produces additional symbol table information for the debugger. -g

Removes all symbolic debugging information from the output object file. -s

Disables Auto-Read for dbx. -xs
Linking and Libraries

Specifies whether bindings of libraries for linking are static or dynamic. -B[static|dynamic]

Specifies dynamic or static linking in the link editor. -d[y|n]

Passes the option to the link editor to produce a shared object rather than a dynamically linked executable. -G

Assigns a name to a shared dynamic library as a way to have different versions of a library. -h name

Passes the option to the linker to ignore any LD_LIBRARY_PATH setting. -i

Adds directories to the list that the linker searches for libraries. -Ldir

Links with object library libname.so, or libname.a. -lname

Removes duplicate strings from the .comment section of the object file. -mc

Removes all strings from the .comment section. -mr

Removes all strings from the .comment section and inserts string in that section of the object file. -mr,string

Emits or does not emit identification information to the output file. -Q[y|n]

Passes a colon-separated list of directories used to specify library search directories to the runtime linker. -Rdir[:dir]

Merges data segments into text segments. -xMerge

Specify code address space. -xcode=v

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

Turns off the incremental linker and forces the use of ld. -xildoff

Turns on the incremental linker and forces the use of ild in incremental mode. -xildon

Does not link any libraries by default -xnolib

Does not inline math library routines. -xnolibmil
Target Platform

Specify instruction set architecture. -xarch

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

Specifies values for -xarch, -xchip, and -xcache. -xcg[89|92]

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

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

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


The cc Options

This section describes the cc options, arranged alphabetically. These descriptions are also available in the man page, cc(1). Use the cc -flags option for a one-line summary of these descriptions.

Options noted as being unique to one or more platforms are accepted without error and ignored on all other platforms. For an explanation of the typographic notations used with the options and arguments, refer to Typographic Conventions.

-#

Turns on verbose mode, showing each component as it is invoked.

-###

Shows each component as it would be invoked, but does not actually execute it.

-Aname[(tokens)]

Associates name as a predicate with the specified tokens as if by a #assert preprocessing directive. Preassertions:

These preassertions are not valid in -Xc mode.

-B[static|dynamic]

Specifies whether bindings of libraries for linking are static or dynamic, indicating whether libraries are non-shared or shared, respectively.

-Bdynamic causes the link editor to look for files named libx.so and then for files named libx.a when given the -lx option.

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


Note – Many system libraries, such as libc, are only available as dynamic libraries in the Solaris 64-bit compilation environment. Therefore, do not use -Bstatic as the last toggle on the command line.

-C

Prevents the C preprocessor from removing comments, except those on the preprocessing directive lines.

-c

Directs cc to suppress linking with ld(1) and to produce a .o file for each source file. You can explicitly name a single object file using the -o option. When the compiler produces object code for each .i or .c input file, it always creates an object (.o) file in the current working directory. If you suppress the linking step, you also suppress the removal of the object files.

-Dname[=tokens]

Associates name with the specified tokens as if by a #define preprocessing directive. If no =tokens is specified, the token 1 is supplied.

Predefinitions (not valid in -Xc mode):

The following predefinitions are valid in all modes.

__sparcv9 (-Xarch=v9, v9a)
 __sun
 __unix
 __SUNPRO_C=0x510 
 __`uname -s`_`uname -r` (example:  __SunOS_5_7)
 __sparc (SPARC)
 __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 arguments are passed to ld(1).


Note – Many system libraries are only available as dynamic libraries in the Solaris 7 64-bit compilation environment. As a result, this option causes fatal errors if you use it in combination with -Xarch=v9.

-dalign

-dalign is equivalent to -xmemalign=8s. See -xmemalign=ab.

-E

Runs the source file through the preprocessor only and sends the output to stdout. The preprocessor is built directly into the compiler, except in -Xs mode, where /usr/ccs/lib/cpp is invoked. Includes the preprocessor line numbering information. See also the -P option.

-erroff=t

Suppresses cc warning messages. Has no effect on error messages.

t is a comma-separated list that consists of one or more of the following: tag, no%tag, %all, %none. Order is important; for example, %all,no%tag suppresses all warning messages except tag. The following table lists the -erroff values:

TABLE 2-2   -erroff arguments
Value Meaning
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 (default)


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

You can achieve finer control over error message suppression. See #pragma error_messages (on|off|default,tag... tag).

-errtags=a

Displays the message tag for each warning message.

a can be either yes or no. The default is -errtags=no. Specifying -errtags is equivalent to specifying -errtags=yes.

-errwarn=t

If the indicated warning message is issued, cc exits with a failure status. t is a comma-separated list that consists of one or more of the following: tag, no%tag, %all, %none. Order is important; for example %all,no%tag causes cc to exit with a fatal status if any warning except tag is issued. The following table list the -errwarn values:

TABLE 2-3   -errwarn Values
tag Cause cc to exit with a fatal status if the message specified by this tag is issued as a warning message. Has no effect if tag is not issued.
no%tag Prevent cc from exiting with a fatal status if the message specified by tag is issued only as a warning message. Has no effect if the message specified by tag is not issued. Use this option to revert a warning message that was previously specified by this option with tag or %all from causing cc to exit with a fatal status when issued as a warning message.
%all Cause cc to exit with a fatal status if any warning messages are issued. %all can be followed by no%tag to exempt specific warning messages from this behavior.
%none Prevents any warning message from causing cc to exit with a fatal status should any warning message be issued.


The default is -errwarn=%none. If you specify -errwarn alone, it is equivalent to -errwarn=%all.

-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 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 that depend on exception handling specified by SVID, follow -fast by -xnolibmil:

% cc -fast -xnolibmil


With -xlibmil, exceptions cannot be noted by setting errno or calling matherr(3m).

The -fast option is unsuitable for programs that require strict conformance to the IEEE 754 Standard.

The following table lists the set of options selected by -fast across platforms.

Option SPARC x86
-dalign  X -
-fns  X  X
-fsimple=2  X
-ftrap=%none  X  X
-xlibmil  X  X
-xtarget=native  X  X
-nofstore -  X
-xO5  X  X
-fsingle  X  X


-fast acts like a macro expansion on the command line. Therefore, you can override the optimization level and code generation option aspects by following -fast with the desired optimization level or code generation option. Compiling with the -fast -xO4 pair is like compiling with the -xO2 -xO4 pair. The latter specification takes precedence.

In previous releases, the -fast macro option included -fnonstd; now it includes -fns instead.

You can usually improve performance for most programs with this option.

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-style function definitions and declarations.

-flags

Prints a brief summary of each available compiler option.

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

By default, IEEE 754 floating-point arithmetic is nonstop, and underflows are gradual. (See Nonstandard Floating Point for a further explanation.)

(SPARC) Synonym for -fns -ftrap=common.

-fns[={no,yes}]

(SPARC) Turns on the SPARC nonstandard floating-point mode.

The default is -fns=no, the SPARC standard floating-point mode. -fns is the same as -fns=yes.

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. This flag enables the nonstandard floating point mode when a program begins execution. By default, the non-standard 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 replaced silently 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.

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) -fprecision={single, double, extended}

Initializes the rounding-precision mode bits in the Floating-point Control Word to 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.

When r is tozero, negative, or positive, this flag sets the rounding direction mode 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:

-fsimple=0

Permits no simplifying assumptions. Preserve 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:

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 runtime. The -fast macroflag includes -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 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 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 a register. Due to rounding and truncation, the results may be different from those that are generated from the register value. This is the default mode.

To turn off this option, use the -nofstore option.

-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:

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

Passes the option to the link editor to produce a shared object rather than a dynamically linked executable. This option is passed to ld(1), and cannot be used with the -dn option.

-g

Produces additional symbol table information for the debugger.

This option invokes the incremental linker; see -xildoff and -xildon. Invoke ild instead of ld unless you are using the -G or -xildoff options, or you are naming source files on the command line.

If you issue -g, and the optimization level is -xO3 or lower, the compiler provides best-effort symbolic information with almost full optimization. Tail-call optimization and back-end inlining are disabled.

If you issue -g and the optimization level is -xO4, the compiler provides best-effort symbolic information with full optimization.

-H

Prints to standard error, one per line, the path name of each file included during the current compilation. The display is indented so as to show which files are included by other files.

Here, the program sample.c includes the files, stdio.h and math.h; math.h includes the file, floatingpoint.h, which itself includes functions that use sys/ieeefp.h:

% cc -H sample.c
	 /usr/include/stdio.h
	 /usr/include/math.h
	 	 	 /usr/include/floatingpoint.h
	 	 	 	 /usr/include/sys/ieeefp.h


-h name

Assigns a name to a shared dynamic library as a way to have different versions of a library. In general, the name after -h should be the same as the file name given after 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 -hname 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

Adds dir to the list of directories that are searched for #include files with relative file names, that is, those not beginning with a / (slash). See Include Files for a discussion of the search order used to find the include files.

-i

Passes the option to the linker to ignore any LD_LIBRARY_PATH or LD_LIBRARY_PATH_64 setting.

-KPIC

-KPIC is equivalent to -xcode=pic32, see -xcode=v.

(x86) -KPIC is identical to -Kpic.

-Kpic

-Kpic is equivalent to -xcode=pic13, see -xcode=v.

-keeptmp

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

-Ldir

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

-lname

Links with object library libname.so, or libname.a. The order of libraries in the command-line is important, as symbols are resolved from left to right.

This option must follow the sourcefile arguments.

-mc

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

-misalign

(SPARC) -misalign is equivalent to -xmemalign=1i. See -xmemalign=ab.

-misalign2

(SPARC) -misalign2 is equivalent to -xmemalign=2i. See -xmemalign=ab.

-mr

Removes all strings from the .comment section. When you use this flag, mcs -d -a is invoked.

-mr,string

Removes all strings from the .comment section and inserts string in that section of the object file. If string contains embedded blanks, it must be enclosed in quotation marks. A null string results in an empty .comment section. This option is passed as -dastring to mcs.

-mt

Macro option that expands to -D_REENTRANT -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. See also -fstore.

-noqueue

Instructs the compiler not to queue this compile request if a license is not available. Under normal circumstances, if no license is available, the compiler waits until one becomes available. With this option, the compiler returns immediately.

-O

Same as -xO2.

-o filename

Names the output file filename (as opposed to the default, a.out). filename cannot be the same as sourcefile, since cc does not overwrite the source file. This option and its arguments are passed to ld(1).

-P

Runs the source file through the C preprocessor only. It then puts the output in a file with a .i suffix. Unlike -E, this option does not include preprocessor-type line number information in the output. See also the -E option.

-p

Prepares the object code to collect data for profiling with prof(1). This option invokes a runtime recording mechanism that produces a mon.out file at normal termination.

-Q[y|n]

Emits or does not emit identification information to the output file. -Qy is the default.

If -Qy is used, identification information about each invoked compilation tool is added to the .comment section of output files, which is accessible with mcs. This option can be useful for software administration.

-Qn suppresses this information.

-qp

Same as -p.

-Rdir[:dir]

Passes 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

Directs cc to produce an assembly source file but not to assemble the program.

-s

Removes all symbolic debugging information from the output object file. This option cannot be specified with -g.

Passed to ld(1).

-Uname

Removes any initial definition of the preprocessor symbol name. This option is the inverse of the -D option. You can give multiple -U options.

-V

Directs cc to print the name and version ID of each component as the compiler executes.

-v

Directs the compiler to perform stricter semantic checks and to enable other lint-like checks. For example, the code:

#include <stdio.h>
main(void)
{
     printf("Hello World.\n");
}


compiles and executes without problem. With -v, it still compiles; however, the compiler displays this warning:

"hello.c", line 5: warning: function has no return statement: main

-v does not give all the warnings that lint(1) does. Try running the above example through lint.

-Wc,arg

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

See Components of the C Compilation System for a list of components. c can be one of the following:

a Assembler (fbe); (gas)
c C code generator (cg) (SPARC)
d cc driver1
h Intermediate code translator (ir2hf)(Intel)
i Inter-procedure analysis (ube_ipa)(Intel)
l Link editor (ld)
m mcs
p Preprocessor (cpp)
u C code generator (ube) (Intel)
0 Compiler (acomp) (ssbd, SPARC)
2 Optimizer (iropt) (SPARC)
1 You cannot use -Wd to pass the cc options listed in this chapter to the C compiler.


-w

Suppresses compiler warning messages.

This option overrides the error_messages pragma.

-X[a|c|s|t]

The -X (note uppercase X) options specify varying degrees of compliance to the ANSI/ISO C standard. -Xa is the default mode.

See K&R Sun C Incompatibilities with Sun ANSI/ISO C for a discussion of differences between ANSI/ISO C and K&R C.

-Xa

(a = ANSI) This is the default compiler mode. 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 uses the ANSI C interpretation. If the -Xa option is used in conjunction with the -xtransition option, the compiler issues warning about the conflict. The predefined macro _ _STDC_ _ has a value of 0 with the -Xa option.

-Xc

(c = conformance) Issues errors and warnings for programs that use non-ANSI/ISO C constructs. This option is strictly conformant ANSI/ISO C, without K&R C compatibility extensions. The predefined macro _ _STDC_ _ has a value of 1 with the -Xa option.

-Xs

(s = K&R C) Attempts to warn about all language constructs that have differing behavior between ANSI/ISO C and K&R C. The compiler language includes all features compatible with K&R C. This option invokes cpp for preprocessing. _ _STDC_ _ is not defined in this mode. For more information regarding the effects of compiling with the -Xs option, see The Difference Between Sun C and ANSI/ISO C As Set By -Xs.

-Xt

(t = transition) This option uses 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 uses the K&R C interpretation. If you use the -Xt option in conjunction with the -xtransition option, the compiler issues warnings about the conflict. The predefined macro _ _STDC_ _ has a value of 0 with the -Xa option.

-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 option is the old style of basic block profiling for tcov. See -xprofile=p for information on the new style of profiling and the tcov(1) man page for more details. See also Analyzing Program Performance With Sun Workshop.

-xa 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. tcov(1) can then be run on the source file to generate statistics about the program. Since this option entails some optimization, it is incompatible with -g.

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=isa

Specify instruction set architecture (ISA).

Architectures that are accepted by -xarch keyword isa are shown in TABLE 2-4:

TABLE 2-4   -xarch ISA Keywords
Platform Valid -xarch Keywords
SPARC generic, native, v7, v8a, v8, v8plus, v8plusa, v8plusb, v9, v9a, v9b
x86 generic, 386, pentium_pro


Note that although -xarch can be used alone, it is part of the expansion of the -xtarget option and may be used to override the -xarch value that is set by a specific -xtarget option. For example:

% cc -xtarget=ultra2 -xarch=v8plusb ...

overrides the -xarch=v8 set by -xtarget=ultra2

If you use this option with optimization, the appropriate choice can provide good performance of the executable on the specified architecture. An inappropriate choice results in a binary program that is not executable on the intended target platform.

SPARC Only

The following table details the performance of an executable that is compiled with a given -xarch option and then executed by various SPARC processors. The purpose of this table is to help you identify the best -xarch option for your executable given a particular target machine. Start by identifying the range of machines that are of interest to you and then consider the cost of maintaining multiple binaries versus the benefit of extracting the last iota of performance from newer machines.

TABLE 2-5   -xarch Matrix

Instruction Set of SPARC Machine:


V7 V8a V8 V9 (Non-Sun Processor) V9 (Sun processor) V9b
-xarch compilation option
v7 N S S S S S
v8a PD N S S S S
v8 PD PD N S S S
v8plus NE NE NE N S S
v8plusa NE NE NE ** N S
v8plusb NE NE NE ** NE N
v9 NE NE NE N S S
v9a NE NE NE ** N S
v9b NE NE NE ** NE N
** Note: An executable compiled with this instruction set may perform nominally on a V9 non-Sun processor chip or it may not execute at all. Check with your hardware vendor to make sure your executable can run on its target machine.


If you are going to compile your executable with the v8plus or v8plusa instruction set, consider compiling your executable with v9 or v9a instead. The v8plus and v8plusa options were provided so that programs could take advantage of some SPARC V9 and UltraSPARC features prior to the availability of Solaris 7 with its support for 64-bit programs. Programs compiled with the v8plus or v8plusa option are not portable to SPARC V8 or older machines. Such programs can be re-compiled with v9 or v9a, respectively, to take full advantage of all the features of SPARC V9 and UltraSPARC. The V8+ Technical Specification white paper, part number 802-7447-10, is available through your Sun representative and explains the limitations of v8plus and v8plusa.

For any particular choice, the generated executable may run much more slowly on earlier architectures. Also, although quad-precision (REAL*16 and long double) floating-point instructions are available in many of these instruction set architectures, the compiler does not use these instructions in the code it generates.

The following table gives details for each of the -xarch keywords on SPARC platforms.

TABLE 2-6   -xarch Values for SPARC Platforms  
-xarch= Meaning
generic
Compile for good performance on most systems.
This is the default. This option uses the best instruction set for good performance on most processors without major performance degradation on any of them. With each new release, the definition of "best" instruction set may be adjusted, if appropriate.
native
Compile for good performance on this system. This is the default for the -fast option. The compiler chooses the appropriate setting for the current system processor it is running on.
v7
Compile for the SPARC-V7 ISA.
Enables the compiler to generate code for good performance on the V7 ISA. This is equivalent to using the best instruction set for good performance on the V8 ISA, but without integer mul and div instructions, and the fsmuld instruction.
Examples: SPARCstation 1, SPARCstation 2
v8a
Compile for the V8a version of the SPARC-V8 ISA. By definition, V8a means the V8 ISA, but without the fsmuld instruction. This option enables the compiler to generate code for good performance on the V8a ISA.
Example: Any system based on the microSPARC I chip architecture
v8
Compile for the SPARC-V8 ISA. Enables the compiler to generate code for good performance on the V8 architecture.
Example: SPARCstation 10
v8plus
Compile for the V8plus version of the SPARC-V9 ISA. By definition, V8plus means the V9 ISA, but limited to the 32-bit subset defined by the V8plus ISA specification, without the Visual Instruction Set (VIS), and without other implementation-specific ISA extensions.

  • This option enables the compiler to generate code for good performance on the V8plus ISA.

  • The resulting object code is in SPARC-V8+ ELF32 format and only executes in a Solaris UltraSPARC environment--it does not run on a V7 or V8 processor.


    Example: Any system based on the UltraSPARC chip architecture
  • v8plusa
    
    Compile for the V8plusa version of the SPARC-V9 ISA. By definition, V8plusa means the V8plus architecture, plus the Visual Instruction Set (VIS) version 1.0, and with UltraSPARC extensions.

  • This option enables the compiler to generate code for good performance on the UltraSPARC architecture, but limited to the 32-bit subset defined by the V8plus specification.

  • The resulting object code is in SPARC-V8+ ELF32 format and only executes in a Solaris UltraSPARC environment--it does not run on a V7 or V8 processor.


    Example: Any system based on the UltraSPARC chip architecture
  • v8plusb
    
    Compile for the V8plusb version of the SPARC-V8plus ISA with UltraSPARC-III extensions. Enables the compiler to generate object code for the UltraSPARC architecture, plus the Visual Instruction Set (VIS) version 2.0, and with UltraSPARC-III extensions.

  • The resulting object code is in SPARC-V8+ ELF32 format and executes only in a Solaris UltraSPARC-III environment.

  • Compiling with this option uses the best instruction set for good performance on the UltraSPARC-III architecture.

  • v9
    
    Compile for the SPARC-V9 ISA. Enables the compiler to generate code for good performance on the V9 SPARC architecture.

  • The resulting .o object files are in ELF64 format and can only be linked with other SPARC-V9 object files in the same format.

  • The resulting executable can only be run on an UltraSPARC processor running a 64-bit enabled Solaris operating environment with the 64-bit kernel.

  • -xarch=v9 is only available when compiling in a 64-bit enabled Solaris environment.

  • v9a
    
    Compile for the SPARC-V9 ISA with UltraSPARC extensions. Adds to the SPARC-V9 ISA the Visual Instruction Set (VIS) and extensions specific to UltraSPARC processors, and enables the compiler to generate code for good performance on the V9 SPARC architecture.

  • The resulting .o object files are in ELF64 format and can only be linked with other SPARC-V9 object files in the same format.

  • The resulting executable can only be run on an UltraSPARC processor running a 64-bit enabled Solaris operating environment with the 64-bit kernel.

  • -xarch=v9a is only available when compiling in a 64-bit enabled Solaris operating environment.

  • v9b
    
    Compile for the SPARC-V9 ISA with UltraSPARC-III extensions. Adds UltraSPARC-III extensions and VIS version 2.0 to the V9a version of the SPARC-V9 ISA. Compiling with this option uses the best instruction set for good performance in a Solaris UltraSPARC-III environment.

  • The resulting object code is in SPARC-V9 ELF64 format and can only be linked with other SPARC-V9 object files in the same format.

  • The resulting executable can only be run on an UltraSPARC-III processor running a 64-bit enabled Solaris operating environment with the 64-bit kernel.

  • -xarch=v9b is only available when compiling in a 64-bit enabled Solaris operating environment.


  • x86 Only

    TABLE 2-7   -xarch Values on x86
    Value Meaning
    generic Limits instruction set to the Intel x86 architecture and is the equivalent of the 386 option.
    386 Limits the instruction set to the Intel 386/486 architecture.
    pentium Limits the instruction set to the pentium architecture.
    pentium_pro Limits the instruction set to the 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 psrinfo command:

    % psrinfo
    
    0	 on-line since 01/12/95 10:41:54
    
    1	 on-line since 01/12/95 10:41:54
    
    3	 on-line since 01/12/95 10:41:54
    
    4	 on-line since 01/12/95 10:41:54
    


    To request a number of processors, set the PARALLEL environment variable. The default is 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.

    -xCC

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

    -xcache=c

    Defines the cache properties for use by the optimizer. c must be one of the following:

    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 following table lists the -xcache values.

    TABLE 2-8   The -xcache Values 
    Value Meaning
    generic Define the cache properties for good performance on most x86 and SPARC architectures.
    This is the default value which directs the compiler to use cache properties for good performance on most x86 and SPARC processors, without major performance degradation on any of them.
    With each new release, these best timing properties will be adjusted, if appropriate.
    s1/l1/a1 Define level 1 cache properties.
    s1/l1/a1:s2/l2/a2 Define levels 1 and 2 cache properties.
    s1/l1/a1:s2/l2/a2:s3/l3/a3 Define levels 1, 2, and 3 cache properties.


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

    Level 1 cache has: 16K bytes 32 bytes line size 4-way associativity Level 2 cache has: 1024K bytes 32 bytes line size Direct mapping associativity


    -xcg[89|92]

    (SPARC).

    -xcg89 is a macro for: -xarch=v7 -xchip=old -xcache=64/32/1.

    -xcg92 is a macro for: -xarch=v8 -xchip=super

    -xcache=16/32/4:1024/32/1.

    -xchar_byte_order=o

    Produce an integer constant by placing the characters of a multi-character character-constant in the specified byte order. You can substitute one of the following values for o:

    -xchip=c

    Specifies the target processor for use by the optimizer.

    c must be one of the following: 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:

    -xcode=v

    (SPARC) Specify code address space. v must be one of:

    abs32 Generate 32-bit absolute addresses. Code + data + bss size is limited to 2**32 bytes. This is the default on 32-bit architectures: -xarch-generic, v7, v8, v8a, v8plus, v8plusa
    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 architectures. The -xcode=pic13 command is similar to -xcode=pic32, except that the size of the global offset table is limited to 8Kbytes.
    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 architectures. Each reference to a global datum is generated as a dereference of a pointer in the global offset table. Each function call is generated in pc-relative addressing mode through a procedure linkage table. 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 -xcode=pic32.


    The default is -xcode=abs32 for SPARC V7 and V8, and -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, you must specify -xcode=pic13 or -xcode=pic32.

    There are two nominal performance costs with -xcode=pic13 and -xcode=pic32:

    When considering the above costs, remember that the use of -xcode=pic13 and -xcode=pic32 can significantly reduce system memory requirements, due to the effect of library code sharing. Every page of code in a shared library compiled -xcode=pic13 or -xcode=pic32 can be shared by every process that uses the library. If a page of code in a shared library contains even a single non-pic (that is, absolute) memory reference, the page becomes nonsharable, and a copy of the page must be created each time a program using the library is executed.

    The easiest way to tell whether or not a .o file has been compiled with -xcode=pic13 or -xcode=pic32 is with the nm command:

    % nm file.o | grep _GLOBAL_OFFSET_TABLE_ U _GLOBAL_OFFSET_TABLE_
    


    A .o file containing position-independent code contains an unresolved external reference to _GLOBAL_OFFSET_TABLE_, as indicated by the letter U.

    To determine whether to use -xcode=pic13 or -xcode=pic32, use nm to identify the number of distinct global and static variables used or defined in the library. If the size of _GLOBAL_OFFSET_TABLE_ is under 8,192 bytes, you can use -Kpic. Otherwise, you must use -xcode=pic32.

    -xcrossfile=[n]

    (SPARC) Enables optimization and inlining across source files. If specified, n can 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, and must be used as a unit when they are linked into a program. If any one routine is changed and the files recompiled, they must all be recompiled. As a result, using this option affects the construction of makefiles.

    The default 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 also included with -xautopar or -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, then 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 code.

    -xexplicitpar

    (SPARC) Generates parallelized code based on specification of #pragma MP directives. You do the dependency analysis: analyze and specify loops for inter-iteration data dependencies. The software parallelizes the specified loops. If optimization is not at -xO3 or higher, optimization 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. To get faster code, this option requires 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.

    In summary, to parallelize explicitly:

    An example of inserting a parallel pragma immediately before the loop is:

    #pragma MP taskloop
    
      for (j=0; j<1000; j++){
    
      ...
    
      }
    


    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 Analyzer. (See the 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() are 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 in the object file, necessary for data collection.

    -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 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=[{%auto,func_name,no%func_name}[,{%auto,func_name,no%func_name}]...]

    Tries to inline only those functions specified in the list. The list is comprised of either a comma-separated list of functions names, or a comma separated list of       no%func_ name values, or the value %auto. If you issue no%func_ name, the compiler is not to inline the named function. If you issue %auto, the compiler is to attempt to automatically inline all functions in the source files.

    If you are compiling with -xO3, you can use -xinline to increase optimization by inlining some or all functions. The -xO3 level of optimization does not include inlining.

    If you are compiling with -xO4, -xinline can decrease optimization by restricting inlining to only those routines in the list. With -xO4, the compiler normally tries to inline all references to functions defined in the source file. When you specify -xinline= but do not name any functions or %auto, this indicates that none of the routines in the source file are to be inlined.

    A function is not inlined if any of the following conditions apply (no warning is issued):

    -xlibmieee

    Forces IEEE 754 style return values for math routines in exceptional cases. In such cases, no exception message is printed, and you should not rely on errno.

    -xlibmil

    Inlines some library routines for faster execution. This option selects the appropriate assembly language inline templates for the floating-point option and platform for your system.

    -xlic_lib=sunperf

    (SPARC) Links in the Sun-supplied performance libraries.

    -xlicinfo

    Returns information about the licensing system. In particular, this option returns the name of the license server and the IDs of users who have checked out licenses. This option does not request compilation or check out a license.

    -xloopinfo

    (SPARC) Shows which loops are parallelized and which are not. Gives a short reason for not parallelizing a loop. The -xloopinfo option is valid only if -xautopar, or -xparallel, or -xexplicitpar is specified; otherwise, the compiler issues a warning.

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

    -xM

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

    For example:

    #include <unistd.h>
    
    void main(void)
    
    {}
    

    generates this output:

    e.o: e.c
    
    e.o: /usr/include/unistd.h
    
    e.o: /usr/include/sys/types.h
    
    e.o: /usr/include/sys/machtypes.h
    
    e.o: /usr/include/sys/select.h
    
    e.o: /usr/include/sys/time.h
    
    e.o: /usr/include/sys/types.h
    
    e.o: /usr/include/sys/time.h
    
    e.o: /usr/include/sys/unistd.h
    


    -xM1

    Collects dependencies like -xM, but excludes /usr/include 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

    Merges data segments into text segments. 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.

    -xmemalign=ab

    Specify maximum assumed memory alignment and behavior of misaligned data accesses. There must be a value for both a (alignment) and b (behavior). a specifies the maximum assumed memory alignment and b specifies the behavior for misaligned memory accesses. The following table lists the alignment and behavior values for -xmemalign

    TABLE 2-10   -xmemalign alignment and behavior values
    a
    b
    1 Assume at most 1 byte alignment. i Interpret access and continue execution.
    2 Assume at most 2 byte alignment. s Raise signal SIGBUS.
    4 Assume at most 4 byte alignment. f Raise signal SIGBUS for alignments less or equal to 4, otherwise interpret access and continue execution.
    8 Assume at most 8 byte alignment.
    16 Assume at most 16 byte alignment.


    .

    For memory accesses where the alignment is determinable at compile time, the compiler will generate the appropriate load/store instruction sequence for that alignment of data.

    For memory accesses where the alignment cannot be determined at compile time, the compiler must assume an alignment to generate the needed load/store sequence.

    The -xmemalign flag allows the user to specify the maximum memory alignment of data to be assumed by the compiler in these indeterminable situations. It also specifies the error behavior to be followed at run time when a misaligned memory access does take place.

    Here are the default values for -xmemalign. The following default values only apply when no -xmemalign flag is present:

    Here is the default when -xmemalign flag is present but no value is given:

    The following table shows how you can use -xmemalign to handle different alignment situations.

    TABLE 2-11   Examples of -xmemalign
    Command Situation
    -xmemalign=1s There are many misaligned accesses so trap handling is too slow.
    -xmemalign=8i There are occasional, intentional, misaligned accesses in code that is otherwise correct.
    -xmemalign=8s There should be no misaligned accesses in the program.
    -xmemalign=2s You want to check for possible odd-byte accesses.
    -xmemalign=2i You want to check for possible odd-byte access and you want the program to work.


    -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 the -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 it after the -fast option. For example:

    % cc -fast -xnolibmil....
    


    -xO[1|2|3|4|5]

    Optimizes the object code; note the upper-case letter O. When -xO is used with the -g option, a limited amount of debugging is available. For more information, see "Debugging Optimized Code" in Chapter 1 of Debugging a Program With dbx.        

    The levels (1, 2, 3, 4, or 5) you can use with -xO 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. This 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 automatically inlines functions contained in the same file; this usually improves execution speed. If you want to control which functions are inlined, see -xinline=[{%auto,func_name,no%func_name}[,{%auto,func_name,no%func_name}]...].

    This level traces the effects of pointer assignments, and usually results in increased code size.

    -xO5

    Attempts to generate 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. See -xprofile=p.

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

    -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 adding 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 all K&R C functions defined in this module.

    f()
    
    {
    
    }
    
     
    
    main(argc,argv)
    
    int argc;
    
    char *argv[];
    
    {
    
    }
    


    produces this output:

    int f(void);
    
    int main(int, char **);
    


    -xparallel

    (SPARC) Parallelizes loops both automatically by the compiler and explicitly specified by the programmer. The -xparallel option is a macro, and is equivalent to specifying all three of -xautopar, -xdepend, and -xexplicitpar. With explicit parallelization of loops, there is a risk of producing incorrect results. If optimization is not at -xO3 or higher, optimization is raised to -xO3 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, this option requires a multiprocessor system. On a single-processor system, the generated code usually runs slower.

    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) Optimizes for the Pentium processor.

    -xpg

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

    -xprefetch=[val],val

    (SPARC) Enable prefetch instructions on those architectures that support prefetch, such as UltraSPARC II. (-xarch=v8plus, v9plusa, v9, or v9a)

    Explicit prefetching should only be used under special circumstances that are supported by measurements.

    val must be one of the following:

    Value Meaning
    auto Enable automatic generation of prefetch instructions
    no%auto Disable automatic generation of prefetch instructions
    explicit Enable explicit prefetch macros
    no%explicit Disable explicit prefetch macros
    yes Same as -xprefetch=auto,explicit
    no Same as -xprefetch=no%auto,no%explicit


    If you do not specify -xprefetch, the default is -xprefetch=no%auto,explicit. If you specify -xprefetch without a value, that is equivalent to -xprefetch=auto,explicit.

    The sun_prefetch.h header file provides the macros that you can use to specify explicit prefetch instructions. The prefetches are approximately at the place in the executable that corresponds to where the macros appear.

    -xprofile=p

    Collects data for a profile or uses a profile to optimize.

    (SPARC) 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 you specify a level of optimization.

    collect[:name]

    Collects and saves execution frequency data 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.

    As with collect:name, the name is optional and may be used to specify the name of the program.

    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 -xa for information on the old style of profiling, the tcov(1) man page, and Analyzing Program Performance With Sun WorkShop 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 tcov(1) and Analyzing Program Performance With Sun WorkShop for more details.


    Note – tcov's code coverage report can be unreliable if there is inlining of routines due to -xO4 or -xinline.

    -xreduction

    (SPARC) Turns on reduction recognition during automatic parallelization. -xreduction must be specified with -xautopar, or -xparallel.

    Parallelization options require a WorkShop license.

    When reduction recognition is enabled, the compiler parallelizes reductions such as dot products, maximum and minimum finding. These reductions yield different roundoffs than 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

    TABLE 2-12   The -xregs Values
    Value Meaning
    appl Allows the use of the following registers:g2, g3, g4 (v8a, v8, v8plus, v8plusa, v8plusb) g2, g3 (v9, v9a, v9b) For more information on SPARC instruction sets, see -xarch=isa. In the SPARC ABI, these registers are described as application registers. Using these registers can increase performance because fewer load and store instructions are needed. However, such use can conflict with some old library programs written in assembly code.
    no%appl Does not use the appl registers.
    float Allows using the floating-point registers as specified in the SPARC ABI. You can use these registers even if the program contains no floating-point code.
    no%float Does not use the floating-point registers.
    With this option, a source program cannot contain any floating-point code.


    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, or %none.

    If a function list is specified with this option, pointer parameters in the specified functions are treated as restricted; if -xrestrict=%all is specified, all pointer parameters in the entire C file are treated as restricted. Refer to _Restrict Keyword, for more information.

    This command-line option can be used on its own, but it is best used with optimization. For example, the command:

    %cc -xO3 -xrestrict=%all prog.c

    treats all pointer parameters in the file prog.c as restricted pointers. The command:

    %cc -xO3 -xrestrict=agc prog.c

    treats all pointer parameters in the function agc in the file prog.c as restricted pointers.

    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 you specify -xO5 optimization and -xarch=v8plus|v8plusa|v9|v9a.

    -xsb

    Generates extra symbol table information for the Source Browser. This option is not valid with the -Xs mode of the compiler.

    -xsbfast

    Creates the database for the Source Browser. 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 or parallelization of loops that increase code size.

    Example: The compiler will not unroll loops or parallelize loops if it increases code size.

    -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 instruction set and optimization.

    The value of t must be one of the following: native, generic, system-name (SPARC, x86).

    The -fast macro option includes -xtarget=native in its expansion.

    The -xtarget option is a macro that 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.

    TABLE 2-13   The -xtarget Values
    Value Meaning
    native Gets the best performance on the host system.
    The compiler generates code for the best performance on the host system. It determines the available architecture, chip, and cache properties of the machine on which the compiler is running.
    generic Gets the best performance for generic architecture, chip, and cache.
    The compiler expands -xtarget=generic to: -xarch=generic -xchip=generic -xcache=generic
    This is the default value.
    system-name
    Gets the best performance for the specified system.
    You select a system name from TABLE 2-14 that lists the mnemonic encodings of the actual system name and numbers.


    The performance of some programs may benefit by providing the compiler with an accurate description of the target computer hardware. When program performance is critical, the proper specification of the target hardware could be very important. This is especially true when running on the newer SPARC processors. However, for most programs and older SPARC processors, the performance gain is negligible and a generic specification is sufficient.

    Each specific value for -xtarget expands into a specific set of values for the -xarch, -xchip, and -xcache options. See TABLE 2-14 for the values. For example:

    -xtarget=sun4/15 is equivalent to: -xarch=v8a -xchip=micro

    -xcache=2/16/1

    TABLE 2-14   -xtarget Expansions  
    -xtarget= -xarch -xchip -xcache
    generic
    
    generic
    
    generic
    
    generic
    
    cs6400
    
    v8
    
    super
    
    16/32/4:2048/64/1
    
    entr150
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr2
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr2/1170
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr2/1200
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr2/2170
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr2/2200
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr3000
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr4000
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr5000
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    entr6000
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    sc2000
    
    v8
    
    super
    
    16/32/4:2048/64/1
    
    solb5
    
    v7
    
    old
    
    128/32/1
    
    solb6
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss1
    
    v7
    
    old
    
    64/16/1
    
    ss10 
    
    v8
    
    super
    
    16/32/4
    
    ss10/20
    
    v8
    
    super
    
    16/32/4
    
    ss10/30
    
    v8
    
    super
    
    16/32/4
    
    ss10/40
    
    v8
    
    super
    
    16/32/4
    
    ss10/402
    
    v8
    
    super
    
    16/32/4
    
    ss10/41
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/412
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/50
    
    v8
    
    super
    
    16/32/4
    
    ss10/51
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/512
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/514
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/61
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/612
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss10/71
    
    v8
    
    super2
    
    16/32/4:1024/32/1
    
    ss10/712
    
    v8
    
    super2
    
    16/32/4:1024/32/1
    
    ss10/hs11
    
    v8
    
    hyper
    
    256/64/1
    
    ss10/hs12
    
    v8
    
    hyper
    
    256/64/1
    
    ss10/hs14
    
    v8
    
    hyper
    
    256/64/1
    
    ss10/hs21
    
    v8
    
    hyper
    
    256/64/1
    
    ss10/hs22
    
    v8
    
    hyper
    
    256/64/1
    
    ss1000
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss1plus
    
    v7
    
    old
    
    64/16/1
    
    ss2
    
    v7
    
    old
    
    64/32/1
    
    ss20
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss20/151
    
    v8
    
    hyper
    
    512/64/1
    
    ss20/152
    
    v8
    
    hyper
    
    512/64/1
    
    ss20/50
    
    v8
    
    super
    
    16/32/4
    
    ss20/502
    
    v8
    
    super
    
    16/32/4
    
    ss20/51
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss20/512
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss20/514
    
    v8
    
    super
    
    16/32/4:1024/32/1 
    
    ss20/61
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss20/612
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss20/71
    
    v8
    
    super2
    
    16/32/4:1024/32/1
    
    ss20/712
    
    v8
    
    super2
    
    16/32/4:1024/32/1
    
    ss20/hs11
    
    v8
    
    hyper
    
    256/64/1
    
    ss20/hs12
    
    v8
    
    hyper
    
    256/64/1
    
    ss20/hs14
    
    v8
    
    hyper
    
    256/64/1
    
    ss20/hs21
    
    v8
    
    hyper
    
    256/64/1
    
    ss20/hs22
    
    v8
    
    hyper
    
    256/64/1
    
    ss2p
    
    v7
    
    powerup
    
    64/32/1
    
    ss4
    
    v8a
    
    micro2
    
    8/16/1
    
    ss4/110
    
    v8a
    
    micro2
    
    8/16/1
    
    ss4/85
    
    v8a
    
    micro2
    
    8/16/1
    
    ss5
    
    v8a
    
    micro2
    
    8/16/1
    
    ss5/110
    
    v8a
    
    micro2
    
    8/16/1
    
    ss5/85
    
    v8a
    
    micro2
    
    8/16/1
    
    ss600/120
    
    v7
    
    old
    
    64/32/1
    
    ss600/140
    
    v7
    
    old
    
    64/32/1
    
    ss600/41
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss600/412
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss600/51
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss600/512
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss600/514
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss600/61
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    ss600/612
    
    v8
    
    super
    
    16/32/4:1024/32/1
    
    sselc
    
    v7
    
    old
    
    64/32/1
    
    ssipc
    
    v7
    
    old
    
    64/16/1
    
    ssipx
    
    v7
    
    old
    
    64/32/1
    
    sslc
    
    v8a
    
    micro
    
    2/16/1
    
    sslt
    
    v7
    
    old    
    
    64/32/1
    
    sslx
    
    v8a
    
    micro
    
    2/16/1
    
    sslx2
    
    v8a
    
    micro2
    
    8/16/1
    
    ssslc
    
    v7
    
    old
    
    64/16/1
    
    ssvyger
    
    v8a
    
    micro2
    
    8/16/1
    
    sun4/110
    
    v7
    
    old
    
    2/16/1
    
    sun4/15
    
    v8a
    
    micro
    
    2/16/1
    
    sun4/150
    
    v7
    
    old
    
    2/16/1
    
    sun4/20
    
    v7
    
    old
    
    64/16/1
    
    sun4/25
    
    v7
    
    old
    
    64/32/1
    
    sun4/260
    
    v7
    
    old
    
    128/16/1
    
    sun4/280
    
    v7
    
    old
    
    128/16/1
    
    sun4/30
    
    v8a
    
    micro
    
    2/16/1
    
    sun4/330
    
    v7
    
    old
    
    128/16/1
    
    sun4/370
    
    v7
    
    old
    
    128/16/1
    
    sun4/390
    
    v7
    
    old
    
    128/16/1
    
    sun4/40
    
    v7
    
    old
    
    64/16/1
    
    sun4/470
    
    v7
    
    old
    
    128/32/1
    
    sun4/490
    
    v7
    
    old
    
    128/32/1
    
    sun4/50
    
    v7
    
    old
    
    64/32/1
    
    sun4/60
    
    v7
    
    old
    
    64/16/1
    
    sun4/630
    
    v7
    
    old
    
    64/32/1
    
    sun4/65
    
    v7
    
    old
    
    64/16/1
    
    sun4/670
    
    v7
    
    old
    
    64/32/1
    
    sun4/690
    
    v7
    
    old
    
    64/32/1
    
    sun4/75
    
    v7
    
    old
    
    64/32/1
    
    ultra
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    ultra1/140
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    ultra1/170
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    ultra1/200
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    ultra2
    
    v8
    
    ultra2
    
    16/32/1:512/64/1
    
    ultra2/1170
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    ultra2/1200
    
    v8
    
    ultra
    
    16/32/1:1024/64/1
    
    ultra2/1300
    
    v8
    
    ultra2
    
    16/32/1:2048/64/1
    
    ultra2/2170
    
    v8
    
    ultra
    
    16/32/1:512/64/1
    
    ultra2/2200
    
    v8
    
    ultra
    
    16/32/1:1024/64/1
    
    ultra2/2300
    
    v8
    
    ultra2
    
    16/32/1:2048/64/1
    
    ultra2i
    
    v8
    
    ultra2i
    
    16/32/1:512/64/1
    
    ultra3
    
    v8
    
    ultra3
    
    64/32/4:8192/256/1
    


    For x86: -xtarget= accepts:

    -xtemp=dir

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

    -xtime

    Reports the time and resources used by each compilation component.

    -xtransition

    Issues warnings for the differences between K&R C and Sun ANSI/ISO C. The -xtransition option issues warnings in conjunction with the -Xa and -Xt options. You can eliminate all warning messages about differing behavior through appropriate coding. The following warnings no longer appear unless the -xtransition option is used:

    -xunroll=n

    Suggests to the optimizer to unroll loops n times. 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, the -xunroll=n merely suggests to the compiler that it unroll loops n times.

    -xvector[={yes|no}

    Enable automatic generation of calls to the vector library functions.

    -xvector=yes permits the compiler to transform math library calls within loops into single calls to the equivalent vector math routines when such transformations are possible. Such transformations could result in a performance improvement for loops with large loop counts.

    If you do not issue -xvector, the default is -xvector=no. If you specify -xvector but do not supply a value, the default is -xvector=yes.

    If you use -xvector on the command line without previously specifying -xdepend, -xvector triggers -xdepend. The -xvector option also raises the optimization level to -x03 if optimization is not specified or optimization is set lower than -x03.

    The compiler includes the libmvec libraries in the load step. If you compile and link with separate commands, be sure to use -xvector in the linking cc command.

    -xvpara

    (SPARC) Warns about loops that have #pragma MP directives specified when the loop may not be properly specified for parallelization. For example, when the optimizer detects data dependencies between loop iterations, it issues a warning.

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

    Use -xvpara with the -xexplicitpar option or the -xparallel option and the #pragma MP. See Explicit Parallelization and Pragmas for more information.

    -Yc, dir

    Specifies a new directory dir for the location of component c. c can consist of any of the characters representing components that are listed under the -W option.

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

    -YA, dir

    Changes the default directory searched for components.

    -YI, dir

    Changes the default directory searched for include files.

    -YP, dir

    Changes the default directory for finding library files.

    -YS, dir

    Changes the default directory for startup object files.

    -Zll

    (SPARC) Creates the program database for lock_lint, but does not actually compile. Refer to the lock_lint(1) man page for more details.

    -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. Generally, this option is used with one of the loop parallelization options: -xexplicitpar, -xautopar, or -xparallel.

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

    If you compile and link in separate steps, and you compile with -Zlp, then be sure to link with -Zlp.

    If you compile one subprogram with -Zlp, you need not compile all subprograms of that program with -Zlp. However, you get loop information only for the files compiled with -Zlp, and no indication that the program includes other files.

    Options Passed to the Linker

    cc recognizes -a, -e, -r, -t, -u, and -z and passes these options and their arguments to ld. cc passes any unrecognized options to ld with a warning.


    Sun Microsystems, Inc.
    Copyright information. All rights reserved.
    Feedback
    Library   |   Contents   |   Previous   |   Next   |   Index