Section B.1. AIX and Linux C Compiler Options Table

B.1. AIX and Linux C Compiler Options Table

Table B-1. AIX XLC/C++ and gcc/g++ Compiler Switches Comparison Table

C/C++ VisualAge for AIX Option[1]

GNU gcc Option[2]

Description (AIX-Based)


-x c++

(C++) Compiles any file, filename.nnn, as a C++ language file, where nnn is any suffix other than .o, .a, or .s.



Traces the compilation without doing anything.



Selects 32- or 64-bit compiler mode. Additional m options for GCC are available. Refer to GNU.



Specifies which language level to use when invoking the compiler.



Enables destructive copy operations for structures and unions.



Specifies which type-based aliasing is to be used during optimization.



Specifies what aggregate alignment rules the compiler uses for file compilation.



Substitutes inline code for calls to function alloca as if #pragma alloca directives are in the source code.



Specifies the type of IBM architecture on which the executable program will be run. This refers to the RS6000 and POWER architecture.



Requests the compiler to apply aliasing assertions to your compilation unit.



Produces a compiler listing that includes an attribute listing for all identifiers.

-B t


-B: Determines substitute path names for the compiler, assembler, linkage editor, and preprocessor.


-t: Adds the prefix specified by the -B option to designated programs. -tE replaces the CreateExportList script.


-shared fpic (or fPIC) -Bsharable or -Wl brt -shared

Instructs the linker to process subsequent shared objects as either dynamic or shared.



Links all referenced objects statically, although they may be shared objects.


-fsigned-bitfields (default)

Specifies whether bitfields are signed.


Refer to Large Page Support section 6.13.

Sets the size of the heap in bytes.


-shared Wl

Enables runtime linking.



Preserves comments in preprocessed output.



Instructs the compiler to pass source files to the compiler only.



Specifies a cache configuration for a specific execution machine.

-qchars=[signed or unsigned]


Instructs the compiler to treat all variables of type char as either signed or unsigned.



Generates code that performs certain types of runtime checking.



(C++) Include files from specified directories have the tokens extern " C " { inserted before the file and } appended after the file.



When used with optimization, reduces code size where possible, at the expense of execution speed.


C++-style comments is turned on automatically in GNU C, unless ansi is turned on.

(C++) Use this option if you want C++ comments to be recognized in C source files.



Defines the identifier name as in a #define preprocessor directive.



Marks data as imported. Used to import functions.



Marks data as local.



(C only) Specifies that all typedef declarations, struct, union, and enum type definitions are included for debugger processing.



Allows the use of digraph character sequences in your program.


fdollars-in-identifiers This is the default behavior of GNU on most platforms.

Allows the $ symbol to be used in the names of identifiers.



Generates block scopes to support the IBM Dynamic Probe Class Library.



Runs the source files named in the compiler invocation through the preprocessor.


-e Label
Refer to Linker section

Specifies the entry name for the shared object. Equivalent to using ld -e name. See your system documentation for additional information about ld options. Used only with qmkshrobj.



(C++) Controls exception handling.


Use keyword

Specifies the amount of storage occupied by the enumerations.



Saves all exported symbols in a file.



Generates bind-time type checking information and checks for compile- time consistency.



Names an alternative configuration file for xlC.



Names a file to store a list of object files.



Collects program information for use with the AIX fdpr performance-tuning utility.



Specifies the minimum severity level of diagnostic messages to be reported.


None (Accuracy of floating point is different on differing platforms.)

Specifies various floating-point options to speed up or improve the accuracy of floating-point operations.


trap mode

Generates extra instructions to detect and trap floating-point exceptions.



Specifies that constant floating-point expressions are to be evaluated at compile time.



Specifies what path information is stored for files when you use -g and the distributed graphical debugger.



Places instructions for each function in a separate object file, control section, or csect.



Linkage editor (ld command) option only. Used to generate a dynamic library file.



Generates debugging information used by a debugger such as the Distributed Debugger.



Produces ANSI prototypes from K&R function definitions.



Instructs the compiler to stop after the compilation phase when it encounters errors of specified severity or greater.



Enables debug versions of memory management functions.



Instructs the compiler to perform high-order transformations on loops and array language during optimization, and to pad array dimensions and data objects to avoid cache misses.



Speeds up calculations by removing range checking on single-precision float results and on conversions from floating point to integer.



Specifies that single-precision expressions are rounded only when the results are stored into float memory locations.



Specifies an additional search path if the file name in the #include directive is not specified using its absolute path name.



Specifies the search order for files included with the #include "file_name" directive.



Allows the compiler to perform optimizations that assume errno is not modified by system calls.



Instructs the compiler to ignore certain pragma statements.



Produces informational messages.



Initializes automatic storage to a specified two-digit hexadecimal byte value.



Generates fast external linkage by inlining the pointer glue code necessary to make a call to an external function or a call through a function pointer.



Attempts to inline functions instead of generating calls to a function.



Turns on or customizes a class of optimizations known as interprocedural analysis (IPA).



Specifies functions in the source file that have no side effects.



(C++) Instructs the compiler to keep or discard definitions for unreferenced extern inline functions.



Controls whether a specified string is treated as a keyword or an identifier.



Searches the specified directory for library files specified by the -l option.



Searches a specified library for linking.



Selects the C or C++ language level for compilation.


Refer to Large Page Support section

Instructs the compiler to exploit large page heaps available on POWER4 systems running AIX v5.1D or later.



Increases the size of the long double type from 64 bits to 128 bits.



Assumes that all functions with the name of an ANSI C library function are in fact the system functions.



Generates abbreviated line number and source file name information for the debugger.



Produces a compiler listing that includes an object listing.



Produces a compiler listing that displays all options in effect.



