1 .abicalls 2 .set noreorder 3 .set nomacro 4 5/* The GNU and SGI linkers differ in their implementation of -init and -fini. 6 With the GNU linker, there can only be a single -init option, and the 7 linker simply sets DT_INIT to that value. gcc's initialization and 8 finalization code can go directly in .init, with the prologue and 9 epilogue of the main initialization routine being provided by external 10 object files (*crti.o and *crtn.o in this case). 11 12 The SGI linker instead accepts several -init options. It will set DT_INIT 13 to a linker-created function (placed in .init) that calls each of the -init 14 functions in turn. If there is any user code in .init, this linker-created 15 function will be placed after it. Note that such user code is not treated 16 specially; it will only be called if the -init options arrange for it to 17 be called. 18 19 In theory, the SGI model should allow the crti, crtn and intermediate code 20 to go in .init, just like it can with the GNU linker. However, doing this 21 seems to confuse the linker and triggers an internal error: 22 23 ld32: FATAL 2 : Internal: at ../../ld/mips_code.c mips_code_fixup() 24 text section overflow! 25 26 (seen with MIPSpro 7.30). We therefore put everything in a special 27 .gcc_init section instead. */ 28 29 .section .gcc_init,"ax",@progbits 30 .globl __gcc_init 31__gcc_init: 32#if _MIPS_SIM == _ABIO32 33 addiu $sp,$sp,-16 34 sw $31,0($sp) 35#else 36 daddiu $sp,$sp,-16 37 sd $31,0($sp) 38 sd $28,8($sp) 39#endif 40 41 .section .gcc_fini,"ax",@progbits 42 .globl __gcc_fini 43__gcc_fini: 44#if _MIPS_SIM == _ABIO32 45 addiu $sp,$sp,-16 46 sw $31,0($sp) 47#else 48 daddiu $sp,$sp,-16 49 sd $31,0($sp) 50 sd $28,8($sp) 51#endif 52