]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/sol-c0.c
Daily bump.
[gcc.git] / gcc / config / rs6000 / sol-c0.c
1 /* Solaris PowerPC startfile. */
2 /* Copyright (C) 1996 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* As a special exception, if you link this library with other files,
22 some of which are compiled with GCC, to produce an executable,
23 this library does not by itself cause the resulting executable
24 to be covered by the GNU General Public License.
25 This exception does not however invalidate any other reasons why
26 the executable file might be covered by the GNU General Public License. */
27
28 extern char **_environ;
29
30 extern int atexit (void (*__func) (void));
31 extern void __init (void) __attribute__ ((__longcall__));
32 extern void __fini (void) __attribute__ ((__longcall__));
33
34 typedef void (*func_ptr) (void);
35 int (*__atexit)(func_ptr) = atexit;
36
37 /* Exception handling */
38 struct ex_shared1 {
39 void *prev;
40 void *next;
41 char *text_start;
42 char *range_start;
43 char *text_end;
44 char *range_end;
45 };
46
47 struct ex_shared {
48 void (*ex_register) (struct ex_shared1 *);
49 void (*ex_deregister) (struct ex_shared1 *);
50 struct ex_shared1 shared_info;
51 };
52
53 extern char _ex_text0[], _ex_text1[];
54 extern char _ex_range0[], _ex_range1[];
55 extern void _ex_register (struct ex_shared1 *);
56 extern void _ex_deregister (struct ex_shared1 *);
57 extern char _SDA_BASE_[];
58 extern char _SDA2_BASE_[];
59
60 struct ex_shared shared __attribute__((section(".ex_shared"))) = {
61 _ex_register,
62 _ex_deregister,
63 {
64 (void *)0,
65 (void *)0,
66 _ex_text0,
67 _ex_range0,
68 _ex_text1,
69 _ex_range1
70 }
71 };
72
73 static void
74 deregister (void)
75 {
76 (* shared.ex_deregister) (&shared.shared_info);
77 }
78
79 /* Start function. */
80 void
81 _start(int argc, char *argv[], char *envp[], void *auxp, void (*termfunc)())
82 {
83 int ret;
84 int dummy = 0;
85
86 #if 0
87 /* Disable this for now, it causes an impossible reload. */
88 /* Load up r13/r2 before we do anything else. */
89 __asm__ volatile ("mr %%r13,%0;mr %%r2,%1" : "=r" (dummy) : "r" (&_SDA_BASE_[0]), "r" (&_SDA2_BASE_[0]), "r" (dummy));
90 #endif
91
92 _environ = envp + dummy;
93
94 /* Register loader termination function (the || dummy is to make sure the above asm
95 is not optimized away). */
96 if (termfunc)
97 atexit (termfunc);
98
99 /* Register exception handler if needed */
100 if (shared.ex_register)
101 (* shared.ex_register) (&shared.shared_info);
102
103 if (shared.ex_deregister)
104 atexit (deregister);
105
106 /* Call any global constructors and destructors. */
107 __init ();
108
109 atexit (__fini);
110
111 /* Call the main program now */
112 ret = main (argc, argv, envp, auxp);
113
114 /* Return to the os */
115 exit (ret);
116 }
117
118 /* Provide a dummy __eabi in case main got compiled without -mcall-solaris. */
119 void
120 __eabi ()
121 {
122 }
This page took 0.039262 seconds and 5 git commands to generate.