A P P E N D I X  A

C++ Compiler Options

This appendix details the command-line options for the CC compiler running under Solaris 7 and Solaris 8. The features described apply to all platforms except as noted; features that are unique to the Solaris SPARC Platform Edition operating environment are identified as SPARC, and the features that are unique to the Solaris Intel Platform Edition operating environment are identified as IA.

The following table shows examples of typical option syntax formats.

TABLE A-1 Option Syntax Format Examples

Syntax Format

Example

-option

-E

-optionvalue

-Ipathname

-option=value

-xunroll=4

-option value

-o filename


The typographical conventions that are listed in "Before You Begin" at the front of this manual are used in this section of the manual to describe individual options.

Parentheses, braces, brackets, pipe characters, and ellipses are metacharacters used in the descriptions of the options and are not part of the options themselves.


A.1 How Option Information Is Organized

To help you find information, compiler option descriptions are separated into the following subsections. If the option is one that is replaced by or identical to some other option, see the description of the other option for full details.

TABLE A-2 Option Subsections

Subsection

Contents

Option Definition

A short definition immediately follows each option. (There is no heading for this category.)

Values

If the option has one or more values, this section defines each value.

Defaults

If the option has a primary or secondary default value, it is stated here.

The primary default is the option value in effect if the option is not specified. For example, if -compat is not specified, the default is -compat=5.

The secondary default is the option in effect if the option is specified, but no value is given. For example, if -compat is specified without a value, the default is -compat=4.

Expansions

If the option has a macro expansion, it is shown in this section.

Examples

If an example is needed to illustrate the option, it is given here.

Interactions

If the option interacts with other options, the relationship is discussed here.

Warnings

If there are cautions regarding use of the option, they are noted here, as are actions that might cause unexpected behavior.

See also

This section contains references to further information in other options or documents.

"Replace with" "Same as"

If an option has become obsolete and has been replaced by another option, the replacement option is noted here. Options described this way may not be supported in future releases.

If there are two options with the same general meaning and purpose, the preferred option is referenced here. For example, "Same as -xO" indicates that -xO is the preferred option.



A.2 Option Reference

A.2.1 -386

IA: Same as -xtarget=386. This option is provided for backward compatibility only.

A.2.2 -486

IA: Same as -xtarget=486. This option is provided for backward compatibility only.

A.2.3 -a

Same as -xa.

A.2.4 -Bbinding

Specifies whether a library binding for linking is symbolic, dynamic (shared), or static (nonshared).

You can use the -B option several times on a command line. This option is passed to the linker, ld.



Note - On the Solaris 7 and Solaris 8 platforms, not all libraries are available as static libraries.



Values

binding must be one of the following:

Value of binding

Meaning

dynamic

Directs the link editor to look for liblib.so (shared) files, and if they are not found, to look for liblib.a (static, nonshared) files. Use this option if you want shared library bindings for linking.

static

Directs the link editor to look only for liblib.a (static, nonshared) files. Use this option if you want nonshared library bindings for linking.

symbolic

Forces symbols to be resolved within a shared library if possible, even when a symbol is already defined elsewhere.

See the ld(1) man page.


(No space is allowed between -B and the binding value.)

Defaults

If -B is not specified, -Bdynamic is assumed.

Interactions

To link the C++ default libraries statically, use the -staticlib option.

The -Bstatic and -Bdynamic options affect the linking of the libraries that are provided by default. To ensure that the default libraries are linked dynamically, the last use of -B should be -Bdynamic.

In a 64-bit environment, many system libraries are available only as shared dynamic libraries. These include libm.so and libc.so (libm.a and libc.a are not provided). As a result, -Bstatic and -dn may cause linking errors in 64-bit Solaris environments. Applications must link with the dynamic libraries in these cases.

Examples

The following compiler command links libfoo.a even if libfoo.so exists; all other libraries are linked dynamically:

example% CC a.o -Bstatic -lfoo -Bdynamic

Warnings

Never use -Bsymbolic with programs containing C++ code, use linker map files instead.

With -Bsymbolic, references in different modules can bind to different copies of what is supposed to be one global object.

The exception mechanism relies on comparing addresses. If you have two copies of something, their addresses won't compare equal, and the exception mechanism can fail because the exception mechanism relies on comparing what are supposed to be unique addresses.

If you compile and link in separate steps and are using the -Bbinding option, you must include the option in the link step.

See also

-nolib, -staticlib, ld(1), Section 12.5, Statically Linking Standard Libraries, Linker and Libraries Guide

A.2.5 -c

Compile only; produce object .o files, but suppress linking.

This option directs the CC driver to suppress linking with ld and produce a .o file for each source file. If you specify only one source file on the command line, then you can explicitly name the object file with the -o option.

Examples

If you enter CC -c x.cc, the x.o object file is generated.

If you enter CC -c x.cc -o y.o, the y.o object file is generated.

Warnings

When the compiler produces object code for an input file (.c, .i), the compiler always produces a .o file in the working directory. If you suppress the linking step, the .o files are not removed.

See also

-o filename

A.2.6 -cg{89|92}

Same as -xcg{89|92}.

A.2.7 -compat[={4|5}]

Sets the major release compatibility mode of the compiler. This option controls the __SUNPRO_CC_COMPAT and __cplusplus macros.

The C++ compiler has two principal modes. The compatibility mode accepts ARM semantics and language defined by the 4.2 compiler. The standard mode accepts constructs according to the ANSI/ISO standard. These two modes are incompatible with each other because the ANSI/ISO standard forces significant, incompatible changes in name mangling, vtable layout, and other ABI details. These two modes are differentiated by the -compat option as shown in the following values.

Values

The -compat option can have the following values.

Value

Meaning

-compat=4

(Compatibility mode) Set language and binary compatibility to that of the 4.0.1, 4.1, and 4.2 compilers. Set the __cplusplus preprocessor macro to 1 and the __SUNPRO_CC_COMPAT preprocessor macro to 4.

-compat=5

(Standard mode) Set language and binary compatibility to ANSI/ISO standard mode. Set the __cplusplus preprocessor macro to 199711L and the __SUNPRO_CC_COMPAT preprocessor macro to 5.


Defaults

If the -compat option is not specified, -compat=5 is assumed.

If only -compat is specified, -compat=4 is assumed.

Regardless of the -compat setting, _ _SUNPRO_CC is set to 0x540.

Interactions

You cannot use the standard libraries in compatibility mode (-compat[=4]).

Use of -compat[=4] with any of the following options is not supported.

  • -Bsymbolic when the library has exceptions in it
  • -features=[no%]strictdestrorder
  • -features=[no%]tmplife
  • -library=[no%]iostream
  • -library=[no%]Cstd
  • -library=[no%]Crun
  • -library=[no%]rwtools7_std
  • -xarch=native64, -xarch=generic64, -xarch=v9, -xarch=v9a, or -xarch=v9b

Use of -compat=5 with any of the following options is not supported.

  • +e
  • features=[no%]arraynew
  • features=[no%]explicit
  • features=[no%]namespace
  • features=[no%]rtti
  • library=[no%]complex
  • library=[no%]libC
  • -vdelx
Warnings

When building a shared library in compatibility mode (-compat[=4]), do not use -Bsymbolic if the library has exceptions in it. Exceptions that should be caught might be missed.

See also

C++ Migration Guide

A.2.8 +d

Does not expand C++ inline functions.

Under the C++ language rules, a C++ inline function is a function for which one of the following statements is true.

  • The function is defined using the inline keyword,
  • The function is defined (not just declared) inside a class definition
  • The function is a compiler-generated class member function

Under the C++ language rules, the compiler can choose whether actually to inline a call to an inline function. The C++ compiler inlines calls to an inline function unless:

  • The function is too complex,
  • The +d option is selected, or
  • The -g option is selected
Examples

By default, the compiler may inline the functions f() and memf2() in the following code example. In addition, the class has a default compiler-generated constructor and destructor that the compiler may inline. When you use +d, the compiler will not inline f()and C::mf2(), the constructor, and the destructor.

inline int f() { return 0; } // may be inlined
class C {
  int mf1(); // not inlined unless inline definition comes later
  int mf2() { return 0; } // may be inlined
};

Interactions

This option is automatically turned on when you specify -g, the debugging option.

The -g0 debugging option does not turn on +d.

The +d option has no effect on the automatic inlining that is performed when you use -xO4 or -xO5.

See also

-g0, -g

A.2.9 -D[ ]name[=def]

Defines the macro symbol name to the preprocessor.

Using this option is equivalent to including a #define directive at the beginning of the source. You can use multiple -D options.

Values

The following table shows the predefined macros. You can use these values in such preprocessor conditionals as #ifdef.

TABLE A-3 Predefined Macros

Type

Macro Name

Notes

SPARC and IA

_ _ARRAYNEW

_ _ARRAYNEW is defined if the "array" forms of operators new and delete are enabled. See -features=[no%]arraynew for more information.

 

_ BOOL

_BOOL is defined if type bool is enabled. See -features=[no%]bool for more information.

 

_ _BUILTIN_VA_ARG_INCR

For the _ _builtin_alloca, _ _builtin_va_alist, and _ _builtin_va_arg_incr keywords in varargs.h, stdarg.h, and sys/varargs.h.

 

_ _cplusplus

 

 

_ _DATE_ _

 

 

_ _FILE_ _

 

 

_ _LINE_ _

 

 

_ _STDC_ _

 

 

_ _sun

 

 

sun

See Interactions.

 

_ _SUNPRO_CC=0x540

The value of _ _SUNPRO_CC indicates the release number of the compiler

 

_ _SUNPRO_CC_COMPAT=4 or _ _SUNPRO_CC_COMPAT=5

See Section A.2.7, -compat[={4|5}]

 

_ _SVR4

 

 

_ _TIME_ _

 

 

_ _'uname -s'_'uname -r'

Where uname -s is the output of uname -s and uname -r is the output of uname -r with the invalid characters, such as periods (.), replaced by underscores, as in -D_ _SunOS_5_7 and -D_ _SunOS_5_8.

 

_ _unix

 

 

unix

See Interactions.

SPARC

_ _sparc

 

 

sparc

See Interactions.

SPARC v9

_ _sparcv9

64-bit compilation modes only

IA

_ _i386

 

 

i386

See Interactions.

UNIX

_WCHAR_T

 


If you do not use =def, name is defined as 1.

Interactions

If +p is used, sun, unix, sparc, and i386 are not defined.

See also

-U

A.2.10 -d{y|n}

Allows or disallows dynamic libraries for the entire executable.

This option is passed to ld.

This option can appear only once on the command line.

Values

Value

Meaning

-dy

Specifies dynamic linking in the link editor.

-dn

Specifies static linking in the link editor.


Defaults

If no -d option is specified, -dy is assumed.

Interactions

In a 64-bit environment, many system libraries are available only as shared dynamic libraries. These include libm.so and libc.so (libm.a and libc.a are not provided). As a result, -Bstatic and -dn may cause linking errors in 64-bit Solaris environments. Applications must link with the dynamic libraries in these cases.

See also

ld(1), Linker and Libraries Guide

A.2.11 -dalign

SPARC: Generates double-word load and store instructions whenever possible for improved performance.

This option assumes that all double type data are double-word aligned.

Warnings

If you compile one program unit with -dalign, compile all units of a program with -dalign, or you might get unexpected results.

A.2.12 -dryrun

Shows the subcommands built by driver, but does not compile.

This option directs the driver CC to show, but not execute, the subcommands constructed by the compilation driver.

A.2.13 -E

Runs the preprocessor on source files; does not compile.

Directs the CC driver to run only the preprocessor on C++ source files, and to send the result to stdout (standard output). No compilation is done; no .o files are generated.

This option causes preprocessor-type line number information to be included in the output.

Examples

This option is useful for determining the changes made by the preprocessor. For example, the following program, foo.cc, generates the output shown in CODE EXAMPLE A-2.

CODE EXAMPLE A-1 Preprocessor Example Program foo.cc
#if __cplusplus < 199711L
int power(int, int);
#else
template <> int power(int, int);
#endif
 
int main () {
  int x;
  x=power(2, 10);
}

CODE EXAMPLE A-2 Preprocessor Output of foo.cc Using -E Option
example% CC -E foo.cc
#4 "foo.cc"
template < > int power ( int , int ) ; 
 
 
int main ( ) { 
int x ; 
x = power ( 2 , 10 ) ; 
} 

Warnings

Output from this option is not supported as input to the C++ compiler when templates are used.

See also

-P

A.2.14 +e{0|1}

Controls virtual table generation in compatibility mode (-compat[=4]). Invalid and ignored when in standard mode (the default mode).

Values

The +e option can have the following values.

Value

Meaning

0

Suppresses the generation of virtual tables and creates external references to those that are needed.

1

Creates virtual tables for all defined classes with virtual functions.


Interactions

When you compile with this option, also use the -features=no%except option. Otherwise, the compiler generates virtual tables for internal types used in exception handling.

If template classes have virtual functions, ensuring that the compiler generates all needed virtual tables, but does not duplicate these tables, might not be possible.

See also

C++ Migration Guide

A.2.15 -fast

Optimizes for speed of execution using a selection of options.

This option is a macro that selects a combination of compilation options for optimum execution speed on the machine upon which the code is compiled.

Expansions

This option provides near maximum performance for many applications by expanding to the following compilation options.

TABLE A-4 -fast Expansion

Option

SPARC

IA

-dalign

X

-

-fns

X

X

-fsimple=2

X

-

-ftrap=%none

X

X

-nofstore

-

X

-xarch

X

X

-xlibmil

X

X

-xlibmopt

X

X

-xmemalign

X

 

-xO5

X

X

-xtarget=native

X

X

-xbuiltin=%all

X

X


Interactions

The -fast macro expands into compilation options that may affect other specified options. For example, in the following command, the expansion of the -fast macro includes -xtarget=native which reverts -xarch to one of the 32-bit architecture options.

Incorrect:

example% CC -xarch=v9 -fast test.cc

Correct:

example% CC -fast -xarch=v9 test.cc

See the description for each option to determine possible interactions.

The code generation option, the optimization level, the optimization of built-in functions, and the use of inline template files can be overridden by subsequent options (see examples). The optimization level that you specify overrides a previously set optimization level.

The -fast option includes -fns -ftrap=%none; that is, this option turns off all trapping.

Examples

The following compiler command results in an optimization level of -xO3.

example% CC -fast -xO3

