SPARC Assembly Language Reference Manual

3.2.2.2 Creating a .fini Section in an Object File

.fini sections contain codes that are to be executed after the the main program is executed. To create an .fini section in an object file, use the assembler pseudo-ops shown in Example 3-2Code Example 3-2.


Example 3-2 Creating an .fini Section

.section ".fini"

.align   4

<instructions>

At link time, the .fini sections in a sequence of .o files are concatenated into a .fini section in the linker output file. The codes in the .fini section are executed after the main program is executed.

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

call routine_name

nop

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