Makes unsuffixed literals the long type for 64-bit mode.


-mlong64 (Refer to the m options for your targeted platform)

Allows long long types in your program.



Creates an output file that contains targets suitable for inclusion in a description file for the AIX make command.


Refer to alloc

(C only) Substitutes inline code for calls to function alloca as if #pragma alloca directives are in the source code.



(C only) Converts Pascal string literals into null-terminated strings where the first byte contains the length of the string.



Specifies whether the floating-point multiply-add instructions are to be generated.



Creates an output file that contains targets suitable for inclusion in a description file for the AIX make command.



Instructs the compiler to halt compilation when a specified number of errors of specified or greater severity is reached.



Limits the amount of memory used for local tables of specific, memory-intensive optimizations.

-qmbcs, dbcs


Use the -qmbcs option if your program contains multibyte characters.


-shared or libtool[6]

Creates a shared object from generated object files.



Selects the name mangling scheme for external symbol names generated from C++ source code.



Optimizes code at a choice of levels during compilation.



Specifies a name or directory for the output executable file(s) created by either the compiler or the linkage editor.



(C++) Sets the type of object model.



(C++) Specifies how classes containing const or reference members are passed in function arguments.



Preprocesses the C or C++ source files named in the compiler invocation and creates an output preprocessed source file for each input source file.



Sets up the object files produced by the compiler for profiling.



(C only) Ignores the word pascal in in type specifiers and function declarations.



Constructs alternate program and path names.



Tunes optimizations through Profile-Directed Feedback.



Sets up the object files for profiling, but provides more information than is provided by the -p option.



Reports the time taken in each compilation phase.



Suppresses listings.



(C++) Specifies the priority level for the initialization of static constructors.



Marks functions as local, imported, or unknown.



(C only) Assumes all functions are prototyped.



Attempts to inline functions instead of generating calls to a function.



Produces a relocatable object.



Instructs the compiler to produce transformation reports that show how program loops are parallelized and optimized.



Controls the compile-time rounding mode of constant floating-point expressions.



Specifies that the result of each single-precision float operation is to be rounded to single precision.



Specifies the storage type for string literals.



Specifies the storage location for constant values.



Prevents floating-point optimizations that are incompatible with runtime rounding to plus and minus infinity modes.



(C++) Generates runtime type identification (RTTI) information for the typeid operator and the dynamic_cast operator.



Generates an assembly language file (.s) for each source file.



Strips the symbol table.



If used with -qsource, all the include files are included in the source listing.



Instructs the compiler to reduce the size of the stack frame.



Enables parallelization of IBM SMP-compliant program code.



Produces a compiler listing and includes source code.



Specifies the size of the register allocation spill area.



Generates extra instructions to detect signaling NaN on conversion from single precision to double precision.



(C only) Adds the corresponding source code lines to the diagnostic messages in the stderr file.



(C ++) Controls whether inline functions are treated as static or extern.



Adds user-defined, nonexternal names that have a persistent storage class to the name list.


for C++ source)

Specifies which files are included with #include <file_name> and #include "file_name" directives.



Turns off aggressive optimizations of the -O3 option that have the potential to alter the semantics of your program.



Disables loop induction variable optimizations that have the potential to alter the semantics of your program.



Specifies compiler message numbers to be suppressed.



Sets symbol tables for unreferenced variables or xcoff objects.



(C only) Causes the compiler to perform syntax checking without generating an object file.



Changes the length of tabs as perceived by the compiler.



Sets traceback table characteristics.



(C++) Generates separate include files for template functions and class declarations and places these files in a directory that can be optionally specified.



(C ++) Helps manage dependencies between compilation units that have been compiled using the -qtemplateregistry compiler option.



(C++) Maintains records of all templates as they are encountered in the source and ensures that only one instantiation of each template is made.



(C++) Specifies the maximum number of template include files to be generated by the tempinc option for each header file.



Indicates that the program will run in a multithreaded environment.



(C++) Controls whether parsing and semantic checking are applied to template definition implementations.



Marks data as local.



Enables TOC merging to reduce TOC pointer loads and improves the scheduling of external loads.



Specifies the architecture for which the executable program is optimized.



(C++) Minimizes the number of static constructors included from libraries.



Undefines a specified identifier defined by the compiler or by the -D option.



(C++) Generates unique names for static constructor/deconstructor file compilation units.



Unrolls inner loops in the program.



Informs the compiler that the application does not rely on any program stack unwinding mechanism.



Preserves the unsigned specification when performing integral promotions.



Instructs the compiler to report information on the progress of the compilation in a command-like format.



Instructs the compiler to report information on the progress of the compilation.



(C++) Controls the generation of virtual function tables.



Passes the listed words to a designated compiler program.



Requests that warning messages be suppressed.



Enables warning of possible long to integer data truncations.



Generates code to static routines within a compilation unit as if they were external calls.



Produces a compiler listing that includes a cross-reference listing of all identifiers.



Specifies the compile-time rounding mode of constant floating-point expressions. See also rndflt.

[1] VisualAge C++ for AIX Compiler Reference (SC09-4959-00)

[2] GNU Compiler Collections version 3.4.2 (last updated May 23, 2004)

[3] These are all part of the GNU m machine-dependent options. Refer to the following link for specific platform compiler options:

[4] Refer to "Specifying attributes of types" in the GNU documentation:

[5] Part of GCC environment variables.

[6] As an alternative, GNU libtool could be used. Similar to the qmkshrobj option, libtool is also a script, but it provides a generic interface for building platform-independent libraries. Refer to for more information on using it.

[7] gcov is a tool you can use in conjuction with GNU CC to test and profile code coverage. For more information on gcov, refer to the GNU documentation.

UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175 © 2008-2017.
If you may any questions please contact us: