]>
gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/sol-c0.c
1 /* Solaris PowerPC startfile. */
2 /* Copyright (C) 1996 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
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. */
28 extern char **_environ
;
30 extern int atexit (void (*__func
) (void));
31 extern void __init (void) __attribute__ ((__longcall__
));
32 extern void __fini (void) __attribute__ ((__longcall__
));
34 typedef void (*func_ptr
) (void);
35 int (*__atexit
)(func_ptr
) = atexit
;
37 /* Exception handling */
48 void (*ex_register
) (struct ex_shared1
*);
49 void (*ex_deregister
) (struct ex_shared1
*);
50 struct ex_shared1 shared_info
;
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_
[];
60 struct ex_shared shared
__attribute__((section(".ex_shared"))) = {
76 (* shared
.ex_deregister
) (&shared
.shared_info
);
81 _start(int argc
, char *argv
[], char *envp
[], void *auxp
, void (*termfunc
)())
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
));
92 _environ
= envp
+ dummy
;
94 /* Register loader termination function (the || dummy is to make sure the above asm
95 is not optimized away). */
99 /* Register exception handler if needed */
100 if (shared
.ex_register
)
101 (* shared
.ex_register
) (&shared
.shared_info
);
103 if (shared
.ex_deregister
)
106 /* Call any global constructors and destructors. */
111 /* Call the main program now */
112 ret
= main (argc
, argv
, envp
, auxp
);
114 /* Return to the os */
118 /* Provide a dummy __eabi in case main got compiled without -mcall-solaris. */
This page took 0.039262 seconds and 5 git commands to generate.