Go to main content
Oracle® Developer Studio 12.6: C User's Guide

Exit Print View

Updated: July 2017
 
 

Compiler Options Grouped by Functionality

This chapter summarizes the C compiler options by function. Detailed explanations of the options and the compiler command-line syntax are provided in Table 35.

A.1 Options Summarized by Function

In this section, the compiler options are grouped by function to provide a quick reference. For a detailed description of each option, refer to C Compiler Options Reference. Some flags serve more than one purpose and appear more than once.

The options apply to all platforms except as noted. Features that are unique to SPARC-based systems are identified as (SPARC), and the features that are unique to x86/x64–based systems are identified as (x86). Options that apply to Oracle Solaris platforms only are marked (Oracle Solaris). Options for Oracle Linux-only platforms are marked (Oracle Linux).

A.1.1 Optimization and Performance Options

Table 22  Optimization and Performance Options
Option
Action
-fast
Selects the optimum combination of compilation options for speed of executable code.
-fma
Enables automatic generation of floating-point fused multiply-add instructions.
-fsemantic-interposition
-fno-semantic-interposition
Control optimizations that impact interposing on global library functions.
-library=sunperf
Links with the Sun Performance Library.
-p
Prepares the object code to collect data for profiling.
-xalias_level
Enables the compiler to perform type-based alias analysis and optimizations.
-xannotate
Instructs the compiler to create binaries that can be used by the optimization and observability tools binopt(1), code-analyzer(1), discover(1), collect(1), and uncover(1).
-xbuiltin
Improves the optimization of code that calls standard library functions.
-xdepend
Analyzes loops for inter-iteration data dependencies and does loop restructuring.
-xF
Enables reordering of data and functions by the linker.
-xglobalize
Controls globalization of file static variables but not functions.
-xhwcprof
Enables compiler support for hardware counter-based profiling.
-xinline
Tries to inline only those functions specified.
-xinline_param
Manually changes the heuristics used by the compiler for deciding when to inline a function call.
-xinline_report
Generates a report written to standard output on the inlining of functions by the compiler.
-xinstrument
Compiles and instruments your program for analysis by the Thread Analyzer.
-xipo
Performs whole-program optimizations by invoking an interprocedural analysis component.
-xipo_archive
Allows crossfile optimization to include archive (.a) libraries.
-xipo_build
Reduces compile time by avoiding optimizations during the initial pass through the compiler, optimizing only at link time.
-xkeepframe
Prohibits stack related optimizations for the named functions.
-xjobs
Sets how many processes the compiler creates.
-xlibmil
Inlines some library routines for faster execution.
-xlinkopt
Performs link-time optimizations on relocatable object files.
-xlibmopt
Selects library of optimized math routines.
-xmaxopt
Limits the level of pragma opt to the level specified.
-xnolibmil
Does not inline math library routines.
-xO
Optimizes the object code.
-xnorunpath
Prevents inclusion of a runtime search path for shared libraries in the executable.
-xpagesize
Sets the preferred page size for the stack and the heap.
-xpagesize_stack
Sets the preferred page size for the stack.
-xpagesize_heap
Sets the preferred page size for the heap.
-xpch
Reduces compile time for applications whose source files share a common set of include files.
–xpec
Generates a Portable Executable Code (PEC) binary which can be used with additional tuning and troubleshooting.
-xpchstop
Can be used in conjunction with -xpch to specify the last include file of the viable prefix.
-xprefetch
Enables prefetch instructions.
-xprefetch_level
Controls the aggressiveness of automatic insertion of prefetch instructions as set by -xprefetch=auto
-xprefetch_auto_type
Controls how indirect prefetches are generated.
-xprofile
Collects data for a profile or uses a profile to optimize.
-xprofile_ircache
Improves compilation time of -xprofile=use phase by reusing compilation data saved from the -xprofile=collect phase.
-xprofile_pathmap
Support for multiple programs or shared libraries in a single profile directory.
-xrestrict
Treats pointer-valued function parameters as restricted pointers.
-xsafe
(SPARC) Allows the compiler to assume no memory-based traps occur.
-xspace
Does no optimizations or parallelization of loops that increase code size.
-xthroughput
Specifies that the application will be run in situations where many processes are simultaneously running on the system.
-xunroll
Suggests to the optimizer to unroll loops n times.

