1 |
734 |
jeremybenn |
/* Copyright (C) 2004, 2008, 2011 Free Software Foundation, Inc.
|
2 |
|
|
|
3 |
|
|
This file is part of GCC.
|
4 |
|
|
|
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
|
8 |
|
|
version.
|
9 |
|
|
|
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
|
13 |
|
|
for more details.
|
14 |
|
|
|
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.
|
18 |
|
|
|
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 |
|
|
. */
|
23 |
|
|
|
24 |
|
|
.abicalls
|
25 |
|
|
.set noreorder
|
26 |
|
|
.set nomacro
|
27 |
|
|
|
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).
|
34 |
|
|
|
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
|
40 |
|
|
be called.
|
41 |
|
|
|
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:
|
45 |
|
|
|
46 |
|
|
ld32: FATAL 2 : Internal: at ../../ld/mips_code.c mips_code_fixup()
|
47 |
|
|
text section overflow!
|
48 |
|
|
|
49 |
|
|
(seen with MIPSpro 7.30). We therefore put everything in a special
|
50 |
|
|
.gcc_init section instead. */
|
51 |
|
|
|
52 |
|
|
.section .gcc_init,"ax",@progbits
|
53 |
|
|
.globl __gcc_init
|
54 |
|
|
__gcc_init:
|
55 |
|
|
daddiu $sp,$sp,-16
|
56 |
|
|
sd $31,0($sp)
|
57 |
|
|
sd $28,8($sp)
|
58 |
|
|
|
59 |
|
|
.section .gcc_fini,"ax",@progbits
|
60 |
|
|
.globl __gcc_fini
|
61 |
|
|
__gcc_fini:
|
62 |
|
|
daddiu $sp,$sp,-16
|
63 |
|
|
sd $31,0($sp)
|
64 |
|
|
sd $28,8($sp)
|
65 |
|
|
|
66 |
|
|
/* This object will typically be included in the final link for both
|
67 |
|
|
shared libraries and executable, and we need to hide the symbols to
|
68 |
|
|
prevent possible symbol preemption warnings from the SGI linker. */
|
69 |
|
|
.hidden __gcc_init
|
70 |
|
|
.hidden __gcc_fini
|
71 |
|
|
|