Specifying compiler options for architecture-specific 32-bit or 64-bit compilation
You can use z/OS® XL C/C++ compiler options to optimize compiler output for use on specific processor architectures. You can also instruct the compiler to compile in either 32-bit or 64-bit mode.
The compiler evaluates compiler options in the following order, with the last allowable one found determining the compiler mode:
- Compiler default (32-bit mode)
- Configuration file settings
- Command line compiler options (-q32, -q64, -qarch, -qtune)
- Source file statements (#pragma options(ARCH(suboption),TUNE(suboption)))
The compilation mode actually used by the compiler depends on a combination of the settings of the -q32, -q64, -qarch, and -qtune compiler options, subject to the following conditions:
- Compiler mode is set according to the last-found instance of the -q32, or -q64 compiler options. If neither of these compiler options is chosen, the compiler mode is set to 32-bit.
- Architecture target is set according to the last-found instance of the -qarch
compiler option, provided that the specified -qarch setting is compatible with
the compiler mode setting. If the -qarch option is not set, the compiler assumes
a -qarch setting of
5
. - Tuning of the architecture target is set according to the last-found instance of the -qtune compiler option, provided that the -qtune setting is compatible with the architecture target and compiler mode settings. If the -qtune option is not set, the compiler assumes a default -qtune setting according to the -qarch setting in use.
Possible option conflicts and compiler resolution of these conflicts are described below:
- -q32 or -q64 setting is incompatible with user-selected
-qarch option.
Resolution: -q32 or -q64 setting overrides -qarch option; compiler issues a warning message, sets -qarch to
5
, and sets the -qtune option to the -qarch setting's default -qtune value. - -q32 or -q64 setting is incompatible with user-selected
-qtune option.
Resolution: -q32 or -q64 setting overrides -qtune option; compiler issues a warning message, and sets -qtune to the -qarch settings's default -qtune value.
- -qarch option is incompatible with user-selected -qtune
option.
Resolution: Compiler issues a warning message, and sets -qtune to the -qarch setting's default -qtune value.
- Selected -qarch and -qtune options are not known to the
compiler.
Resolution: Compiler issues a warning message, sets -qarch to
5
, and sets -qtune to the -qarch setting's default -qtune setting. The compiler mode (32 or 64-bit) is determined by the -q32 or -q64 compiler settings.