Next: IA-64 Options, Previous: HPPA Options, Up: Submodel Options [Contents][Index]
These are the ‘-m’ options defined for the Intel IA-16 architecture.
-mtune=cpu-type
Tune to cpu-type everything applicable about the generated code, except for the ABI and the set of available instructions. The choices for cpu-type are:
The Intel 8086.
The Intel 8088.
The Intel 80186.
The Intel 80286.
The NEC V20.
The NEC V30.
Any CPU listed above. The aim is to generate code which runs reasonably well on any CPU listed above.
As with -mtune=any, but assume a CPU which supports immediate operands for push, imul and shift/rotate instructions.
-march=cpu-type
Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type.
-mmsdos
Produce executables for MS-DOS. This is the default.
-mmsdos-handle-v1
Produce executables for MS-DOS, in such a way that the executables will fail gracefully under MS-DOS version 1.x, rather than crash the system. This option implies -mmsdos.
-melks
-melks-libc
Produce executables for the Embeddable Linux Kernel Subset (ELKS) operating system. In addition, link against ELKS’s own C runtime library—which must be built with GCC, and installed—instead of the Newlib C library.
This option also turns on -mprotected-mode and -mcmodel=small.
-maout-stack=stack-size
-mstack-size=stack-size
When building an ELKS program (-melks), set it to request the operating system to reserve at least stack-size bytes in the data segment for the stack. This requires support from the linker back-end and from the linker script which comes with the C library.
-maout-heap=heap-size
When building an ELKS program (-melks), set it to request the operating system to reserve at least heap-size bytes in the data segment for the heap. This requires support from the linker back-end and from the linker script which comes with the C library.
-mcmodel=tiny
Generate code for the tiny code model, with a single combined data and text segment in a 64 KiB address space. This is the default for MS-DOS.
-mcmodel=small
-mseparate-code-segment
Generate code for the small code model, with one data segment and one text segment, in separate 64 KiB spaces. This is now (February 2020) the default for ELKS (-melks).
At the compile stage, -mcmodel=small currently disables trampolines for nested functions.
At the linking stage—unless -T is used—this option also causes
GCC to switch to a different output format to better support separate
segments. In particular, if targeting MS-DOS, GCC will produce an MZ
executable. (This requires support from the linker script which comes with
the C library.)
-msegment-relocation-stuff
-mno-segment-relocation-stuff
Enable (or disable) language features, such as static pointers to far variables, that rely on segment relocations to work. If the small code model is used, the default is to allow such language features.
-mshort-jumps
-mno-short-jumps
Allow (or disallow) the use of jump instructions which can only jump -128/+127 bytes. The default is not to use them. This option only affects instructions for which the assembler doesn’t provide a work-around and the compiler doesn’t know the jump displacement.
-mrtd
-mstdcall
Use a different function-calling convention, in which functions that
take a fixed number of arguments return with the ret num
instruction, which pops their arguments while returning. This saves one
instruction in the caller since there is no need to pop the arguments
there.
At the linking stage, this option will also make GCC link your code against the appropriate -mrtd multilib.
You can specify that an individual function is called with this calling
sequence with the function attribute stdcall
. You can also
override the -mrtd option by using the function attribute
cdecl
or regparmcall
. See IA-16 Function Attributes.
Warning: you must provide function prototypes for all functions that
take variable numbers of arguments (including printf
);
otherwise incorrect code is generated for calls to those
functions.
In addition, seriously incorrect code results if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.)
-mregparmcall
Use a different function-calling convention, in which functions receive
their first few arguments in the registers ax
, dx
, and
cx
, and pop their remaining arguments off the stack. An exception is
that, if the number of arguments to a function is variable, the ...
variable arguments will always go on the stack, and the calling function
pops all pushed arguments.
At the linking stage, -mregparmcall will also make GCC link your code against the appropriate -mregparmcall multilib.
You can specify that an individual function is called with this calling
sequence with the function attribute regparmcall
. You can also
override the -mregparmcall option by using the function attribute
cdecl
or stdcall
. See IA-16 Function Attributes.
Warning: you must provide function prototypes for all functions that
take variable numbers of arguments (including printf
);
otherwise incorrect code is generated for calls to those
functions.
In addition, seriously incorrect code results if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.)
-mno-callee-assume-ds-data-segment
-mcallee-assume-ds-data-segment
Use (or do not use) a different function-calling convention, in which the
ds
register is not assumed to point to the program’s data segment
(the generic address space) at function entry, and is treated as just an
ordinary call-used register (with -fcall-used-ds) or fixed
register (-ffixed-ds) with no special meaning.
The ss
register is still assumed to point to the data segment—data
items in the generic address space will be accessed via ss
.
This option is ignored if ds
is set to be a call-saved register
(-fcall-saved-ds).
In the default configuration (-mcallee-assume-ds-data-segment
-mcallee-assume-ss-data-segment -fcall-used-ds), functions can assume that
ds
points to the program’s data segment at function entry, and will
arrange to reset ds
to ss
—if needed—just before returning.
You can override this option for individual functions, by using the
assume_ds_data
and no_assume_ds_data
function attributes.
See IA-16 Function Attributes.
-mprotected-mode
Enable partial support for generating code to run in Intel 80286 protected mode.
With this option, the output code will avoid using segment registers
(ds
, es
) to hold arbitrary 16-bit values—in protected mode,
doing so may make the CPU crash the program. Instead, the output code will
only load segment registers when dereferencing near or far pointers.
Currently, -mprotected-mode also causes GCC to avoid placing
asm
operands in segment registers. You can tell GCC to let an
operand go into a segment register, by passing the operand through a
built-in function ‘__builtin_ia16_selector’:
void foo (unsigned selector) { __asm volatile ("nop" : : "e" (__builtin_ia16_selector (selector))); }
At the linking stage, -mprotected-mode will also make GCC link your code against library routines that are built to work with protected mode.
-mcmodel=medium
Generate code for the medium code model, with one data segment and multiple text segments, each in a separate 64 KiB space.
At the linking stage—unless -T is used—this option will also make GCC link your code against the appropriate medium model multilib, and switch to the appropriate output program format.
This option is currently not supported for C++. Also, medium model support for the ELKS target is incomplete.
-mnewlib-nano-stdio
If using the Newlib C library, link against a limited version of the
formatted I/O routines (stdio
) which supports only C89 functionality
and by default excludes floating-point support.
-mnewlib-autofloat-stdio
If using the Newlib C library, try to detect whether the program needs
floating-point support in the formatted I/O routines (stdio
), and
link against the appropriate version of the stdio
code.
If you use this option, specify it at compile time and during the final link.
-mdpmiable
Produce MS-DOS executables which try to use the DOS Protected Mode Interface (DPMI) to switch to and run in protected mode when they detect a DPMI host.
This option implies -mmsdos and -mprotected-mode, and requires support from the linker script which comes with the C library.
-msegelf
Generate object files which follow H. Peter Anvin’s proposed 16-bit segmented code ABI, https://git.zytor.com/users/hpa/segelf/abi.git/plain/segelf.txt.
Warning: The -msegelf switch causes GCC to generate code that is not binary compatible with code generated without that switch. Using this switch may require recompiling all other modules in a program, including system libraries.
-mno-callee-assume-ss-data-segment
Use a different function-calling convention, in which the ss
register
is not assumed to point to the program’s data segment at function entry.
This option exists only for testing.
-mno-far-function-if-far-return-type
Do not treat a function with a __far
return type as a far function.
See IA-16 Named Address Spaces.
-maout-total=total
When building an ELKS program (-melks), set it to request the operating system to set the top of the data segment—including static storage, heap, stack, and environment variables—to at least total. This requires support from the linker back-end and from the linker script which comes with the C library.
-maout-chmem=chmem
When building an ELKS program (-melks), set it to request the operating system to reserve at least chmem bytes in the data segment for non-static storage (such as heap, stack, and environment variables). This requires support from the linker back-end and from the script which comes with the C library.
__FAR
__SEG_SS
Each of these macros is defined only if the compiler supports the named address space specifier (see IA-16 Named Address Spaces).
__IA16_CMODEL_TINY__
__TINY__
__IA16_CMODEL_SMALL__
__SMALL__
__IA16_CMODEL_MEDIUM__
__MEDIUM__
Each of these macros is defined only if the named code model (tiny, small, or medium) is selected.
__IA16_ARCH_ANY
__IA16_ARCH_ANY_186
__IA16_ARCH_I8086
__IA16_ARCH_I8088
__IA16_ARCH_NEC_V30
__IA16_ARCH_NEC_V20
__IA16_ARCH_I80186
__IA16_ARCH_I80188
__IA16_ARCH_I80286
These macros are defined according to the -march=cpu-type option settings.
__IA16_TUNE_I8086
__IA16_TUNE_I8088
__IA16_TUNE_NEC_V30
__IA16_TUNE_NEC_V20
__IA16_TUNE_I80186
__IA16_TUNE_I80188
__IA16_TUNE_I80286
These macros are defined according to the -mtune=cpu-type and option settings.
__IA16_FEATURE_SHIFT_IMM
__IA16_FEATURE_PUSH_IMM
__IA16_FEATURE_IMUL_IMM
__IA16_FEATURE_PUSHA
__IA16_FEATURE_ENTER_LEAVE
__IA16_FEATURE_AAD_IMM
__IA16_FEATURE_FSTSW_AX
Each of these macros is defined only if the CPU selected by -march=cpu-type supports the named type of IA-16 instruction.
__IA16_FEATURE_SHIFT_MASKED
This macro is defined only if the selected CPU’s bitwise shift and rotation
instructions—rcl
, shr
, and so on—implicitly mask each
shift count to their lower 5 bits.
__IA16_FEATURE_PROTECTED_MODE
This macro is defined only if -mprotected-mode is in effect.
__IA16_FEATURE_DPMIABLE
This macro is defined only if -mdpmiable is in effect.
__IA16_FEATURE_ALLOCABLE_DS_REG
This macro is defined only if the ds
register is configured to be
available for register allocation—that is, it is either call-used or
call-saved, not fixed.
__IA16_FEATURE_FAR_FUNCTION_SYNTAX
This macro is defined only if the postfix __far
syntax for declaring
far functions is supported (see IA-16 Named Address Spaces).
__IA16_CALLCVT_FAR_FUNCTION_IF_FAR_RETURN_TYPE
This macro is defined only if the classical syntax for declaring far functions is supported (see IA-16 Named Address Spaces).
__IA16_FEATURE_FAR_STATIC_STORAGE
This macro is defined only if static storage variables can be placed in
__far
space (see IA-16 Named Address Spaces).
__IA16_FEATURE_ATTRIBUTE_CDECL
__IA16_FEATURE_ATTRIBUTE_STDCALL
__IA16_FEATURE_ATTRIBUTE_REGPARMCALL
__IA16_FEATURE_ATTRIBUTE_ASSUME_DS_DATA
__IA16_FEATURE_ATTRIBUTE_NO_ASSUME_DS_DATA
__IA16_FEATURE_ATTRIBUTE_RESTORE_DS
__IA16_FEATURE_ATTRIBUTE_NO_ASSUME_SS_DATA
__IA16_FEATURE_ATTRIBUTE_NEAR_SECTION
__IA16_FEATURE_ATTRIBUTE_FAR_SECTION
Each of these macros is defined only if the corresponding function attribute is supported (see IA-16 Function Attributes).
__BUILTIN_IA16_SELECTOR
__BUILTIN_IA16_FP_OFF
__BUILTIN_IA16_NEAR_DATA_SEGMENT
__BUILTIN_IA16_SS
Each of these macros is defined only if the corresponding
__builtin_ia16_
… macro is defined (see IA-16 Built-in Functions).
Next: IA-64 Options, Previous: HPPA Options, Up: Submodel Options [Contents][Index]