]>
Commit | Line | Data |
---|---|---|
e4448b6f | 1 | /* Initialization code run first thing by the ELF startup code. Stub version. |
0413b54c | 2 | Copyright (C) 1995, 1997 Free Software Foundation, Inc. |
7cc27f44 | 3 | This file is part of the GNU C Library. |
e4448b6f | 4 | |
7cc27f44 UD |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
e4448b6f | 9 | |
7cc27f44 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Library General Public License for more details. | |
e4448b6f | 14 | |
7cc27f44 UD |
15 | You should have received a copy of the GNU Library General Public |
16 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
e4448b6f | 19 | |
e4448b6f | 20 | #include <unistd.h> |
0413b54c | 21 | #include <sys/types.h> |
e4448b6f | 22 | |
548330d3 TBB |
23 | int __libc_multiple_libcs = 1; |
24 | ||
e4448b6f | 25 | extern void __libc_init (int, char **, char **); |
2604afb1 | 26 | extern void __getopt_clean_environment (char **); |
e4448b6f | 27 | |
0413b54c UD |
28 | pid_t __libc_pid; |
29 | ||
e4448b6f | 30 | #ifdef PIC |
e4448b6f RM |
31 | void |
32 | __libc_init_first (void) | |
33 | { | |
34 | } | |
35 | #endif | |
36 | ||
37 | #ifdef PIC | |
0e7725cc RM |
38 | /* NOTE! The linker notices the magical name `_init' and sets the DT_INIT |
39 | pointer in the dynamic section based solely on that. It is convention | |
40 | for this function to be in the `.init' section, but the symbol name is | |
41 | the only thing that really matters!! */ | |
42 | void _init | |
e4448b6f RM |
43 | #else |
44 | void __libc_init_first | |
45 | #endif | |
46 | (int argc, char *arg0, ...) | |
47 | { | |
48 | char **argv = &arg0, **envp = &argv[argc + 1]; | |
49 | ||
50 | __environ = envp; | |
51 | __libc_init (argc, argv, envp); | |
7cc27f44 UD |
52 | |
53 | /* This is a hack to make the special getopt in GNU libc working. */ | |
2604afb1 | 54 | __getopt_clean_environment (envp); |
e4448b6f | 55 | } |