]>
Commit | Line | Data |
---|---|---|
f607bc57 | 1 | # crti.s for sysv4 |
c81bebd7 | 2 | |
748086b7 | 3 | # Copyright (C) 1996, 2008, 2009 Free Software Foundation, Inc. |
c81bebd7 MM |
4 | # Written By Michael Meissner |
5 | # | |
6 | # This file is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License as published by the | |
748086b7 | 8 | # Free Software Foundation; either version 3, or (at your option) any |
c81bebd7 MM |
9 | # later version. |
10 | # | |
c81bebd7 MM |
11 | # This file is distributed in the hope that it will be useful, but |
12 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | # General Public License for more details. | |
748086b7 JJ |
15 | # |
16 | # Under Section 7 of GPL version 3, you are granted additional | |
17 | # permissions described in the GCC Runtime Library Exception, version | |
18 | # 3.1, as published by the Free Software Foundation. | |
19 | # | |
20 | # You should have received a copy of the GNU General Public License and | |
21 | # a copy of the GCC Runtime Library Exception along with this program; | |
22 | # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
23 | # <http://www.gnu.org/licenses/>. | |
c81bebd7 MM |
24 | |
25 | # This file just supplies labeled starting points for the .got* and other | |
26 | # special sections. It is linked in first before other modules. | |
27 | ||
c81bebd7 MM |
28 | .ident "GNU C scrti.s" |
29 | ||
9739c90c | 30 | #ifndef __powerpc64__ |
0bc25b2b MM |
31 | # Start of .text |
32 | .section ".text" | |
33 | .globl _ex_text0 | |
34 | _ex_text0: | |
35 | ||
36 | # Exception range | |
37 | .section ".exception_ranges","aw" | |
38 | .globl _ex_range0 | |
39 | _ex_range0: | |
40 | ||
c81bebd7 MM |
41 | # List of C++ constructors |
42 | .section ".ctors","aw" | |
43 | .globl __CTOR_LIST__ | |
44 | .type __CTOR_LIST__,@object | |
45 | __CTOR_LIST__: | |
46 | ||
47 | # List of C++ destructors | |
48 | .section ".dtors","aw" | |
49 | .globl __DTOR_LIST__ | |
50 | .type __DTOR_LIST__,@object | |
51 | __DTOR_LIST__: | |
52 | ||
f607bc57 | 53 | # Head of _init function used for static constructors |
c81bebd7 MM |
54 | .section ".init","ax" |
55 | .align 2 | |
f607bc57 ZW |
56 | .globl _init |
57 | .type _init,@function | |
58 | _init: stwu %r1,-16(%r1) | |
0bc25b2b | 59 | mflr %r0 |
5b9d9a0c | 60 | stw %r31,12(%r1) |
0bc25b2b MM |
61 | stw %r0,16(%r1) |
62 | ||
5b9d9a0c MM |
63 | bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address |
64 | mflr %r31 | |
65 | ||
0bc25b2b MM |
66 | # lwz %r3,_ex_shared0@got(%r31) |
67 | # lwz %r4,-8(%r3) # _ex_register or 0 | |
68 | # cmpi %cr0,%r4,0 | |
69 | # beq .Lno_reg | |
70 | # mtlr %r4 | |
71 | # blrl | |
72 | #.Lno_reg: | |
c81bebd7 | 73 | |
f607bc57 | 74 | # Head of _fini function used for static destructors |
c81bebd7 MM |
75 | .section ".fini","ax" |
76 | .align 2 | |
f607bc57 ZW |
77 | .globl _fini |
78 | .type _fini,@function | |
79 | _fini: stwu %r1,-16(%r1) | |
0bc25b2b MM |
80 | mflr %r0 |
81 | stw %r31,12(%r1) | |
82 | stw %r0,16(%r1) | |
83 | ||
5b9d9a0c MM |
84 | bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address |
85 | mflr %r31 | |
0bc25b2b MM |
86 | |
87 | # _environ and its evil twin environ, pointing to the environment | |
1b30b9cf MM |
88 | .section ".sdata","aw" |
89 | .align 2 | |
90 | .globl _environ | |
91 | .space 4 | |
0bc25b2b MM |
92 | .weak environ |
93 | .set environ,_environ | |
9739c90c | 94 | #endif |