Define F_DUPFD_CLOEXEC.
[glibc-ports.git] / sysdeps / unix / arm / start.c
blob6bf08b1d7f8645287485ac954a390af9dfedfc2b
1 /* Special startup code for ARM a.out binaries.
2 Copyright (C) 1998, 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The GNU Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
19 Note that people who make modified versions of this file are not
20 obligated to grant this special exception for their modified
21 versions; it is their choice whether to do so. The GNU Lesser
22 General Public License gives permission to release a modified
23 version without this exception; this exception also makes it
24 possible to release a modified version which carries forward this
25 exception.
27 The GNU C Library is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 Lesser General Public License for more details.
32 You should have received a copy of the GNU Lesser General Public
33 License along with the GNU C Library; if not, write to the Free
34 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
35 02111-1307 USA. */
37 #include <errno.h>
38 #include <stdlib.h>
39 #include <unistd.h>
40 #include <sysdep.h>
42 /* The first piece of initialized data. */
43 int __data_start = 0;
44 #ifdef HAVE_WEAK_SYMBOLS
45 weak_alias (__data_start, data_start)
46 #endif
48 extern void __libc_init (int argc, char **argv, char **envp);
49 extern int main (int argc, char **argv, char **envp);
51 /* N.B.: It is important that this be the first function.
52 This file is the first thing in the text section. */
54 /* If this was in C it might create its own stack frame and
55 screw up the arguments. */
56 #ifdef NO_UNDERSCORES
57 asm (".text; .globl _start; _start: B start1");
58 #else
59 asm (".text; .globl __start; __start: B _start1");
61 /* Make an alias called `start' (no leading underscore, so it can't
62 conflict with C symbols) for `_start'. This is the name vendor crt0.o's
63 tend to use, and thus the name most linkers expect. */
64 asm (".set start, __start");
65 #endif
67 /* Fool gcc into thinking that more args are passed. This makes it look
68 on the stack (correctly) for the real arguments. It causes somewhat
69 strange register usage in start1(), but we aren't too bothered about
70 that at the moment. */
71 #define DUMMIES a1, a2, a3, a4
73 #ifdef DUMMIES
74 #define ARG_DUMMIES DUMMIES,
75 #define DECL_DUMMIES int DUMMIES;
76 #else
77 #define ARG_DUMMIES
78 #define DECL_DUMMIES
79 #endif
81 /* ARGSUSED */
82 static void
83 start1 (ARG_DUMMIES argc, argv, envp)
84 DECL_DUMMIES
85 int argc;
86 char **argv;
87 char **envp;
89 /* Store a pointer to the environment. */
90 __environ = envp;
92 /* Do C library initializations. */
93 __libc_init (argc, argv, __environ);
95 /* Call the user program. */
96 exit (main (argc, argv, __environ));