Home » Support » AIX C Compiler Options


xlc - C for AIX Compiler Options



xlc - C for AIX Compiler

  Usage:
     xlc [ option | inputfile ]...
     cc [ option | inputfile ]...
     c89 [ option | inputfile ]...
     xlc128 [ option | inputfile ]...
     cc128 [ option | inputfile ]...
     xlc_r [ option | inputfile ]...
     cc_r [ option | inputfile ]...
     xlc_r4 [ option | inputfile ]...
     cc_r4 [ option | inputfile ]...
     xlc_r7 [ option | inputfile ]...
     cc_r7 [ option | inputfile ]...

  Description:
     The xlc and related commands compile C source files.
     They also processes assembler source files and object files. Unless the
     -c option is specified, xlc calls the linkage editor to produce a
     single object file. Input files may be any of the following:
       1. file name with .c suffix: C source file
       2. file name with .i suffix: preprocessed C source file
       3. file name with .so suffix: shared object file
       4. file name with .o suffix: object file for ld command
       5. file name with .s suffix: assembler source file

  Options:
     Options can be flag options or keyword options:

       1. Flag options:

        -#        Display language processing commands but do
                  not invoke them; output goes to stdout.
        -bdynamic, -bstatic
                  Determines which types of library files are searched by
                  the linkage editor.
        -brtl     Tells the linkage editor to accept both .so and .a
                  library file types.
        -B{prefix}
                  Construct alternate compiler/assembler/linkage editor
                  program names. {prefix} is added to the beginning of
                  the standard program names.
        -c        Do not send object files to the linkage editor.
        -C        Write comments to output when doing preprocessing,
                  used with -E and -P.
        -D{name}[={def}]
                  Define {name} as in #define directive. If {def} is
                  not specified, 1 is assumed.
        -E        Preprocess but do not compile; output goes to stdout
        -F{x}[:{stanza}]
                  Use alternate configuration file {x} with optional
                  {stanza}. If {stanza} is not specified, xlc is
                  assumed.
        -g        Produce information for the debugger.
        -I{dir}   Search in directory {dir} for include files that
                  do not start with an absolute path.
        -l{key}   Search the specified library file,
                  where {key} selects the file lib{key}.a.
        -L{dir}   Search in directory {dir} for files specified by -l{key}.
        -ma       Generate inline calls to the "alloca" function as if
                  "#pragma alloca" directives were in the source file.
        -M        Generate information to be included in a "make"
                  description file; output goes to .u file.
        -o{name}  Name the executable file {name} instead of a.out.
                  When used with the -c option and one source file,
                  name the object file {name} instead of filename.o.
                  If {name} is the name of a directory, files generated by
                  the compiler will be placed into that directory.
        -O        Optimize generated code.
        -O2       Equivalent level of optimization as -O in the
                  previous release.
        -O3       Perform some memory and compile time intensive
                  optimizations in addition to those executed with -O2.
                  The -O3 specific optimizations have the potential to
                  alter the semantics of a user's program.
                  The compiler guards against these optimizations at -O2
                  and the option -qstrict is provided at -O3 to turn off
                  these aggressive optimizations.
        -O4       Equivalent to -O3 -qipa with automatic generation of
                  architecture and tuning option ideal for that platform.
        -p        Generate profiling support code.
        -pg       Generate profiling support code including BSD
                  profiling support.
        -P        Preprocess but do not compile; output goes to .i file.
        -Q{x}, -qinline{x}
                  Inline all appropriate functions where x can be
                  one of the following:
                    !       Not inline any function
                    ={lc}   Inline if number of source statement in
                            function is less than the number specified
                            in {lc}.
                    -{nm}   Not inline function listed by names in {nm}
                    +{nm}   Attempt to inline function listed by names
                            in {nm}.
        -r        Permits the output file to be produced even if it
                  contains unresolved symbols.
        -S        Produce a .s file for any source file processed by the
                  compiler.
        -t{x}     Apply prefix from the -B option to the specified program {x},
                  where x can be one or more of the following:
                    p = preprocessor
                    c = compiler frontend
                    b = compiler backend
                    i = compiler inliner
                    a = assembler
                    l = linkage editor.
                    m = 'munch' utility
                    I = inter procedural analysis - compile phase
                    L = inter procedural analysis - link phase
        -U{name}  Undefine name as in #undef directive.
        -v        Displays language processing commands as they
                  are invoked by xlC; output goes to stdout.
        -w        Suppress informational, language-level, and
                  warning messages.
        -W{x,y}   Give the options {y} to the compiler program {x}
                  where x can be one or more of the following:
                    {p,c,b,i,a,l,I,L,m}
        -y{x}     Specify compile-time rounding of constant floating-point
                  expressions, where {x} can be one of the following:
                    n = round to nearest
                    m = round toward minus infinity
                    p = round toward positive infinity
                    z = round toward zero.

       2. Keyword options:

          Keyword options are specified in one of the following ways:

          -q{option}
          -q{option}={parameter}
          -q{option}={parameter}:{parameter}

          where {option} is an option name and {parameter} is a
          parameter value.
          Keyword options with no parameters represent switches
          that may be either on or off. The keyword by itself turns
          the switch on, and the keyword preceded by the letters NO
          turns the switch off. For example, -qLIST tells the
          compiler to produce a listing and -qNOLIST tells the
          compiler not to produce a listing. If an option that
          represents a switch is set more than once, the compiler
          uses the last setting.

          Keyword option and parameter names may appear in either
          UPPER CASE or lower case letters in the ixlc command.

          Options without parameters:

          32          Selects 32-bit compiler mode.
          64          Selects 64-bit compiler mode.
          ansialias   Use type-based aliasing during optimization.
          attr        Produce an attribute listing containing only
                      referenced names; output goes to .lst file.
          compact     Reduce code size where possible, at the expense
                      of execution speed.  Code size is reduced by
                      inhibiting optimizations that replicate or expand
                      code inline.
          cpluscmt    Permit "//" to introduce a comment that lasts
                      until the end of the current source line, as in C++.
          dbcs        String literals and comments can contain DBCS
                      characters (same as mbcs option).
          dbxextra    Generate symbol table information for unreferenced
                      variables. By default such information is not generated
                      thus reducing the size of the executable compiled with
                      the "-g" option.
          digraph     Allow special digraph
          dollar      Allow '$' as an identifier character
          extchk      Perform external name type-checking and function
                      call checking.
          fdpr        Collect information about programs for use with
                      the AIX fdpr (Feedback Directed Program Restructuring)
                      performance-tuning utility.
          funcsect    Place instructions for each function in a separate csect.
          flttrap     Generate instructions to trap floating-point
                      exceptions.
          fold        Specifies that constant floating-point expressions
                      are to be evaluated at compile time.
          fullpath    Specifies the path information stored for files when
                      you use "-g" and the symbolic debugger (dbx).
          heapdebug   Enables debug versions of memory management functions.
          idirfirst   Specify the search order for files included with
                      the #include "file_name" directive.  Use -qidirfist
                      with the -Idirectory option.  If -qidirfirst option
                      is specified, the directories specified by the
                      -Idirectory option are searched before the directory
                      where the current file resides.
          ignerrno    Tell the optimizer that the program will never
                      refer to or set errno.  This allows additional
                      optimizations.
          inlglue     Generate fast external linkage by inlining the
                      code (pointer glue code) necessary at calls
                      via a function pointer and calls to external
                      procedures.
          ldbl128     Increase long double size from 64 to 128 bits.
          libansi     Assumes hat all functions with th ename of an
                      ANSI C library functions are in fact the system functions.
          linedebug   Generates abbreviated line number and source file name
                      information for the debugger.
          list        Produce an object listing; output goes to .lst file.
          listopt     Display the settings of all options; output goes
                      to .lst file.
          longdouble  Increase long double size from 64 to 128 bits.
          longlong    Allow long long integers.
          macpstr     Allow '\p' as the first character of a string constant
                      which will be replaced by the length in bytes.
          makedep     Creates an output file that contains targets suitable for
                      inclusion in a description file for the AIX make command.
          maxerr      Instructs the compiler to halt compilation when a
                      specified number of errors of specified or greater
                      severity is reached.
          mbcs        String literals and comments can contain DBCS
                      characters (same as dbcs option).
          noprint     Direct listing to /dev/null.
          nostdinc    Specify which files are included with the #include
                      "file_name" and #include {file_name} directives.
                      If -qnostdinc is specified, the /usr/include directory
                      is not searched.
          once        Only process each include file one time.
                      The default is -qnoonce.
          optimize    Same as O, and O2. Perform optimization that is the
                      mix between speed and size.
          pascal      Accept and ignore the keyword 'pascal' as a
                      type modifier.
          pdf1, pdf2  Perform aggressive optimizations with profile
                      directed feedback.
          phsinfo     Produce compiler phase information; output goes to
                      stdout.
          proto       Assert that procedure call points agree
                      with their declarations even if the procedure has
                      not been prototyped. This allows the caller to
                      pass floating point arguments in floating point
                      registers instead of general purpose registers.
          ro          Put string literals in read only area.
          roconst     Put constant values in read only area.
          showinc     Include the source of all included files in the
                      source listing, if the SOURCE option is in effect.
          source      Produce a source listing; output goes to .lst file.
          srcmsg      Reconstruct source lines in error along with the
                      diagnostic messages in the stderr file.
          statsym     Adds user-defined, nonexternal names that have a
                      persistent storage class, such as initialized and
                      uninitialized static variables, to the name list
                      (the symbol table of xcoff objects).
          strict      Turns off aggresive optimizations which have the
                      potential to alter the semantics of a user's program.
                      This option also sets -qfloat=nofltint:norsqrt.
          strict_induction
                      Turns off induction variable optimizations that have
                      the potential to alter the semantics of a user's program.
                      Use this option only if your program contains overflows or
                      wrap arounds of loop induction variables.
          syntaxonly  Causes the compiler to perform syntax checking without
                      generating an object file.
          upconv      Preserves the unsigned specification when performing
                      integral promotions.
          warn64      Enables checking for possible long-to-integer truncation.
          xcall       Generate code to static routines within a compilation
                      unit as if they were external routines.
          xref        Produce a cross-reference listing containing
                      only referenced names.

          Options with parameters:

          alias={option}
                      Specifies the aliasing assertion to be applied to
                      your compilation unit.
                      The available options are:
                      typ     Pointers to different types are never aliased.
                      allp    Pointers are never aliased.
                      addr    Variables are disjoint from pointers
                              unless their address is taken.
                      ansi    Pointers can only point to an object of the
                              same type. Require -O option.
          align={algnopt}
                      power   The compiler uses the RISC System/6000
                              alignment rules.
                      full    The compiler uses the RISC System/6000
                              alignment rules. This is the same as power.
                      mac68k  The compiler uses the Macintosh**
                              alignment rules.
                      twobyte The compiler uses the Macintosh alignment rules.
                              The mac68k option is the same as twobyte.
                      packed  The compiler uses the packed alignment rules.
                      natural The compiler maps structure members to
                              their natural boundaries.
          arch={option}
                      Specifies the architecture on which the executable
                      program will be run.
                      The available options are:
                      com     Produce an object that contains instructions
                              that will run on all the POWER and PowerPC
                              hardware platforms.
                      pwr     Produce an object that contains instructions
                              that will run on the POWER hardware
                              platform.
                      pwr2    Produce an object that contains instructions
                              that will run on the POWER2 hardware
                              platform.
                      pwrx    Same as pwr2.
                      ppc     Produce an object that contains instructions
                              that will run on any of the 32-bit PowerPC
                              hardware platforms.
                      ppcgr   Produce an object that contains optional
                              graphics instructions for PowerPC processors.
                      pwr2s   Produce an object that contains instructions
                              that will run on a pwr2s chip.
                      p2sc    Produce an object that contains instructions
                              that will run on a p2sc chip.
                      601     Produce an object that contains instructions
                              that will run on a 601 chip.
                      602     Produce an object that contains instructions
                              that will run on a 602 chip.
                      603     Produce an object that contains instructions
                              that will run on a 603 chip.
                      604     Produce an object that contains instructions
                              that will run on a 604 chip.
                      403     Produce an object that contains instructions
                              that will run on a 403 chip.
                      rs64a   Produce an object that contains instructions
                              that will run on a rs64a chip.
                      rs64b   Produce an object that contains instructions
                              that will run on a rs64b chip.
                      The default is -qarch=com.  If the -qarch option is
                      specified without the -qtune={option}, the compiler
                      uses -qtune=pwr.
          assert={option}
                      Specifies the aliasing assertion to be applied to
                      your compilation unit.
                      The available options are:
                      typ     Pointers to different types are never aliased.
                      allp    Pointers are never aliased.
                      addr    Variables are disjoint from pointers
                              unless their address is taken.
          attr=full   Produce an attribute listing containing all names,
                      whether referenced or not; output goes to .lst file.
          bitfields=signed
          bitfields=unsigned
                      Specify whether bitfields will be signed or unsigned.
          chars=signed
          chars=unsigned
                      Specify whether the data type char will be signed
                      or unsigned.
          check={option}
                      Generate code to check for run-time checks.
                      nullptr  Runtime checking of addresses
                               contained in pointer variables used to
                               reference storage.
                      bounds   Runtime checking of addresses when
                               subscripting within an object of known size.
                      divzero  Runtime checking of integer division.
                               A trap will occur if an attempt is made to
                               divide by zero.
                      all      Switches on all the above suboptions.
          dataimported={name1}:{name2}: ...
                      Specify which data items are imported.  If no names are
                      specified, all data items are assumed to be imported.
                      This is the default.
          datalocal={name1}:{name2}: ...
                      Specify which data items are local.  If no names are
                      specified, all data items are assumed to be local.
          enum={enumopt}
                      Specify whether minimum-sized enumerated types will be
                      produced or not. {enumopt} can be either small, int,
                      1, 2 or 4.
                      small denotes that either one, two or four bytes of
                      storage will be allocated for enum variables based on
                      the range of the enum constants.
                      int is the default, and causes enum variables to be
                      treated as though they were of type signed int
                      depending on the range of the enum constants.
                      1 will cause enum variables to be packed into 1 byte.
                      2 will cause enum variables to be packed into 2 bytes.
                      4 will cause enum variables to be packed into 4 bytes.
          flag={sev1}
                      Specify severity level of diagnostics to be reported
                      in source listing and stderr; the severity level
                      is one of {i,w,e,s,u}.
          flag={sev1}:{sev2}
                      Specify severity level of diagnostics to be reported
                      in source listing ({sev1}), and stderr ({sev2});
                      the severity levels are one of {i,w,e,s,u}.
          float={opt1}:{opt2}:...:{optN}
                      The available options are:
                      emulate  Function calls are emitted in place of
                               PowerPC floating-point instructions.
                               Use this option only in a single-threaded
                               stand-alone environment, targeting the
                               PowerPC 403 processor.
                               Do not use this suboption with any of the
                               following:
                               o  -qarch=pwr, -qarch=pwr2, -qarch=pwrx
                               o  -qlongdouble, -qldbl128
                               o  xlC128, xlc128 invocation commands
                      fltint   Specify whether range checking of floating
                               point to integer conversions is done.
                               Default at -O2: -qfloat=nofltint.
                               Default at -O3: -qfloat=fltint.
                      hsflt    Never round single-precision expressions,
                               and don't perform range checking for
                               floating-point to integer conversions.
                      hssngl   Round single-precision expressions only
                               when the results are stored into REAL*4 memory
                               locations.
                      nans     Detect conversion of single-precision NaNS to
                               double precision call checking.
                      nomaf    Suppress generation of multiply-add
                               instructions.
                      nofold   Suppress compile-time evaluation of constant
                               floating-point expressions.
                      rndsngl  Ensure strict adherence to IEEE standard.
                               all operations on single-precision values
                               produce results that remain in single
                               precision.
                      rrm      Specify run-time rounding mode. Compile with
                               this option if the run-time rounding mode
                               is round toward minus infinity, round toward
                               positive infinity, or not known.
                      rsqrt    Specify whether a division by the result of a
                               square root can be replaced with a multiply
                               by the reciprocal of the square root.
                               Default at -O2: -qfloat=norsqrt.
                               Default at -O3: -qfloat=rsqrt.
                      spnans   Generate extra instructions to detect signalling
                               NaN on conversion from single precision to
                               double precision.  Obsolete; use the equivalent
                               -qfloat=nans option.
          flttrap={opt1}:{opt2}:...:{optN}
                      Generate instructions to detect and trap floating-point.
                      The available options are:  overflow, underflow,
                      zerodivide, invalid, inexact, enable, imprecise.
          halt={sev}  Stop compiler after first phase if severity of errors
                      detected equals or exceeds {sev}; the severity
                      level is one of i, w, e, s, u.
          genpcomp[=dirname]
                      Generate precompiled include files.  See C for AIX online
                      documentation for details.
          genproto={parmnames}
                      Produces ANSI prototypes from K&R function definitions.
          ignprag=disjoint
          ignprag=isolated
          ignprag=all
                      Ignore the aliasing pragmas disjoint and/or
                      isolated_call.
          info
          info=all
                      Produce additional lint-like messages. Turns on all
                      diagnostic messages for all groups.
          info={group}
                      Produce additional lint-like messages based on {group}.
                      cmp      Possible redundancies in unsigned comparisons
                      cnd      Possible redundancies or problems in conditional
                               expressions
                      cns      Operations involving constants.
                      cnv      Conversions
                      dcl      Consistency of declarations
                      eff      Statements with no effect
                      enu      Consistency of enum variables
                      ext      Unused external definitions
                      gen      General diagnostic messages
                      gnr      Generation of temporary variables
                      got      Use of goto statements
                      ini      Possible problems with initialization
                      inl      Functions not inlined
                      lan      Language level effects
                      obs      Obsolete features
                      ord      Unspecified order of evaluation
                      par      Unused parameters
                      por      Nonportable language constructs
                      ppc      Possible problems with using the preprocessor
                      ppt      Trace of preprocessor actions
                      pro      Missing function prototypes
                      rea      Code that cannot be reached
                      ret      Consistency of return statements
                      trd      Possible truncation or loss of data or precision
                      tru      Variable names truncated by the compiler
                      uni      Unitialized variables
                      use      Unused auto and static variables
                      vft      Generation of virtual function tables
                      private  Lists shared variables made private to a parallel
                               loop.
                      reduction
                               Lists all variables that are recognized as
                               reduction variables inside a parallel loop.
          initauto={hh}
                      Initialialize automatic storage to {hh}. {hh} is a
                      hexadecimal value.  This generates extra code and
                      should only be used for error determination.
          inline={x}  This is functionally equivalent to the -Q option.
          ipa[={ipa_options}]
                      Turn on inter-procedural analysis.  See C for AIX
                      online documentation for details.
          isolated_call={name1}:{name2}: ...
                      Specify that the calls to the functions listed have no
                      side effects. {name1} and {name2} are function names.
                      The user may specify as many function names as
                      necessary.
          langlvl={langlvl}
                      Specify language level to be used during compilation.
                      {langlvl} can be ansi, saal2, saa, extended, or classic.
          maxmem={num}
                      Limit the amount of memory used by space intensive
                      optimizations to {num}.  {num} specified in kilobytes.
                      prioriry=NNN
          optimize
                      Same as -O. Optimize generated code using the best
                      best combination for speed and size.
          optimize={level}
                      Enables different levels of optimization.
                      2       Same as -O and -qoptimize.
                      3       Same as -O3. Aggresive optimization.
                      4       Same as -O4. Internally generates -O3 -qipa with
                              with automatic architecture and tuning option
                              generation.
          proclocal={name1}:{name2}: ...
                      Specify which functions are local.
                      If no filenames are specified, all invoked functions
                      are assumed to be defined whithin the current file.
                      The last explicit specification for a function takes
                      precedence.
          procimported={name1}:{name2}: ...
                      Specify which functions are imported.  If no filenames
                      are specified, all invoked functions are assumed to be
                      defined outside the current file.  The last explicit
                      specification for a function takes precedence.
          procunknown={name1}:{name2}: ...
                      Specify which functions are unknown to be local or
                      imported.  If no filenames are specified, all functions
                      called are assumed to be unknown. This is the default
                      when no user options are specified. The last explicit
                      specification for a function takes precedence.
          smp[=suboption[:suboption] [ ... ]]
                      [no]auto       Enables or disables automatic parallelization.
                      [no]explicit   Enables or disables explicit parallelization.
                      schedule={sched_type}[=n]
                                     Specifies what kind of scheduling algorithms
                                     and chunking are used for loops to which no
                                     other scheduling algorithm has been explicitly
                                     assigned in the source code. Valid options for
                                     {sched_type} are:
                                         * dynamic[=n]
                                         * guided[=n]
                                         * static[=n]
                                         * affinity[=n]
                                         * runtime
                                     For more information, see C for AIX online
                                     documentation.
                      [no]nested_par Enables or disables parallelization of
                                     nested parallel constructs.
                      [no]rec_locks  Specifies whether recursive or regular locks
                                     should be used to implement critical sections.
          spill={size}
                      Specify the size of the register allocation spill
                      area.
          tabsize={size}
                      Changes the length of tabs in your source file.
          tbtable={option}
                      Generate a traceback table for each function and
                      place it in the text segment at the end of the
                      function code.
                      The available options are:
                      none    No traceback table is generated.
                      full    A full traceback table is generated.
                              This is the default with -g specified.
                      small   A traceback table is generated with no name or
                              parameter information.
                              This is the default when -g is NOT specified.
          tune={option}
                      Specifies the architecture system for which the
                      executable program is optimized.
                      The available options are:
                      403    Produce an object optimized for all the
                             PowerPC 403 processors.
                             Use -qfloat=emulate to emulate the floating-point
                             instructions omitted by the 403 processor.
                      601    Produce an object optimized for all the
                             PowerPC 601 processors.
                      602    Produce an object optimized for all the
                             PowerPC 602 processors.
                      603    Produce an object optimized for all the
                             PowerPC 603 processors.
                      604    Produce an object optimized for all the
                             PowerPC 604 processors.
                      p2sc   Produce an object optimized for all the
                             p2sc processors.
                      pwr    Produce an object optimized for the POWER
                             hardware platform.
                      pwr2   Produce an object optimized for the
                             POWER2 hardware platform.
                      pwr2s  Produce an object optimized for the
                             POWER2 hardware platform, avoiding certain
                             quadruple-precision instructions that would
                             slow program performance.

                      pwrx   Same as pwr2.
                      rs64a  Produce an object optimized for the rs64a
                             processor.
                      rs64b  Produce an object optimized for the rs64b
                             processor.
          unroll[=n]  Allow the optimizer to unroll loops.
          usepcomp[=dirname]
                      Use precompiled include files.  See C for AIX online
                      documentation for details.
          wait[={seconds}]
                      Specify the number of seconds to wait for a LUM
                      license to become available.  The default is to wait
                      forever.
          xref=full   Produce a cross-reference listing containing
                      all names, whether referenced or not; output goes
                      to .lst file.

  For a detailed description of each option, please refer to the
  C for AIX online documentation.