The following compiler command results in an optimization level of -xO5.

example% CC -xO3 -fast

Warnings

If you compile and link in separate steps, the -fast option must appear in both the compile command and the link command.

Code that is compiled with the -fast option is not portable. For example, using the following command on an UltraSPARC III system generates a binary that will not execute on an UltraSPARC II system.

example% CC -fast test.cc

Do not use this option for programs that depend on IEEE standard floating-point arithmetic; different numerical results, premature program termination, or unexpected SIGFPE signals can occur.

In previous SPARC releases, the -fast macro expanded to -fsimple=1. Now it expands to -fsimple=2.

In previous releases, the -fast macro expanded to -xO4. Now it expands to -xO5.



Note - In previous SPARC releases, the -fast macro option included -fnonstd; now it does not. Nonstandard floating-point mode is not initialized by -fast. See the Numerical Computation Guide, ieee_sun(3M).



See also

-dalign, -fns, -fsimple, -ftrap=%none, -xlibmil, -nofstore, -xO5, -xlibmopt, -xtarget=native

A.2.16 -features=a[,a...]

Enables/disables various C++ language features named in a comma-separated list.

Values

In both compatibility mode (-compat[=4]) and standard mode (the default mode), a can have the following values.

TABLE A-5 -features Options for Compatibility Mode and Standard Mode

Value of a

Meaning

%all

All the -features options that are valid for the specified mode.

[no%]altspell

[Do not] Recognize alternative token spellings (for example, "and" for "&&"). The default is no%altspell in compatibility mode and altspell in standard mode.

[no%]anachronisms

[Do not] Allow anachronistic constructs. When disabled (that is, -features=no%anachronisms), no anachronistic constructs are allowed. The default is anachronisms.

[no%]bool

[Do not] Allow the bool type and literals. When enabled, the macro _BOOL=1. When not enabled, the macro is not defined. The default is no%bool in compatibility mode and bool

in standard mode.

[no%]conststrings

[Do not] Put literal strings in read-only memory. The default is no%conststrings in compatibility mode and conststrings in standard mode.

[no%]except

[Do not] Allow C++ exceptions. When C++ exceptions are disabled (that is, -features=no%except), a throw-specification on a function is accepted but ignored; the compiler does not generate exception code. Note that the keywords try, throw, and catch are always reserved. See Section 8.3, Disabling Exceptions. The default is except.

[no%]export

[Do not] Recognize the keyword export. The default is no%export in compatibility mode and export in standard mode.

[no%]extensions

[Do not] allow nonstandard code that is commonly accepted by other C++ compilers. See Chapter 4 for an explanation of the invalid code that is accepted by the compiler when you use the -features=extensions option. The default is no%extensions.

[no%]iddollar

[Do not] Allow a $ symbol as a noninitial identifier character. The default is no%iddollar.

[no%]localfor

[Do not] Use new local-scope rules for the for statement. The default is no%localfor in compatibility mode and localfor in standard mode.

[no%]mutable

[Do not] Recognize the keyword mutable. The default is no%mutable in compatibility mode and mutable in standard mode.

[no%]split_init

[Do not] Put initializers for nonlocal static objects into individual functions. When you use -features=no%split_init, the compiler puts all the initializers in one function. Using -features=no%split_init minimizes code size at the possible expense of compile time. The default is split_init.

[no%]transitions

[Do not] allow ARM language constructs that are problematic in standard C++ and that may cause the program to behave differently than expected or that may be rejected by future compilers. When you use -features=no%transitions, the compiler treats these as errors. When you use -features=transitions in standard mode, the compiler issues warnings about these constructs instead of error messages. When you use -features=transitions in compatibility mode (-compat[=4]), the compiler displays the warnings about these constructs only if +w or +w2 is specified. The following constructs are considered to be transition errors: redefining a template after it was used, omitting the typename directive when it is needed in a template definition, and implicitly declaring type int. The set of transition errors may change in a future release. The default is transitions.

%none

Turn off all the features that can be turned off for the specified mode.


In standard mode (the default mode), a can have the following additional values.

TABLE A-6 -features Options for Standard Mode Only

Value of a

Meaning

[no%]strictdestrorder

[Do not] Follow the requirements specified by the C++ standard regarding the order of the destruction of objects with static storage duration. The default is strictdestrorder.

[no%]tmplife

[Do not] Clean up the temporary objects that are created by an expression at the end of the full expression, as defined in the ANSI/ISO C++ Standard. (When -features=no%tmplife is in effect, most temporary objects are cleaned up at the end of their block.) The default is no%tmplife.


In compatibility mode (-compat[=4]), a can have the following additional values.

TABLE A-7 -features Options for Compatibility Mode Only

Value of a

Meaning

[no%]arraynew

[Do not] Recognize array forms of operator new and operator delete (for example, operator new [ ] (void*)). When enabled, the macro __ARRAYNEW=1. When not enabled, the macro is not defined. The default is no%arraynew.

[no%]explicit

[Do not] Recognize the keyword explicit. The default is no%explicit.

[no%]namespace

[Do not] Recognize the keywords namespace and using. The default is no%namespace.

The purpose of -features=namespace is to aid in converting code to standard mode. By enabling this option, you get error messages if you use these keywords as identifiers. The keyword recognition options allow you to find uses of the added keywords without having to compile in standard mode.

[no%]rtti

[Do not] Allow runtime type information (RTTI). RTTI must be enabled to use the dynamic_cast<> and typeid operators. The default is no%rtti.




Note - The [no%]castop setting is allowed for compatibility with makefiles written for the C++ 4.2 compiler, but has no affect on compiler versions 5.0, 5.1, 5.2 and 5.3. The new style casts (const_cast, dynamic_cast, reinterpret_cast, and static_cast) are always recognized and cannot be disabled.



Defaults

If -features is not specified, the following is assumed:

  • Compatibility mode (-compat[=4])
  • -features=%none,anachronisms,except,split_init,transitions
    

  • Standard mode (the default mode)
  • -features=%all,no%iddollar,no%extensions
    

Interactions

This option accumulates instead of overrides.

Use of the following in standard mode (the default) is not compatible with the standard libraries and headers:

  • no%bool
  • no%except
  • no%mutable
  • no%explicit
Interactions

This option accumulates instead of overrides.

In compatibility mode (-compat[=4]), the -features=transitions option has no effect unless you specify the +w option or the +w2 option.

Warnings

The behavior of a program might change when you use the -features=tmplife option. Testing whether the program works both with and without the -features=tmplife option is one way to test the program's portability.

The compiler assumes -features=split_init by default. If you use the -features=%none option to turn off other features, you may find it desirable to turn the splitting of initializers into separate functions back on by using -features=%none,split_init instead.

See also

Chapter 4 and the C++ Migration Guide

A.2.17 -filt[=filter[,filter...]]

Suppress the filtering that the compiler normally applies to linker error messages.

filter must be one of the following values.

TABLE A-8 -filt Options

Value of filter

Meaning

[no%]names

[Do not] Demangle the C++ mangled linker names.

[no%]returns

[Do not] Demangle the return types of functions. Suppression of this type of demangling helps you to identify function names more quickly, but note that in the case of co-variant returns some functions differ only in the return type.

[no%]errors

[Do not] Show the C++ explanations of the linker error messages. The suppression of the explanations is useful when the linker diagnostics are provided directly to another tool.

%all

Equivalent to -filt=errors,names,returns. This is the default behavior.

%none

Equivalent to -filt=no%errors,no%names,no%returns.


Defaults

If you do not specify the -filt option, or if you specify -filt without any values, then the compiler assumes -filt=errors,names,returns.

Examples

The following examples show the effects of compiling this code with the -filt option.


// filt_demo.cc
class type {
public:
    virtual ~type(); // no definition provided
};
 
int main()
{
    type t;
}
 

When you compile the code without the -filt option, the compiler assumes -filt=names,returns,errors and displays the standard output.

example% CC filt_demo.cc
Undefined             first referenced
 symbol                  in file
type::~type()         filt_demo.o
type::__vtbl          filt_demo.o
[Hint: try checking whether the first non-inlined, non-pure virtual function of class type is defined]
 
ld: fatal: Symbol referencing errors. No output written to a.out

The following command suppresses the demangling of the of the C++ mangled linker names and suppresses the C++ explanations of linker errors.

example% CC -filt=no%names,no%errors filt_demo.cc
Undefined                       first referenced
 symbol                             in file
__1cEtype2T6M_v_                    filt_demo.o
__1cEtypeG__vtbl_                   filt_demo.o
ld: fatal: Symbol referencing errors. No output written to a.out

Interactions

When you specify no%names, neither returns nor no%returns has an effect.

A.2.18 -flags

Same as -xhelp=flags.

A.2.19 -fnonstd

Causes hardware traps to be enabled for floating-point overflow, division by zero, and invalid operations exceptions. These results are converted into SIGFPE signals; if the program has no SIGFPE handler, it terminates with a memory dump (unless you limit the core dump size to 0).

SPARC: In addition, -fnonstd selects SPARC nonstandard floating point.

Defaults

If -fnonstd is not specified, IEEE 754 floating-point arithmetic exceptions do not abort the program, and underflows are gradual.

Expansions

IA: -fnonstd expands to -ftrap=common.

SPARC: -fnonstd expands to -fns -ftrap=common.

See also

-fns, -ftrap=common, Numerical Computation Guide.

A.2.20 -fns[={yes|no}]

SPARC: Enables/disables the SPARC nonstandard floating-point mode.

-fns=yes (or -fns) causes the nonstandard floating point mode to be enabled when a program begins execution.

This option provides a way of toggling the use of nonstandard or standard floating-point mode following some other macro option that includes -fns, such as -fast. (See "Examples.")

On some SPARC devices, the nonstandard floating-point mode disables "gradual underflow," causing tiny results to be flushed to zero rather than to produce subnormal numbers. It also causes subnormal operands to be silently replaced by zero.

On those SPARC devices that do not support gradual underflow and subnormal numbers in hardware, -fns=yes (or -fns) can significantly improve the performance of some programs.

Values

The -fns option can have the following values.

Value

Meaning

yes

Selects nonstandard floating-point mode

no

Selects standard floating-point mode


Defaults

If -fns is not specified, the nonstandard floating point mode is not enabled automatically. Standard IEEE 754 floating-point computation takes place--that is, underflows are gradual.

If only -fns is specified, -fns=yes is assumed.

Examples

In the following example, -fast expands to several options, one of which is -fns=yes which selects nonstandard floating-point mode. The subsequent -fns=no option overrides the initial setting and selects floating-point mode.

example% CC foo.cc -fast -fns=no

Warnings

When nonstandard mode is enabled, floating-point arithmetic can produce results that do not conform to the requirements of the IEEE 754 standard.

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

This option is effective only on SPARC devices, and only if used when compiling the main program. On IA devices, the option is ignored.

Use of the -fns=yes (or -fns) option might generate the following message if your program experiences a floating-point error normally managed by the IEEE floating-point trap handlers:

See also

Numerical Computation Guide, ieee_sun(3M)

A.2.21 -fprecision=p

IA: Sets the non-default floating-point precision mode.

The -fprecision option sets the rounding precision mode bits in the Floating Point Control Word. These bits control the precision to which the results of basic arithmetic operations (add, subtract, multiply, divide, and square root) are rounded.

Values

p must be one of the following values.

Value of p

Meaning

single

Rounds to an IEEE single-precision value.

double

Rounds to an IEEE double-precision value.

extended

Rounds to the maximum precision available.


If p is single or double, this option causes the rounding precision mode to be set to single or double precision, respectively, when a program begins execution. If p is extended or the -fprecision option is not used, the rounding precision mode remains at the extended precision.

The single precision rounding mode causes results to be rounded to 24 significant bits, and double precision rounding mode causes results to be rounded to 53 significant bits. In the default extended precision mode, results are rounded to 64 significant bits. This mode controls only the precision to which results in registers are rounded, and it does not affect the range. All results in register are rounded using the full range of the extended double format. Results that are stored in memory are rounded to both the range and precision of the destination format, however.

The nominal precision of the float type is single. The nominal precision of the long double type is extended.

Defaults

When the -fprecision option is not specified, the rounding precision mode defaults to extended.

Warnings

This option is effective only on IA devices and only if used when compiling the main program. On SPARC devices, this option is ignored.

A.2.22 -fround=r

Sets the IEEE rounding mode in effect at startup.

This option sets the IEEE 754 rounding mode that:

  • Can be used by the compiler in evaluating constant expressions
  • Is established at runtime during the program initialization

The meanings are the same as those for the ieee_flags subroutine, which can be used to change the mode at runtime.

Values

r must be one of the following values.

Value of r

Meaning

nearest

Rounds towards the nearest number and breaks ties to even numbers.

tozero

Rounds to zero.

negative

Rounds to negative infinity.

positive

Rounds to positive infinity.


Defaults

When the -fround option is not specified, the rounding mode defaults to -fround=nearest.

Warnings

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

This option is effective only if used when compiling the main program.

A.2.23 -fsimple[=n]

Selects floating-point optimization preferences.

This option allows the optimizer to make simplifying assumptions concerning floating-point arithmetic.

Values

If n is present, it must be 0, 1, or 2.

Value of n

Meaning

0

Permit no simplifying assumptions. Preserve strict IEEE 754 conformance.

1

Allow conservative simplification. 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:

  • IEEE754 default rounding/trapping modes do not change after process initialization.
  • Computation producing no visible result other than potential floating-point exceptions can be deleted.
  • Computation with infinities or NaNs as operands needs to propagate NaNs to their results; that is, x*0 can be replaced by 0.
  • 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 when rounding modes are held constant at runtime.

2

Permit aggressive floating-point optimization that can cause many programs to produce different numeric results due to changes in rounding. For example, permit 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.


Defaults

If -fsimple is not designated, the compiler uses -fsimple=0.

If -fsimple is designated but no value is given for n, the compiler uses -fsimple=1.

Interactions

-fast implies -fsimple=2.

Warnings

This option can break IEEE 754 conformance.

See also

-fast

A.2.24 -fstore

IA: This option causes the compiler to convert the value of a floating-point expression or function to the type on the left side of an assignment rather than leave the value in a register when the following is true:

  • The expression or function is assigned to a variable.
  • The expression is cast to a shorter floating-point type.

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

Warnings

Due to roundoffs and truncation, the results can be different from those that are generated from the register values.

See also

-nofstore