A.1.2 Compile-Time and Link-Time Options

The following table lists the options that must be specified both at link-time and at compile-time.

Table 23  Compile-Time and Link-Time Options
Option
Action
-fast
Selects the optimum combination of compilation options for speed of executable code.
-fopenmp
Equivalent to -xopenmp=parallel.
-m32 |-m64
Specifies the data type model for the compiled binary object.
-mt
Macro option that expands to -D_REENTRANT -lthread.
-p
Prepares the object code to collect data for profiling with prof(1)
-xarch
Specify instruction set architecture.
-xautopar
Enables automatic parallelization for multiple processors.
-xhwcprof
Enables compiler support for hardware counter-based profiling.
-xipo
Performs whole-program optimizations by invoking an interprocedural analysis component.
-xlinkopt
Performs link-time optimizations on relocatable object files.
-xmemalign
(SPARC) Specify maximum assumed memory alignment and behavior of misaligned data accesses.
-xopenmp
Supports the OpenMP interface for explicit parallelization including a set of source code directives, run-time library routines, and environment variables
-xpagesize
Sets the preferred page size for the stack and the heap.
-xpagesize_stack
Sets the preferred page size for the stack.
-xpagesize_heap
Sets the preferred page size for the heap.
-xpatchpadding
Reserve an area of memory before the start of each function.
-xpg
Prepares the object code to collect data for profiling with gprof(1).
-xprofile
Collects data for a profile or uses a profile to optimize.
-xs
(Oracle Solaris) Link debug information from object files into executable.
-xvector=lib
Enable automatic generation of calls to the vector library functions.

A.1.3 Data-Alignment Options

Table 24  Data-Alignment Options
Option
Action
-xchar_byte_order
Produce an integer constant by placing the characters of a multi-character character-constant in the specified byte order.
-xdepend
Analyzes loops for inter-iteration data dependencies and does loop restructuring.
-xmemalign
(SPARC) Specify maximum assumed memory alignment and behavior of misaligned data accesses.
-xsegment_align
Cause the driver to include a special mapfile on the link line.

A.1.4 Numerics and Floating-Point Options

Table 25  Numerics and Floating-Point Options
Option
Action
-flteval
(x86) Controls floating point evaluation.
-fma
Enables automatic generation of floating-point fused multiply-add instructions.
-fnonstd
Causes nonstandard initialization of floating-point arithmetic hardware.
-fns
Turns on nonstandard floating-point mode.
-fprecision
(x86) Initializes the rounding-precision mode bits in the Floating-point Control Word
-fround
Sets the IEEE 754 rounding mode that is established at runtime during the program initialization.
-fsimple
Allows the optimizer to make simplifying assumptions concerning floating-point arithmetic.
-fsingle
Causes the compiler to evaluate float expressions as single precision rather than double precision.
-fstore
(x86) Causes the compiler to convert the value of a floating-point expression or function to the type on the left-hand side of an assignment
-ftrap
Sets the IEEE 754 trapping mode in effect at startup.
-nofstore
(x86) Does not convert the value of a floating-point expression or function to the type on the left-hand side of an assignment
-xdepend
Analyzes loops for inter-iteration data dependencies and does loop restructuring.
-xlibmieee
Forces IEEE 754 style return values for math routines in exceptional cases.
-xsfpconst
Represents unsuffixed floating-point constants as single precision
-xvector
Enable automatic generation of calls to the vector library functions.

A.1.5 Parallelization Options

