Remove *xattr syscalls.
[glibc.git] / sysdeps / unix / start.c
blob49c96403fea0e56ab563943af8cd4135f3efc6f2
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
17 02111-1307 USA. */
19 #include <errno.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <sysdep.h> /* In case it wants to define anything. */
24 /* The first piece of initialized data. */
25 int __data_start = 0;
26 #ifdef HAVE_WEAK_SYMBOLS
27 weak_alias (__data_start, data_start)
28 #endif
30 #ifdef DUMMIES
31 #define ARG_DUMMIES DUMMIES,
32 #define DECL_DUMMIES int DUMMIES;
33 #else
34 #define ARG_DUMMIES
35 #define DECL_DUMMIES
36 #endif
38 #ifndef errno
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)
43 #endif
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. */
50 static void start1();
52 #ifndef HAVE__start
54 /* N.B.: It is important that this be the first function.
55 This file is the first thing in the text section. */
56 void
57 _start ()
59 start1 ();
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");
67 #endif
69 #endif
71 /* ARGSUSED */
72 static void
73 start1 (ARG_DUMMIES argc, argp)
74 DECL_DUMMIES
75 int argc;
76 char *argp;
78 char **argv = &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. */
88 --__environ;
90 /* Do C library initializations. */
91 __libc_init (argc, argv, __environ);
93 /* Call the user program. */
94 exit (main (argc, argv, __environ));