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, see <http://www.gnu.org/licenses/>.
21 /* This is the canonical entry point, usually the first thing in the text
24 At this entry point, most registers' values are unspecified, except:
26 r4 Contains a function pointer to be registered with `atexit'.
27 This is how the dynamic linker arranges to have DT_FINI
28 functions called for shared libraries that have been loaded
29 before this code runs.
31 sp The stack contains the arguments and environment:
36 (4*(argc+1))(sp) envp[0]
45 .type _start,%function
48 /* Clear the frame pointer since this is the outermost frame. */
51 /* Pop argc off the stack and save a pointer to argv */
55 /* Push the stack_end, rtld_fini and fini func onto the stack */
68 /* Set up the main/init funcs that go in registers */
74 /* __uClibc_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
76 /* Let the libc call main and exit with its return code. */
77 mov.l L_uClibc_main,r0
81 /* We should not get here. */
90 /* Set up the main/init funcs that go in registers */
94 /* __uClibc_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
96 /* Let the libc call main and exit with its return code. */
97 mov.l L_uClibc_main,r1
100 /* We should not get here. */
106 .size _start,.-_start
111 .long _GLOBAL_OFFSET_TABLE_
119 .long __uClibc_main@GOT
135 /* Define a symbol for the first piece of initialized data. */
141 data_start = __data_start