Specifying compiler options for architecture-specific compilation
You can use the -m32, -m64, and -mcpu compiler options to optimize the output of the compiler.
The compiler options optimize the output of the compiler to suit:
- The broadest possible selection of target processors
- A range of processors within a given processor architecture family
- A single specific processor
Generally speaking, the options do the following:
- -m32 selects 32-bit execution mode.
- -m64 selects 64-bit execution mode.
- -mcpu selects the general family processor architecture for which instruction code should be generated. Certain -mcpu settings produce code that will run only on systems that support all of the instructions generated by the compiler in response to a chosen -mcpu setting.
The compiler evaluates compiler options in the following order, with the last allowable one found determining the compiler mode:
- Internal default (32-bit mode)
- OBJECT_MODE environment variable setting
- Configuration file settings
- Command line compiler options (-m32, -m64, and -mcpu)
The compilation mode actually used by the compiler depends on a combination of the settings of the -m32, -m64, and -mcpu compiler options, subject to the following conditions:
- Compiler mode is set according to the last-found instance of the -m32 or -m64 compiler options. If neither of these compiler options is set, the compiler mode is set by the value of the OBJECT_MODE environment variable. If the OBJECT_MODE environment variable is also not set, the compiler assumes 32-bit compilation mode.
- Architecture target is set according to the last-found instance of the -mcpu compiler option, provided that the specified -mcpu setting is compatible with the compiler mode setting. If the -mcpu option is not set, the compiler sets -mcpu to the appropriate default based on the effective compiler mode setting.
The following list describes possible option conflicts and compiler resolution of these conflicts:
- Selected -mcpu options are
not known to the compiler. Resolution: The compiler issues an error message and stops the compilation.