A.2.25 -ftrap=t[,t...]

Sets the IEEE trapping mode in effect at startup.

This option sets the IEEE 754 trapping modes that are established at program initialization, but does not install a SIGFPE handler. You can use ieee_handler to simultaneously enable traps and install a SIGFPE handler. When more than one value is used, the list is processed sequentially from left to right.

Values

t can be one of the following values.

Value of t

Meaning

[no%]division

[Do not] Trap on division by zero.

[no%]inexact

[Do not] Trap on inexact result.

[no%]invalid

[Do not] Trap on invalid operation.

[no%]overflow

[Do not] Trap on overflow.

[no%]underflow

[Do not] Trap on underflow.

%all

Trap on all of the above.

%none

Trap on none of the above.

common

Trap on invalid, division by zero, and overflow.


Note that the [no%] form of the option is used only to modify the meaning of the %all and common values, and must be used with one of these values, as shown in the example. The [no%] form of the option by itself does not explicitly cause a particular trap to be disabled.

If you want to enable the IEEE traps, -ftrap=common is the recommended setting.

Defaults

If -ftrap is not specified, the -ftrap=%none value is assumed. (Traps are not enabled automatically.)

Examples

When one or more terms are given, the list is processed sequentially from left to right, thus -ftrap=%all,no%inexact means to set all traps except inexact.

Interactions

The mode can be changed at runtime with ieee_handler(3M).

Warnings

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

Use the -ftrap=inexact trap with caution. Use of -ftrap=inexact results in the trap being issued whenever a floating-point value cannot be represented exactly. For example, the following statement generates this condition:

x = 1.0 / 3.0;

This option is effective only if used when compiling the main program. Be cautious when using this option. If you wish to enable the IEEE traps, use -ftrap=common.

See also

ieee_handler(3M) man page

A.2.26 -G

Build a dynamic shared library instead of an executable file.

All source files specified in the command line are compiled with -Kpic by default.

When building a shared library that uses templates, it is necessary in most cases to include in the shared library those template functions that are instantiated in the template data base. Using this option automatically adds those templates to the shared library as needed.

Interactions

The following options are passed to ld if -c (the compile-only option) is not specified:

  • -dy
  • -G
  • -R
Warnings

Do not use ld -G to build shared libraries; use CC -G. The CC driver automatically passes several options to ld that are needed for C++.

When you use the -G option, the compiler does not pass any default -l options to ld. If you want the shared library to have a dependency on another shared library, you must pass the necessary -l option on the command line. For example, if you want the shared library to be dependent upon libCrun, you must pass -lCrun on the command line.

See also

-dy, -Kpic, -xcode=pic13, -xildoff, -ztext, ld(1) man page, Section 16.3, Building Dynamic (Shared) Libraries.

A.2.27 -g

Produces additional symbol table information for debugging with dbx(1) or the Debugger and for analysis with the Performance Analyzer analyzer(1).

Instructs both the compiler and the linker to prepare the file or program for debugging and for performance analysis.

The tasks include:

  • Producing detailed information, known as stabs, in the symbol table of the object files and the executable
  • Producing some "helper functions," which the debugger can call to implement some of its features
  • Disabling the inline generation of functions
  • Disabling certain levels of optimization
Interactions

If you use this option with -xOlevel (or its equivalent options, such as -O), you will get limited debugging information. For more information, see Section A.2.131, -xOlevel.

If you use this option 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 use this option and the optimization level is -xO4 or higher, the compiler provides best-effort symbolic information with full optimization.

When you specify this option, the +d option is specified automatically.

This option makes -xildon the default incremental linker option in order to speed up the compile-edit-debug cycle.

This option invokes 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

To use the full capabilities of the Performance Analyzer, compile with the -g option. While some performance analysis features do not require -g, you must compile with -g to view annotated source, some function level information, and compiler commentary messages. See the analyzer(1) man page and "Compiling Your Program for Data Collection and Analysis" in Program Performance Analysis Tools for more information.

The commentary messages that are generated with -g describe the optimizations and transformations that the compiler made while compiling your program. Use the er_src(1) command to display the messages, which are interleaved with the source code.

Warnings

If you compile and link your program in separate steps, then including the -g option in one step and excluding it from the other step will not affect the correctness of the program, but it will affect the ability to debug the program. Any module that is not compiled with -g (or -g0), but is linked with -g (or -g0) will not be prepared properly for debugging. Note that compiling the module that contains the function main with the -g option (or the -g0 option) is usually necessary for debugging.

See also

+d, -g0, -xildoff, -xildon, -xs, analyzer(1) man page, er_src(1) man page, ld(1) man page, Debugging a Program With dbx (for details about stabs), Program Performance Analysis Tools.

A.2.28 -g0

Compiles and links for debugging, but does not disable inlining.

This option is the same as -g, except that +d is disabled.

See also

+d, -g, -xildon, Debugging a Program With dbx

A.2.29 -H

Prints path names of included files.

On the standard error output (stderr), this option prints, one per line, the path name of each #include file contained in the current compilation.

A.2.30 -h[ ]name

Assigns the name name to the generated dynamic shared library. This is a loader option, passed to ld. In general, the name after -h should be exactly the same as the one after -o. A space between the -h and name is optional.

The compile-time loader assigns the specified name to the shared dynamic library you are creating. It 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.

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

Examples
example% CC -G -o libx.so.1 -h libx.so.1 a.o b.o c.o

A.2.31 -help

Same as -xhelp=flags.

A.2.32 -Ipathname

Add pathname to the #include file search path.

This option adds pathname to the list of directories that are searched for #include files with relative file names (those that do not begin with a slash).

