1169689Skan .abicalls 2169689Skan .set noreorder 3169689Skan .set nomacro 4169689Skan 5169689Skan/* The GNU and SGI linkers differ in their implementation of -init and -fini. 6169689Skan With the GNU linker, there can only be a single -init option, and the 7169689Skan linker simply sets DT_INIT to that value. gcc's initialization and 8169689Skan finalization code can go directly in .init, with the prologue and 9169689Skan epilogue of the main initialization routine being provided by external 10169689Skan object files (*crti.o and *crtn.o in this case). 11169689Skan 12169689Skan The SGI linker instead accepts several -init options. It will set DT_INIT 13169689Skan to a linker-created function (placed in .init) that calls each of the -init 14169689Skan functions in turn. If there is any user code in .init, this linker-created 15169689Skan function will be placed after it. Note that such user code is not treated 16169689Skan specially; it will only be called if the -init options arrange for it to 17169689Skan be called. 18169689Skan 19169689Skan In theory, the SGI model should allow the crti, crtn and intermediate code 20169689Skan to go in .init, just like it can with the GNU linker. However, doing this 21169689Skan seems to confuse the linker and triggers an internal error: 22169689Skan 23169689Skan ld32: FATAL 2 : Internal: at ../../ld/mips_code.c mips_code_fixup() 24169689Skan text section overflow! 25169689Skan 26169689Skan (seen with MIPSpro 7.30). We therefore put everything in a special 27169689Skan .gcc_init section instead. */ 28169689Skan 29169689Skan .section .gcc_init,"ax",@progbits 30169689Skan .globl __gcc_init 31169689Skan__gcc_init: 32169689Skan#if _MIPS_SIM == _ABIO32 33169689Skan addiu $sp,$sp,-16 34169689Skan sw $31,0($sp) 35169689Skan#else 36169689Skan daddiu $sp,$sp,-16 37169689Skan sd $31,0($sp) 38169689Skan sd $28,8($sp) 39169689Skan#endif 40169689Skan 41169689Skan .section .gcc_fini,"ax",@progbits 42169689Skan .globl __gcc_fini 43169689Skan__gcc_fini: 44169689Skan#if _MIPS_SIM == _ABIO32 45169689Skan addiu $sp,$sp,-16 46169689Skan sw $31,0($sp) 47169689Skan#else 48169689Skan daddiu $sp,$sp,-16 49169689Skan sd $31,0($sp) 50169689Skan sd $28,8($sp) 51169689Skan#endif 52