1 /* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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
27 int __cache_line_size attribute_hidden
;
28 /* The main work is done in the generic function. */
29 #define LIBC_START_MAIN generic_start_main
30 #define LIBC_START_DISABLE_INLINE
31 #define LIBC_START_MAIN_AUXVEC_ARG
32 #define MAIN_AUXVEC_ARG
33 #define INIT_MAIN_ARGS
34 #include <csu/libc-start.c>
38 void *__unbounded sda_base
;
39 int (*main
) (int, char **, char **, void *);
40 int (*init
) (int, char **, char **, void *);
46 # include <sys/time.h>
48 # undef __gettimeofday
49 # undef __clock_gettime
50 # undef __clock_getres
51 # include <bits/libc-vdso.h>
53 void *__vdso_gettimeofday
;
54 void *__vdso_clock_gettime
;
55 void *__vdso_clock_getres
;
56 void *__vdso_get_tbfreq
;
58 static inline void _libc_vdso_platform_setup (void)
60 __vdso_gettimeofday
= _dl_vdso_vsym ("__kernel_gettimeofday",
63 __vdso_clock_gettime
= _dl_vdso_vsym ("__kernel_clock_gettime",
66 __vdso_clock_getres
= _dl_vdso_vsym ("__kernel_clock_getres",
69 __vdso_get_tbfreq
= _dl_vdso_vsym ("__kernel_vdso_get_tbfreq",
75 /* GKM FIXME: GCC: this should get __BP_ prefix by virtue of the
76 BPs in the arglist of startup_info.main and startup_info.init. */
77 BP_SYM (__libc_start_main
) (int argc
, char *__unbounded
*__unbounded ubp_av
,
78 char *__unbounded
*__unbounded ubp_ev
,
79 ElfW (auxv_t
) * __unbounded auxvec
,
80 void (*rtld_fini
) (void),
81 struct startup_info
*__unbounded stinfo
,
82 char *__unbounded
*__unbounded stack_on_entry
)
84 #if __BOUNDED_POINTERS__
90 /* the PPC SVR4 ABI says that the top thing on the stack will
91 be a NULL pointer, so if not we assume that we're being called
92 as a statically-linked program by Linux... */
93 if (*stack_on_entry
!= NULL
)
95 char *__unbounded
* __unbounded temp
;
96 /* ...in which case, we have argc as the top thing on the
97 stack, followed by argv (NULL-terminated), envp (likewise),
98 and the auxilary vector. */
99 /* 32/64-bit agnostic load from stack */
100 argc
= *(long int *__unbounded
) stack_on_entry
;
101 ubp_av
= stack_on_entry
+ 1;
102 ubp_ev
= ubp_av
+ argc
+ 1;
103 #ifdef HAVE_AUX_VECTOR
105 while (*temp
!= NULL
)
107 auxvec
= (ElfW (auxv_t
) *)++ temp
;
112 /* Initialize the __cache_line_size variable from the aux vector. */
113 for (ElfW (auxv_t
) * av
= auxvec
; av
->a_type
!= AT_NULL
; ++av
)
117 __cache_line_size
= av
->a_un
.a_val
;
121 /* Resolve and initialize function pointers for VDSO functions. */
122 _libc_vdso_platform_setup ();
124 return generic_start_main (stinfo
->main
, argc
, ubp_av
, auxvec
,
125 stinfo
->init
, stinfo
->fini
, rtld_fini
,