The compiler searches for quote-included files (of the form #include "foo.h") in this order.

1. In the directory containing the source

2. In the directories named with -I options, if any

3. In the include directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files

4. In the /usr/include directory

The compiler searches for bracket-included files (of the form #include <foo.h>) in this order.

1. In the directories named with -I options, if any

2. In the include directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files

3. In the /usr/include directory



Note - If the spelling matches the name of a standard header file, also refer to Section 12.7.5, Standard Header Implementation.



Interactions

The -I- option allows you to override the default search rules.

If you specify -library=no%Cstd, then the compiler does not include in its search path the compiler-provided header files that are associated with the C++ standard libraries. See Section 12.7, Replacing the C++ Standard Library.

If -ptipath is not used, the compiler looks for template files in -Ipathname.

Use -Ipathname instead of -ptipath.

This option accumulates instead of overrides.

See also

-I-

A.2.33 -I-

Change the include-file search rules to the following:

For include files of the form #include "foo.h", search the directories in the following order.

1. The directories named with -I options (both before and after -I-)

2. The directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files

3. The /usr/include directory

For include files of the form #include <foo.h>, search the directories in the following order.

1. The directories named in the -I options that appear after -I-

2. The directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files

3. The /usr/include directory



Note - If the name of the include file matches the name of a standard header, also refer to Section 12.7.5, Standard Header Implementation.



Examples

The following example shows the results of using -I- when compiling prog.cc.

prog.cc
#include "a.h"
#include <b.h>
#include "c.h"
c.h
#ifndef _C_H_1
#define _C_H_1
int c1;
#endif
inc/a.h
#ifndef _A_H
#define _A_H
#include "c.h"
int a;
#endif
inc/b.h
#ifndef _B_H
#define _B_H
#include <c.h>
int b;
#endif
inc/c.h
#ifndef _C_H_2
#define _C_H_2
int c2;
#endif

The following command shows the default behavior of searching the current directory (the directory of the including file) for include statements of the form #include "foo.h". When processing the #include "c.h" statement in inc/a.h, the compiler includes the c.h header file from the inc subdirectory. When processing the #include "c.h" statement in prog.cc, the compiler includes the c.h file from the directory containing prog.cc. Note that the -H option instructs the compiler to print the paths of the included files.

example% CC -c -Iinc -H prog.cc
inc/a.h
        inc/c.h
inc/b.h
        inc/c.h
c.h

The next command shows the effect of the -I- option. The compiler does not look in the including directory first when it processes statements of the form #include "foo.h". Instead, it searches the directories named by the -I options in the order that they appear in the command line. When processing the #include "c.h" statement in inc/a.h, the compiler includes the ./c.h header file instead of the inc/c.h header file.

example% CC -c -I. -I- -Iinc -H prog.cc
inc/a.h
        ./c.h
inc/b.h
        inc/c.h
./c.h

Interactions

When -I- appears in the command line, the compiler never searches the current directory, unless the directory is listed explicitly in a -I directive. This effect applies even for include statements of the form #include "foo.h".

Warnings

Only the first -I- in a command line causes the described behavior.

A.2.34 -i

Tells the linker, ld, to ignore any LD_LIBRARY_PATH setting.

A.2.35 -inline

Same as -xinline.

A.2.36 -instances=a

Controls the placement and linkage of template instances.

Values

a must be one of the following values.

Value of a

Meaning

explicit

Places explicitly instantiated instances into the current object file and gives them global linkage. Does not generate any other needed instances.

extern

Places all needed instances into the template repository and gives them global linkage. (If an instance in the repository is out of date, it is reinstantiated.)

global

Places all needed instances into the current object file and gives them global linkage.

semiexplicit

Places explicitly instantiated instances into the current object file and gives them global linkage. Places all instances needed by the explicit instances into the current object file and gives them static linkage. Does not generate any other needed instances.

static

Places all needed instances into the current object file and gives them static linkage.


Defaults

If -instances is not specified, -instances=extern is assumed.

See also

Section 7.3, Template Instance Placement and Linkage.

A.2.37 -keeptmp

Retains temporary files created during compilation.

Along with -verbose=diags, this option is useful for debugging.

See also

-v, -verbose

A.2.38 -KPIC

SPARC: Same as -xcode=pic32.

IA: Same as -Kpic.

Use this option to compile source files when building a shared library. 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.

A.2.39 -Kpic

SPARC: Same as -xcode=pic13.

IA: Compiles with position-independent code.

Use this option to compile source files when building a shared library. 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.

A.2.40 -Lpath

Adds path to list of directories to search for libraries.

This option is passed to ld. The directory that is named by path is searched before compiler-provided directories.

Interactions

This option accumulates instead of overrides.

A.2.41 -llib

Adds library liblib.a or liblib.so to the linker's list of search libraries.

This option is passed to ld. Normal libraries have names such as liblib.a or liblib.so, where the lib and .a or .so parts are required. You should specify the lib part with this option. Put as many libraries as you want on a single command line; they are searched in the order specified with -Ldir.

Use this option after your object file name.

Interactions

This option accumulates instead of overrides.

It is always safer to put -lx after the list of sources and objects to insure that libraries are searched in the correct order.

Warnings

To ensure proper library linking order, you must use -mt, rather than -lthread, to link with libthread.

If you are using POSIX threads, you must link with the -mt and -lpthread options. The -mt option is necessary because libCrun (standard mode) and libC (compatibility mode) need libthread for a multithreaded application.

See also

-Ldir, -mt, Chapter 12, and Tools.h++ Class Library Reference

A.2.42 -libmieee

Same as -xlibmieee.

A.2.43 -libmil

Same as -xlibmil.

A.2.44 -library=l[,l...]

Incorporates specified CC-provided libraries into compilation and linking.

Values

For compatibility mode (-compat[=4]), l must be one of the following values.

TABLE A-9 Compatibility Mode -library Options

Value of l

Meaning

[no%]f77

Deprecated. Do not use. Use -xlang=f77.

[no%]f90

Deprecated. Do not use. Use -xlang=f90.

[no%]f95

Deprecated. Do not use. Use -xlang=f95.

[no%]rwtools7

[Do not] Use classic-iostreams Tools.h++ version 7.

[no%]rwtools7_dbg

[Do not] Use debug-enabled Tools.h++ version 7.

[no%]complex

[Do not] Use libcomplex for complex arithmetic.

[no%]interval

Deprecated. Do not use. Use -xia.

[no%]libC

[Do not] Use libC, the C++ support library.

[no%]gc

[Do not] Use libgc, garbage collection.

[no%]gc_dbg

[Do not] Use debug-enabled libgc, garbage collection.

[no%]sunperf

SPARC: [Do not] Use the Sun Performance Librarytrademark

%all

Deprecated. -library=%all is the same as specifying -library=f77,f90,rwtools7, complex,interval,gc. Note that the libC library always is included unless it is specifically excluded using -library=no%libC. See the Warnings section for additional information.

%none

Use no C++ libraries except for libC.


For standard mode (the default mode), l must be one of the following:

TABLE A-10 Standard Mode -library Options

Value of l

Meaning

[no%]f77

Deprecated. Do not use. Use -xlang=f77.

[no%]f90

Deprecated. Do not use. Use -xlang=f90.

[no%]f95

Deprecated. Do not use. Use -xlang=f95.

[no%]rwtools7

[Do not] Use classic-iostreams Tools.h++ version 7.

[no%]rwtools7_dbg

[Do not] Use debug-enabled Tools.h++ version 7.

[no%]rwtools7_std

[Do not] Use standard-iostreams Tools.h++ version 7.

[no%]rwtools7_std_dbg

[Do not] Use debug-enabled standard-iostreams Tools.h++ version 7.

[no%]interval

Deprecated. Do not use. Use -xia.

[no%]iostream

[Do not] Use libiostream, the classic iostreams library.

[no%]Cstd

[Do not] Use libCstd, the C++ standard library. [Do not] Include the compiler-provided C++ standard library header files.

[no%]Crun

[Do not] Use libCrun, the C++ runtime library.

[no%]gc

[Do not] Use libgc, garbage collection.

[no%]gc_dbg

[Do not] Use debug-enabled libgc, garbage collection.

[no%]stlport4

[Do not] Use STLport's Standard Library implementation version 4.5.2 instead of the default libCstd.

[no%]sunperf

SPARC: [Do not] Use the Sun Performance Librarytrademark

%all

Deprecated. -library=%all is the same as specifying -library=f77,f90,rwtools7,gc,interval,iostream,Cstd. Note that the libCrun library always is included unless it is specifically excluded using -library=no%Crun. See the Warnings section for additional information.

%none

Use no C++ libraries, except for libCrun.


Defaults
  • Compatibility mode (-compat[=4])
    • If -library is not specified, -library=%none is assumed.
    • The libC library always is included unless it is specifically excluded using -library=no%libC.
  • Standard mode (the default mode)
    • If -library is not specified, -library=%none,Cstd is assumed.
    • The libCstd library always is included unless it is specifically excluded using -library=%none or -library=no%Cstd or -library=stlport4.
    • The libCrun library always is included unless it is specifically excluded using -library=no%Crun.
Examples

To link in standard mode without any C++ libraries (except libCrun), use:

example% CC -library=%none

To include the classic-iostreams Rogue Wave tools.h++ library in standard mode:

example% CC -library=rwtools7,iostream

To include the standard-iostreams Rogue Wave tools.h++ library in standard mode:

example% CC -library=rwtools7_std

To include the classic-iostreams Rogue Wave tools.h++ library in compatibility mode:

example% CC -compat -library=rwtools7

Interactions

If a library is specified with -library, the proper -I paths are set during compilation. The proper -L,-Y P, -R paths and -l options are set during linking.

This option accumulates instead of overrides.

When you use the interval arithmetic libraries, you must include one of the following libraries: libC, libCstd, or libiostream.

Use of the -library option ensures that the -l options for the specified libraries are emitted in the right order. For example, the -l options are passed to ld in the order -lrwtool -liostream for both -library=rwtools7,iostream and -library=iostream,rwtools7.

The specified libraries are linked before the system support libraries are linked.

You cannot use -library=sunperf and -xlic_lib=sunperf on the same command line.

You cannot use -library=stlport4 and -library=Cstd on the same command line.

Only one Rogue Wave tools library can be used at a time and you cannot use any Rogue Wave tools library with -library=stlport4.

When you include the classic-iostreams Rogue Wave tools library in standard mode (the default mode), you must also include libiostream (see the C++ Migration Guide for additional information). You can use the standard-iostreams Rogue Wave tools library in standard mode only. The following command examples show both valid and invalid use of the Rogue Wave tools.h++ library options.

% CC -compat -library=rwtools foo.cc        <-- valid
% CC -compat -library=rwtools_std foo.cc    <-- invalid
 
% CC -library=rwtools,iostream foo.cc       <-- valid, classic iostreams
% CC -library=rwtools foo.cc                <-- invalid
 
% CC -library=rwtools_std foo.cc            <-- valid, standard iostreams
% CC -library=rwtools_std,iostream foo.cc   <-- invalid

If you include both libCstd and libiostream, you must be careful to not use the old and new forms of iostreams (for example, cout and std::cout) within a program to access the same file. Mixing standard iostreams and classic iostreams in the same program is likely to cause problems if the same file is accessed from both classic and standard iostream code.

Programs linking neither libC nor libCrun might not use all features of the C++ language.

If -xnolib is specified, -library is ignored.

Warnings

If you compile and link in separate steps, the set of -library options that appear in the compile command must appear in the link command.

The set of libraries is not stable and might change from release to release.

We recommend against using the -library=%all option because:

  • The exact set of libraries that will be included by using this command may vary from release to release.
  • You might not get a library you were expecting.
  • You might get a library you were not expecting.
  • Others developers who look at the makefile command line will not know what what you were expecting to link.
  • This option will be removed in a future release of the compiler.
See also

-I, -l, -R, -staticlib, -xia, -xlang, -xnolib, Chapter 12, Chapter 13, Chapter 14, Section 2.7.3.3, Using make With Standard Library Header Files, Tools.h++ User's Guide, Tools.h++ Class Library Reference, Standard C++ Class Library Reference, C++ Interval Arithmetic Programming Reference.

For information on using the -library=no%cstd option to enable use of your own C++ standard library, see Section 12.7, Replacing the C++ Standard Library.

A.2.45 -mc

Removes duplicate strings from the .comment section of the object file. If the string contains blanks, the string must be enclosed in quotation marks. When you use the -mc option, the mcs -c command is invoked.

A.2.46 -migration

Explains where to get information about migrating source code that was built for earlier versions of the compiler.



Note - This option might cease to exist in the next release.



A.2.47 -misalign

SPARC: Permits misaligned data, which would otherwise generate an error, in memory. This is shown in the following code:

char b[100];
int f(int * ar) {
return *(int *) (b +2) + *ar;
}

This option informs the compiler that some data in your program is not properly aligned. Thus, very conservative loads and stores must be used for any data that might be misaligned, that is, one byte at a time. Using this option may cause significant degradation in runtime performance. The amount of degradation is application dependent.

Interactions

When using #pragma pack on a SPARC platform to pack denser than the type's default alignment, the -misalign option must be specified for both the compilation and the linking of the application.

Misaligned data is handled by a trap mechanism that is provided by ld at runtime. If an optimization flag (-xO{1|2|3|4|5} or an equivalent flag) is used with the -misalign option, the additional instructions required for alignment of misaligned data are inserted into the resulting object file and will not generate runtime misalignment traps.

Warnings

If possible, do not link aligned and misaligned parts of the program.

If compilation and linking are performed in separate steps, the -misalign option must appear in both the compile and link commands.

A.2.48 -mr[,string]

Removes all strings from the .comment section of the object file and, if string is supplied, places string in that section. If the string contains blanks, the string must be enclosed in quotation marks.When you use this option, the command mcs -d [-a string] is invoked.

Interactions

This option is not valid when either -S, -xsbfast, or -sbfast is specified.

A.2.49 -mt

Compiles and links for multithreaded code.

This option:

  • Passes -D_REENTRANT to the preprocessor
  • Passes -lthread in the correct order to ld
  • Ensures that, for standard mode (the default mode), libthread is linked before libCrun
  • Ensures that, for compatibility mode (-compat), libthread is linked before libC

The -mt option is required if the application or libraries are multithreaded.

Warnings

To ensure proper library linking order, you must use this option, rather than -lthread, to link with libthread.

If you are using POSIX threads, you must link with the -mt and -lpthread options. The -mt option is necessary because libCrun (standard mode) and libC (compatibility mode) need libthread for a multithreaded application.

If you compile and link in separate steps and you compile with -mt, be sure to link with -mt, as shown in the following example, or you might get unexpected results.

example% CC -c -mt myprog.cc
example% CC -mt myprog.o

If you are mixing parallel Fortran objects with C++ objects, the link line must specify the -mt option.

See also

-xnolib, Chapter 11, Multithreaded Programming Guide, Linker and Libraries Guide

A.2.50 -native

Same as -xtarget=native.

A.2.51 -noex

Same as -features=no%except.

A.2.52 -nofstore

IA: Disables forced precision of an expression.

This option does not force the value of a floating-point expression or function to the type on the left side of an assignment, but leaves the value in a register when either of the following are true:

  • The expression or function is assigned to a variable
or
  • The expression or function is cast to a shorter floating-point type
See also

-fstore

A.2.53 -nolib

Same as -xnolib.

A.2.54 -nolibmil

Same as -xnolibmil.

A.2.55 -noqueue

Disables license queueing.

If no license is available, this option returns without queuing your request and without compiling. A nonzero status is returned for testing makefiles.

A.2.56 -norunpath

Does not build a runtime search path for shared libraries into the executable.

If an executable file uses shared libraries, then the compiler normally builds in a path that points the runtime linker to those shared libraries. To do so, the compiler passes the -R option to ld. The path depends on the directory where you have installed the compiler.

This option is recommended for building executables that will be shipped to customers who may have a different path for the shared libraries that are used by the program.

Interactions

If you use any shared libraries under the compiler installed area (the default location is /opt/SUNWspro/lib) and you also use -norunpath, then you should either use the -R option at link time or set the environment variable LD_LIBRARY_PATH at runtime to specify the location of the shared libraries. Doing so allows the runtime linker to find the shared libraries.

A.2.57 -O

Same as -xO2.

A.2.58 -Olevel

Same as -xOlevel.

A.2.59 -o filename

Sets the name of the output file or the executable file to filename.

Interactions

When the compiler must store template instances, it stores them in the template repository in the output file's directory. For example, the following command writes the object file to ./sub/a.o and writes template instances into the repository contained within ./sub/SunWS_cache.

example% CC -o sub/a.o a.cc

The compiler reads from the template repositories corresponding to the object files that it reads. For example, the following command reads from ./sub1/SunWS_Cache and ./sub2/SunWS_cache, and, if necessary, writes to ./SunWS_cache.

example% CC sub1/a.o sub2/b.o

For more information, see Section 7.4, The Template Repository.

Warnings

The filename must have the appropriate suffix for the type of file to be produced by the compilation. It cannot be the same file as the source file, since the CC driver does not overwrite the source file.

A.2.60 +p

Ignore nonstandard preprocessor asserts.

Defaults

If +p is not present, the compiler recognizes nonstandard preprocessor asserts.

Interactions

If +p is used, the following macros are not defined:

  • sun
  • unix
  • sparc
  • i386

A.2.61 -P

Only preprocesses source; does not compile. (Outputs a file with a .i suffix.)

This option does not include preprocessor-type line number information in the output.

See also

-E

A.2.62 -p

Prepares object code to collect data for profiling with prof.

This option invokes a runtime recording mechanism that produces a mon.out file at normal termination.

Warnings

If you compile and link in separate steps, the -p option must appear in both the compile command and the link command. Including -p in one step and excluding it from the other step will not affect the correctness of the program, but you will not be able to do profiling.

See also

-xpg, -xprofile, analyzer(1) man page, Program Performance Analysis Tools.

A.2.63 -pentium

IA: Replace with -xtarget=pentium.

A.2.64 -pg

Same as -xpg.

A.2.65 -PIC

SPARC: Same as -xcode=pic32.

IA: Same as -Kpic.

A.2.66 -pic

SPARC: Same as -xcode=pic13.

IA: Same as -Kpic.

A.2.67 -pta

Same as -template=wholeclass.

A.2.68 -ptipath

Specifies an additional search directory for template source.

This option is an alternative to the normal search path set by -Ipathname. If the -ptipath option is used, the compiler looks for template definition files on this path and ignores the -Ipathname option.

Using the -Ipathname option instead of -ptipath produces less confusion.

Interactions

This option accumulates instead of overrides.

See also

-Ipathname

A.2.69 -pto

Same as -instances=static.

A.2.70 -ptr

This option is obsolete and is ignored by the compiler.

Warnings

Even though the -ptr option is ignored, you should remove -ptr from all compilation commands because, in a later release, it may be reused with a different behavior.

See also

For information about repository directories, see Section 7.4, The Template Repository.

A.2.71 -ptv

Same as -verbose=template.

A.2.72 -Qoption phase option[,option...]

Passes option to the compilation phase.

To pass multiple options, specify them in order as a comma-separated list.

Values

phase must have one of the following values.

SPARC

IA

ccfe

ccfe

iropt

cg386

cg

codegen

CClink

CClink

ld

ld


Examples

In the following command line, when ld is invoked by the CC driver, -Qoption passes the -i and -m options to ld.

example% CC -Qoption ld -i,-m test.c

Warnings

Be careful to avoid unintended effects. For example,

-Qoption ccfe -features=bool,iddollar

is interpreted as

-Qoption ccfe -features=bool -Qoption ccfe iddollar

The correct usage is

-Qoption ccfe -features=bool,-features=iddollar

A.2.73 -qoption phase option

Same as -Qoption.

A.2.74 -qp

Same as -p.

A.2.75 -Qproduce sourcetype

Causes the CC driver to produce output of the type sourcetype.

Sourcetype suffixes are defined below.

Suffix

Meaning

.i

Preprocessed C++ source from ccfe

.o

Object file the code generator

.s

Assembler source from cg


A.2.76 -qproduce sourcetype

Same as -Qproduce.

A.2.77 -Rpathname[:pathname...]

Builds dynamic library search paths into the executable file.

This option is passed to ld.

Defaults

If the -R option is not present, the library search path that is recorded in the output object and passed to the runtime linker depends upon the target architecture instruction specified by the -xarch option (when -xarch is not present, -xarch=generic is assumed).

-xarch Value

Default Library Search Path

v9, v9a, or v9b

install-directory/SUNWspro/lib/v9

All other values

install-directory/SUNWspro/lib


In a default installation, install-directory is /opt.

Interactions

This option accumulates instead of overrides.

If the LD_RUN_PATH environment variable is defined and the -R option is specified, then the path from -R is scanned and the path from LD_RUN_PATH is ignored.

See also

-norunpath, Linker and Libraries Guide

A.2.78 -readme

Same as -xhelp=readme.

A.2.79 -S

Compiles and generates only assembly code.

This option causes the CC driver to compile the program and output an assembly source file, without assembling the program. The assembly source file is named with a .s suffix.

A.2.80 -s

Strips the symbol table from the executable file.

This option removes all symbol information from output executable files. This option is passed to ld.

A.2.81 -sb

Replace with -xsb.

A.2.82 -sbfast

Same as -xsbfast.

A.2.83 -staticlib=l[,l...]

Indicates which C++ libraries specified in the -library option (including its defaults), which libraries specified in the -xlang option, and which libraries specified by use of the -xia option are to be linked statically.

Values

l must be one of the following values.

Value of l

Meaning

[no%]library

[Do not] link library statically. The valid values for library are all the valid values for -library (except %all and %none), all the valid values for -xlang, and interval (to be used in conjunction with -xia).

%all

Statically link all the libraries specified in the -library option, all the libraries specified in the -xlang option, and, if -xia is specified in the command line, the interval libraries.

%none

Link no libraries specified in the -library option and the -xlang option statically. If -xia is specified in the command line, link no interval libraries statically.


Defaults

If -staticlib is not specified, -staticlib=%none is assumed.

Examples

The following command line links libCrun statically because Crun is a default value for -library:

example% CC -staticlib=Crun (correct)

However, the following command line does not link libgc because libgc is not linked unless explicitly specified with the -library option:

example% CC -staticlib=gc (incorrect)

To link libgc statically, use the following command:

example% CC -library=gc -staticlib=gc (correct)

With the following command, the librwtool library is linked dynamically. Because librwtool is not a default library and is not selected using the -library option, -staticlib has no effect:

example% CC -lrwtool -library=iostream \
-staticlib=rwtools7 (incorrect)

This command links the librwtool library statically:

example% CC -library=rwtools7,iostream -staticlib=rwtools7 (correct)

This command will link the Sun Performance Libraries dynamically because -library=sunperf must be used in conjunction with -staticlib=sunperf in order for the -staticlib option to have an effect on the linking of these libraries: This command links the Sun Performance Libraries statically:

example% CC -xlic_lib=sunperf -staticlib=sunperf (incorrect)

example% CC -library=sunperf -staticlib=sunperf (correct)

Interactions

This option accumulates instead of overrides.

The -staticlib option only works for the C++ libraries that are selected explicitly with the -xia option, the -xlang option, and the -library option, in addition to the C++ libraries that are selected implicitly by default. In compatibility mode (-compat=[4]), libC is selected by default. In standard mode (the default mode), Cstd and Crun are selected by default.

When using -xarch=v9, -xarch=v9a, or -xarch=v9b (or equivalent 64-bit architecture options), some C++ libraries are not available as static libraries.

Warnings

The set of allowable values for library is not stable and might change from release to release.

See also

-library, Section 12.5, Statically Linking Standard Libraries

A.2.84 -temp=path

Defines the directory for temporary files.

This option sets the path name of the directory for storing the temporary files that are generated during the compilation process.

See also

-keeptmp

A.2.85 -template=opt[,opt...]

Enables/disables various template options.

Values

opt must be one of the following values.

Value of w

Meaning

[no%]wholeclass

[Do not] Instantiate a whole template class, rather than only those functions that are used. You must reference at least one member of the class; otherwise, the compiler does not instantiate any members for the class.

[no%]extdef

[Do not] Search for template definitions in separate source files.


Defaults

If the -template option is not specified, -template=no%wholeclass,extdef is assumed.

See also

Section 6.3.2, Whole-Class Instantiation, Section 7.5, Template Definition Searching

A.2.86 -time

Same as -xtime.

A.2.87 -Uname

Deletes initial definition of the preprocessor symbol name.

This option removes any initial definition of the macro symbol name created by -D on the command line including those implicitly placed there by the CC driver. This option has no effect on any other predefined macros, nor on macro definitions in source files.

To see the -D options that are placed on the command line by the CC driver, add the -dryrun option to your command line.

Examples

The following command undefines the predefined symbol __sun. Preprocessor statements in foo.cc such as #ifdef(__sun) will sense that the symbol is undefined.

example% CC -U__sun foo.cc

Interactions

You can specify multiple -U options on the command line.

All -U options are processed after any -D options that are present. That is, if the same name is specified for both -D and -U on the command line, name is undefined, regardless of the order the options appear.

See also

-D

A.2.88 -unroll=n

Same as -xunroll=n.

A.2.89 -V

Same as -verbose=version.

A.2.90 -v

Same as -verbose=diags.

A.2.91 -vdelx

Compatibility mode only (-compat[=4]):

For expressions using delete[], this option generates a call to the runtime library function _vector_deletex_ instead of generating a call to _vector_delete_. The function _vector_delete_ takes two arguments: the pointer to be deleted and the size of each array element.

The function _vector_deletex_ behaves the same as _vector_delete_ except that it takes a third argument: the address of the destructor for the class. This third argument is not used by the function, but is provided to be used by third-party vendors.

Default

The compiler generates a call to _vector_delete_ for expressions using delete[].

Warnings

This is an obsolete option that will be removed in future releases. Don't use this option unless you have bought some software from a third-party vendor and the vendor recommends using this option.

A.2.92 -verbose=v[,v...]

Controls compiler verbosity.

Values

v must be one of the following values.

Value of v

Meaning

[no%]diags

[Do not] Print the command line for each compilation pass.

[no%]template

[Do not] Turn on the template instantiation verbose mode (sometimes called the "verify" mode). The verbose mode displays each phase of instantiation as it occurs during compilation.

[no%]version

[Do not] Direct the CC driver to print the names and version numbers of the programs it invokes.

%all

Invokes all of the above.

%none

-verbose=%none is the same as -verbose=no%template,no%diags,no%version.


Defaults

If -verbose is not specified, -verbose=%none is assumed.

Interactions

This option accumulates instead of overrides.

A.2.93 +w

Identifies code that might have unintended consequences. The +w option no longer generates a warning if a function is too large to inline or if a declared program element is unused. These warnings do not identify real problems in the source, and were thus inappropriate to some development environments. Removing these warnings from +w enables more aggressive use of +w in those environments. These warnings are still available with the +w2 option.

This option generates additional warnings about questionable constructs that are:

  • Nonportable
  • Likely to be mistakes
  • Inefficient
Defaults

If +w is not specified, the compiler warns about constructs that are almost certainly problems.

Interactions

Some C++ standard headers result in warnings when compiled with +w.

See also

-w, +w2

A.2.94 +w2

Emits all the warnings emitted by +w plus warnings about technical violations that are probably harmless, but that might reduce the maximum portability of your program.

The +w2 option no longer warns about the use of implementation-dependent constructs in the system header files. Because the system header files are the implementation, the warning was inappropriate. Removing these warnings from +w2 enables more aggressive use of the option.

Warnings

Some Solaris and C++ standard header files result in warnings when compiled with +w2.

See also

+w

A.2.95 -w

Suppresses most warning messages.

This option causes the compiler not to print warning messages. However, some warnings, particularly warnings regarding serious anachronisms, cannot be suppressed.

See also

+w

A.2.96 -xa

Generates code for profiling.

If set at compile time, the TCOVDIR environment variable specifies the directory where the coverage (.d) files are located. If this variable is not set, then the coverage (.d) files remain in the same directory as the source files.

Use this option only for backward compatibility with old coverage files.

Interactions

The -xprofile=tcov option and the -xa option 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 that have been compiled with -xa. You cannot compile a single file with both options.

The -xa option is incompatible with -g.

Warnings

If you compile and link in separate steps and you compile with -xa, be sure to link with -xa, or you might get unexpected results.

See also

-xprofile=tcov, tcov(1) man page, Program Performance Analysis Tools.

A.2.97 -xalias_level[=n]

(SPARC) The C++ compiler can perform type-based alias-analysis and optimizations when you specify the following command:

  • -xalias_level[=n]
where n is any, simple, or compatible.
  • -xalias_level=any
At this level of analysis, the compiler assumes that any type may alias any other type. However, despite this assumption, some optimization is possible.
  • -xalias_level=simple
The compiler assumes that fundamental types are not aliased. Specifically, a storage object with a dynamic type that is one of the following fundamental types:

char

short int

long int

float

signed char

unsigned short int

unsigned long int

double

unsigned char

int

long long int

long double

wchar_t

unsigned int

unsigned long long int

enumeration types

data pointer types

function pointer types

data member pointer types

function member pointer types


is only accessed through lvalues of the following types:
    • The dynamic type of the object
    • A constant or volatile qualified version of the dynamic type of the object, a type that is the signed or unsigned type corresponding to the dynamic type of the object
    • A type that is the signed or unsigned type corresponding to a constant or volatile qualified version of the dynamic type of the object
    • An aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union)
    • A char or unsigned char type
  • -xalias_level=compatible
The compiler assumes that layout-incompatible types are not aliased. A storage object is only accessed through lvalues of the following types:
    • The dynamic type of the object
    • A constant or volatile qualified version of the dynamic type of the object, a type that is the signed or unsigned type which corresponds to the dynamic type of the object
    • A type that is the signed or unsigned type which corresponds to the constant or volatile qualified version of the dynamic type of the object
    • An aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union)
    • A type that is (possibly constant or volatile qualified) base class type of the dynamic type of the object
    • A char or unsigned char type.
