about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-10-01 12:55:34 -0700
committerRoland McGrath <roland@hack.frob.com>2012-10-01 12:55:34 -0700
commit93c65d438497842a42fe4f6a8af272d20a143025 (patch)
tree112d49bebbc46a568d5e8f4fb074c87a9d80f736 /sysdeps
parent55a051c985c3e7965a2f5dd5f762ac2737adae01 (diff)
downloadglibc-93c65d438497842a42fe4f6a8af272d20a143025.tar.gz
glibc-93c65d438497842a42fe4f6a8af272d20a143025.tar.xz
glibc-93c65d438497842a42fe4f6a8af272d20a143025.zip
Clean up init-first.c files.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/init-first.c78
-rw-r--r--sysdeps/sh/init-first.c78
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c115
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/init-first.c5
-rw-r--r--sysdeps/unix/sysv/linux/s390/init-first.c5
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/init-first.c5
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/init-first.c5
7 files changed, 12 insertions, 279 deletions
diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c
deleted file mode 100644
index edea7f2697..0000000000
--- a/sysdeps/i386/init-first.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  For i386/Unix.
-   Copyright (C) 1995-2012 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <ctype.h>
-#include <unistd.h>
-
-extern void __libc_init (int, char **, char **);
-#ifdef USE_NONOPTION_FLAGS
-extern void __getopt_clean_environment (char **);
-#endif
-extern void __libc_global_ctors (void);
-
-int __libc_multiple_libcs attribute_hidden = 1;
-
-static void
-init (int *data)
-{
-  int argc = *data;
-  char **argv = (void *) (data + 1);
-  char **envp = &argv[argc + 1];
-
-  __environ = envp;
-  __libc_init (argc, argv, envp);
-
-#ifdef USE_NONOPTION_FLAGS
-  /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment (envp);
-#endif
-
-  /* Initialize ctype data.  */
-  __ctype_init ();
-}
-
-#ifdef SHARED
-/* This function is called to initialize the shared C library.
-   It is called just before the user _start code from i386/start.S,
-   with the stack set up as that code gets it.  */
-
-/* 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 (int argc, ...) __attribute__ ((unused, section (".init")));*/
-
-void
-_init (int argc, ...)
-{
-  init (&argc);
-
-#ifndef NO_CTORS_DTORS_SECTIONS
-  __libc_global_ctors ();
-#endif
-}
-#endif
-
-
-void
-__libc_init_first (int argc __attribute__ ((unused)), ...)
-{
-#ifndef SHARED
-  init (&argc);
-#endif
-}
diff --git a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c
deleted file mode 100644
index f298724c1d..0000000000
--- a/sysdeps/sh/init-first.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  For SH.
-   Copyright (C) 1995-2012 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <ctype.h>
-#include <unistd.h>
-
-extern void __libc_init (int, char **, char **);
-#ifdef USE_NONOPTION_FLAGS
-extern void __getopt_clean_environment (char **);
-#endif
-extern void __libc_global_ctors (void);
-
-int __libc_multiple_libcs attribute_hidden = 1;
-
-static void
-init (int *data)
-{
-  int argc = *data;
-  char **argv = (void *) (data + 1);
-  char **envp = &argv[argc + 1];
-
-  __environ = envp;
-  __libc_init (argc, argv, envp);
-
-#ifdef USE_NONOPTION_FLAGS
-  /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment (envp);
-#endif
-
-  /* Initialize ctype data.  */
-  __ctype_init ();
-}
-
-#ifdef SHARED
-/* This function is called to initialize the shared C library.
-   It is called just before the user _start code from sh/sh[34]/start.S,
-   with the stack set up as that code gets it.  */
-
-/* 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 (int argc, ...) __attribute__ ((unused, section (".init")));*/
-
-void
-_init (int argc, ...)
-{
-  init (&argc);
-
-#ifndef NO_CTORS_DTORS_SECTIONS
-  __libc_global_ctors ();
-#endif
-}
-#endif
-
-
-void
-__libc_init_first (int argc __attribute__ ((unused)), ...)
-{
-#ifndef SHARED
-  init (&argc);
-#endif
-}
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
deleted file mode 100644
index 00234e6898..0000000000
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  Linux version.
-   Copyright (C) 1995-2004, 2005, 2007, 2011 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   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.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sysdep.h>
-#include <fpu_control.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <libc-internal.h>
-
-#include <ldsodefs.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.  */
-int __libc_multiple_libcs attribute_hidden = 1;
-
-/* Remember the command line argument and enviroment contents for
-   later calls of initializers for dynamic libraries.  */
-int __libc_argc attribute_hidden;
-char **__libc_argv attribute_hidden;
-
-
-void
-__libc_init_first (int argc, char **argv, char **envp)
-{
-#ifdef SHARED
-  /* For DSOs we do not need __libc_init_first but instead _init.  */
-}
-
-void
-attribute_hidden
-_init (int argc, char **argv, char **envp)
-{
-#endif
-#ifdef USE_NONOPTION_FLAGS
-  extern void __getopt_clean_environment (char **);
-#endif
-
-  __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
-
-  /* Make sure we don't initialize twice.  */
-  if (!__libc_multiple_libcs)
-    {
-      /* Set the FPU control word to the proper default value if the
-	 kernel would use a different value.  (In a static program we
-	 don't have this information.)  */
-#ifdef SHARED
-      if (__fpu_control != GLRO(dl_fpu_control))
-#endif
-	__setfpucw (__fpu_control);
-    }
-
-  /* Save the command-line arguments.  */
-  __libc_argc = argc;
-  __libc_argv = argv;
-  __environ = envp;
-
-#ifndef SHARED
-  __libc_init_secure ();
-
-  /* First the initialization which normally would be done by the
-     dynamic linker.  */
-  _dl_non_dynamic_init ();
-#endif
-
-#ifdef VDSO_SETUP
-  VDSO_SETUP ();
-#endif
-
-  __init_misc (argc, argv, envp);
-
-#ifdef USE_NONOPTION_FLAGS
-  /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment (envp);
-#endif
-
-  /* Initialize ctype data.  */
-  __ctype_init ();
-
-#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
-  __libc_global_ctors ();
-#endif
-}
-
-/* This function is defined here so that if this file ever gets into
-   ld.so we will get a link error.  Having this file silently included
-   in ld.so causes disaster, because the _init definition above will
-   cause ld.so to gain an init function, which is not a cool thing. */
-
-extern void _dl_start (void) __attribute__ ((noreturn));
-
-void
-_dl_start (void)
-{
-  abort ();
-}
diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c
index 57b36afc40..ba7ae294b5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/init-first.c
+++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Initialization code run first thing by the ELF startup code.  Linux/PowerPC.
+   Copyright (C) 2007-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,4 +46,4 @@ _libc_vdso_platform_setup (void)
 # define VDSO_SETUP _libc_vdso_platform_setup
 #endif
 
