Files
glibc/csu/init-first.c
T

60 lines
1.9 KiB
C
Raw Normal View History

/* Initialization code run first thing by the ELF startup code. Stub version.
2002-03-13 06:33:52 +00:00
Copyright (C) 1995, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
1997-02-10 03:19:57 +00:00
This file is part of the GNU C Library.
1997-02-10 03:19:57 +00:00
The GNU C Library is free software; you can redistribute it and/or
2001-07-06 04:58:11 +00:00
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
1997-02-10 03:19:57 +00:00
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2001-07-06 04:58:11 +00:00
Lesser General Public License for more details.
2001-07-06 04:58:11 +00:00
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <unistd.h>
1997-08-10 18:37:15 +00:00
#include <sys/types.h>
/* Set nonzero if we have to be prepared for more then one libc being
used in the process. Safe assumption if initializer never runs. */
2002-03-13 06:33:52 +00:00
int __libc_multiple_libcs attribute_hidden = 1;
1996-08-26 17:39:10 +00:00
extern void __libc_init (int, char **, char **);
2001-08-11 20:40:40 +00:00
#ifdef USE_NONOPTION_FLAGS
1997-09-21 01:47:02 +00:00
extern void __getopt_clean_environment (char **);
2001-08-11 20:40:40 +00:00
#endif
2000-03-31 05:50:02 +00:00
#ifdef SHARED
void
__libc_init_first (void)
{
}
#endif
2000-03-31 05:50:02 +00:00
#ifdef SHARED
/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT
pointer in the dynamic section based solely on that. It is convention
for this function to be in the `.init' section, but the symbol name is
the only thing that really matters!! */
void _init
#else
void __libc_init_first
#endif
(int argc, char *arg0, ...)
{
char **argv = &arg0, **envp = &argv[argc + 1];
__environ = envp;
__libc_init (argc, argv, envp);
1997-02-10 03:19:57 +00:00
2001-08-11 20:40:40 +00:00
#ifdef USE_NONOPTION_FLAGS
1997-02-10 03:19:57 +00:00
/* This is a hack to make the special getopt in GNU libc working. */
1997-09-21 01:47:02 +00:00
__getopt_clean_environment (envp);
2001-08-11 20:40:40 +00:00
#endif
}