Table 26  Parallelization Options
Option
Action
-fopenmp
Equivalent to -xopenmp=parallel.
-mt
Macro option that expands to -D_REENTRANT -lthread.
-xautopar
Enables automatic parallelization for multiple processors.
-xcheck
Adds runtime checks for stack overflow and initializes local variables.
-xdepend
Analyzes loops for inter-iteration data dependencies and does loop restructuring.
-xloopinfo
Shows which loops are parallelized and which are not.
-xopenmp
Supports the OpenMP interface for explicit parallelization including a set of source code directives, run-time library routines, and environment variables
-xreduction
Enables reduction recognition during automatic parallelization.
-xrestrict
Treats pointer-valued function parameters as restricted pointers.
-xthreadvar
Controls the implementation of thread local variables.
-xthroughput
Specify that the application will be run in situations where many processes are simultaneously running on the system.
-xvpara
Warns about loops that have #pragma MP directives specified but might not be properly specified for parallelization.

A.1.6 Source Code Options

Table 27  Source Code Options
Option
Action
-A
Associates name as a predicate with the specified tokens as if by a #assert preprocessing directive.
-ansi
Equivalent to -std=c89.
-C
Prevents the preprocessor from removing comments, except those on the preprocessing directive lines.
-D
Associates name with the specified tokens as if by a #define preprocessing directive.
-E
Runs the source file through the preprocessor only and sends the output to stdout.
-fd
Reports K&R-style function definitions and declarations.
-H
Prints to standard error, one per line, the path name of each file included during the current compilation.
-I
Adds directories to the list that is searched for #include files with relative file names.
–include
Causes the compiler to treat the argument filename as if it appears in the first line of a primary source file as a #include preprocessor directive.
-P
Runs the source file through the C preprocessor only.
-pedantic
Enforce strict conformance with errors/warnings for non-ANSI constructs.
-preserve_argvalues
(x86) Save copies of register-based function arguments in the stack.
-std
Specify C language standard.
-U
Removes any initial definition of the preprocessor symbol name.
-X
The -X options specify varying degrees of compliance to the ISO C standard.
-xCC
Accepts the C++-style comments.
-xc99
Controls compiler recognition of supported C99 features.
-xchar
Helps with migration from systems where char is defined as unsigned.
-xcsi
Allows the C compiler to accept source code written in locales that do not conform to the ISO C source character code requirements
-xM
Runs only the preprocessor on the named C programs, requesting that it generate makefile dependencies and send the result to the standard output
-xM1
Collects dependencies like -xM, but excludes /usr/include files.
-xMD
Generates makefile dependencies like -xM but includes compilation.
-xMF
Specifies a filename which stores makefile dependency information.
-xMMD
Generates makefile dependencies but excludes system headers.
-xP
Prints prototypes for all K&R C functions defined in this module
-xpg
Prepares the object code to collect data for profiling with gprof(1).
-xtrigraphs
Determines recognition of trigraph sequences.
-xustr
Enables recognition of string literals composed of sixteen-bit characters.

A.1.7 Compiled Code Options

Table 28  Compiled Code Options
Option
Action
-c
Directs the compiler to suppress linking with ld(1) and to produce a .o file in the current working directory for each source file
-o
Names the output file
-S
Directs the compiler to produce an assembly source file but not to assemble the program.

A.1.8 Compilation Mode Options

Table 29  Compilation Mode Options
Option
Action
-#
Enables verbose mode, which shows how command options expand and shows each component as it is invoked.
-###
Shows each component as it would be invoked, but does not actually execute it. Also shows how command options expand.
-ansi
Equivalent to -std=c89.
-features
Enables or disables various C-language features.
-fshort-enums
Set the type of an enum to that of the smallest type capable of holding all of the enumerator values. -fno-short-enums can be used to reverse -fshort_enums specified earlier on the command line.
-fexceptions
Generate code to interoperate with C++ exception handling in C++ gcc compatibility modes.
-keeptmp
Retains temporary files created during compilation instead of deleting them automatically.
-std
Specify C language standard.
-temp
Define the directory for temporary files.
-V
Directs cc to print the name and version ID of each component as the compiler executes.
-W
Passes arguments to C compilation-system components.
-X
The -X options specify varying degrees of compliance to the ISO C standard.
-xc99
Controls compiler recognition of supported C99 features.
-xchar
Preserves the sign of a char
-xhelp
Displays on-line help information.
-xjobs
Sets how many processes the compiler creates.
-xlang
Override the default libc behavior as specified by the -std flag.
-xpch
Reduces compile time for applications whose source files share a common set of include files.
-xpchstop
Can be used in conjunction with -xpch to specify the last include file of the viable prefix.
-xtime
Reports the time and resources used by each compilation component.
-Y
Specifies a new directory for the location of a C compilation-system component.
-YA
Changes the default directory searched for components.
-YI
Changes the default directory searched for include files.
-YP
Changes the default directory for finding library files.
-YS
Changes the default directory for startup object files.

