Blame csu/init-first.c

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