PR c++/3637
[official-gcc.git] / gcc / config / sparc / sol2-g1.asm
blobb9d878856f8d1343638585216dd1ddbcc0722f41
1 ! gcrt1.s for solaris 2.0.
3 ! Copyright (C) 1992 Free Software Foundation, Inc.
4 ! Written By David Vinayak Henkel-Wallace, June 1992
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
8 ! Free Software Foundation; either version 2, or (at your option) any
9 ! later version.
11 ! In addition to the permissions in the GNU General Public License, the
12 ! Free Software Foundation gives you unlimited permission to link the
13 ! compiled version of this file with other programs, and to distribute
14 ! those programs without any restriction coming from the use of this
15 ! file. (The General Public License restrictions do apply in other
16 ! respects; for example, they cover modification of the file, and
17 ! distribution when not linked into another program.)
19 ! This file is distributed in the hope that it will be useful, but
20 ! WITHOUT ANY WARRANTY; without even the implied warranty of
21 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ! General Public License for more details.
24 ! You should have received a copy of the GNU General Public License
25 ! along with this program; see the file COPYING. If not, write to
26 ! the Free Software Foundation, 59 Temple Place - Suite 330,
27 ! Boston, MA 02111-1307, USA.
29 ! As a special exception, if you link this library with files
30 ! compiled with GCC to produce an executable, this does not cause
31 ! the resulting executable to be covered by the GNU General Public License.
32 ! This exception does not however invalidate any other reasons why
33 ! the executable file might be covered by the GNU General Public License.
36 ! This file takes control of the process from the kernel, as specified
37 ! in section 3 of the SVr4 ABI.
38 ! This file is the first thing linked into any executable.
40 .section ".text"
41 .proc 022
42 .global _start
44 _start:
45 mov 0, %fp ! Mark bottom frame pointer
46 ld [%sp + 64], %l0 ! argc
47 add %sp, 68, %l1 ! argv
49 ! Leave some room for a call. Sun leaves 32 octets (to sit on
50 ! a cache line?) so we do too.
51 sub %sp, 32, %sp
53 ! %g1 may contain a function to be registered w/atexit
54 orcc %g0, %g1, %g0
55 be .nope
56 mov %g1, %o0
57 call atexit
58 nop
59 .nope:
60 ! Now make sure constructors and destructors are handled.
61 set _fini, %o0
62 call atexit, 1
63 nop
64 call _init, 0
65 nop
67 ! We ignore the auxiliary vector; there's no defined way to
68 ! access those data anyway. Instead, go straight to main:
69 mov %l0, %o0 ! argc
70 mov %l1, %o1 ! argv
71 set ___Argv, %o3
72 st %o1, [%o3] ! *___Argv
73 ! Skip argc words past argv, to env:
74 sll %l0, 2, %o2
75 add %o2, 4, %o2
76 add %l1, %o2, %o2 ! env
77 set _environ, %o3
78 st %o2, [%o3] ! *_environ
79 call main, 4
80 nop
81 call exit, 0
82 nop
83 call _exit, 0
84 nop
85 ! We should never get here.
87 .type _start,#function
88 .size _start,.-_start