1 /* Copyright (C) 2004, 2008 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 3, or (at your option) any later
10 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
28 /* The GNU and SGI linkers differ in their implementation of -init and -fini.
29 With the GNU linker, there can only be a single -init option, and the
30 linker simply sets DT_INIT to that value. gcc's initialization and
31 finalization code can go directly in .init, with the prologue and
32 epilogue of the main initialization routine being provided by external
33 object files (*crti.o and *crtn.o in this case).
35 The SGI linker instead accepts several -init options. It will set DT_INIT
36 to a linker-created function (placed in .init) that calls each of the -init
37 functions in turn. If there is any user code in .init, this linker-created
38 function will be placed after it. Note that such user code is not treated
39 specially; it will only be called if the -init options arrange for it to
42 In theory, the SGI model should allow the crti, crtn and intermediate code
43 to go in .init, just like it can with the GNU linker. However, doing this
44 seems to confuse the linker and triggers an internal error:
46 ld32: FATAL 2 : Internal: at ../../ld/mips_code.c mips_code_fixup()
47 text section overflow!
49 (seen with MIPSpro 7.30). We therefore put everything in a special
50 .gcc_init section instead. */
52 .section .gcc_init,"ax",@progbits
55 #if _MIPS_SIM == _ABIO32
64 .section .gcc_fini,"ax",@progbits
67 #if _MIPS_SIM == _ABIO32
76 /* This object will typically be included in the final link for both
77 shared libraries and executable, and we need to hide the symbols to
78 prevent possible symbol preemption warnings from the SGI linker. */