This option allocates variables to sections separated according to the number of alignment.
[Specification format]
-stuff[=<variable-type>[,...]]
<variable-type> : { bss | data | const }
|
- | Interpretation when omitted |
Variables are allocated without separating sections.
[Detailed description]
- | This option allocates the variables belonging to the specified <variable-type> to sections separated according to the number of alignment. |
- | bss specifies uninitialized variables, data specifies initialized variables, and const specifies const variables. |
- | If <variable-type> is omitted, all types of variables are applicable. |
- | If this option is specified multiple times, all specified types of variables are applicable. |
- | If the same variable type is specified multiple times, the compiler handles this as one specification. For this, no warning is issued. |
- | If anything other than bss, data, and const is specified for <variable-type>, an error occurs. |
- | Variables are output to a section whose section name has <number-of-alignment>.
However, if the number of alignment is 2, "_2" is not added to a section name. |
Examples:
When the number of alignment of variables is 2: .bss
When the number of alignment of variables is 1: .bss_1
[Example of use]
// near area
const char __near c_n = 1;
const short __near s_n = 2;
const long __near l_n = 3;
// far area
const char __far c_f = 1;
const short __far s_f = 2;
const long __far l_f = 3;
|
|
|
.SECTION .const,CONST
_c_n:
.DB 0x01
.ALIGN 2
_s_n:
.DB2 0x0002
.ALIGN 2
_l_n:
.DB4 0x00000003
.SECTION .constf,CONSTF
_c_f:
.DB 0x01
.ALIGN 2
_s_f:
.DB2 0x0002
.ALIGN 2
_l_f:
.DB4 0x00000003
|
.SECTION .const_1,CONST,align=1
_c_n:
.DB 0x01
.SECTION .const,CONST
.ALIGN 2
_s_n:
.DB2 0x0002
.ALIGN 2
_l_n:
.DB4 0x00000003
.SECTION .constf_1,CONSTF,align=1
_c_f:
.DB 0x01
.SECTION .constf,CONSTF
.ALIGN 2
_s_f:
.DB2 0x0002
.ALIGN 2
_l_f:
.DB4 0x00000003
|
[Remark]
- | Each section name reflects the following options or specification in #pragma section: |
-memory_model, -far_rom