The compiler assumes that the types of all references are layout compatible with the dynamic type of the corresponding storage object. Two types are layout-compatible under the following conditions:
    • If two types are the same type, then they are layout-compatible types.
    • If two types differ only in constant or volatile qualification, then they are layout-compatible types.
    • For each of the signed integer types, there exists a corresponding (but different) unsigned integer type. These corresponding types are layout compatible.
    • Two enumeration types are layout-compatible if they have the same underlying type.
    • Two Plain Old Data (POD) struct types are layout compatible if they have the same number of members, and corresponding members (in order) have layout compatible types.
    • Two POD union types are layout compatible if they have the same number of members, and corresponding members (in any order) have layout compatible types.
References may be non-layout-compatible with the dynamic type of the storage object under limited circumstances:
    • If a POD union contains two or more POD structs that share a common initial sequence, and if the POD union object currently contains one of those POD structs, it is permitted to inspect the common initial part of any of them. Two POD structs share a common initial sequence if corresponding members have layout compatible types and, as applicable to bit fields, the same widths, for a sequence of one or more initial members.
    • A pointer to a POD struct object, suitably converted using a reinterpret_cast, points to its initial member, or if that member is a bit field, to the unit in which it resides.
Defaults

If you do not specify -xalias_level, the compiler sets the option to -xalias_level=any. If you specify -xalias_level but do not provide a value, the compiler sets the option to -xalias_level=compatible.

Interactions

The compiler does not perform type-based alias analysis at optimization level -xO2 and below.

A.2.98 -xar

Creates archive libraries.

When building a C++ archive that uses templates, it is necessary in most cases to include in the archive those template functions that are instantiated in the template database. Using this option automatically adds those templates to the archive as needed.

Examples

The following command line archives the template functions contained in the library and object files.

example% CC -xar -o libmain.a a.o b.o c.o

Warnings

Do not add .o files from the template database on the command line.

Do not use the ar command directly for building archives. Use CC -xar to ensure that template instantiations are automatically included in the archive.

See also

Chapter 16

A.2.99 -xarch=isa

Specifies the target instruction set architecture (ISA).

This option limits the code generated by the compiler to the instructions of the specified instruction set architecture by allowing only the specified set of instructions. This option does not guarantee use of any target-specific instructions. However, use of this option may affect the portability of a binary program.

Values

For SPARC platforms:

TABLE A-11 gives the details for each of the -xarch keywords on SPARC platforms.

TABLE A-11 -xarch Values for SPARC Platforms

Value of isa

Meaning

generic

Produce 32-bit object binaries 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. Currently, this is equivalent to -xarch=v7.

generic64

Produce 64-bit object binaries for good performance on most 64-bit platform architectures. This option uses the best instruction set for good performance on Solaris operating environments with 64-bit kernels, without major performance degradation on any of them. With each new release, the definition of "best" instruction set may be adjusted, if appropriate. Currently, this is equivalent to -xarch=v9.

native

Produce 32-bit object binaries for good performance on this system. This is the default for the -fast option. The compiler chooses the appropriate setting for the system on which the processor is running.

native64

Produce 64-bit object binaries for good performance on this system. The compiler chooses the appropriate setting for producing 64-bit binaries for the system on which the processor is running.

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.

Also note the following:

  • SPARC instruction set architectures V7, V8, and V8a are all binary compatible.
  • Object binary files (.o) compiled with v8plus and v8plusa can be linked and can execute together, but only on a SPARC V8plusa compatible platform.
  • Object binary files (.o) compiled with v8plus, v8plusa, and v8plusb can be linked and can execute together, but only on a SPARC V8plusb compatible platform.
  • -xarch values generic64, native64, v9, v9a, and v9b are only available on UltraSPARC 64-bit Solaris environments.
  • Object binary files (.o) compiled with generic64, native64, v9 and v9a can be linked and can execute together, but will run only on a SPARC V9a compatible platform.
  • Object binary files (.o) compiled with generic64, native64, v9, v9a, and v9b can be linked and can execute together, but will run only on a SPARC V9b compatible platform.

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.

For IA platforms:

TABLE A-12 gives the details for each of the -xarch keywords on IA platforms.

TABLE A-12 -xarch Values for IA Platforms

Value of isa

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.

386

generic and 386 are equivalent in this release.

pentium_pro

Limits the instruction set to the pentium_pro architecture.


Defaults

If -xarch=isa is not specified, -xarch=generic is assumed.

Interactions

Although this option 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, -xtarget=ultra2 expands to -xarch=v8plusa -xchip=ultra2 -xcache=16/32/1:512/64/1. In the following command -xarch=v8plusb overrides the -xarch=v8plusa that is set by the expansion of -xtarget=ultra2.

example% CC -xtarget=ultra2 -xarch=v8plusb foo.cc

Use of -compat[=4] with -xarch=generic64, -xarch=native64, -xarch=v9, -xarch=v9a, or -xarch=v9b is not supported.

Warnings

If this option is used with optimization, the appropriate choice can provide good performance of the executable on the specified architecture. An inappropriate choice, however, might result in serious degradation of performance or in a binary program that is not executable on the intended target platform.

A.2.100 -xbuiltin[={%all|%none}]

Enables or disables better optimization of standard library calls.

By default, the functions declared in standard library headers are treated as ordinary functions by the compiler. However, some of those functions can be recognized as "intrinsic" or "built-in" by the compiler. When treated as a built-in, the compiler can generate more efficient code. For example, the compiler can recognize that some functions have no side effects, and always return the same output given the same input. Some functions can be generated inline directly by the compiler.

The -xbuiltin=%all option asks the compiler to recognize as many of the built-in standard functions as possible. The exact list of recognized functions varies with the version of the compiler code generator.

The -xbuiltin=%none option results in the default compiler behavior, and the compiler does not do any special optimizations for built-in functions.

Defaults

If the -xbuiltin option is not specified, then the compiler assumes -xbuiltin=%none.

If only -xbuiltin is specified, then the compiler assumes -xbuiltin=%all.

Interactions

The expansion of the macro -fast includes -xbuiltin=%all.

Examples

The following compiler command requests special handling of the standard library calls.

example% CC -xbuiltin -c foo.cc 

The following compiler command request that there be no special handling of the standard library calls. Note that the expansion of the macro -fast includes -xbuiltin=%all.

example% CC -fast -xbuiltin=%none -c foo.cc

A.2.101 -xcache=c

SPARC: Defines cache properties for use by the optimizer.

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



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



Values

c must be one of the following values.

Value of c

Meaning

generic

Defines the cache properties for good performance on most SPARC processors

s1/l1/a1

Defines level 1 cache properties

s1/l1/a1:s2/l2/a2

Defines level 1 and 2 cache properties

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

Defines level 1, 2, and 3 cache properties


The definitions of the cache properties, si/li/ai, are as follows:

Property

Definition

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


For example, i=1 designates level 1 cache properties, s1/l1/a1.

Defaults

If -xcache is not specified, the default -xcache=generic is assumed. This value directs the compiler to use cache properties for good performance on most SPARC processors, without major performance degradation on any of them.

Examples

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

Level 1 Cache Has

Level 2 Cache Has

16 Kbytes

1024 Kbytes

32 bytes line size

32 bytes line size

4-way associativity

Direct mapping associativity


See also

-xtarget=t

A.2.102 -xcg89

Same as -xtarget=ss2.

Warnings

If you compile and link in separate steps and you compile with -xcg89, be sure to link with the same option, or you might get unexpected results.

