SPRAB89A September 2011 – March 2014
The abstract conventions designate variables as either near or far, as follows:
Toolchains may support other models but must minimally support these three. Interoperability with other toolchains may or may not be achievable if other models are used.
In the cases where the designation depends on toolchain-specific aspects like command-line options or language extensions, the onus is on the programmer to use these constructs consistently wherever the variable is declared, but on the linker to catch errors (see Section 4.3.2.3).
The ABI establishes conventional assignments of variables to sections. A variable's assignment is a function of its near/far designation and its initialization category, as determined by the first matching condition from the following list.
The conventional section assignment is given by Table 4-1:
Initialization category | |||
---|---|---|---|
Designation | Uninitialized | Initialized | Const |
near | .bss | .neardata | .rodata |
far | .far | .fardata | .const |
The conventional assignments may be overridden in toolchain-specific ways. For example, variables may be assigned to user-defined sections. However, the toolchain must not allow users to place variables designated as far into any of the three near sections.