~ubuntu-branches/ubuntu/utopic/eglibc/utopic

« back to all changes in this revision

Viewing changes to ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/init-first.c

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-10-26 05:14:58 UTC
  • mfrom: (1.5.1) (4.4.22 experimental)
  • Revision ID: package-import@ubuntu.com-20121026051458-oryotr4i03ob5pab
Tags: 2.16-0ubuntu1
* Merge with unreleased 2.16 in Debian experimental, remaining changes:
  - Drop the Breaks line from libc6, which refers to a Debian transition
  - Remove the libc6 recommends on libc6-i686, which we don't build
  - Enable libc6{,-dev}-armel on armhf and libc6{-dev}-armhf on armel
  - Ship update-locale and validlocale in /usr/sbin in libc-bin
  - Don't build locales or locales-all in Ubuntu, we rely on langpacks
  - Heavily mangle the way we do service restarting on major upgrades
  - Use different MIN_KERNEL_SUPPORTED versions than Debian, due to
    buildd needs.  This should be universally bumped to 3.2.0 once all
    our buildds (including the PPA guests) are running precise kernels
  - Build i386 variants as -march=i686, build amd64 with -O3, and build
    ppc64 variants (both 64-bit and 32-bit) with -O3 -fno-tree-vectorize
  - Re-enable unsubmitted-ldconfig-cache-abi.diff and rebuild the cache
    on upgrades from previous versions that used a different constant
  - debian/patches/any/local-CVE-2012-3406.diff: switch to malloc when
    array grows too large to handle via alloca extension (CVE-2012-3406)
  - Build generic i386/i686 flavour with -mno-tls-direct-seg-refs
* Changes added/dropped with this merge while reducing our delta:
  - Stop building glibc docs from the eglibc source, and instead make
    the glibc-docs stub have a hard dependency on glibc-doc-reference
  - Remove outdated conflicts against ancient versions of ia32-libs
  - Drop the tzdata dependency from libc6, it's in required and minimal
  - Use gcc-4.7/g++-4.7 by default on all our supported architectures
  - Save our historical changelog as changelog.ubuntu in the source
  - Drop nscd's libaudit build-dep for now, as libaudit is in universe
  - Drop the unnecessary Breaks from libc6 to locales and locales-all
  - Ship xen's ld.so.conf.d snippet as /etc/ld.so.conf.d/libc6-xen.conf
* Disable hard failures on the test suite for the first upload to raring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Initialization code run first thing by the ELF startup code.
 
2
   Copyright (C) 1995-2004, 2005, 2007 Free Software Foundation, Inc.
 
3
   This file is part of the GNU C Library.
 
4
 
 
5
   The GNU C Library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Lesser General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2.1 of the License, or (at your option) any later version.
 
9
 
 
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
   Lesser General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Lesser General Public
 
16
   License along with the GNU C Library; if not, write to the Free
 
17
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
18
   02111-1307 USA.  */
 
19
 
 
20
#include <stdio.h>
 
21
#include <stdlib.h>
 
22
#include <fcntl.h>
 
23
#include <unistd.h>
 
24
#include <sysdep.h>
 
25
#include <signal.h>
 
26
#include <fpu_control.h>
 
27
#include <sys/param.h>
 
28
#include <sys/types.h>
 
29
#include <libc-internal.h>
 
30
 
 
31
#include <ldsodefs.h>
 
32
 
 
33
extern int __syscall_sigaction (int __sig,  const struct sigaction *__act, struct sigaction *__oact) __THROW;
 
34
libc_hidden_proto (__syscall_sigaction)
 
35
 
 
36
/* Set nonzero if we have to be prepared for more then one libc being
 
37
   used in the process.  Safe assumption if initializer never runs.  */
 
38
int __libc_multiple_libcs attribute_hidden = 1;
 
39
 
 
40
/* Remember the command line argument and enviroment contents for
 
41
   later calls of initializers for dynamic libraries.  */
 
42
int __libc_argc attribute_hidden;
 
43
char **__libc_argv attribute_hidden;
 
44
 
 
45
 
 
46
void
 
47
__libc_init_first (int argc, char **argv, char **envp)
 
48
{
 
49
#ifdef SHARED
 
50
  /* For DSOs we do not need __libc_init_first but instead _init.  */
 
51
}
 
52
 
 
53
void
 
54
attribute_hidden
 
55
_init (int argc, char **argv, char **envp)
 
56
{
 
57
#endif
 
58
#ifdef USE_NONOPTION_FLAGS
 
59
  extern void __getopt_clean_environment (char **);
 
60
#endif
 
61
 
 
62
  __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
 
63
 
 
64
  /* Make sure we don't initialize twice.  */
 
65
  if (!__libc_multiple_libcs)
 
66
    {
 
67
      /* Set the FPU control word to the proper default value if the
 
68
         kernel would use a different value.  (In a static program we
 
69
         don't have this information.)  */
 
70
#if 0
 
71
      /* at least on kFreeBSD set it even if SHARED,
 
72
      fixes "make check" failures like math/test-fpucw.out */
 
73
#ifdef SHARED
 
74
      if (__fpu_control != GLRO(dl_fpu_control))
 
75
#endif
 
76
#endif
 
77
        __setfpucw (__fpu_control);
 
78
    }
 
79
 
 
80
  /* By default on kFreeBSD when a call to non existing syscall is
 
81
     made, the program is terminated. As we want to be able to detect
 
82
     missing syscalls and provide a fallback code, we ignore the SIGSYS
 
83
     signal. */
 
84
  {
 
85
    struct sigaction act;
 
86
    
 
87
    act.sa_handler = SIG_IGN;
 
88
    __sigemptyset (&act.sa_mask);
 
89
    act.sa_flags = 0;
 
90
    
 
91
    INLINE_SYSCALL (sigaction, 3, SIGSYS, &act, NULL); 
 
92
  }  
 
93
 
 
94
  /* Save the command-line arguments.  */
 
95
  __libc_argc = argc;
 
96
  __libc_argv = argv;
 
97
  __environ = envp;
 
98
 
 
99
#ifndef SHARED
 
100
  __libc_init_secure ();
 
101
 
 
102
  /* First the initialization which normally would be done by the
 
103
     dynamic linker.  */
 
104
  _dl_non_dynamic_init ();
 
105
#endif
 
106
 
 
107
#ifdef VDSO_SETUP
 
108
  VDSO_SETUP ();
 
109
#endif
 
110
 
 
111
  __init_misc (argc, argv, envp);
 
112
 
 
113
#ifdef USE_NONOPTION_FLAGS
 
114
  /* This is a hack to make the special getopt in GNU libc working.  */
 
115
  __getopt_clean_environment (envp);
 
116
#endif
 
117
 
 
118
#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
 
119
  __libc_global_ctors ();
 
120
#endif
 
121
}
 
122
 
 
123
 
 
124
/* This function is defined here so that if this file ever gets into
 
125
   ld.so we will get a link error.  Having this file silently included
 
126
   in ld.so causes disaster, because the _init definition above will
 
127
   cause ld.so to gain an init function, which is not a cool thing. */
 
128
 
 
129
extern void _dl_start (void) __attribute__ ((noreturn));
 
130
 
 
131
void
 
132
_dl_start (void)
 
133
{
 
134
  abort ();
 
135
}