1 /* Copyright (C) 1991, 93, 1995-1998, 2000 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
22 #include <sysdep.h> /* In case it wants to define anything. */
24 /* The first piece of initialized data. */
26 #ifdef HAVE_WEAK_SYMBOLS
27 weak_alias (__data_start
, data_start
)
31 #define ARG_DUMMIES DUMMIES,
32 #define DECL_DUMMIES int DUMMIES;
39 /* __errno must be initialized since otherwise one cannot create an
40 alias (at least on some platforms). */
41 volatile int __errno
= 0;
42 strong_alias (__errno
, errno
)
45 extern void __libc_init (int argc
, char **argv
, char **envp
);
46 extern int main (int argc
, char **argv
, char **envp
);
49 /* Not a prototype because it gets called strangely. */
54 /* N.B.: It is important that this be the first function.
55 This file is the first thing in the text section. */
62 #ifndef NO_UNDERSCORES
63 /* Make an alias called `start' (no leading underscore, so it can't
64 conflict with C symbols) for `_start'. This is the name vendor crt0.o's
65 tend to use, and thus the name most linkers expect. */
66 asm (".set start, __start");
73 start1 (ARG_DUMMIES argc
, argp
)
80 /* The environment starts just after ARGV. */
81 __environ
= &argv
[argc
+ 1];
83 /* If the first thing after ARGV is the arguments
84 themselves, there is no environment. */
85 if ((char *) __environ
== *argv
)
86 /* The environment is empty. Make __environ
87 point at ARGV[ARGC], which is NULL. */
90 /* Do C library initializations. */
91 __libc_init (argc
, argv
, __environ
);
93 /* Call the user program. */
94 exit (main (argc
, argv
, __environ
));