1 |
207 |
jeremybenn |
/* Executable and DSO init/fini start for cris*-axis-linux-gnu and simulators
|
2 |
|
|
Copyright (C) 2000, 2001, 2004, 2005 Axis Communications.
|
3 |
|
|
All rights reserved.
|
4 |
|
|
|
5 |
|
|
Redistribution and use in source and binary forms, with or without
|
6 |
|
|
modification, are permitted provided that the following conditions
|
7 |
|
|
are met:
|
8 |
|
|
|
9 |
|
|
1. Redistributions of source code must retain the above copyright
|
10 |
|
|
notice, this list of conditions and the following disclaimer.
|
11 |
|
|
|
12 |
|
|
2. Neither the name of Axis Communications nor the names of its
|
13 |
|
|
contributors may be used to endorse or promote products derived
|
14 |
|
|
from this software without specific prior written permission.
|
15 |
|
|
|
16 |
|
|
THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
|
17 |
|
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18 |
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19 |
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
|
20 |
|
|
COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
21 |
|
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
22 |
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
23 |
|
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
24 |
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
25 |
|
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
26 |
|
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE. */
|
28 |
|
|
|
29 |
|
|
#ifdef __ELF__
|
30 |
|
|
__asm__ (".syntax no_register_prefix");
|
31 |
|
|
|
32 |
|
|
__asm__ (".section .init\n"
|
33 |
|
|
#ifdef __NO_UNDERSCORES__
|
34 |
|
|
" .globl _init\n"
|
35 |
|
|
"_init:\n"
|
36 |
|
|
#else /* not __NO_UNDERSCORES__ */
|
37 |
|
|
" .globl __init\n"
|
38 |
|
|
"__init:\n"
|
39 |
|
|
#endif /* not __NO_UNDERSCORES__ */
|
40 |
|
|
"\tsubq 4,sp\n"
|
41 |
|
|
"\tmove srp,[sp]\n"
|
42 |
|
|
#ifdef __PIC__
|
43 |
|
|
"\tsubq 4,sp\n"
|
44 |
|
|
"\tmove.d r0,[sp]\n"
|
45 |
|
|
#if __CRIS_arch_version >= 32
|
46 |
|
|
"\tlapc _GLOBAL_OFFSET_TABLE_,$r0\n"
|
47 |
|
|
#else /* not __CRIS_arch_version >= 32 */
|
48 |
|
|
"\tmove.d $pc,$r0\n"
|
49 |
|
|
"\tsub.d .:GOTOFF,$r0\n"
|
50 |
|
|
#endif /* not __CRIS_arch_version >= 32 */
|
51 |
|
|
#endif /* __PIC__ */
|
52 |
|
|
|
53 |
|
|
"\t.section .fini\n"
|
54 |
|
|
#ifdef __NO_UNDERSCORES__
|
55 |
|
|
" .globl _fini\n"
|
56 |
|
|
"_fini:\n"
|
57 |
|
|
#else /* not __NO_UNDERSCORES__ */
|
58 |
|
|
" .globl __fini\n"
|
59 |
|
|
"__fini:\n"
|
60 |
|
|
#endif /* not __NO_UNDERSCORES__ */
|
61 |
|
|
"\tsubq 4,sp\n"
|
62 |
|
|
"\tmove srp,[sp]\n"
|
63 |
|
|
#ifdef __PIC__
|
64 |
|
|
"\tsubq 4,sp\n"
|
65 |
|
|
"\tmove.d r0,[sp]\n"
|
66 |
|
|
#if __CRIS_arch_version >= 32
|
67 |
|
|
"\tlapc _GLOBAL_OFFSET_TABLE_,$r0\n"
|
68 |
|
|
#else /* not __CRIS_arch_version >= 32 */
|
69 |
|
|
"\tmove.d $pc,$r0\n"
|
70 |
|
|
"\tsub.d .:GOTOFF,$r0\n"
|
71 |
|
|
#endif /* not __CRIS_arch_version >= 32 */
|
72 |
|
|
#endif /* __PIC__ */
|
73 |
|
|
);
|
74 |
|
|
|
75 |
|
|
#else /* not __ELF__ */
|
76 |
|
|
extern int Dummy;
|
77 |
|
|
#endif /* not __ELF__ */
|