1 /* Copyright (C) 1991, 1993, 1995, 1996 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 modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
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
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with the GNU C Library; see the file COPYING. If not, write to
16 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include <sysdep.h> /* In case it wants to define anything. */
23 /* The first piece of initialized data. */
25 #ifdef HAVE_WEAK_SYMBOLS
26 weak_alias (__data_start
, data_start
)
30 #define ARG_DUMMIES DUMMIES,
31 #define DECL_DUMMIES int DUMMIES;
39 string_alias (__errno
, errno
)
42 extern void __libc_init
__P ((int argc
, char **argv
, char **envp
));
43 extern int main
__P ((int argc
, char **argv
, char **envp
));
46 /* Not a prototype because it gets called strangely. */
51 /* N.B.: It is important that this be the first function.
52 This file is the first thing in the text section. */
59 #ifndef NO_UNDERSCORES
60 /* Make an alias called `start' (no leading underscore, so it can't
61 conflict with C symbols) for `_start'. This is the name vendor crt0.o's
62 tend to use, and thus the name most linkers expect. */
63 asm (".set start, __start");
70 start1 (ARG_DUMMIES argc
, argp
)
77 /* The environment starts just after ARGV. */
78 __environ
= &argv
[argc
+ 1];
80 /* If the first thing after ARGV is the arguments
81 themselves, there is no environment. */
82 if ((char *) __environ
== *argv
)
83 /* The environment is empty. Make __environ
84 point at ARGV[ARGC], which is NULL. */
87 /* Do C library initializations. */
88 __libc_init (argc
, argv
, __environ
);
90 /* Call the user program. */
91 exit (main (argc
, argv
, __environ
));