6.31.10 IA-16 Function Attributes

These function attributes are supported by the IA-16 back end:

cdecl

On the IA-16 target, the cdecl attribute causes the compiler to assume that the function’s caller pushes arguments onto the stack, and pops off the stack space used to pass arguments. This is the default function calling convention if neither of the options -mrtd or -mregparmcall is specified (see IA-16 Options). For more information on this default convention, See Default IA-16 Calling Convention.

Specifying this function attribute is useful to override the effects of a -mrtd or -mregparmcall switch.

stdcall

On the IA-16 target, the stdcall attribute causes the compiler to assume that the function’s caller pushes arguments onto the stack, and the function itself (the callee) pops off the stack space used to pass arguments, unless it takes a variable number of arguments.

regparmcall

On the IA-16 target, the regparmcall attribute causes the compiler to pass its first few arguments to the function in the registers ax, dx, and cx, instead of on the stack. The called function pops the remaining arguments off the stack.

An exception is that, if the number of arguments is variable, the ... variable arguments will always go on the stack, and the calling function pops all pushed arguments.

assume_ds_data

This attribute, attached to a function, causes the compiler to assume that the ds register points to the program’s data segment on function entry. The function will also arrange to restore ds to the same data segment on function exit.

Use this attribute to override the -mno-callee-assume-ds-data-segment switch for a function.

This attribute has no effect if ds is a call-saved register (-fcall-saved-ds).

no_assume_ds_data

This attribute, attached to a function, causes the compiler not to assume that ds points to the program’s data segment on function entry. It has no effect if -ffixed-ds or -fcall-saved-ds is used.

By default, no_assume_ds_data also means the function will save the value of ds on entry, and restore it on exit. To allow the function to clobber ds, you can specify the no_save_ds attribute as well.

no_save_ds

This attribute, attached to a function, means that the function is allowed to clobber ds, and callers cannot assume that the function will preserve it. This is mostly useful in conjunction with the no_assume_ds_data attribute.

This attribute has no effect if -ffixed-ds or -fcall-saved-ds is used.

save_es

This attribute, attached to a function, means that the function is not allowed to clobber es.

Specifying this function attribute is useful to override the effects of a -fcall-used-es switch.

save_all

Use this attribute to indicate that, except for registers which hold the function’s return values, all registers that the function modifies—including possibly the flags register—should be saved in the prologue.

Warning: This feature is experimental, and may produce broken code. Use with caution.

no_assume_ss_data

This attribute, attached to a function, causes the compiler not to assume that ss points to the program’s data segment on function entry. The function’s stack parameters and variables are considered to be in a separate __seg_ss address space. See IA-16 Named Address Spaces.

Warning: This feature is experimental, and may produce broken code. Use with caution.

interrupt

Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.

This attribute is only supported for void functions.

By default, interrupt functions do not assume any particular values for ds or ss. You can combine interrupt with the assume_ds_data and/or assume_ss_data attributes if you know—with absolute certainty—that the interrupt handler will only be invoked while ds or ss (respectively) points to the program’s data segment.

Warning: This feature is experimental, and may produce broken code. Use with caution.

pascal

On the IA-16 target, the pascal attribute causes the compiler to assume that the function’s caller pushes arguments onto the stack, from first to last, and the function itself (the callee) pops off the stack space used to pass arguments. A function that takes a variable number of arguments cannot use this attribute.

Warning: This feature is experimental, and may produce broken code. Use with caution.

near_section

This attribute, attached to a far function declaration, tells GCC that the function is known to reside in the program’s text segment. See IA-16 Named Address Spaces.

far_section

This attribute, attached to a far function definition, tells GCC to place the function outside the normal text segment. See IA-16 Named Address Spaces.