A.1.9 Diagnostic Options

Table 30  Diagnostic Options
Option
Action
-errfmt
Prefix error messages with string “error:” for ready distinction from warning messages.
-errhdr
Limits the warnings from header files to a specified group.
-erroff
Suppresses compiler warning messages.
-errshort
Control how much detail is in the error message produced by the compiler when it discovers a type mismatch.
-errtags
Displays the message tag for each warning message.
-errwarn
If the indicated warning message is issued, cc exits with a failure status.
-pedantic
Enforce strict conformance with errors/warnings for non-ANSI constructs.
-v
Directs the compiler to perform stricter semantic checks and to enable other lint-like checks.
-w
Suppresses compiler warning messages.
-xanalyze
Produce a static analysis of the source code that can be viewed using the Code Analyzer.
-xe
Performs only syntax and semantic checking on the source file, but does not produce any object or executable code.
-xprevise
Produce a static analysis of the source code that can be viewed using the Code Analyzer.
-xs
(Oracle Solaris) Link debug information from object files into executable.
-xtransition
Issues warnings for the differences between K&R C and Oracle Developer Studio ISO C.
-xvpara
Warns about loops that have #pragma MP directives specified but might not be properly specified for parallelization.

A.1.10 Debugging Options

Table 31  Debugging Options
Option
Action
-g
Produces additional symbol table information for the debugger.
-g3
Produces addition debugging information.
-s
Removes all symbolic debugging information from the output object file.
-xcheck
Adds runtime checks for stack overflow and initializes local variables.
-xcompress
Control compression of the debug section.
-xcompress_format
Specify format of compression of the debug section.
-xdebugformat
Generates debugging information in dwarf format.
-xdebuginfo
Control how much debugging and observability information is emitted.
-xglobalize
Control globalization of file static variables but not functions.
-xkeep_unref
Keep definitions of unreferenced functions and variables.
-xpagesize
Sets the preferred page size for the stack and the heap.
-xpagesize_stack
Sets the preferred page size for the stack.
-xpagesize_heap
Sets the preferred page size for the heap.
-xs
Disables Auto-Read of object files for dbx.
-xvis
(SPARC) Enables compiler recognition of the assembly-language templates defined in the VIS instruction set

A.1.11 Linking and Libraries Options

Table 32  Linking and Libraries Options Table
Option
Action
-B
Specifies whether bindings of libraries for linking are static or dynamic.
-d
Specifies dynamic or static linking in the link editor.
-G
Passes the option to the link editor to produce a shared object rather than a dynamically linked executable.
Does not link any libraries by default.
-h
Assigns a name to a shared dynamic library as a way to have different versions of a library.
-i
Passes the option to the linker to ignore any LD_LIBRARY_PATH setting.
-L
Adds directories to the list that the linker searches for libraries.
-l
Links with object library libname.so, or libname.a.
-mc
Removes duplicate strings from the .comment section of the object file.
-mr
Removes all strings from the .comment section. Can also insert a string in that section of the object file.
-Q
Determines whether to emit identification information to the output file.
-R
Passes a colon-separated list of directories used to specify library search directories to the runtime linker.
-shared
Passes the –G option to the link editor to produce a shared object rather than a dynamically linked executable. Links default system libraries.
-staticlib
Specify whether linking with the Sun performance libraries will be static or dynamic.
-xMerge
Merges data segments into text segments.
-xcode
Specify code address space.
-xlang
Override the default libc behavior as specified by the -std flag.
-xldscope
Controls the default scope of variable and function definitions to create faster and safer shared libraries.
-xnolib
Does not link any libraries by default
-xnolibmil
Does not inline math library routines.
-xpatchpadding
Reserve an area of memory before the start of each function.
-xsegment_align
Cause the driver to include a special mapfile on the link line.
-xstrconst
This option may be deprecated in a future release. Use –features=[no%]conststrings instead.
Inserts string literals into the read-only data section of the text segment instead of the default data segment.
-xunboundsym
Specify whether the program contains references to dynamically bound symbols.

