SPARC Assembly Language Reference Manual Creating an .init Section in an Object File

The .init sections contain codes that are to be executed before the the main program is executed. To create an .init section in an object file, use the assembler pseudo-ops shown in Example 3–1.

Example 3–1 Creating an .init Section

.section ".init"

.align   4


At link time, the .init sections in a sequence of .o files are concatenated into an .init section in the linker output file. The code in the .init section are executed before the main program is executed.

Because the whole .init section is treated as a single function body, it is recommented that the only code added to these sections be in the following form:.

call routine_name


The called routine should be located in another section. This will prevent conflicting register and stack usage within the .init sections.