cc - C compiler
cc [option...] file... [option...]
Default Options:
cc -std -arch generic -assume aligned_objects
-noansi_alias -assume math_errno -call_shared -cpp
-error_limit 30 -float -nofp_reorder -fprm n -fptm n
-g0 -I/usr/include -inline manual -intrinsics -member_alignment
-nomisalign -nestlevel=50 -newc -O1 -p0
-nopg -preempt_symbol -SD/usr/include -signed -tune
generic -weak_volatile -writable_strings
Options described in this section are divided into the
following categories. The default options for each category,
if any, are listed: Compiler Selection Options
Default: -newc
Language Mode Options
Default: -std
Overall Compiler Behavior Options
Defaults: -arch generic, -error_limit 30,
-nestlevel=50
Compiler Diagnostic Controls Options
Default: -SD/usr/include
C Preprocessor Options
Defaults: -cpp, -I/usr/include
Options that Affect the Linker or Loader
Default: -call_shared
Optimization Options
Defaults: -noansi_alias, -assume math_errno,
-float, -nofp_reorder, -inline manual, -intrinsics,
-O1, -preempt_symbol, -tune generic
Feedback-directed Optimization Options
Default: None
Source-code Debugging Options
Default: -g0
Program Profiling Options
Defaults: -p0, -nopg
Data Alignment Options
Defaults: -assume aligned_objects, -member_alignment
-nomisalign
Data Volatility Options
Default: -weak_volatile
C Language Options
Defaults: -signed, -writable_strings
Stack-handling and Pointer-handling Options
Default: None
IEEE Floating-point Support Options
Defaults: -fprm n, -fptm n
Compiler Development Options (Not Generally Used)
Default: None
Compiler Selection Options [Toc] [Back]
Invokes the compiler with the default option settings
shown in the SYNOPSIS section. This option is provided to
turn off -migrate, and it is the default. Invokes the
compiler with a set of optimization settings that are
slightly different from those associated with -newc. These
settings are consistent with the cc -migrate settings for
versions of the DEC OSF/1 operating system that preceded
DIGITAL UNIX Version 4.0. This option is provided for
backwards compatibility only, and its use is strongly discouraged.
Language Mode Options [Toc] [Back]
The language mode options are mutually exclusive. When
more than one such option appears on the command line, the
last one listed will take effect. The default is -std.
Selects the relaxed ANSI language mode. This is the
default. Accepts standard ANSI C89 and C99 features, but
allows some common programming practices disallowed by the
standards.
This option does not restrict the Tru64 UNIX name
space (for example, the names defined in system
header files). To restrict that name space so that
only ANSI reserved names are visible from the ANSI
header files, use the _ANSI_C_SOURCE macro. See
standards(5) for more details.
This option sets the macro __STDC_VERSION__ to
199901L, and the macro __STDC__ to 0. Selects the
K & R language mode. Enforces the K & R programming
style, with certain ANSI extensions in areas where
the K & R behavior is undefined or ambiguous. In
general, -std0 compiles most pre-ANSI C89 programs
and produces expected results. The -std0 option
leaves the macros __STDC__ and __STDC_VERSION__
undefined. Selects the strict ANSI C89 language
mode. Strictly enforces the ANSI C89 standard and
all its prohibitions (such as those that apply to
the handling of void types, the definition of lvalues
in expressions, the mixing of integrals and
pointers, and the modification of rvalues).
This option does not restrict the Tru64 UNIX name
space (for example, the names defined in system
header files). To restrict that name space so that
only ANSI reserved names are visible from the ANSI
header files, use the _ANSI_C_SOURCE macro. See
standards(5) for more details.
This option sets the macro __STDC__ to 1 and leaves
the macro __STDC_VERSION__ undefined. Note that
this option also affects linker-defined symbols.
See ld(1) for more information.
This option, combined with -O3 or higher, turns on
ANSI aliasing rules (-ansi_alias option). Selects
the strict ANSI C99 language mode. Strictly
enforces the ANSI C99 standard and all its prohibitions.
This option does not restrict the Tru64 UNIX name
space (for example, the names defined in system
header files). To restrict that name space so that
only ANSI reserved names are visible from the ANSI
header files, use the _ANSI_C_SOURCE macro. See
standards(5) for more details.
This option sets the macro __STDC_VERSION__ to
199901L, and the macro __STDC__ to 1. Enables
additional features from Amendment 1 to the ANSI
C89 standard.
This option sets the macro __STDC_VERSION__ to
199409L in all language modes except for the following:
-c99 (__STDC_VERSION__ is set to 199901L)
-vaxc (__STDC_VERSION__ is not set)
This option has no effect on the macro __STDC__.
Selects the Microsoft language mode, which provides
some compatibility with the Microsoft Visual C compiler.
Although this option does not provide full
compatibility, it can be useful as a porting aid.
It provides the following extensions. Except for
these extensions, the -ms option is equivalent to
-std. Thread Local Storage (TLS) and structured
exception handling are always enabled. Allow a
declaration of an unnamed structure within another
structure. You can reference all members of the
inner structure as members of the named outer
structure. This is similar to the C++ treatment of
nested unions lacking a name, but extended to both
structures and unions. For example:
struct {
struct {
int a;
int b;
}; /*No name here */
int c; }d; /* d.a, d.b, and d.c are valid member
names. */ Allow duplicate typedef declarations.
For example:
typedef int typedefname; typedef int typedefname;
Allow typedef declarations that are redeclared to a
compatible type. For example:
typedef enum {a,b,c} typedefname; typedef enum
{d,e,f} typedefname; Allow declaration of a structure
with a trailing incomplete array. This is useful
if you are dealing with counted arrays, where
the first element of the structure is used to hold
a count of the array elements, the second element
is an array of data, and the structure is always
allocated dynamically. The sizeof operator treats
the incomplete array as having a length of zero.
For example:
struct {
int a;
int b[]; }s; Allow a static function declaration
in block scope (that is, inside another function).
For example:
f() {
static int a(int b); } Allow & to produce an
lvalue expression in certain cases. For example:
int *a, *b;
f() {
&*a=b; } Allow integers and pointers to be
compared without a cast. For example:
int *a,b; f() { if (a==b)
b=1; } Treat the char type as either signed char
or unsigned char, depending of the default in
effect. For example, a pointer to char can be
assigned to a pointer to signed char, assuming that
the -signed option is in effect:
signed char *a; Suppress warning messages for declarations
that contain two semicolons; that is,
allow completely empty declarations at file scope.
For example:
int a;; Suppress warning messages for declarations
that contain a variable name but no type. For example:
b;
This is assigned type int. Ignore any extra comma
at the end of the last enumerator in an enumeration
declaration. For example:
enum E {a, b, c,}; /* Ignore the comma after "c".
*/ Allow typedef declarations that have a type
specifier but no identifier name declaring the new
type. For example:
typedef struct { int a; }; Suppress warning messages
when one of the following unsupported
Microsoft pragmas is encountered:
#pragma code_seg #pragma optimize #pragma warning
Selects the K & R language mode. This option is
equivalent to -std0. Selects the K & R language
mode. This option is equivalent to -std0. Selects
the VAX C language mode. This is similar to -std
(relaxed ANSI mode) but extends the language semantics
in ways that are incompatible with ANSI C. It
provides close compatibility with the vaxc compiler.
Overall Compiler Behavior Options [Toc] [Back]
Causes the compiler to recognize additional keywords. The
following options are available: The default compilation
mode on OpenVMS systems includes recognition of the following
keywords that are not available on Tru64 UNIX
except in -vaxc mode: _align, globaldef, globalref, globalvalue,
noshare, readonly, variant_struct, and variant_union.
This option causes these keywords to be recognized.
It may help in porting applications from OpenVMS
systems. Cause the compiler to recognize the restrict
keyword (from the C9X review draft). Specifies which version
of the Alpha architecture to generate instructions
for. All Alpha processors implement a core set of instructions
and, in some cases, the following extensions: BWX
(byte/word-manipulation extension), MVI (multimedia extension),
FIX (square root and floating-point convert extension),
and CIX (count extension). (The Alpha Architecture
Reference Manual describes the extensions in detail.)
The option specified by the -arch option determines
which instructions the compiler can generate: Generate
instructions that are appropriate for all
Alpha processors. This option is the default. Generate
instructions for the processor that the compiler
is running on (for example, EV6 instructions
on an EV6 processor). Generate instructions for
the EV4 processor (21064, 21064A, 21066, and 21068
chips) and EV5 processor (some 21164 chips). (Note
that chip number 21164 is used for both EV5 and
EV56 processors.)
Applications compiled with this option will not
incur any emulation overhead on any Alpha processor.
Generate instructions for EV56 processors
(some 21164 chips).
This option permits the compiler to generate any
EV4 instruction, plus any instructions contained in
the BWX extension.
Applications compiled with this option may incur
emulation overhead on EV4 and EV5 processors. Generate
instructions for EV6 processors (21264
chips).
This option permits the compiler to generate any
EV6 instruction, plus any instructions contained in
the following extensions: BWX, MVI, and FIX.
Applications compiled with this option may incur
emulation overhead on EV4, EV5, EV56, and PCA56
processors. Generate instructions for EV67 processors
(21264A chips).
This option is the same as the ev6 option except
that it also permits the compiler to generate any
instructions contained in the CIX extension.
If your application uses CIX instructions, it may
incur emulation overhead on all processors that are
older than EV67. Generate instructions for PCA56
processors (21164PC chips).
This option permits the compiler to generate any
EV4 instruction, plus any instructions contained in
the BWX and MVI extensions.
Applications compiled with this option may incur
emulation overhead on EV4, EV5, and EV56 processors.
A program compiled with any of the options will run
on any Alpha processor. Beginning with DIGITAL
UNIX V4.0 and continuing with subsequent versions,
the operating system kernel includes an instruction
emulator. This capability allows any Alpha chip to
execute and produce correct results from Alpha
instructions--even if the some of the instructions
are not implemented on the chip. Applications using
emulated instructions will run correctly, but may
incur significant emulation overhead at run time.
The psrinfo -v command can be used to determine
which type of processor is installed on any given
Alpha system.
Note the following differences between the -arch
evx and -tune evx options (where x designates a
specific processor): -arch evx implies -tune evx,
but -tune evx does not imply -arch evx. -arch evx
can generate unguarded evx-specific instructions.
If you run that application on a pre-evx processor,
those instructions may get emulated (and emulated
instructions can be up to 1000 times slower than
actual instructions). -tune evx can generate evxspecific
instructions, but those are always amaskguarded.
That expands the code size but avoids
instruction emulation. If you want the best performance
possible on an evx processor and are not
concerned about performance on earlier processors,
the best choice would be -arch evx (which implies
-tune evx). If you want good performance on an evx
processor but also want the application to run reasonably
fast on earlier processors, the best choice
would probably be -tune evx. Suppresses the loading
phase of the compilation and forces the creation
of an object file. Generates runtime code to
check the values of array subscripts (and equivalent
pointer arithmetic involving pointers produced
by converting an array name to a pointer) to verify
that the resulting address lies within the range
for which the C standard requires well-defined
behavior. The exact source code constructs that
trigger these checks, and the values used for a
given bounds check, are not simple to describe. In
some cases the checks will trap on a partial
address computation even though the final result of
the computation is within bounds. A failed bounds
check at runtime produces a Trace/BPT trap, which
may be caught by signal(SIGTRAP, handler). See the
Programmer's Guide for more details.
The -nocheck_bounds option (the default) disables
the runtime checking of array bounds. When syntactic
or semantic errors are detected by the compiler's
front end, invokes the editor defined by
the environment variable EDITOR (or vi if EDITOR is
undefined). Two files are opened for editing: the
error message file, which indicates the location of
the error, and the source file. When you exit from
the editor, the compilation is restarted.
The n argument specifies the number of times a compilation
can be interrupted in this way. If no number
is specified, the compile-edit-compile cycle
repeats indefinitely until all errors are corrected.
The -edit0 option turns off this feature.
To abort the cycle, you must press Ctrl-C while the
process is in the compilation phase (that is, while
it is not in the editor).
When compiling on a character-based terminal, the
compile job has to be in the foreground for this
option to take effect. When compiling on a workstation,
this option takes effect whether it is in the
foreground or background. Sets a limit on the number
of error-level diagnostics that the compiler
will emit. The default is 30. Specifies a file
that is to be included before the first line in a
source file is actually compiled. This enables
users to develop include files containing sets of
pragmas that control a particular aspect of a compilation
(for example, optimizations or diagnostics).
Controls the size of shared data in memory
that can be safely accessed from different threads.
The possible size values are byte, longword, and
quadword.
Specifying byte allows single bytes to be accessed
from different threads sharing data in memory without
corrupting surrounding bytes. This option will
slow runtime performance.
Specifying longword allows naturally aligned 4-byte
longwords to be accessed safely from different
threads sharing data in memory. Accessing data
items of 3 bytes or less, or unaligned data, may
result in data items written from multiple threads
being inconsistently updated.
Specifying quadword allows naturally aligned 8-byte
quadwords to be accessed safely from different
threads sharing data in memory. Accessing data
items of 7 bytes or less, or unaligned data, may
result in data items written from multiple threads
being inconsistently updated. This is the default.
Sets the nesting-level limit for include files. The
default is 50. Includes the generated machine code
in the listing file. By default, machine code is
not listed. To produce the listing file, you must
also specify -source_listing. Suppresses creation
of an object file. By default, an object module
file is created with the same name as that of the
first source file of a compilation unit and with
the file extension.
Use the -noobject option when you need only a listing
of a program or when you want the compiler to
check a source file for errors. Names the final
output file output. Ensures that the compiler's
assumptions about pointer sizes and data alignments
are not in conflict with the default values that
were in effect when the system libraries were created.
The keywords for the -protect_headers option are as
follows: Enables the protect headers feature. This
is the default if the file being compiled is a C
source file. Disables the protect headers feature.
This is the default if the file being compiled is a
non-C source file. Cancels any previous -protect_headers
options and places the compiler's
default behavior in effect.
If more than one -protect_headers option appears on
the command line, only the last one is applied. See
protect_headers_setup(8) for details. Compiles the
specified source files and generates symbolic
assembly language output in corresponding files
suffixed with Specifies one or more items to be
included in the listing file. When specifying multiple
keywords, separate them by commas and no
intervening blanks. To use any of the -show keywords,
you must also specify the -source_listing
option.
The keywords for the -show option are as follows:
Turns off all show options. Turns on all show
options. Produces a brief macro and symbol table
map in the program listing, omitting most macros
and symbols that are unreferenced. Attributes such
as line number of declaration, size, alignment,
storage class, and type are shown for each symbol.
Adds a list of line numbers to each identifier produced
by the brief or symbol show options, identifying
the listing lines that contain references to
that identifier. If neither brief nor symbol is
specified, the default is brief. Listing line numbers
are the sequential numbers that span included
files, and appear just before the text of each
source line in the source listing. When appropriate,
the line number designating a reference to a
symbol is annotated with one or more suffixes indicating
the way in which the symbol was used on that
line, as follows:
= Assigned or initialized
& Address taken
() Function called
* Simple dereference
-> Member dereference
[] Subscripted (that is, using [] syntax)
b Invoked as a builtin function
Places final macro expansions in the program listing.
When you specify expansion, the number printed
in the margin indicates the maximum depth of macro
substitutions that occur on each line. Expansion is
not shown for lines that are preprocessor directives.
Produces header lines at the top of each
page of listing. Places contents of header files
in program listing. Places source program statements
in program listing. Places compile-time performance
statistics in the program listing. Same
as [no]brief, except that unreferenced macros and
symbols are not suppressed.
If you specify -source_listing but do not specify
-show keywords, the compiler includes header lines
and source statements in the program listing (-show
header,source). Produces a source program listing
file with the same name as the source file and with
a file extension. You must specify this qualifier
to get a listing. The default is to not produce a
listing file. Prints the compilation phases as
they execute with their arguments and their input
and output files. Prints resource usage in the Cshell
time format. Prints the macros defined at the
start of the compilation. Prints the version of
the compiler driver.
Compiler Diagnostic Controls Options [Toc] [Back]
Performs compile-time code checking. With this option, the
compiler checks for code that exhibits nonportable behavior,
represents a possible unintended code sequence, or
possibly affects operation of the program because of a
quiet change in the ANSI C Standard. Some of these checks
have traditionally been associated with the lint utility.
The -check option is equivalent to -msg_enable
level5. The cc driver converts -check into
-msg_enable level5 (the -v option notifies you of
this transformation). Causes the compiler to dump,
to stdout, all messages enabled by any given cc
command line. The compiler then exits, without
doing a compilation. Provides users with the ability
to control the diagnostic messages issued by
the compiler. The message output can be tuned in
groups (based on message level or message group) or
individually (based on the message ID strings
enclosed in parentheses at the end of message text
strings).
The -msg_actiontype option has eight different
forms, each resulting in a different action that
changes the status, severity, or frequency that
will be applied to the messages identified by the
msg_list argument. The following message-control
options are supported: Enable a specific message or
group of messages. Disable a specific message or
group of messages. (Note that messages with error
or fatal severity cannot be disabled; only warning
and informational messages can be disabled.)
Always emit the messages identified by the msg_list
argument. Emit the identified messages only once.
Change the identified messages to be fatal, compilation-ending
errors. Change the identified messages
to be warnings. (Note that error- or fatalseverity
messages cannot be changed to warningseverity
messages.) Change the identified messages
to be informational messages. (Note that error- or
fatal-severity messages cannot be changed to informational-severity
messages.) Change the identified
messages to be error messages. (Note that fatalseverity
messages cannot be changed to error-severity
messages.)
The msg_list argument to the -msg_actiontype option
is a comma-separated list of one or more message
levels, message groups, or message IDs. Enabling a
message level also enables all lower levels, and
disabling a level also disables all higher levels.
For example, disabling level 3 messages disables
levels 3 - 6. Operations other than enabling or
disabling apply only to the specified (or default)
level, not to lower levels.
The following message levels and message groups are
supported:
Message Levels: Very important messages that are
enabled by default. Level 0 messages cannot be disabled
as a class (level0), but individual level 0
messages can be disabled if they are warning- or
informational-severity messages. (Error- or fatalseverity
messages cannot be disabled.)
Messages at this level correspond to messages covered
by pragma nostandard. These include all messages
that should be displayed for code in header
files. Important messages, but less important than
level 0 messages. These messages are not displayed
if pragma nostandard is active. Level 1 is the
default for DIGITAL UNIX releases prior to V4.0E.
Moderately important messages. Level 2 is the
default for DIGITAL UNIX V4.0E and later (Tru64
UNIX) versions. Less important messages. (The -w0
option enables level 3 messages.) Useful messages
associated with the -check and -portable options.
Less useful -check and -portable messages than the
messages associated with level 4. The -check option
is equivalent to -msg_enable level5. All messages,
including all messages not in any of the lower levels.
Disabling level 6 messages does not affect the
lower-level messages; it affects only the messages
added by level 6.
Message Groups: Messages reporting code or practices
that may have unintended consequences on
64-bit architectures. Messages reporting unusual
or inefficient data alignment. Messages reporting
the use of C features that would be invalid or have
a different meaning if compiled by a C++ compiler.
Messages reporting code or practices that, although
correct and perhaps portable, are sometimes considered
ill-advised because they can be confusing or
fragile to maintain (for example, assignment as the
test expression in an if statement). Messages
reporting the use of obsolete features, features
that were accepted by early C compilers but were
subsequently removed from the language. Messages
reporting the use of features that are not in the
ANSI C89 standard. Same as noc89. Messages reporting
the use of features that are not in the ANSI
C89 standard. Same as noansi. Messages reporting
the use of features that are not in the ANSI C99
standard. Messages reporting the use of features
that are new in the ANSI C99 standard. Messages
reporting the use of features that are valid in
ANSI C, but which are identified in the standard as
being obsolescent and likely to be removed from the
language in a future version of the standard. Messages
reporting assignments and/or casts that may
cause overflow or other loss of data significance.
Messages reporting code that might result in poor
run-time performance. Messages reporting the use
of language extensions or other constructs that
might not be portable to other compilers or platforms.
-msg_enable portable is equivalent to
-portable. Messages reporting questionable or nonportable
use of preprocessing constructs. Messages
reporting questionable coding practices. Similar to
check, but messages in this group are more likely
to indicate a programming error, not just a nonrobust
style. Messages relating to function return
values. Messages reporting expressions, declarations,
and code paths that are not used. Directs
the compiler to issue diagnostics for certain constructs
that may not be portable to other compilers
or platforms. -portable is equivalent to
-msg_enable portable. Suppresses certain warningand
informational-level diagnostic messages that
are inappropriate for system header files. The suppressed
messages relate to non-portable constructs
in header files whose pathnames are prefixed by
string directory.
The default is -SD/usr/include.
Specifying -SD without a directory string cancels
the effect of any previous -SD options on the command
line (including the default, -SD/usr/include).
It also disables the -protect_headers feature's
suppression of diagnostic messages by defining the
macro __DECC_EMPTY_SD_OPTION. (The -protect-headers
feature provides message suppression in the file
__DECC_include_prologue.h.) Produces longer error
and warning messages. Messages in this form may
give the user more hints about why the compilation
failed. Controls the display of messages as well
as the actions that occur as a result of the messages.
The value of n can be one of the following:
Displays compiler messages for less important
issues. This is equivalent to -msg_enable level3.
For Tru64 UNIX V4.0E and later versions,
-msg_enable level2 is the default. Suppresses
warning and informational messages and displays
error and fatal messages. This is equivalent to
specifying -w. If the compiler encounters an error
that generates a warning-level diagnostic message,
the compiler displays the message and then aborts.
Does not print warning messages. However, when
warnings occur, exits with nonzero status. Causes
the compiler to produce warning messages when a
function is called that is not declared with a full
prototype. This checking is more strict than
required by ANSI C.
C Preprocessor Options [Toc] [Back]
Passes all comments directly to the preprocessor output,
except comments on preprocessor directive lines. Determines
whether to call the C macro preprocessor on C and
assembly source files before compiling.
-cpp is the default. Defines the name as if with a
#define statement. If no definition is given, the
name is defined as 1. Runs only the C macro preprocessor
on the files and sends the result to the
standard output device. Specifies a search path
for header files whose names do not indicate a specific
directory path (that is, whose names do not
begin with a /). The actual search path depends
upon the form of the #include directive used for
the file: If the #include "filename" form of the
directive is used, the C macro preprocessor
searches for the file first in the directory in
which it found the file that contains the directive,
then in the search path indicated by the -I
option, and finally in the standard directory,
/usr/include. If the #include <filename> form of
the directive is used, the preprocessor searches
for the file first in the search path indicated by
the -I option, and then in the standard directory,
/usr/include.
You can specify multiple iterations of the -I[dir]
option in the cc command line; each instance of the
-[dir] option appends locations to the previously
established -I[dir] search path. If no dir is specified
in any instance of the -I[dir] option, the C
macro preprocessor never searches the standard
directory, /usr/include, for header files.
The -nocurrent_include option can also modify the
search path. Outputs a set of make dependency
rules to standard output for each source file on
the command line (and suppresses compilation). The
make dependencies include all of the header files
upon which each source file depends. The make targets
are the object files for those source files.
The output lines are indented to show header file
nesting. Requests dependency files from the preprocessor
(and linker if it is also run). It does
not suppress compilation like the -M option. This
option is passed directly to the preprocessor and
linker. For more information, see cpp(1) and ld(1).
Changes the behavior of the #include "filename"
directive to not search the source file's directory
for filename. This option causes the #include
"filename" directives to behave like #include
<filename> directives. This option allows makefiles
to control the search order for header files by
using -I options. Directs the preprocessor to
delete comments (replacing them with nothing at
all). This allows traditional token concatenation.
This is the default in -std0 mode. In -std and
-std1 mode, the default is to replace comments with
a single space. Runs only the C preprocessor and
puts the result for each or source file in a corresponding
file. The file has no #line_number preprocessor
directives in it. Extracts prototype declarations
for function definitions and puts them in a
suffixed file. The suboption i includes identifiers
in the prototype, and the suboption s generates
prototypes for static functions as well. Directs
the preprocessor to use single quotes in __FILE__
expansions instead of double quotes. See cpp(1) for
details. Removes any macro definition of name at
the start of the compilation. name could have been
defined with a -D option or predefined by the compiler.
If no name is specified or if name is not
defined, the -U option is ignored. (To display a
list of predefined macros, use the -v option.)
Options that Affect the Linker or Loader [Toc] [Back]
Produces a dynamic executable file that uses shareable
objects during run time. This is the default. The loader
uses shareable objects to resolve undefined symbols. The
run-time loader (/sbin/loader) is invoked to bring in all
required shareable objects and to resolve any symbols that
remained undefined during static link time. Passes the
-compress option to the compilation phase (if the -c
option is present) or passes the -compress_r option to ld
(if the -r option is present). Use of this option causes
the output object file to be produced in compressed object
file format, resulting in a substantially smaller object
file. Runs the procedure rearranger, cord, on the resulting
file after linking. The rearrangement is done to
reduce the cache conflicts associated with accessing the
program's text. The output of cord is left in the file
specified by the -o output option or a.out by default. At
least one -feedback file must be specified. See prof(1)
for information on creating feedback files. Causes any
unresolved symbols matching pattern to be ignored. Such
symbols are not displayed and are not treated as errors or
warnings. You can enter this option multiple times on a
command line. The patterns use shell wildcard characters
(?, *, [, ]). The wildcard characters must be properly
quoted to prevent them from being expanded by the shell.
For more information, see sh(1). Used in conjunction with
-call_shared to request strict dependency testing for the
executable file produced. Executable files built in this
manner can be executed only if the shared libraries that
they use were not modified after the executable was built.
Makes the procedure represented by the symbol into a termination
routine. A termination routine is a routine that
is called without an argument when either the file that
contains the routine is unloaded or the program that contains
the routine exits. Makes the procedure represented
by the symbol into an initialization routine. An initialization
routine is a routine that is called without an
argument when either the file that contains the routine is
loaded or the program that contains the routine is
started. Directs the linker to read the contents of file
filename as if the contents had been supplied on the ld
command line.
Inside file filename, lines ending with \ are
treated as continuation lines, and lines starting
with # are treated as comment lines and ignored.
The -v option can be used to display the expansion
of files specified in a -input file. The files can
be nested up to 20 levels. Prevents the linker
from using archive libraries to resolve symbols.
This option is used in conjunction with
-call_shared. The -noarchive option is position
sensitive; it affects only those options and variables
that follow it on the command line. This
option can also be used more than once on the command
line. Directs the linker to produce a static
executable. The output object created by the linker
will not use any shared objects during execution.
Directs the linker to use the threadsafe version of
any library specified with the -l option when linking
programs. This option also tells the linker to
include the POSIX 1003.1c-conformant DECthreads
interfaces in libpthread when linking the program.
This option also defines the _REENTRANT macro.
Produces dynamic shareable objects. The loader will
produce a shareable object that other dynamic executables
can use at run time.
The following options are used with -shared: Checks
the location of this shared object's segments and
make sure they stay out of the way of other
object's segments in the location_file. Multiple
instances of this option are allowed. Creates an
rpath record containing the specified path string.
The path string is a colon-separated list of directories
that is meaningful only when creating an
executable with shared linkage. If an item in the
path supplied to -rpath is of the form $VARNAME or
${VARNAME}, the linker interprets it as an environment
variable.
Additional rpath directories found in shared
objects on the link command line are appended to
path. Duplicate entries are excluded. The loader
uses the rpath record to search for shared
libraries at run time. Establishes the version
identifier (or identifiers) associated with a
shared library. The string version-string is either
a single version identifier or a colon-separated
list of version identifiers. No restrictions are
placed on the names of version identifiers; however,
it is highly recommended that UNIX directory
naming conventions be followed.
If a shared library is built with this option, any
executable built against it will record a dependency
on the specified version or, if a list of
version identifiers is specified, the rightmost
version specified in the list. If a shared library
is built with a list of version identifiers, the
loader will allow any executable to run that has a
shared library dependency on any of the listed versions.
Sets DT_SONAME for a shared object. The
name can be a single component name (for example,
libc.a), a full pathname (starting with a slash),
or a relative pathname (containing a slash). The
default DT_SONAME used for shared objects is the
filename component of the output file name. Specify
the output file name using the -o option as
described previously. Registers the location of
this shared object's segments and makes sure they
stay out of the way of others in the location_file.
Location_file is updated if it is writable.
Directs the linker to load the executable file in
the lower 31-bit addressable virtual address range.
The -T and -D options to the ld command can also be
used, respectively, to ensure that the text and
data segments are loaded into low memory.
The -taso option, however, in addition to setting
default addresses for text and data segments, also
causes shared libraries linked outside the 31-bit
address space to be appropriately relocated by the
loader. If you specify -taso and also specify text
and data segment addresses with -T and -D, those
addresses override the -taso default addresses. The
-taso option can be helpful when porting programs
that assume address values can be stored in 32-bit
variables (that is, programs that assume that
pointers are the same length as int variables).
Directs the linker to use the threadsafe version of
any library specified with the -l option when linking
programs. This option also tells the linker to
include the POSIX 1003.4a Draft 4 conformant DECthreads
interfaces. It is supported only for compatibility
with earlier releases of Tru64 UNIX. New
designs should use the -pthread option.
Optimization Options [Toc] [Back]
Directs the compiler to assume the ANSI C aliasing rules,
and thus allows the optimizer to be more aggressive in its
optimizations.
The aliasing rules are explained in Section 3.3,
paragraphs 20 and 25 of the ANSI C Standard,
reprinted as follows:
"An object shall have its stored value accessed
only by an lvalue that has one of the following
types: The declared type of the object, A qualified
version of the declared type of the object, A type
that is the signed or unsigned type corresponding
to the declared type of the object, A type that is
the signed or unsigned type corresponding to a
qualified version of the declared 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), or A character type."
If your program does not access the same data
through pointers that have different types (and for
this purpose, signed and qualified versions of an
otherwise same type are considered to be the same
type), then assuming ANSI C aliasing rules allows
the compiler to generate better optimized code.
If your program does access the same data through
pointers that have different types (for example, by
a "pointer to int" and a "pointer to float"), you
must not allow the compiler to assume ANSI C aliasing
rules because these rules can result in the
generation of incorrect code.
The -noansi_alias option turns off ANSI C aliasing
rules.
The default is -noansi_alias except when compiling
with -std1 (when combined with -O3 or higher) or
-fast. Tells the compiler whether the source code
follows all ANSI rules about arguments, that is,
whether the type of an argument matches the type of
the parameter in the called function or whether a
function prototype is present so the compiler can
automatically perform the expected type conversion.
Specifying -noansi_args means that the argument
type may not match the expected parameter type.
This option is important, for example, when the
caller passes a parameter of type long and the
called routine expects an int. The -noansi_args
option forces the compiler to generate argument
cleaning code to convert the argument to the appropriate
type. Except when the -std1 option is specified,
-noansi_args is the default. Note that it is
safe to specify -ansi_args if you use ANSI-style
function prototypes at all call sites.
Specifying -ansi_args means that your code meets
the ANSI C requirements, so no special argument
cleaning code is generated. This is a performance
gain. When -std1 is specified, -ansi_args is the
default. Specifies the assumption that all array
parameters are or are not restricted. The default
is -assume noarray_parameter_restricted_pointers.
For the sample declaration: foo(int * __restrict
p1, int p2[], int * p3, int **p4);
The following statements apply: By default, only p1
is restricted. If you specify -assume array_parameter_restricted_pointers,
p1 and p2 are restricted.
If you specify -assume parameter_restricted_pointers,
p1, p2, p3 and p4 are restricted, but *p4 is
not restricted If you specify -assume
restricted_pointers, p1, p2, p3, p4, and *p4 are
restricted. If you specify -assume
ignore_restricted_pointers, no pointers are
restricted, not even p1.
Each of these assumptions is negatable independently
by prefixing a no to the assumption name. By
default, all of the assumptions are in this negated
state. The state of each assumption is resolved
separately by processing negations in left-to-right
order. For example, -assume norestricted_pointers
-assume restricted_pointers is resolved to -assume
restricted_pointers.
At the same time, the four assumptions have
strictly-increasing strength in the order shown,
such that the behavior is determined only by the
strongest assumption in effect at the end of the
command line, regardless of their relative placement.
Thus if -ignore_restricted_pointers is in
effect, the state of any other assumption is
ignored. For the other assumptions, this "strength"
effect is a natural result of supersetting.
The -assume norestricted_pointers option disables
the __restrict keyword from all pointers. This can
help detect inappropriate use of __restrict. If the
code works correctly at high optimization with
__restrict turned off, but breaks with it turned
on, it is likely that the compiler encountered a
pointer that was restricted in error. Restricted
pointers are an assertion by the programmer to aid
optimization; the compiler cannot detect erroneous
assertions. Specifies the assumption that the
restricted attribute is or is not ignored for all
pointers. The default is -assume
noignore_restricted_pointers. For more information,
see -assume [no]array_parameter_restricted_pointers.
Controls the compiler's assumption about a
program's dependence on the setting of errno by
math library routines: By default (-assume
math_errno), the compiler assumes that the program
might interrogate errno after any call to a math
libarry routine that is capable of setting errno.
The definition of the ANSI C math library allows
programs to depend on this behavior, which unfortunately
restricts optimization because this causes
most math functions to be treated as having side
effects. Specifying -assume nomath_errno instructs
the compiler to assume that the program does not
look at the value of errno after calls to math
functions. This assumption allows the compiler to
reorder or combine computations to improve the performance
of those math functions that it recognizes
as intrinsic functions. In practice, robust floating-point
code seldom relies on errno to detect
domain or range errors, so -assume nomath_errno can
often be safely used to improve performance. Specifies
the assumption that all pointer parameters
are or are not restricted. The default is -assume
noparameter_restricted_pointers. For more information,
see -assume [no]array_parameter_restricted_pointers.
Specifies the assumption
that all pointers are or are not restricted. The
default is -assume norestricted_pointers. For more
information, see -assume [no]array_parameter_restricted_pointers.
Specifies that no occurrences
of the address-of operator (&) are being
applied outside the current compilation unit to
extern variables that are declared inside the current
compilation unit. Making this assertion
allows the compiler to perform better optimizations.
This option is often suitable for use with the -ifo
option, which presents a group of source files to
the compiler as a single compilation unit. Enables
runtime checking of certain OpenMP constructs. This
includes runtime detection of invalid nesting and
other invalid OpenMP cases. When invalid nesting is
discovered at runtime and this option is set, the
executable will fail with a Trace/BPT trap. If this
option is not set and invalid nesting is discovered,
the behavior is indeterminate (the executable
may hang, and so on). See also the -mp and -omp
options. Provides a single method for turning on a
collection of optimizations for increased performance.
Note that the -fast option can produce different
results for floating-point arithmetic and math
functions, although most programs are not sensitive
to these differences.
The -fast option defines the following compiler
options and symbols to improve run-time performance.
You can adjust the optimizations by specifying
the negation of any given option. Directs the
compiler to assume the ANSI C aliasing rules, and
thus allows the optimizer to be more aggressive in
its optimizations.
See the description of this option elsewhere in
this reference page for more detailed information
about this operation. Tells the compiler that the
source code follows all ANSI rules about arguments;
that is, whether the type of an argument matches
the type of the parameter in the called function,
or whether a function prototype is present so the
compiler can automatically perform the expected
type conversion.
See the description of this option elsewhere in
this reference page for more detailed information
about this operation. Allows the compiler to
reorder or combine computations to improve the performance
of those math functions that it recognizes
as intrinsic functions.
See the description of this option elsewhere in
this reference page for more detailed information
about this operation. Specifies that this is a
strictly-conforming ANSI C program with respect to
the dereferencing of pointer-to-short variables.
This allows the compiler to assume that any short
accessed through a pointer is naturally aligned (as
the C language requires). It typically produces the
fastest code but can silently generate the wrong
results if any such short object crosses a quadword
boundary.
See the description of this option elsewhere in
this reference page for more detailed information
about this operation. This option affects the
compilation of a number of system header files,
causing them to compile #pragma intrinsic directives
for certain functions that they declare. The
exact functions affected may vary depending on the
language mode and other macro definitions. See the
header files math.h, stdio.h, stdlib.h, string.h,
and strings.h for details. The exact effect of each
#pragma intrinsic varies by function, by optimization
options, and by other compile-time options.
The basic effect is to inform the compiler that the
function specified in the pragma is the one by that
name whose behavior is known to the compiler (that
is, it is a standard C or commonly-used library
function rather than a user-written external function).
This gives the compiler license to perform
additional checks on the usage of the function and
issue diagnostics, and to optimize and/or rewrite
calls to it based on the compiler's understanding
of what the function does. Some possible optimizations
include generating complete inline code, generating
partial inline code with calls to one or
more different functions, or just using characteristics
of the function to move the call site or
avoid some of the overhead triggered by an external
call. This option affects the compilation of
stdio.h in two ways: Whenever the header file would
otherwise define getc and putc as preprocessor
macros expanding into code to access the _cnt and
_ptr members of the referenced FILE object
directly, instead these macros are de
|