A.1.12 Target Platform Options

Table 33  Target Platform Options
Option
Action
-m32 |-m64
Specifies the data type model for the compiled binary object.
-xarch
Specify instruction set architecture.
-xcache
Defines the cache properties for use by the optimizer.
-xchip
Specifies the target processor for use by the optimizer.
-xregs
Specifies the usage of registers for the generated code.
-xtarget
Specifies the target system for instruction set and optimization.

A.1.13 x86-Specific Options

Table 34  x86-Specific Options
Option
Action
-flteval
Controls floating point evaluation.
-fprecision
Initializes the rounding-precision mode bits in the Floating-point Control Word
-fstore
Causes the compiler to convert the value of a floating-point expression or function to the type on the left-hand side of an assignment
-nofstore
Does not convert the value of a floating-point expression or function to the type on the left-hand side of an assignment
-preserve_argvalues
(x86) Save copies of register-based function arguments in the stack.
-xmodel
Modifies the form of 64-bit objects for the Oracle Solaris x86 platforms

A.1.14 Obsolete Options

The following table lists the options that have been deprecated. Note that the compiler might still accept these options, but might not do so in future releases. Begin using the suggested alternative option as soon as possible.

Table 35  Obsolete Options Table
Option
Action
-dalign
Use -xmemalign=8s instead.
-features=%none
Use features=no% followed by the sub-option.
-flteval
Obsolete.
-misalign
Use -xmemalign=1i instead.
-misalign2
Use -xmemalign=2i instead.
-p
Use -xpg instead.
-xanalyze
Produce a static analysis of the source code that can be viewed using the Code Analyzer.
-xarch=pentium_pro
Obsolete. Use -xarch=generic instead.
-xarch=sse
Obsolete. Use -xarch=generic instead.
-xchip=amdfam10
Obsolete.
-xchip=pentium
Obsolete. Use -xchip=generic instead.
-xchip=T3
Obsolete.
-xchip=pentium_pro
Obsolete. Use -xchip=generic instead.
-xchip=pentium3
Obsolete. Use -xchip=generic instead.
-xchip=ultraT1
Obsolete.
-xchip=ultraT2
Obsolete.
-xchip=ultraT2plus
Obsolete.
-xchip=sparc64vi
Obsolete.
-xchip=sparc64vii
Obsolete.
–xcrossfile
Obsolete. Use –xipo instead.
-xlicinfo
Obsolete; there is no alternative option.
-xnolibmopt
Use -xlibmopt=%none instead.
-xpentium
Obsolete. Use -xchip=generic instead.
-xprefetch=yes
Use -xprefetch=auto,explicit instead.
-xprefetch=no
Use -xprefetch=no%auto,no%explicit instead.
-Xs
Obsolete. There is no alternative option. Recommend converting code to at least conform with C99.
-xstrconst
Use -features=conststrings instead.
-Xt
Obsolete. There is no alternative option. Recommend converting code to at least conform with C99.
-xtarget=T3
Obsolete.
-xtarget=pentium
Obsolete. Use -xtarget=generic instead.
-xtarget=pentium_pro
Obsolete. Use -xtarget=generic instead.
-xtarget=pentium3
Obsolete. Use -xtarget=generic instead.
-xtarget=ultraT1
Obsolete.
-xtarget=ultraT2
Obsolete.
-xtarget=ultraT2plus
Obsolete.
-xtarget=ultraT3
Obsolete.
-xtarget=sparc64vi
Obsolete.
-xtarget=sparc64vii
Obsolete.
–xvector=yes
Use –xvector=lib instead.
–xvector=no
Use –xvector=none instead.