1 /* Startup code for SH & ELF.
2 Copyright (C) 1999 Free Software Foundation, Inc.
3 Copyright (C) 2001 Hewlett-Packard Australia
4 Copyright (C) 2002 Stefan Allius
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Library General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option) any
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
16 You should have received a copy of the GNU Library General Public License
17 along with this program; if not, write to the Free Software Foundation, Inc.,
18 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 /* This is the canonical entry point, usually the first thing in the text
25 At this entry point, most registers' values are unspecified, except:
27 r4 Contains a function pointer to be registered with `atexit'.
28 This is how the dynamic linker arranges to have DT_FINI
29 functions called for shared libraries that have been loaded
30 before this code runs.
32 sp The stack contains the arguments and environment:
37 (4*(argc+1))(sp) envp[0]
46 .type _start,%function
49 /* Clear the frame pointer since this is the outermost frame. */
52 /* Pop argc off the stack and save a pointer to argv */
56 /* Push the stack_end, rtld_fini and fini func onto the stack */
69 /* Set up the main/init funcs that go in registers */
75 /* __uClibc_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
77 /* Let the libc call main and exit with its return code. */
78 mov.l L_uClibc_main,r0
82 /* We should not get here. */
91 /* Set up the main/init funcs that go in registers */
95 /* __uClibc_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
97 /* Let the libc call main and exit with its return code. */
98 mov.l L_uClibc_main,r1
101 /* We should not get here. */
107 .size _start,.-_start
112 .long _GLOBAL_OFFSET_TABLE_
120 .long __uClibc_main@GOT
136 /* Define a symbol for the first piece of initialized data. */
142 data_start = __data_start