Update.
[glibc.git] / sysdeps / unix / sysv / aix / start.s
blobbf17b8ce5cb481294476b404a13cfc4b2d7d939b
1 /* Copyright (C) 2001 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 .file "start.s"
20 .toc
21 T.lsd: .tc __libc_start_data[tc], __libc_start_data[rw]
22 T.main: .tc main[tc], main[rw]
23 T.init: .tc __libc_start_init[tc], __libc_start_init[rw]
24 T.fini: .tc __libc_start_fini[tc], __libc_start_init[rw]
25 T.rtld_fini : .tc __libc_start_rtld_fini[tc], __libc_start_rtld_fini[rw]
27 .globl __start
28 .globl .__start
29 .globl __libc_start_data
31 .extern .__libc_start_main
32 .extern .main
33 .extern main
34 .extern __libc_start_init
35 .extern __libc_start_fini
36 .extern __libc_start_rtld_fini
38 /* Text */
40 .csect __start[ds]
41 __start:
42 .long .__start, TOC[tc0], 0
44 .csect .text[pr]
45 .__start:
47 /* No prologue needed, __start does not have to follow the ABI.
49 Input from kernel/loader
50 r1 : stack
51 r2 : TOC
52 r3 : argc
53 r4 : argv
54 r5 : envp
55 r28 : data origin
56 r29 : text origin
57 r30 : module count
58 r31 : default processing flag
60 If r31 == r30, no special processing is needed, ie r28, r29 & r30
61 are not used
63 Save input in __libc_start_data */
64 l 16, T.lsd(2)
65 st 1, 0(16) /* stack */
66 st 2, 4(16) /* toc */
67 st 3, 8(16) /* argc */
68 st 4, 12(16) /* argv */
69 st 5, 16(16) /* envp */
70 st 28, 20(16) /* data origin */
71 st 29, 24(16) /* text origin */
72 st 30, 28(16) /* module count */
73 st 31, 32(16) /* special */
75 /* Call __libc_start_main() */
77 bl .__libc_start_main
78 nop
80 /* No epilog needed, __start does not have to follow the ABI */
82 /* Trace back */
83 TB.__start:
84 .long 0x0
85 .long 0xc2040
86 .long 0x0
87 .long TB.__start - .__start
88 .short 7
89 .byte "__start"
90 .byte 0,0,0
92 /* Data
93 __libc_start_data
94 Space to keep libc initialization information */
96 .csect __libc_start_data[rw]
97 __libc_start_data:
98 /* For kernel/loader input args */
99 .space 36
101 /* Externs */
102 .long main
103 init:
104 .long __libc_start_init
105 fini:
106 .long __libc_start_fini
107 rtld_fini:
108 .long __libc_start_rtld_fini
109 .space 0x1000 + (4 + rtld_fini - __libc_start_data)