|
Packit |
6c4009 |
/* Initialization code run first thing by the ELF startup code. Common version
|
|
Packit |
6c4009 |
Copyright (C) 1995-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <ctype.h>
|
|
Packit |
6c4009 |
#include <stdio.h>
|
|
Packit |
6c4009 |
#include <stdlib.h>
|
|
Packit |
6c4009 |
#include <fcntl.h>
|
|
Packit |
6c4009 |
#include <unistd.h>
|
|
Packit |
6c4009 |
#include <sysdep.h>
|
|
Packit |
6c4009 |
#include <fpu_control.h>
|
|
Packit |
6c4009 |
#include <sys/param.h>
|
|
Packit |
6c4009 |
#include <sys/types.h>
|
|
Packit |
6c4009 |
#include <libc-internal.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <ldsodefs.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Set nonzero if we have to be prepared for more than one libc being
|
|
Packit |
6c4009 |
used in the process. Safe assumption if initializer never runs. */
|
|
Packit |
6c4009 |
int __libc_multiple_libcs attribute_hidden = 1;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Remember the command line argument and enviroment contents for
|
|
Packit |
6c4009 |
later calls of initializers for dynamic libraries. */
|
|
Packit |
6c4009 |
int __libc_argc attribute_hidden;
|
|
Packit |
6c4009 |
char **__libc_argv attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
void
|
|
Packit |
6c4009 |
__libc_init_first (int argc, char **argv, char **envp)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
#ifdef SHARED
|
|
Packit |
6c4009 |
/* For DSOs we do not need __libc_init_first but instead _init. */
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
void
|
|
Packit |
6c4009 |
attribute_hidden
|
|
Packit |
6c4009 |
_init (int argc, char **argv, char **envp)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Make sure we don't initialize twice. */
|
|
Packit |
6c4009 |
if (!__libc_multiple_libcs)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* Set the FPU control word to the proper default value if the
|
|
Packit |
6c4009 |
kernel would use a different value. */
|
|
Packit |
6c4009 |
if (__fpu_control != GLRO(dl_fpu_control))
|
|
Packit |
6c4009 |
__setfpucw (__fpu_control);
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Save the command-line arguments. */
|
|
Packit |
6c4009 |
__libc_argc = argc;
|
|
Packit |
6c4009 |
__libc_argv = argv;
|
|
Packit |
6c4009 |
__environ = envp;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef SHARED
|
|
Packit |
6c4009 |
/* First the initialization which normally would be done by the
|
|
Packit |
6c4009 |
dynamic linker. */
|
|
Packit |
6c4009 |
_dl_non_dynamic_init ();
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef VDSO_SETUP
|
|
Packit |
6c4009 |
VDSO_SETUP ();
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__init_misc (argc, argv, envp);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Initialize ctype data. */
|
|
Packit |
6c4009 |
__ctype_init ();
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
|
|
Packit |
6c4009 |
__libc_global_ctors ();
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* This function is defined here so that if this file ever gets into
|
|
Packit |
6c4009 |
ld.so we will get a link error. Having this file silently included
|
|
Packit |
6c4009 |
in ld.so causes disaster, because the _init definition above will
|
|
Packit |
6c4009 |
cause ld.so to gain an init function, which is not a cool thing. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
extern void _dl_start (void) __attribute__ ((noreturn));
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
void
|
|
Packit |
6c4009 |
_dl_start (void)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
abort ();
|
|
Packit |
6c4009 |
}
|