-#include "../init-first.c"
+#include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c
index c971382704..a066daefdf 100644
--- a/sysdeps/unix/sysv/linux/s390/init-first.c
+++ b/sysdeps/unix/sysv/linux/s390/init-first.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2008 Free Software Foundation, Inc.
+/* Initialization code run first thing by the ELF startup code.  Linux/s390.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -46,4 +47,4 @@ _libc_vdso_platform_setup (void)
 # define VDSO_SETUP _libc_vdso_platform_setup
 #endif
 
-#include "../init-first.c"
+#include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index e8b52eacb0..dd41f0f7aa 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2007, 2011 Free Software Foundation, Inc.
+/* Initialization code run first thing by the ELF startup code.  Linux/x86-64.
+   Copyright (C) 2007-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -54,4 +55,4 @@ _libc_vdso_platform_setup (void)
 # define VDSO_SETUP _libc_vdso_platform_setup
 #endif
 
-#include "../init-first.c"
+#include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
index c2aea9d4e5..5fe472ea21 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2012 Free Software Foundation, Inc.
+/* Initialization code run first thing by the ELF startup code.  Linux/x32.
+   Copyright (C) 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,4 +38,4 @@ _libc_vdso_platform_setup (void)
 # define VDSO_SETUP _libc_vdso_platform_setup
 #endif
 
-#include "../../init-first.c"
+#include <csu/init-first.c>