A.2.103 -xcg92

Same as -xtarget=ss1000.

Warnings

If you compile and link in separate steps and you compile with -xcg92, be sure to link with the same option, or you might get unexpected results.

A.2.104 -xcheck[=i]

SPARC: Compiling with -xcheck=stkovf adds a runtime check for stack overflow of the main thread in a singly-threaded program as well as slave-thread stacks in a multithreaded program. If a stack overflow is detected, a SIGSEGV is generated. If your application needs to handle a SIGSEGV caused by a stack overflow differently than it handles other address-space violations, see sigaltstack(2).

Values

i must be one of the following:

TABLE A-13 The -xcheck Values

Value

Meaning

%all

Perform all checks.

%none

Perform no checks.

stkovf

Turns on stack-overflow checking.

no%stkovf

Turns off stack-overflow checking.


Defaults

If you do not specify -xcheck, the compiler defaults to -xcheck=%none.

If you specify -xcheck without any arguments, the compiler defaults to -xcheck=%none.

The -xcheck option does not accumulate on the command line. The compiler sets the flag in accordance with the last occurrence of the command.

A.2.105 -xchip=c

Specifies target processor for use by the optimizer.

The -xchip option specifies timing properties by specifying the target processor. This option affects:

  • The ordering of instructions--that is, scheduling
  • The way the compiler uses branches
  • The instructions to use in cases where semantically equivalent alternatives are available


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



Values

c must be one of the following values.

TABLE A-14 -xchip Options

Platform

Value of c

Optimize for Using Timing Properties

SPARC

generic

For good performance on most SPARC processors

 

native

For good performance on the system on which the compiler is running

 

old

Of processors earlier than the

SuperSPARC processor

 

super

Of the SuperSPARC processor

 

super2

Of the SuperSPARC II processor

 

micro

Of the microSPARC processor

 

micro2

Of the microSPARC II processor

 

hyper

Of the hyperSPARC processor

 

hyper2

Of the hyperSPARC II processor

 

powerup

Of the Weitek PowerUp processor

 

ultra

Of the UltraSPARC processor

 

ultra2

Of the UltraSPARC II processor

 

ultra2e

Of the UltraSPARC IIe processor

 

ultra2i

Of the UltraSPARC IIi processor

 

ultra3

Of the UltraSPARC III processor

 

ultra3cu

Of the UltraSPARC III Cu processor

IA

generic

Of most IA processors

 

386

Of the Intel 386 processor

 

486

Of the Intel 486 processor

 

pentium

Of the Intel Pentium processor

 

pentium_pro

Of the Intel Pentium Pro processor


Defaults

On most SPARC processors, generic is the default value that directs the compiler to use the best timing properties for good performance without major performance degradation on any of the processors.

A.2.106 -xcode=a

SPARC: Specifies the code address space.

Values

a must be one of the following values.

TABLE A-15 -xcode Options

Value of a

Meaning

abs32

Generates 32-bit absolute addresses, which are fast, but have limited range. Code + data + bss size is limited to 2**32 bytes.

abs44

SPARC: Generates 44-bit absolute addresses, which have moderate speed and moderate range. Code + data + bss size is limited to 2**44 bytes. Available only on 64-bit architectures:

-xarch={v9|v9a|v9b}

abs64

SPARC: Generates 64-bit absolute addresses, which are slow, but have full range. Available only on 64-bit architectures:

-xarch={v9|v9a|v9|generic64|native64}

pic13

Generates position-independent code (small model), which is fast, but has limited range. Equivalent to -Kpic. Permits references to at most 2**11 unique external symbols on 32-bit architectures; 2**10 on 64-bit.

pic32

Generates position-independent code (large model), which is slow, but has full range. Equivalent to -KPIC. Permits references to at most 2**30 unique external symbols on 32-bit architectures; 2**29 on 64-bit.


Defaults

For SPARC V8 and V7 processors, the default is -xcode=abs32.

For SPARC and UltraSPARC processors, when you use -xarch={v9|v9a|v9b|generic64|native64}, the default is -xcode=abs64.

Warnings

When you compile and link in separate steps, you must use the same -xarch option in the compile step and the link step.

A.2.107 -xcrossfile[=n]

SPARC: Enables optimization and inlining across source files. -xcrossfile works at compile time and involves only the files that appear on the compilation command. Consider the following command-line example:

example% CC -xcrossfile -xO4 -c f1.cc f2.cc
example% CC -xcrossfile -xO4 -c f3.cc f4.cc

Cross-module optimizations occur between files f1.cc and f2.cc, and between f3.cc and f4.cc. No optimizations occur between f1.cc and f3.cc or f4.cc.

Values

n must be one of the following values.

Value of n

Meaning

0

Do not perform cross-file optimizations or cross-file inlining.

1

Perform optimization and inlining across source files.


Normally the scope of the compiler's analysis is limited to each separate file on the command line. For example, when the -xO4 option is passed, automatic inlining is limited to subprograms defined and referenced within the same source file.

With -xcrossfile or -xcrossfile=1, the compiler analyzes all the files named on the command line as if they had been concatenated into a single source file.

Defaults

If -xcrossfile is not specified, -xcrossfile=0 is assumed and no cross-file optimizations or inlining are performed.

-xcrossfile is the same as -xcrossfile=1.

Interactions

The -xcrossfile option is effective only when it is used with -xO4 or -xO5.

Warnings

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.

A.2.108 -xF

If you compile with the -xF option and then run the Analyzer, you can generate a map file that shows an optimized order for the functions. A subsequent link to build the executable file can be directed to use that map by using the linker -Mmapfile option. It places each function from the executable file into a separate section.

Reordering the subprograms in memory is useful only when the application text page fault time is consuming a large percentage of the application time. Otherwise, reordering might not improve the overall performance of the application.

Interactions

The -xF option is only supported with -features=no%except (-noex).

See also

analyzer(1), debugger(1), ld(1) man pages

A.2.109 -xhelp=flags

Displays a brief description of each compiler option.

A.2.110 -xhelp=readme

Displays contents of the online readme file.

The readme file is paged by the command specified in the environment variable, PAGER. If PAGER is not set, the default paging command is more.

A.2.111 -xia

SPARC: Links the appropriate interval arithmetic libraries and sets a suitable floating-point environment.



Note - The C++ interval arithmetic library is compatible with interval arithmetic as implemented in the Fortran compiler.



Expansions

The -xia option is a macro that expands to -fsimple=0 -ftrap=%none -fns=no -library=interval.

Interactions

To use the interval arithmetic libraries, include <suninterval.h>.

When you use the interval arithmetic libraries, you must include one of the following libraries: libC, Cstd, or iostreams. See -library for information on including these libraries.

Warnings

If you use intervals and you specify different values for -fsimple, -ftrap, or -fns, then your program may have incorrect behavior.

C++ interval arithmetic is experimental and evolving. The specifics may change from release to release.

See also

