SPNU151V January 1998 – February 2020
.sect ".cinit" ; Initialization section
* Initialization record for variable i
.align 4 ; align on word boundary
.field 4,32 ; length of data (1 word)
.field _i+0,32 ; address of i
.field 23,32 ; _i @ 0
* Initialization record for variable a
.sect ".cinit"
.align 4 ; align on word boundary
.field IR1,32 ; Length of data (5 words)
.field _a+0,32 ; Address of a[ ]
.field 1,32 ; _a[0] @ 0
.field 2,32 ; _a[1] @ 32
.field 3,32 ; _a[2] @ 64
.field 4,32 ; _a[3] @ 96
.field 5,32 ; _a[4] @ 128
IR1: .set 20 ; set length symbol
The .cinit section must contain only initialization tables in this format. When interfacing assembly language modules, do not use the .cinit section for any other purpose.
The table in the .pinit section simply consists of a list of addresses of constructors to be called (see Figure 6-6). The constructors appear in the table after the .cinit initialization.
When you use the --rom_model or --ram_model option, the linker combines the .cinit sections from all the C/C++ modules and appends a null word to the end of the composite .cinit section. This terminating record appears as a record with a size field of 0 and marks the end of the initialization tables.
Likewise, the --rom_model or --ram_model link option causes the linker to combine all of the .pinit sections from all C/C++ modules and append a null word to the end of the composite .pinit section. The boot routine knows the end of the global constructor table when it encounters a null constructor address.
The const-qualified variables are initialized differently; see Section 5.7.1.