1 /* Operating system support for run-time dynamic linker. Generic Unix version.
2 Copyright (C) 1995 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 Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
21 #include <sys/types.h>
27 extern char **_dl_argv
;
28 extern char **_environ
;
29 extern void _start (void);
32 _dl_sysdep_start (void **start_argptr
,
33 void (*dl_main
) (const Elf32_Phdr
*phdr
, Elf32_Word phnum
,
34 Elf32_Addr
*user_entry
))
36 const Elf32_Phdr
*phdr
;
38 Elf32_Addr user_entry
;
43 user_entry
= (Elf32_Addr
) &_start
;
44 _dl_argc
= *(int *) start_argptr
;
45 _dl_argv
= (char **) start_argptr
+ 1;
46 _environ
= &_dl_argv
[_dl_argc
+ 1];
47 start_argptr
= (void **) _environ
;
51 for (av
= (void *) ++start_argptr
; av
->a_type
!= AT_NULL
; ++av
)
55 phdr
= av
->a_un
.a_ptr
;
58 phnum
= av
->a_un
.a_val
;
61 user_entry
= av
->a_un
.a_val
;
70 euid
= av
->a_un
.a_val
;
73 egid
= av
->a_un
.a_val
;
77 _dl_secure
= uid
!= euid
|| gid
!= egid
;
79 (*dl_main
) (phdr
, phnum
, &user_entry
);
84 _dl_sysdep_open_zero_fill (void)
86 return open ("/dev/zero", O_RDONLY
);
92 _dl_sysdep_fatal (const char *msg
, ...)
99 size_t len
= strlen (msg
);
100 write (STDERR_FILENO
, msg
, len
);
101 msg
= va_arg (ap
, const char *);
110 _dl_sysdep_message (const char *msg
, ...)
117 size_t len
= strlen (msg
);
118 write (STDOUT_FILENO
, msg
, len
);
119 msg
= va_arg (ap
, const char *);