C++ Interval Arithmetic Programming Reference, Interval Arithmetic Solves Nonlinear Problems While Providing Guaranteed Results (http://www.sun.com/forte/info/features/intervals.html), -library

A.2.112 -xildoff

Turns off the incremental linker.

Defaults

This option is assumed if you do not use the -g option. It is also assumed if you do use the -G option, or name any source file on the command line. Override this default by using the -xildon option.

See also

-xildon, ild(1) man page, ld(1) man page, "Incremental Link Editor" in the C User's Guide

A.2.113 -xildon

Turns on the incremental linker.

This option is assumed if you use -g and not -G, and you do not name any source file on the command line. Override this default by using the -xildoff option.

See also

-xildoff, ild(1) man page, ld(1) man page, "Incremental Link Editor" in the C User's Guide

A.2.114 -xinline[=func_spec[,func_spec...]]

Specifies which user-written routines can be inlined by the optimizer at -xO3 levels or higher.

Values

func_spec must be one of the following values.

TABLE A-16 -xinline Options

Value of func_spec

Meaning

%auto

Enable automatic inlining at optimization levels -xO4 or higher. This argument tells the optimizer that it can inline functions of its choosing. Note that without the %auto specification, automatic inlining is normally turned off when explicit inlining is specified on the command line by -xinline=[no%]func_name...

func_name

Strongly request that the optimizer inline the function. If the function is not declared as extern "C", the value of func_name must be mangled. You can use the nm command on the executable file to find the mangled function names. For functions declared as extern "C", the names are not mangled by the compiler.

no%func_name

When you prefix the name of a routine on the list with no%, the inlining of that routine is inhibited. The rule about mangled names for func_name applies to no%func_name as well.


Only routines in the file being compiled are considered for inlining unless you use -xcrossfile[=1]. The optimizer decides which of these routines are appropriate for inlining.

Defaults

If the -xinline option is not specified, the compiler assumes -xinline=%auto.

If -xinline= is specified with no arguments, no functions are inlined, regardless of the optimization level.

Examples

To enable automatic inlining while disabling inlining of the function declared int foo(), use

example% CC -xO5 -xinline=%auto,no%__1cDfoo6F_i_ -c a.cc

To strongly request the inlining of the function declared as int foo(), and to make all other functions as the candidates for inlining, use

example% CC -xO5 -xinline=%auto,__1cDfoo6F_i_ -c a.cc

To strongly request the inlining of the function declared as int foo(), and to not allow inlining of any other functions, use

example% CC -xO5 -xinline=__1cDfoo6F_i_ -c a.cc

Interactions

The -xinline option has no effect for optimization levels below -xO3. At -xO4 and higher, the optimizer decides which functions should be inlined, and does so without the -xinline option being specified. At -xO4 and higher, the compiler also attempts to determine which functions will improve performance if they are inlined.

A routine is not inlined if any of the following conditions apply. No warnings will be omitted.

  • Optimization is less than -xO3
  • The routine cannot be found
  • Inlining it is not profitable or safe
  • The source is not in the file being compiled, or, if you use -xcrossfile[=1], the source is not in the files named on the command line
Warnings

If you force the inlining of a function with -xinline, you might actually diminish performance.

A.2.115 -xipo[={0|1|2}]

Performs interprocedural optimizations.

The -xipo option performs whole-program optimizations by invoking an interprocedural analysis pass. Unlike -xcrossfile, -xipo performs optimizations across all object files in the link step, and the optimizations are not limited to just the source files on the compile command.

The -xipo option is particularly useful when compiling and linking large multifile applications. Object files compiled with this flag have analysis information compiled within them that enables interprocedural analysis across source and precompiled program files. However, analysis and optimization is limited to the object files compiled with -xipo, and does not extend to object files on libraries.

Values

The -xipo option can have the following values.

Value

Meaning

0

Do not perform interprocedural optimizations

1

Perform interprocedural optimizations

2

Perform interprocedural aliasing analysis as well as optimizations of memory allocation and layout to improve cache performance


Defaults

If -xipo is not specified, -xipo=0 is assumed.

If only -xipo is specified, -xipo=1 is assumed.

Examples

The following example compiles and links in the same step.

example% CC -xipo -xO4 -o prog  part1.cc part2.cc part3.cc

The optimizer performs crossfile inlining across all three source files. This is done in the final link step, so the compilation of the source files need not all take place in a single compilation and could be over a number of separate compilations, each specifying the -xipo option.

The following example compiles and links in separate steps.

example% CC -xipo -xO4 -c part1.cc part2.cc 
example% CC -xipo -xO4 -c part3.cc
example% CC -xipo -xO4 -o prog  part1.o part2.o part3.o

The object files created in the compile steps have additional analysis information compiled within them to permit crossfile optimizations to take place at the link step.

Interactions

The -xipo option requires at least optimization level -xO4.

You cannot use both the -xipo option and the -xcrossfile option in the same compiler command line.

Warnings

When compiling and linking are performed in separate steps, -xipo must be specified in both steps to be effective.

Objects that are compiled without -xipo can be linked freely with objects that are compiled with -xipo.

Libraries do not participate in crossfile interprocedural analysis, even when they are compiled with -xipo, as shown in this example.

example% CC -xipo -xO4 one.cc two.cc three.cc
example% CC -xar -o mylib.a one.o two.o three.o
...
example% CC -xipo -xO4 -o myprog main.cc four.cc mylib.a

In this example, interprocedural optimizations will be performed between one.cc, two.cc and three.cc, and between main.cc and four.cc, but not between main.cc or four.cc and the routines in mylib.a. (The first compilation may generate warnings about undefined symbols, but the interprocedural optimizations will be performed because it is a compile and link step.)

The -xipo option generates significantly larger object files due to the additional information needed to perform optimizations across files. However, this additional information does not become part of the final executable binary file. Any increase in the size of the executable program will be due to the additional optimizations performed.

A.2.116 -xlang=language[,language]

Includes the appropriate runtime libraries and ensures the proper runtime environment for the specified language.

Values

language must be either f77, f90, or f95.

The f90 and f95 arguments are equivalent.

Interactions

The -xlang=f90 and -xlang=f95 options imply -library=f90, and the -xlang=f77 option implies -library=f77. However, the -library=f77 and -library=f90 options are not sufficient for mixed-language linking because only the -xlang option ensures the proper runtime environment.

To determine which driver to use for mixed-language linking, use the following language hierarchy:

1. C++

2. Fortran 95 (or Fortran 90)

3. Fortran 77

When linking Fortran 95, Fortran 77, and C++ object files together, use the driver of the highest language. For example, use the following C++ compiler command to link C++ and Fortran 95 object files.

example% CC -xlang=f95 ...

To link Fortran 95 and Fortran 77 object files, use the Fortran 95 driver, as follows.

example% f95 -xlang=f77 ...

You cannot use the -xlang option and the -xlic_lib option in the same compiler command. If you are using -xlang and you need to link in the Sun Performance Libraries, use -library=sunperf instead.

Warnings

Do not use -xnolib with -xlang.

If you are mixing parallel Fortran objects with C++ objects, the link line must specify the -mt flag.

See also

-library, -staticlib

A.2.117 -xlibmieee

Causes libm to return IEEE 754 values for math routines in exceptional cases.

The default behavior of libm is XPG-compliant.

See also

Numerical Computation Guide

A.2.118 -xlibmil

Inlines selected libm library routines for optimization.



Note - This option does not affect C++ inline functions.



There are inline templates for some of the libm library routines. This option selects those inline templates that produce the fastest executables for the floating-point option and platform currently being used.

Interactions

This option is implied by the -fast option.

See also

-fast, Numerical Computation Guide

A.2.119 -xlibmopt

Uses library of optimized math routines.

This option uses a math routine library optimized for performance and usually generates faster code. The results might be slightly different from those produced by the normal math library; if so, they usually differ in the last bit.

The order on the command line for this library option is not significant.

Interactions

This option is implied by the -fast option.

See also

-fast, -xnolibmopt

A.2.120 -xlic_lib=sunperf

SPARC: Links in the Sun Performance Librarytrademark.

This option, like -l, should appear at the end of the command line, after source or object files.



Note - The -library=sunperf option is recommended for linking the Sun Performance Library because this option ensures that the libraries are linked in the correct order. In addition, the -library=sunperf option is not position dependent (it can appear anywhere on the command line), and it enables you to use -staticlib to statically link the Sun Performance Library. The -staticlib option is more convenient to use than the -Bstatic -xlic_lib=sunperf -Bdynamic combination.



Interactions

You cannot use the -xlang option and the -xlic_lib option in the same compiler command. If you are using -xlang and you need to link in the Sun Performance Library, use -library=sunperf instead.

You cannot use -library=sunperf and -xlic_lib=sunperf in the same compiler command.

The recommended method for statically linking the Sun Performance Library is to use the -library=sunperf and -staticlib=sunperf options, as in the following example.

example% CC -library=sunperf -staticlib=sunperf ... (recommended)

If you choose to use the -xlic_lib=sunperf option instead of -library=sunperf, then use the -Bstatic option, as shown in the following example.

% CC ... -Bstatic -xlic_lib=sunperf -Bdynamic ...

See also

-library and the performance_library readme

A.2.121 -xlicinfo

Shows license server information.

This option returns the license-server name and the user ID for each user who has a license checked out.

A.2.122 -Xm

Same as -features=iddollar.

A.2.123 -xM

Outputs makefile dependency information.

Examples

The program foo.cc contains the following statement:

#include "foo.h"

When foo.c is compiled with the -xM, the output includes the following line:

foo.o : foo.h

See also

make(1S) (for details about makefiles and dependencies)

A.2.124 -xM1

This option is the same as -xM, except that it does not report dependencies for the /usr/include header files, and it does not report dependencies for compiler-supplied header files.

A.2.125 -xMerge

SPARC: Merges the data segment with the text segment.

The data in the object file is read-only and is shared between processes, unless you link with ld -N.

See also

ld(1) man page

A.2.126 -xnativeconnect[=i]

Use the -xnativeconnect option when you want to include interface information inside object files and subsequent shared libraries so that the shared library can interface with code written in the Java[tm] programming language (Java code). You must also include -xnativeconnect when you build the shared library with -G.

When you compile with -xnativeconnect, you are providing the maximum, external, visibility of the native code interfaces. The Native Connector Tool (NCT) enables the automatic generation of Java code and Java Native Interface (JNI) code so that C++ shared libraries can be called from Java code. For more information on how to use the NCT, see the Forte Developer online help.

Values

i must be one of the following:

Value

Meaning

%all

Generates all of the different data described under the individual options of -xnativeconnet.

%none

Generates none of the different data described under the individual options of -xnativeconnet.

[no%]inlines

Forces the generation of out-of-line instances of referenced inline functions. This provides the native connector with an externally visible way to call the inline functions. The normal inlining of these functions at call sites is unaffected

[no%]interfaces

Forces the generation of Binary Interface Descriptors (BIDS)


Defaults
  • If you do not specify -xnativeconnect, the compiler sets the option to -xnativeconnect=%none.
  • If you specify only -xnativeconnect, the compiler sets the option to -xnativeconnect=inlines,interfaces.
  • This option does not accumulate. The compiler uses the last setting that is specified. For example, if you specify the following:
  • CC -xnativeconnect=inlines first.o -xnativeconnect=interfaces second.o -O -G -o library.so
    

the compiler sets the option to -xnativeconnect=no%inlines,interfaces.
Warnings

Do not compile with -compat=4 if you plan to use -xnativeconnect. Remember that if you specify -compat without any arguments, the compiler sets it to -compat=4. If you do not specify -compat, the compiler sets it to -compat=5. You can also explicitly set the compatibility mode by issuing -compat=5.

A.2.127 -xnolib

Disables linking with default system libraries.

Normally (without this option), the C++ compiler links with several system libraries to support C++ programs. With this option, the -llib options to link the default system support libraries are not passed to ld.

Normally, the compiler links with the system support libraries in the following order:

  • Standard mode (default mode):
  • -lCstd -lCrun -lm -lw -lcx -lc 
    

  • Compatibility mode (-compat):
  • -lC -lm -lw -lcx -lc 
    

The order of the -l options is significant. The -lm, -lw, and -lcx options must appear before -lc.



Note - If the -mt compiler option is specified, the compiler normally links with -lthread just before it links with -lm.



To determine which system support libraries will be linked by default, compile with the -dryrun option. For example, the output from the following command:

example% CC foo.cc -xarch=v9 -dryrun

Includes the following in the output:

-lCstd -lCrun -lm -lw -lc 

Note that when -xarch=v9 is specified, -lcx is not linked.

Examples

For minimal compilation to meet the C application binary interface (that is, a C++ program with only C support required), use:

example% CC -xnolib test.cc -lc

To link libm statically into a single-threaded application with the generic architecture instruction set, use:

  • Standard mode:
  • example% CC -xnolib test.cc -lCstd -lCrun -Bstatic -lm \
    
    -Bdynamic -lw -lcx -lc
    

  • Compatibility mode:
  • example% CC -compat -xnolib test.cc -lC -Bstatic -lm \
    
    -Bdynamic -lw -lcx -lc
    

Interactions

Some static system libraries, such as libm.a and libc.a, are not available when linking with -xarch=v9, -xarch=v9a or -xarch=v9b.

If you specify -xnolib, you must manually link all required system support libraries in the given order. You must link the system support libraries last.

If -xnolib is specified, -library is ignored.

Warnings

Many C++ language features require the use of libC (compatibility mode) or libCrun (standard mode).

This set of system support libraries is not stable and might change from release to release.

In 64-bit compilation modes, -lcx is not present.

See also

-library, -staticlib, -l

A.2.128 -xnolibmil

Cancels -xlibmil on the command line.

Use this option with -fast to override linking with the optimized math library.

A.2.129 -xnolibmopt

Does not use the math routine library.

Examples

Use this option after the -fast option on the command line, as in this example:

example% CC -fast -xnolibmopt

A.2.130 -xopenmp[=i]

SPARC: The C++ compiler implements the OpenMP interface for explicit parallelization including a set of source code directives, run-time library routines, and environment variables with the following option:

  • -xopenmp[=i]
where i is parallel, stubs, or none.

If you do not specify -xopenmp, the compiler sets the option to -xopenmp=none.

If you specify only -xopenmp, the compiler sets the option to -xopenmp=parallel which enables recognition of OpenMP pragmas and applies to SPARC only. The optimization level under -xopenmp=parallel is -x03. The compiler issues a warning if the optimization level of your program is changed from a lower level to -x03.

The -xopenmp=stubs command links with the stubs routines for the OpenMP API routines. Use this options if you need to compile your application to execute serially. The -xopenmp=stubs command also defines the _OPENMP preprocessor token.

The -xopenmp=none command does not enable recognition of OpenMP pragmas, makes no change to the optimization level of your program, and does not predefine any preprocessor tokens.

See also

OpenMP API User's Guide

A.2.131 -xOlevel

Specifies optimization level. In general, program execution speed depends on the level of optimization. The higher the level of optimization, the faster the speed.

If -xOlevel is not specified, only a very basic level of optimization (limited to local common subexpression elimination and dead code analysis) is performed. A program's performance might improve significantly when it is compiled with an optimization level. The use of -xO2 (or the equivalent options -O and -O2) is recommended for most programs.

Generally, the higher the level of optimization with which a program is compiled, the better the runtime performance. However, higher optimization levels can result in increased compilation time and larger executable files.

In a few cases, -xO2 might perform better than the others, and -xO3 might outperform -xO4. Try compiling with each level to see if you have one of these rare cases.

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

There are five levels that you can use with -xO. The following sections describe how they operate on the SPARC platform and the IA platform.

Values

On the SPARC Platform:

  • -xO1 does only the minimum amount of optimization (peephole), which is postpass, assembly-level optimization. Do not use -xO1 unless using -xO2 or -xO3 results in excessive compilation time, or you are running out of swap space.
  • -xO2 does basic local and global optimization, which includes:
    • 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
    • Complicated expression expansion
This level does not optimize references or definitions for external or indirect variables.
The -O option is equivalent to the -xO2 option.
  • -xO3, in addition to optimizations performed at the -xO2 level, also optimizes references and definitions for external variables. This level does not trace the effects of pointer assignments. When compiling either device drivers that are not properly protected by volatile or programs that modify external variables from within signal handlers, use -xO2. In general, this level results in increased code size unless combined with the -xspace option.
  • -xO4 does automatic inlining of functions contained in the same file in addition to performing -xO3 optimizations. This automatic inlining usually improves execution speed but sometimes makes it worse. In general, this level results in increased code size unless combined with the -xspace option.
  • -xO5 generates the highest level of optimization. It is suitable only for the small fraction of a program that uses the largest fraction of computer time. This level 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 Section A.2.135, -xprofile=p.

On the IA Platform:

  • -xO1 does basic optimization. This includes algebraic simplification, register allocation, basic block merging, dead code and store elimination, and peephole optimization.
  • -xO2 performs local common subexpression elimination, local copy and constant propagation, and tail recursion elimination, as well as the optimization done by level 1.
  • -xO3 performs global common subexpression elimination, global copy and constant propagation, loop strength reduction, induction variable elimination, and loop-variant optimization, as well as the optimization done by level 2.
  • -xO4 does automatic inlining of functions contained in the same file as well as the optimization done by level 3. This automatic inlining usually improves execution speed, but sometimes makes it worse. This level also frees the frame pointer registration (ebp) for general purpose use. In general this level results in increased code size.
  • -xO5 generates the highest level of optimization. It uses optimization algorithms that take more compilation time or that do not have as high a certainty of improving execution time.
Interactions

If you use -g or -g0 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 use -g or -g0 and the optimization level is -xO4 or higher, the compiler provides best-effort symbolic information with full optimization.

Debugging with -g does not suppress -xOlevel, but -xOlevel limits -g in certain ways. For example, the -xOlevel options reduce the utility of debugging so that you cannot display variables from dbx, but you can still use the dbx where command to get a symbolic traceback. For more information, see Debugging a Program With dbx.

The -xcrossfile option is effective only if it is used with -xO4 or -xO5.

The -xinline option has no effect for optimization levels below -xO3. At -xO4, the optimizer decides which functions should be inlined, and does so regardless of whether you specify the -xinline option. At -xO4, the compiler also attempts to determine which functions will improve performance if they are inlined. If you force the inlining of a function with -xinline, you might actually diminish performance.

Warnings

If you optimize at -xO3 or -xO4 with very large procedures (thousands of lines of code in a single procedure), the optimizer might require an unreasonable amount of memory. In such cases, machine performance can be degraded.

To prevent this degradation from taking place, use the limit command to limit the amount of virtual memory available to a single process (see the csh(1) man page). For example, to limit virtual memory to 16 megabytes:

example% limit datasize 16M

This command causes the optimizer to try to recover if it reaches 16 megabytes of data space.

The limit cannot be greater than the total available swap space of the machine, and should be small enough to permit normal use of the machine while a large compilation is in progress.

The best setting for data size depends on the degree of optimization requested, the amount of real memory, and virtual memory available.

To find the actual swap space, type: swap -l

To find the actual real memory, type: dmesg | grep mem

See also

-fast, -xcrossfile=n, -xprofile=p, csh(1) man page

A.2.132 -xpg

The -xpg option compiles self-profiling code to collect data for profiling with gprof. This option invokes a runtime recording mechanism that produces a gmon.out file when the program normally terminates.

Warnings

If you compile and link separately, and you compile with -xpg, be sure to link with -xpg.

See also

-xprofile=p, analyzer(1) man page, Program Performance Analysis Tools.

A.2.133 -xprefetch[=a[,a]]

SPARC: Enable prefetch instructions on those architectures that support prefetch, such as UltraSPARC II (-xarch=v8plus, v8plusa, v9plusb, v9, v9a, or v9b)

a must be one of the following values.

TABLE A-17 -xprefetch Values

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

latx:factor

Adjust the compiler's assumed prefetch-to-load and prefetch-to-store latencies by the specified factor. The factor must be a positive floating-point or integer number.

yes

-xprefetch=yes is the same as -xprefetch=auto,explicit

no

-xprefetch=no is the same as -xprefetch=no%auto,no%explicit


With -xprefetch, -xprefetch=auto, and -xprefetch=yes, the compiler is free to insert prefetch instructions into the code it generates. This may result in a performance improvement on architectures that support prefetch.

If you are running computationally intensive codes on large multiprocessors, you might find it advantageous to use -xprefetch=latx:factor. This option instructs the code generator to adjust the default latency time between a prefetch and its associated load or store by the specified factor.

The prefetch latency is the hardware delay between the execution of a prefetch instruction and the time the data being prefetched is available in the cache. The compiler assumes a prefetch latency value when determining how far apart to place a prefetch instruction and the load or store instruction that uses the prefetched data.



Note - The assumed latency between a prefetch and a load may not be the same as the assumed latency between a prefetch and a store.



The compiler tunes the prefetch mechanism for optimal performance across a wide range of machines and applications. This tuning may not always be optimal. For memory-intensive applications, especially applications intended to run on large multiprocessors, you may be able to obtain better performance by increasing the prefetch latency values. To increase the values, use a factor that is greater than 1 (one). A value between .5 and 2.0 will most likely provide the maximum performance.

For applications with datasets that reside entirely within the external cache, you may be able to obtain better performance by decreasing the prefetch latency values. To decrease the values, use a factor that is less than 1 (one).

To use the -xprefetch=latx:factor option, start with a factor value near 1.0 and run performance tests against the application. Then increase or decrease the factor, as appropriate, and run the performance tests again. Continue adjusting the factor and running the performance tests until you achieve optimum performance. When you increase or decrease the factor in small steps, you will see no performance difference for a few steps, then a sudden difference, then it will level off again.

Defaults

If -xprefetch is not specified, -xprefetch=no%auto,explicit is assumed.

If only -xprefetch is specified, -xprefetch=auto,explicit is assumed.

The default of no%auto is assumed unless explicitly overridden with the use of -xprefetch without any arguments or with an argument of auto or yes. For example, -xprefetch=explicit is the same as -xprefetch=explicit,no%auto.

The default of explicit is assumed unless explicitly overridden with an argument of no%explicit or an argument of no. For example, -xprefetch=auto is the same as -xprefetch=auto,explicit.

If automatic prefetching is enabled, such as with -xprefetch or -xprefetch=yes, but a latency factor is not specified, then -xprefetch=latx:1.0 is assumed.

Interactions

This option accumulates instead of overrides.

The sun_prefetch.h header file provides the macros for specifying explicit prefetch instructions. The prefetches will be approximately at the place in the executable that corresponds to where the macros appear.

To use the explicit prefetch instructions, you must be on the correct architecture, include sun_prefetch.h, and either exclude -xprefetch from the compiler command or use -xprefetch, -xprefetch=auto,explicit, -xprefetch=explicit or -xprefetch=yes.

If you call the macros and include the sun_prefetch.h header file, but pass -xprefetch=no%explicit or -xprefetch=no, the explicit prefetches will not appear in your executable.

The use of latx:factor is valid only when automatic prefetching is enabled. That is, latx:factor is ignored unless you use it in conjunction with yes or auto, as in -xprefetch=yes,latx:factor.

Warnings

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

Because the compiler tunes the prefetch mechanism for optimal performance across a wide range of machines and applications, you should only use -xprefetch=latx:factor when the performance tests indicate there is a clear benefit. The assumed prefetch latencies may change from release to release. Therefore, retesting the effect of the latency factor on performance whenever switching to a different release is highly recommended.

A.2.134 -xprefetch_level[=i]

Use the new -xprefetch_level=i option to control the aggressiveness of the automatic insertion of prefetch instructions as determined with -xprefetch=auto. The compiler becomes more aggressive, or in other words, introduces more prefetches, with each higher, level of -xprefetch_level.

The appropriate value for -xprefetch_level depends on the number of cache misses your application has. Higher -xprefetch_level values have the potential to improve the performance of applications with a high number of cache misses.

Values

i must be one of 1, 2, or 3.

TABLE A-18 The -xprefecth_level Values

Value

Meaning

1

Enables automatic generation of prefetch instructions.

2

Targets additional loops, beyond those targeted at -xprefetch_level=1, for prefetch insertion. Additional prefetches may be inserted beyond those that were inserted at -xprefetch_level=1.

3

Targets additional loops, beyond those targeted at -xprefetch_level=2, for prefetch insertion. Additional prefetches may be inserted beyond those that were inserted at -xprefetch_level=2.


Defaults

The default is -xprefetch_level=2 when you specify -xprefetch=auto.

Interactions

This option is effective only when it is compiled with -xprefetch=auto, with optimization level 3 or greater (-xO3), and on a platform that supports prefetch (v8plus, v8plusa, v9, v9a, v9b, generic64, native64).

A.2.135 -xprofile=p

Collects or optimizes with runtime profiling data.

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

Values

p must be one of the following values.

TABLE A-19 -xprofile Options

Value of p

Meaning

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. The name is optional and, if not specified, is assumed to be a.out.

At runtime, a program compiled with -xprofile=collect:name creates the subdirectory name.profile to hold the runtime feedback information. Data is written to the file feedback in this subdirectory. You can use the $SUN_PROFDATA and $SUN_PROFDATA_DIR environment variables to change the location of the feedback information. See the Interactions section for more information.

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.

  • Note: Compiling shared libraries with -xprofile=collect is not supported.

use[:name]

Uses execution frequency data to optimize strategically. The name is the name of the executable that is being analyzed. The name is optional and, if not specified, is assumed to be a.out.

The program is optimized by using the execution frequency data previously generated and saved in feedback files that were 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. The same version of the compiler must be used for both the collect build and the use build as well. 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 the new style tcov.

This 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 or make use of C++ templates. Code instrumentation is similar 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, then the data file is stored in /foo/bar/myprog.profile/myprog.tcovd.

When running tcov, you must pass it the -x option to force it to use the new style of data. If you do not pass -x, tcov uses the old .d files by default, 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.


Interactions

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 other files compiled with -xa. You cannot compile a single file with both options.

The code coverage report produced by -xprofile=tcov can be unreliable if there is inlining of functions due to the use of -xinline or -xO4.

You can set the environment variables $SUN_PROFDATA and $SUN_PROFDATA_DIR to control where a program that is compiled with -xprofile=collect puts the profile data. If these variables are not set, the profile data is written to name.profile/feedback in the current directory (name is the name of the executable or the name specified in the -xprofile=collect:name flag). If these variables are set, the -xprofile=collect data is written to $SUN_PROFDATA_DIR/$SUN_PROFDATA.

The $SUN_PROFDATA and $SUN_PROFDATA_DIR environment variables similarly control the path and names of the profile data files written by tcov. See the tcov(1) man page for more information.

Warnings

If you compile and link in separate steps, the same -xprofile option must appear in both the compile command and the link command. Including -xprofile in one step and excluding it from the other step will not affect the correctness of the program, but you will not be able to do profiling.

See also

-xa, tcov(1) man page, Program Performance Analysis Tools.

A.2.136 -xregs=r[,r...]

SPARC: Controls scratch register usage.

The compiler can generate faster code if it has more registers available for temporary storage (scratch registers). This option makes available additional scratch registers that might not always be appropriate.

Values

r must be one of the following values. The meaning of each value depends upon the -xarch setting.

Value of r

Meaning

[no%]appl

[Does not] Allow use of registers g2, g3, and g4 (v8, v8a)

[Does not] Allow use of registers g2, g3, and g4 (v8plus, v8plusa, v8plusb)

[Does not] Allow use of registers g2, g3 (v9, v9a, v9b)

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 programs that use the registers for other purposes.

[no%]float

[Does not] Allow use of floating-point registers as specified in the SPARC ABI.

You can use the floating-point registers even if the program contains no floating point code.

With the no%float option a source program cannot contain any

floating-point code.


Defaults

If -xregs is not specified, -xregs=appl,float is assumed.

Examples

To compile an application program using all available scratch registers, use -xregs=appl,float.

To compile non-floating-point code that is sensitive to context switch, use -xregs=no%appl,no%float.

See also

SPARC V7/V8 ABI, SPARC V9 ABI

A.2.137 -xs

Allows debugging by dbx without object (.o) files.

This option disables Auto-Read for dbx. Use this option if you cannot keep the .o files. This option 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 placed in the .o files, so that dbx loads the symbol table information only if it is needed. Hence the linker links faster, and dbx initializes faster.

With -xs, if you move executables to another directory, you do not have to move the object (.o) files to use dbx.

Without -xs, if you move the executables to another directory, you must move both the source files and the object (.o) files to use dbx.

A.2.138 -xsafe=mem

SPARC: Allows the compiler to assume that no memory protection violations occur.

This option allows the compiler to use the nonfaulting load instruction in the SPARC V9 architecture.
Interactions

This option is effective only when it is used with -xO5 optimization and -xarch=v8plus, v8plusa, v8plusb, v9, v9a, or v9b is specified.

Warnings

Because nonfaulting loads do not cause a trap when a fault such as address misalignment or segmentation violation occurs, you should use this option only for programs in which such faults cannot occur. Because few programs incur memory-based traps, you can safely use this option for most programs. Do not use this option for programs that explicitly depend on memory-based traps to handle exceptional conditions.

A.2.139 -xsb

This option causes the CC driver to generate extra symbol table information in the SunWS_cache subdirectory for the source browser.

See also

-xsbfast

A.2.140 -xsbfast

Produces only source browser information, no compilation.

This option runs only the ccfe phase to generate extra symbol table information in the SunWS_cache subdirectory for the source browser. No object file is generated.

See also

-xsb

A.2.141 -xspace

SPARC: Does not allow optimizations that increase code size.

A.2.142 -xtarget=t

Specifies the target platform for instruction set and optimization.

The performance of some programs can 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.

Values

For SPARC platforms:

On SPARC platforms, t must be one of the following values.

TABLE A-20 -xtarget Values for SPARC Platforms

Value of t

Meaning

native

Gets the best performance on the host system. The compiler generates code optimized for the host system. It determines the available architecture, chip, and cache properties of the machine on which the compiler is running.

native64

Gets the best performance for 64-bit object binaries on the host system. The compiler generates 64-bit object binaries optimized for the host system. It determines the available 64-bit 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.

generic64

Sets the parameters for the best performance of 64-bit object binaries over most 64-bit platform architectures.

platform-name

Gets the best performance for the specified platform. Select a SPARC platform name from TABLE A-21.


The following table details the -xtarget SPARC platform names and their expansions.

TABLE A-21 SPARC Platform Names for -xtarget

-xtarget=

-xarch

-xchip

-xcache

generic

generic

generic

generic

cs6400

v8plusa

super

16/32/4:2048/64/1

entr150

v8plusa

ultra

16/32/1:512/64/1

entr2

v8plusa

ultra

16/32/1:512/64/1

entr2/1170

v8plusa

ultra

16/32/1:512/64/1

entr2/1200

v8plusa

ultra

16/32/1:512/64/1

entr2/2170

v8plusa

ultra

16/32/1:512/64/1

entr2/2200

v8plusa

ultra

16/32/1:512/64/1

entr3000

v8plusa

ultra

16/32/1:512/64/1

entr4000

v8plusa

ultra

16/32/1:512/64/1

entr5000

v8plusa

ultra

16/32/1:512/64/1

entr6000

v8plusa

ultra

16/32/1:512/64/1

sc2000

v8plusa

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

v8plusa

ultra

16/32/1:512/64/1

ultra1/140

v8plusa

ultra

16/32/1:512/64/1

ultra1/170

v8plusa

ultra

16/32/1:512/64/1

ultra1/200

v8plusa

ultra

16/32/1:512/64/1

ultra2

v8plusa

ultra2

16/32/1:512/64/1

ultra2/1170

v8plusa

ultra

16/32/1:512/64/1

ultra2/1200

v8plusa

ultra

16/32/1:1024/64/1

ultra2/1300

v8plusa

ultra2

16/32/1:2048/64/1

ultra2/2170

v8plusa

ultra

16/32/1:512/64/1

ultra2/2200

v8plusa

ultra

16/32/1:1024/64/1

ultra2/2300

v8plusa

ultra2

16/32/1:2048/64/1

ultra2e

v8plusa

ultra2e

16/32/1:256/64/4

ultra2i

v8plusa

ultra2i

16/32/1:512/64/1

ultra3

v8plusa

ultra3

64/32/4:8192/512/1

ultra3cu

v8plusa

ultra3cu

64/32/4:8192/512/2


For IA platforms:

On IA platforms, t must be one of the following values.

TABLE A-22 -xtarget Values for IA Platforms

Value of t

Meaning

generic

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

This is the default value.

native

Gets the best performance on the host system.

386

Directs the compiler to generate code for the best performance on the Intel 80386 microprocessor.

486

Directs the compiler to generate code for the best performance on the Intel 80486 microprocessor.

pentium

Directs the compiler to generate code for the best performance on the Pentium microprocessor.

pentium_pro

Directs the compiler to generate code for the best performance on the Pentium Pro microprocessor.


The following table lists the -xtarget values for the Intel Architecture:

TABLE A-23 -xtarget Expansions on Intel Architecture

-xtarget=

-xarch

-xchip

-xcache

generic

generic

generic

generic

386

386

386

generic

486

386

486

generic

pentium

386

pentium

generic

pentium_pro

pentium_pro

pentium_pro

generic


Defaults

On both SPARC and IA devices, if -xtarget is not specified, -xtarget=generic is assumed.

Expansions

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

Examples

-xtarget=sun4/15 means -xarch=v8a -xchip=micro -xcache=2/16/1.

Interactions

Compilation for SPARC V9 architecture indicated by the -xarch=v9|v9a|v9b option. Setting -xtarget=ultra or ultra2 is not necessary or sufficient. If -xtarget is specified, the -xarch=v9, v9a, or v9b option must appear after the -xtarget. For example:

-xarch=v9 -xtarget=ultra 

expands to the following and reverts the -xarch value to v8.

-xarch=v9 -xarch=v8 -xchip=ultra -xcache=16/32/1:512/64/1

The correct method is to specify -xarch after -xtarget. For example:

-xtarget=ultra -xarch=v9

Warnings

When you compile and link in separate steps, you must use the same -xtarget settings in the compile step and the link step.

A.2.143 -xtime

Causes the CC driver to report execution time for the various compilation passes.

A.2.144 -xunroll=n

Enables unrolling of loops where possible.

This option specifies whether or not the compiler optimizes (unrolls) loops.

Values

When n is 1, it is a suggestion to the compiler to not unroll loops.

When n is an integer greater than 1, -unroll=n causes the compiler to unroll loops n times.

A.2.145 -xtrigraphs[={yes|no}]

Enables or disables recognition of trigraph sequences as defined by the ISO/ANSI C standard.

If your source code has a literal string containing question marks (?) that the compiler is interpreting as a trigraph sequence, you can use the -xtrigraph=no suboption to turn off the recognition of trigraph sequences.

Values

Value

Meaning

yes

Enables recognition of trigraph sequences throughout the compilation unit

no

Disables recognition of trigraph sequences throughout the compilation unit


Defaults

When you do not include the -xtrigraphs option on the command line, the compiler assumes -xtrigraphs=yes.

If only -xtrigraphs is specified, the compiler assumes -xtrigraphs=yes.

Examples

Consider the following example source file named trigraphs_demo.cc.

#include <stdio.h>
 
int main ()
{
    (void) printf("(\?\?) in a string appears as (??)\n");
    return 0;
}

Here is the output if you compile this code with -xtrigraphs=yes.

example% CC -xtrigraphs=yes trigraphs_demo.cc
example% a.out
(??) in a string appears as (]

Here is the output if you compile this code with -xtrigraphs=no.

example% CC -xtrigraphs=no trigraphs_demo.cc
example% a.out
(??) in a string appears as (??)

See also

For information on trigraphs, see the C User's Guide chapter about transitioning to ANSI/ISO C.

A.2.146 -xwe

Converts all warnings to errors by returning nonzero exit status.

A.2.147 -z[ ]arg

Link editor option. For more information, see the ld(1) man page and the Solaris Linker and Libraries Guide.