 |
» |
|
|
 |
When you compile a program, it passes through one or more
of the following steps depending upon which command line options
you use: Preprocessor: This
phase examines all lines beginning with a # and performs the corresponding actions and macro
replacements. Compilation Process: This
phase takes the output of the preprocessor and generates object
code. Optimization: This optional
phase optimizes the generated object code. Linking: In this phase, the
linker is invoked to produce an executable program. External references
in shared and archived libraries are resolved as required. The startup
routines in /opt/langtools/lib/crt0.o are copied in, and the C library in /lib/libc.sl or /lib/libc.a is referenced. (By default, shared libraries take
precedence over archived libraries if both versions are available.
However, if you use the LPATH environment variable, you should make sure that
all shared libraries come before any archive library directories.
See the HP-UX Linker and Libraries Online User Guide for
information on LPATH or on creating and linking with shared libraries.)
Object modules are combined into an executable program file. If
you are referencing 64-bit binaries on the compile-line you must specify
the +DD64 option, or the compiler will pass the 32-bit crt0.o to the linker, producing a Mismatched ABI error message from the linker.
Compatibility
Mode vs. ANSI C Mode |  |
The HP C compiler provides two modes of operation: compatibility
mode and ANSI C mode. The compatibility
mode option causes the compiler to compile code in a manner similar
to version 3.1. ANSI C mode is a strict implementation of the standard.
See “HP
C Compiler Options ” for more
information. The
cc(1) Command |  |
Use the cc(1) command to compile HP C programs. It has the following format: cc [options] files where: - options
is one or more compiler options and their arguments,
if any. Options can be grouped together under one minus sign. - files
is one or more file names, separated by blanks.
Each file is either a source or an object file.
Specifying
Files to the cc Command |  |
Files with names ending in .c are assumed to be HP C source files. Each HP C
source file is compiled, producing an object file with the same
name as the source file except that the .c extension is changed to a .o extension. However, if you compile and link a
single source file into an HP C program in one step, the .o file is automatically deleted. Files with names ending in .i are assumed to be preprocessor output files (see
the -P compiler option in Table 9-2 “HP C Compiler Option Details ” in this chapter). Files ending in
.i are processed the same as .c files, except that the preprocessor is not run
on the .i file before the file is compiled. Files with names ending in .s are assumed to be assembly source files; the compiler
invokes the assembler to produce .o files from these. Files with .o extensions are assumed to be relocatable object
files that are included in the linking. All other files are passed
directly to the linker by the compiler. Specifying
Options to the cc Command |  |
Each compiler option has the following format: -optionname [optionarg] where: - optionname
is the name of a standard compiler option. - optionarg
is the argument to optionname.
The optional argument -- delimits the end of options. Any following arguments
are treated as operands (typically input filenames) even if they
begin with the minus (-) character. An
Example of Using a Compiler Option By default, the cc command names the executable file a.out. For example, given the following command line: cc demo.c the executable file is named a.out. You can use the -o option to override the default name of the executable file
produced by cc. For example, suppose my_source.c contains C source code and you want to create
an executable file name my_executable. Then you would use the following command line: cc -o my_executable my_source.c You can concatenate some options to the cc command under a single prefix. The longest substring
that matches an option is used. Only the last option can take an
argument. You can concatenate option arguments with their options
if the resulting string does not match a longer option. For example, suppose you want to compile my_file.c using the -v, -g, and -DPROG=sub compiler options. There are several ways to do
this: cc my_file.c -v -g -DPROG=sub cc my_file.c -vg -D PROG=sub cc my_file.c -vgDPROG=sub cc -vgDPROG=sub my_file.c HP
C Compiler Options |  |
Table 9-1 “HP C Compiler Options at a Glance ” summarizes the
command line options supported by HP 9000 workstations and servers.
See Table 9-2 “HP C Compiler Option Details ” for detailed information
about each option. Table 9-1 HP C Compiler Options at a Glance Option | Description |
|---|
-Aa | Enables strict ANSI C compliance. | -Ac | Disables ANSI C compliance (HP C version
3.1 compatibility). | -AC99 | Use this option for C99 specific features. | -Ae | Enables ANSI C compliance, HP value-added features
(as described for +e option), and _HPUX_SOURCE name space macro. It is equivalent to -Aa +e -D_HPUX_SOURCE. | | -Bextern | Performs the same operation as +Oextern=sym1,sym2,sym3... except that symbols are loaded from an existing
file, instead of specified on the command line. | -c | Compiles only, does not link. | -C | Prevents the preprocessor from stripping comments. | -Dname | Defines the preprocessor variable name with a value of "1". | -Dname=def | Defines the preprocessor variable name with a value of def. | | -dynamic | Enables linking of PIC objects. | -E | Performs preprocessing only with output
to stdout. | | -fast | Expands into a set of compiler options which results
in improved application run-time. Options included are +O3, +Onolooptransform, +Olibcalls, +FPD, +Oentryschedule, and +Ofastaccess. Any of these options can be overridden by placing
a subsequent option after -fast on the command line. | -g | Inserts information for the symbolic
debugger in the object file. | -G | Inserts information required by the gprof profiler in the object file. | | -include <file> | Causes the compiler to insert <file> at the beginning of a set of translation units,
before processing them. | -Idir | Inserts dir in the include file search path. | -lx | Links with the /lib/libx.a and /usr/lib/libx.a libraries. | -Ldir | Links the libraries in dir before the libraries in the default search path. | | -mt | Enables multithreading capability without
the need to set any other flags, such as -l and -D | -n | Generates shareable code. | -N | Generates unshareable code. | | -noshared | Creates statically-bound executables. | -o outfile | Places object modules in outfile file. | -O | Optimizes at level 2. | -p | Inserts information required by the prof profiler in the object file. | -P | Performs preprocessing only with output
to the corresponding .i file. | -q | Marks the executable as demand loadable. | -Q | Marks the executable as not being demand loadable. | -s | Strips the symbol table from the executable
file. | -S | Generates an assembly language source
file. | -t x,name | Substitutes or inserts subprocess x with name. | -Uname | Undefines name in the preprocessor. | -v | Enables verbose mode. | -V | Causes subprocesses to print version
information to stderr. | -w | Suppresses warning messages. | -Wd,-a or +a | Omits HP provided prefix files required
by the linker. | -Wx, arg1 [,arg2,..,argn] | Passes the arguments arg1 through argn to the subprocess x. | -y | Generates information used by the HP SoftBench static analysis tool. | -Y | Enables Native Language Support (NLS). | -z | Disallows run-time dereferencing of null pointers. | -Z | Allows dereferencing of null pointers
at run-time. | +DAmodel | Generates object code for a specific
version of the PA-RISC architecture. | | +DCapptype | Generate code for portable or embedded applications. | | +DD32 | Generates 32-bit code for PA1.1 architecture. | | +DD64 | Generates 64-bit code for PA2.0 architecture. | +dfname | Specifies the profile database to use
with profile-based optimization. | +DSmodel | Performs instruction scheduling for a
specific implementation of PA-RISC. | | +DOosname | Sets the target operating system for the compiler. | +e | Enables the following HP value added
features while compiling in ANSI C mode: sized enum, long long, long pointers, compiler supplied defaults for
missing arguments to intrinsic calls, and $ in identifier HP C extensions. | +ESfic | Compiles with inline fast indirect calls. | | +ESconstlit | Introduces new default behavior. HP C now stores
constant-qualified (const) objects and literals in read-only memory. | +ESlit | Places string literals and constants
into read-only data storage. | | +ESnolit | Disables +ESconstlit, causing HP C to no longer store literals in read-only
memory. | +ESnoparmreloc | Disables parameter relocation for function
calls. | +ESsfc | Replaces function pointer comparison
millicode calls with inline code. | +f | Inhibits the promotion of float to double, except for function calls and returns. | +FPflags | Controls floating-point traps. | +help | Launches a web browser displaying an
html version of the HP C/HP-UX Online Help. | | +hugesize | Lowers the threshold for huge data. | +I | Prepares the object code for profile-based optimization
data collection. | +k | Generates long-displacement code sequences
so a program can reference large amounts of global data physically
located in shared libraries. | +L | Enables any #pragma listing directives and the listing facility. | +m | Prints identifier maps in the source
code listing. | +M | Provides ANSI migration warnings that
explain the differences between code compiled with -Ac and -Aa. | | +M1 | Provides platform migration warnings for features
that may not be supported in future releases. | | +M2 | Provides migration warnings for transitioning code
from the ILP32 to the LP64 data model. | +o | Prints hexadecimal code offsets in the
source code listing. | | +O[no]clone | Allows the user to turn on[off] the cloning
facility of theoptimizer. | +Olit=[all|const|none] | Specifies the type of data items placed
in the read-only data section | +O[no]memory[=malloc] | Enables[disables] memory optimizations | +[no]objdebug | When used with -g, +objdebug leaves debug information
in the object files instead of copying it to the executable file.
The object files must be accessible to the HP WDB debugger when debugging.
This option is not supported by the HP DDE debugger. | +Oopt | Invokes optimization level opt where opt is 0 to 4. See the HP C/HP-UX Programmer's
Guide for additional optimization options. | +P | Performs profile-based optimization. | | +pa | Requests routine-level profiling with CXperf. | | +pal | Requests routine-level and loop-level profiling with
CXperf. | +pgmname | Specifies the execution profile data
set to be used by the optimizer. | +r | Inhibits the automatic promotion of float to double. | | +sb | Make bit-fields signed by default in both 32-
and 64-bit modes. | +ubytes | Controls pointer alignment where bytes is 1, 2, or 4. | +ub | Treats unqualified char, short, int, long and long long bitfields as unsigned. | | +uc | Makes unqualified char data types unsigned. | +wn | Specifies the level of the warning messages where n is 1 - 3. | +W n1[,n2,...nN] | Suppresses the specified warnings. | +We[n1,n2...nN] | Flags Warnings as errors. | +We n1[,n2,...nN] | Changes the specified warnings to errors. | +Ww n1[,n2,...nN] | Enables the specified warnings, assuming
all other warnings are suppressed with -w or +w3. | +z | Generates shared library object code
(same as +Z in 64-bit mode). | +Z | Generates shared library object code
with a large data linkage table (long-form PIC). |
Table 9-2 “HP C Compiler Option Details ” describes in detail
the options that HP C workstations and servers
support. Table 9-2 HP C Compiler Option Details Option | What It Does |
|---|
-Aa | Requests a compilation in ANSI C mode.
The -Aa option requests a strict implementation of ANSI
C. ANSI C specifies which names are available in the standard libraries
and headers, which are reserved for the implementation, and which
must be left available for you. HP C in ANSI mode conforms to these
restrictions and only names permitted by ANSI C are defined or declared
in the standard libraries and headers. Macro definitions can be
used to access names that are normally defined in other standards
(POSIX and XOPEN, for example), and in HP C Version 3.1 compatibility
mode. To gain access to all variables and functions defined by POSIX, include
the following line at the start of your source file before including
any system headers: or define this macro by using
the -D name option: cc -D _POSIX_SOURCE myfile.c |
To gain access to all the names defined by XOPEN, include
the following line at the start of your source file before including
any system headers:
or define the
macro on the command line: cc -D _XOPEN_SOURCE myfile.c |
To gain access to all the names normally available
in compatibility mode, include the following line at the start of
your source file before including any system headers: or
define the macro on the command line: cc -D _HPUX_SOURCE myfile.c |
| | _HPUX_SOURCE defines a superset of names defined by _XOPEN_SOURCE. _XOPEN_SOURCE defines a superset of names defined by _POSIX_SOURCE. | | -Ac | Requests compatibility with version 3.1.
This was the default at the HP-UX 10.20 operating system release.
It is a non-ANSI implementation. | | -AC99 | This option needs to be used in order to use
the C99 specific features. For example, it enables keywords like restrict, and typeof to be recognized. (Without this option, the keywords __restrict__ and __typeof__ need to be used). | | -Ae | Requests a compilation in ANSI C mode with
HP C extensions. This option is the same as specifying -Aa, -D_HPUX_SOURCE, and +e. This is the default for the HP-UX 10.30 and later
operating system releases. | | -Bextern | Performs the same operation as +Oextern=sym1,sym2,sym3... except that symbols are loaded from an existing
file, instead of specified on the command line. -Bextern does not require that you manually specify symbols
locally, on the command line. In fact, if you specify a locally-defined symbol
with -Bextern, you may experience problems. When used, -Bextern tells the compiler that the symbols reside in
a separate load module. -Bextern:filename fetches the list of symbols from a text file instead
of locally. Symbols referenced in the file must be separated by
white space within the file. | | -Bhidden | Hides all the symbols including references
except for those prefixed with __declspec(dllexport), __declspec(dllimport) or specified with +Oextern or HP_DEFINED_EXTERNAL pragma. This will hide both definitions and references. | | -Bhidden_def | Hides all the symbols defined in the module
except for those prefixed __declspec(dllexport). This will hide only definitions. | | -c | Compiles one or more source files but does
not enter the linking phase. The compiler produces the object file
(a file ending with .o by default) for each source file (a file ending
with .c, .s, or .i). Object files must be linked before they can
be executed. | -C | Prevents the preprocessor from stripping
comments. See the description of cpp(1) in the HP-UX Reference Manual for details. | -Dname -Dname=def | Defines name to the preprocessor cpp as if defined by the preprocessing directive #define. If =def is not given, name is "1". Macros should be assigned integer
values when they will be used in constant expressions that are to
be evaluated by the conditional compilation directives #if and #else. See “Conditional
Compilation (#if, #ifdef, ..#endif)” for more information. | | -dynamic | This option produces dynamically bound executables.
These support shared libraries and use the features of the dynamic
loader. The shl_load and dlopen APIs
are fully supported. The linker links in shared libraries first
and then archive libraries. Only PIC is supported. | -E | Runs the preprocessor only on the named
HP C or assembly programs and sends the result to standard output
(stdout). | | -fast | The -fast compiler option expands into an existing set of
compiler options which, used together, result in optimum speed and
application run-times. This option is also provided for compatibility
in porting other vendors’ applications to HP-UX. NOTE:
Do not use this option for programs that depend on IEEE standard
floating-point denormalized numbers. Otherwise, different numerical
results may occur. -fast expands to the following HP C/ANSI C options: +O3 +nolooptransform +Olibcalls +FPD +Oentrysched +Ofastaccess |
+O3 optimizations
include all +O2 optimizations as well as all subprograms within
a single file. It also inlines certain subprograms within the input
file. +Onolooptransform disables transformation of eligible loops for
improved cache performance. +Olibcalls increases the runtime performance of code which
calls the standard library routines. +FPD enables a fast underflow mode on PA-7100 architectures
or later where denormalized floating-point operands are flushed
to zero. +Oentrysched optimizes instruction scheduling on a procedure's
entry and exit sequences. +Ofastaccess optimizes code for fast access to global data
items.
You can override any
of the options in -fast by specifying a subsequent option after it. | -g | Inserts information for the symbolic
debugger in the object file. In conjunction with the HP Distributed Debugging
Environment (DDE), the C compiler now provides support for debugging
optimized code. This support includes: Tracebacks
with line-number annotation Setting breakpoints and single-stepping at the source
statement level Mapping between source statements and machine instructions Viewing and modifying global variables at procedure
call boundaries Viewing and modifying parameters on procedure entry
To
enable debugging of optimized code, specify the -g compile-line option together with the -0, +01, or +02 option. Currently, debugging is supported at optimization
levels 2 and below. If you try to use -g with the +03 or +04 option, the compiler will issue a warning stating
that the options are incompatible, and will ignore the -g option. | -G | Prepares the object file for profiling
with gprof. See the gprof(1) description
in the HP-UX Reference manual for details. | -include <file> | This option causes the compiler to insert <file> at the beginning of a set of translation units,
before processing the translation units. Effectively,
it executes implicit #include "<file>" directives for each -include <file> option on the command line, before the very first
line of each of the source files specified on the command line. This
is a GCC compatibility feature. Example Usage: $ cc [cc opts] [-include <file>]* [cc opts] <source file(s)> where, [-include <file>]* stands for zero or more -include <file> options. All the -include options are processed in the order in which they
are written. | -Idir | Adds dir to the list of directories that are searched for
include files by the preprocessor. For include files that are enclosed
in double quotes and do not begin with a /, the preprocessor first searches the current directory,
then the directory named in the -I option, and finally, the standard include directory /usr/include. For include files that are enclosed in < and > symbols, the search path begins with the directory
named in the -I option and is completed in the standard include
directory, /usr/include. The current directory is not searched. | -lx | Causes the linker to search the libraries /usr/lib/libx.a or /usr/lib/libx.sl (searched first) and /opt/langtools/lib/libx.a or /opt/langtools/lib/libx.sl (searched second). The -a linker option determines whether the archive (.a) or shared (.sl) version of a library is searched. The linker
searches the shared version of a library by default. Libraries
are searched when their names are encountered. Therefore placement
of a -l is significant. If a file contains an unresolved
external reference, the library containing the definition must be
placed after the file on the command line. See the description of ld(1)
in the HP-UX Reference Manual for details. | -Ldir | Causes the linker to search for libraries
in the directory dir before using the default search path. The default
search path is the directory /usr/lib followed by /opt/langtools/lib. -Ldir must precede -lx on the command line; otherwise -Ldir is ignored. This option is passed directly to the linker. For
example: cc -L/project/libs prog.c -lfoo -lbar |
Compiles and links prog.c and directs the linker to search the directories /project/libs, /usr/lib, then /opt/langtools/lib for libfoo.a, libfoo.sl, libbar.a, and libbar.sl
libraries. | -mt | This option enables multithreading capability without
the need to set any other flags, such as -l and -D. HP C compiler sets the appropriate flags as required. -D__POSIX_C_SOURCE=199506L
Following
macros are used to compile multi-thread source code: _REENTRANT Required by system header files that provide reentrant functions
(suffixed by _r). _HPUX_SOURCE Required by HP C system header files. _POSIX_C_SOURCE=199506L Required by pthread. libpthread.* Kernel thread library used on 11.x systems.
| -n | Causes the program file produced by the
linker to be marked as shareable. For details and system defaults
see the description of ld(1) in the HP-UX Reference manual. | -N | Causes the program file produced by the
linker to be marked as unshareable. For details and system defaults
see the ld(1) description in the HP-UX Reference Manual. | | -noshared | Creates statically bound executables. This
option is available with option +DA2.0W only. See -dynamic for dynamically bound executables.
The default behavior is dynamic. | -o outfile | Causes the output of the compilation
sequence to be placed in outfile. The default name is a.out. When compiling a single source file with the -c option, you can also use the -o option to specify the name and location of the
object file. | -O | Invokes the optimizer to perform level
2 optimization. Other optimization levels can be set. Refer to the HP
C/HP-UX Programmer's Guide for details on optimization. | -p | Causes the compiler to produce extra
profiling code that counts the number of times each routine is called.
Also, if link editing takes place, this option replaces the standard
startup routine with a routine that calls monitor(3C) at the start and writes out a mon.out file upon normal termination of the object program's
execution. An execution profile can then be generated using prof(1). | -P | Preprocesses only. Runs the preprocessor
with the -P option only on the named HP C source files and leaves
the result in the corresponding files with .i as the suffix. | -q | Causes the output file from the linker
to be marked as demand loadable. For details and system defaults, see
the ld(1) description in the HP-UX Reference manual. | -Q | Causes the program file created by the
linker to be marked as not demand loadable. For details and system defaults,
see the ld(1) description in the HP-UX Reference manual. | -s | Strips the executable. Causes the program
file created by the linker to be stripped of symbol table information.
Specifying this option prevents using a symbolic debugger on the
resulting program. See the ld(1) description in the HP-UX Reference manual for more details. | -S | Compiles the named HP C program and leaves
the assembly language output in a corresponding file with .s as the suffix. | -t x,name | Substitutes or inserts subprocess x with name, where x is one or more of a set of identifiers indicating
the subprocesses. This option works in two modes: 1) if x is a single identifier, name represents the full pathname of the new subprocess;
2) if x is a set of identifiers, name represents a prefix to which the standard suffixes
are concatenated to construct the full pathnames of the new subprocesses. x can be one or more of the following values: p—Preprocessor (standard suffix is cpp). c—Compiler (standard suffix is ccom). a—Assembler (standard suffix is as). l—Linker (standard suffix is ldr).
| -Uname | Undefines or removes any initial definition
of name in the preprocessor. See the cpp(1)
description in the HP-UX Reference manual for details. | -v | Enables the verbose mode sending a step-by-step description
of the compilation process to standard error (stderr.) | -V | Prints version information on each invoked subprocess
to standard error (stderr.) | -w | Suppresses warning messages. | -Wx, arg1[,arg2,..,argn] | Passes the arguments arg1 through argn to the subprocess x of the compilation. x can be one of the values described under the -t option with the addition of d, to pass an option to the cc driver. These options
are HP value added extensions to HP C. | -W c,-e or +e | Enables the following HP value added
features while compiling in ANSI C mode: sized enum, long long, long pointers, compiler supplied defaults for
missing arguments to intrinsic calls, and $ in identifier HP C extensions. | -W c,-L or +L | Enables any #pragma listing directives and the listing facility. A
straight listing prints the following: A
banner on the top of each page. The nesting level of each statement or declaration. The postprocessed source file with expanded macros,
include files, and no user comments (unless the -C option is used).
Under
ANSI mode, -Wc,-L causes the compiler to generate an output list
of the source without the cpp macro replacements. The -Wc,-Lp option causes the compiler to generate an output
list of the source with the cpp macro replacements. | -W c,-m or +m | Causes the identifier maps to be printed.
First, all global identifiers are listed, then all the other identifiers
are listed by function at the end of the listing. For struct and union members, the address column contains B@b, where B is the byte offset and b is the bit offset. Both B and b are in hexadecimal. | -W c,-o or +o | Causes the code offsets to be printed
in hexadecimal grouped by function at the end of the listing. | -W c,or -Rnum | Allow only the first num register variables to actually have the register
class. Use this option when the register allocator issues an out
of general registers message. | -W c,-wn or +wn | Specifies the level of the warnings messages.
The value of n can be one of the following: 1—All warnings are issued. This includes
low level warnings that may not indicate anything wrong with the
program. 2—Only warnings indicating that code generation
might be affected are issued. This is equivalent to the compiler
default without the -w options. 3—No warnings are issued. This is equivalent
to the -w option.
| -W d,-a | When processing files written in assembly
language, this option specifies that the compiler should not assemble
with the prefix file that sets up the space and subspace structure
required by the linker. Programs assembled with this option may
not link unless they contain the equivalent information. You
can then optimize the program based on this profile data by re-linking
with the +P command line option. The +I command line option is incompatible with the -g, -p, -s, -S, and -y options. The +I option does not affect the default optimization
level or the optimization level specified by the -O or +O options. For more details on invoking profile-based optimization,
refer to the HP C/HP-UX Programmer's Guide. | -y | Requests the compiler to generate additional information
for the static analysis tool, which is a part of the HP SoftBench software development environment. See HP Softbench Static Analyzer: Analyzing Program Structure for more information. | -Y | Enables Native Language Support (NLS)
of 8-bit and 16-bit characters in comments, string literals, and
character constants. See hpnls(5), long(5), and environ(5) in the HP-UX Reference manual for a description of the NLS model. The
language value is used to initialize the correct tables for interpreting
comments, string literals, and character constants. It is also used
to build the pathname to the proper message catalog. Refer to “Location
of Files ” for a description
of this path. | -z | Disallows run-time dereferencing of null
pointers. Fatal errors result if null pointers are dereferenced. | -Z | Allows dereferencing of null pointers
at run-time. (This behavior is the default.) The value of a dereferenced
null pointer is zero. | +DAmodel | Generates object code for a particular
version of the PA-RISC architecture. If you do
not specify this option, the default object code generated is determined automatically
as that of the system on which you compile. +DA also specifies which version of the HP-UX math
library to link in when you specify -lm. (See the HP-UX Floating-Point Guide for
more information about using math libraries.)
model can be a model number of an HP 9000 system (such
as, 730, 877, H50, or I50), one of the PA-RISC architecture designations 1.1, 2.0, 2.0W, or portable. For example, specifying +DA1.1 or +DA735 generates code for the PA-RISC 1.1 architecture. Similarly,
specifying +DA2.0 generates 32-bit code for the PA-RISC 2.0 architecture. Specifying +DA2.0W generates 64-bit ELF object files for the PA-RISC
2.0 architecture. Specifying +DAportable generates code compatible across all HP 9000 workstations
and servers. See the file /opt/langtools/lib/sched.models for model numbers and their architectures. Use
the command uname -m to determine the model number of your system. Note:
Object code generated for PA-RISC 2.0 will not execute on PA-RISC 1.1 systems. Object code generated
for the 64-bit data model (LP64) will not execute under the 32-bit
data model (ILP32). To generate code compatible across PA-RISC 1.1
and 2.0 workstations and servers, use the +DAportable option. | | For best performance, use +DA with the model number or architecture where you
plan to execute the program. Starting at the HP-UX 10.20 release, the
default object code generated by HP compilers is determined automatically
as that of the machine on which you compile. (Previously, the default
code generation was PA-RISC 1.0 on Series 800 servers, and PA-RISC
1.1 on Series 700 workstations.) For more information
on this option, see “Using
+DA to Generate Code for a Specific Version of PA-RISC ” See
also the +DD32 and +DD64 options. | | +DCapptype | Generate code for portable or embedded applications (64-bit
mode only.) When apptype is hpux, the compiler builds portable applications. This
is the default behavior, and is equivalent to using +Oextern. When apptype is emb, the options most commonly used to generate embedded
systems code are enabled. Note that code generated with the +DCemb must not be included in a shared library. | | +DD32 | Generates 32-bit object code for the PA-RISC
1.1 architecture, which runs on PA1.1 and PA2.0 architectures. This
option is the same as the options +DA1.1 and +DAportable. | | +DD64 | Generates 64-bit object code for PA2.0 architecture. Causes
the macros __LP64__ and _PA_RISC2_0 to be #defined. This is the same as +DA2.0W, but is the recommended option to use when compiling
in 64-bit mode on the PA RISC 2.0 architecture because it is forward
compatible with future 64-bit architectures. | | +dfname | Specifies the path name of the profile database
to use with profile-based optimization. This option can be used
with the +P command line option. The profile database by default
is named flow.data. This file stores profile information for one
or more executables. Use +df when the flow.data file has been renamed or is in a different directory
than where you are linking.
You can also use
the FLOW_DATA environment variable to specify a different path
and file name for the profile database file. The +dfname command line option takes precedence over the FLOW_DATA environment variable.
Note,
the +dfname option cannot be used to redirect the instrumentation
output (with the +I option). It is only compatible with the +P option. | | +DOosname | Sets the target operating system for
the compiler. The osname can be: 11.0EP9806 (indicates the HP-UX 11.0 EXTPAK 9806 release)
If +DO11.0EP9806 and +Olibcalls are both specified on an HP-UX 11.0EP9806 system,
the compiler enables the fusing of math library calls where applicable.
This promotes instruction level parallelism by computing the same
function (such as sin()) of two values concurrently. +DO can be used at any optimization level. By default,
when you compile your application, it is binary compatible across
the 11.x release. You only need to specify +DO when you want the latest performance features
supported in the OS. Caution:
Use of +DO with a non-default osname makes the resulting code binary incompatible with an
earlier version of HP-UX. | | +DSmodel | Performs instruction scheduling tuned for a particular
implementation of the PA-RISC architecture. model can be a model number of an HP 9000 system (such
as 730, 877, H50, or I50); a PA-RISC architecture designation 1.1
or 2.0; or a processor name (such as PA7100LC). For example, specifying +DS720 performs instruction scheduling tuned for one
implementation of PA-RISC 1.1. Specifying +DSPA7100LC performs scheduling for a system with a PA7100LC
processor. Specifying +DSPA8000 performs instruction scheduling for systems based on
the PA-RISC 8000 processor. To obtain the best performance
on a particular model or processor of the HP 9000, use +DS with that model number or processor name. If
you plan to run your program on both PA-RISC 1.1 and 2.0 systems,
in general we recommend you use +DS2.0. See the file /opt/langtools/lib/sched.models for model numbers and the processor names for
which implementation-specific scheduling is performed. Use the command uname -m to determine the model number of your system. Object
code with scheduling tuned for a particular model or processor will execute
on other HP 9000 systems, although possibly less efficiently. For
more information on this option, see “Using
+DS to Specify Instruction Scheduling ”. | +e | See -W c,-e | | +ESconstlit | Introduces a new default behavior for the HP
C compiler, in which HP C stores constant-qualified (const) objects and literals in read-only memory. Storing
const-qualified string literals in read-only memory can cause a
program which violates the semantics of const to abnormally terminate
with a bus error and core dump. This is because literals, which
have been placed in read-only memory, may not be modified at runtime.
See the description of +ESnolit for details on how to specify that literals not
be placed in read-only memory. | +ESfic | The +ESfic option generates code for fast indirect calls.
This option should only be used in an environment where
there are no dependencies on shared libraries. The application must
be linked with archive libraries. Using this option can improve run-time
performance. | +ESlit | Places string literals and constants
defined with the ANSI C const type qualifier into the $LIT$ subspace. The $LIT$ subspace is used for read-only data storage. This
option can reduce memory requirements and improve run-time speed
in multi-user applications. Normally the C compiler
only places floating-point constant values in the $LIT$ subspace, and other constants and literals in
the $DATA$ subspace. This option allows the placement of
large data objects, such as ANSI C const arrays, into the $LIT$ subspace. All users of an application
share the static data stored in the $LIT$ subspace. Each user is allocated a private copy
of the dynamic data stored in the $DATA$ subspace. By moving additional static data from
the $DATA$ subspace to the $LIT$ subspace, overall system memory requirements can
be reduced and run-time speed improved. Most applications can benefit
from this option. Users should not attempt to modify string
literals if they use the +ESlit option. The reason is that this option places
all string literals into read-only memory. Particularly, the following
C library functions should be used with care, since they can alter
the contents of string literals if users specify string literals
as the receiving string.  |
extern char *strncat(char *, const char *, size_t); extern void *memmove(void *, const void *, size_t); extern char *strcpy(char *, const char *); extern char *strncpy(char *, const char *, size_t); extern char *strcat(char *, const char *); extern char *strtok(char *, const char *); |
| | +ESnolit | +ESnolit disables the default behavior of the HP C compiler
to store literals in read-only memory. Specifying this option causes
HP C to no longer store literals in read-only memory. This restores
HP C's traditional behavior prior to this release of the compiler. | +ESnoparmreloc | +ESnoparmreloc disables parameter relocation for function calls.
If your source code uses the ANSI C function prototype consistently
in both declaration and definition of a function, this option may
allow you to produce smaller and faster function entry code. The
library is compiled with this option off. So, to use this option
in your code, you must declare the library functions without function
prototype. For example, cos has not been compiled with +ESnoparmreloc. If you declare cos with a function prototype as shown below, and
compile with +ESnoparmreloc, an incorrect value will be passed to cos(). double cos(double); main() { printf("%f\n", cos(1.0)); } |
For more information on parameter relocation, see the HP
PA-RISC Procedure Calling Conventions Reference Manual,
HP part number 09740-90015. | +ESsfc | Replaces millicode calls with inline
code when performing simple function pointer comparisons. The +ESsfc compiler option affects how function pointers
are compared in generated code. The default is to generate low-level
millicode calls for function pointer comparisons. The +ESsfc option generates code that compares function pointers
directly, as if they were simple integers. The +ESsfc option should only be used in an environment where
there are no dependencies on shared libraries. The application must
be linked with archive libraries. Using this option can improve run-time
performance. | +f | Inhibits the automatic promotion of float to double when evaluating expressions. This differs from
the +r option in that both parameters and function return values are still promoted to double. In ANSI mode, this option is ignored and a warning
is issued. | +FPflags | Specifies what floating-point traps to
enable and also enables or disables fast underflow mode. flags is a series of upper case or lower case letters from
the set [VvZzOoUuIiDd] with no spaces, tabs, or other characters between
them. If the upper-case letter is selected, that behavior is enabled.
If the lower-case letter is selected or if the letter is not present
in the flags, the behavior is disabled. By default, all traps are
disabled. The values for flags are: - V
Enable traps on invalid floating-point operations. - v
Disable traps on invalid floating-point operations. - Z
Enable traps on divide by zero. (If your program
must conform to the POSIX standard, do not enable this trap.) - z
Disable traps on divide by zero. - O
Enable traps on floating-point overflow. - o
Disable traps on floating-point overflow. - U
Enable traps on floating-point underflow. - u
Disable traps on floating-point underflow. - I
Enable traps on floating-point operations that produce
inexact results. - i
Disable traps on floating-point operations that
produce inexact results.
| | | - D
Enable fast underflow (flush to zero) of denormalized
values. (Enabling fast underflow is an undefined operation on PA-RISC 1.0
based systems, but it is defined on all subsequent versions of PA-RISC.
Selecting this value enables fast underflow only if it is available
on the processor that is used at run time.) - d
Disable fast underflow (flush to zero) of denormalized
values.
To dynamically
change these settings at run time, refer to fpgetround(3M). | +help | Launches a web browser displaying an html version of
the HP C/HP-UX online help, and then processes any other arguments.
See “HP
C Online Help ” for instructions
on setting up your environment to view the HP C Online Help. | | +hugesize=n[M][K] | Lowers the threshold for huge data. - n
is an integer with a maximum value of 258 bytes. - M
indicates megabytes. - K
indicates kilobytes.
M or K are optional specifiers. If neither is specified the
default is K. In order for the compiler to qualify
a data object as huge, its size must exceed the current setting
of the hugesize threshold. The threshold is initially set to 256
megabytes (228 bytes). A data object
whose size exceeds the threshold is allocated in huge subspace. The
compiler puts all small arrays, structures, and unions into a separate
subspace. An application with too many arrays may run out of subspace
creating an overflow condition. In this case linking fails. One way
to solve this problem is to lower the threshold so that any array
greater than or equal to the threshold (in bytes) is put into the
huge data subspace instead. The following example lowers
the threshold to 223 (8 megabytes) resulting
in more data objects being put in huge subspace: cc +DD64 +hugesize=8M app1.c app2.c |
For more information, see cc +help. | +I | Instructs the compiler to instrument
the object code for collecting run-time profile data. The profiling information
can then be used by the linker to perform profile-based optimization.
Code generation and optimization phases are delayed until link time by
this option. After compiling and linking with +I, run the resultant program using representative
input data to collect execution profile data. Profile data is stored in flow.data by default. See the +dfname option for information on controlling the name
and location of this data file. | +k | Generates long-displacement code sequences
so a program can reference large amounts of global data that is
physically located in shared libraries. Only use +k when you get a linker message indicating you need
to |
|