/* Operating system support for run-time dynamic linker. Hurd version.
- Copyright (C) 1995,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
+ Copyright (C) 1995-2013 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
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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* In the static library, this is all handled by dl-support.c
+ or by the vanilla definitions in the rest of the C library. */
+#ifdef SHARED
#include <hurd.h>
#include <link.h>
INTVARDEF(__libc_enable_secure)
int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion
of init-first. */
-/* This variable containts the lowest stack address ever used. */
+/* This variable contains the lowest stack address ever used. */
void *__libc_stack_end;
+#if HP_TIMING_AVAIL
+hp_timing_t _dl_cpuclock_offset;
+#endif
+
struct hurd_startup_data *_dl_hurd_data;
+/* This is used only within ld.so, via dl-minimal.c's __errno_location. */
+#undef errno
+int errno attribute_hidden;
+
/* Defining these variables here avoids the inclusion of hurdsig.c. */
unsigned long int __hurd_sigthread_stack_base;
unsigned long int __hurd_sigthread_stack_end;
ElfW(Addr)
_dl_sysdep_start (void **start_argptr,
void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent,
- ElfW(Addr) *user_entry))
+ ElfW(Addr) *user_entry,
+ ElfW(auxv_t) *auxv))
{
- void go (int *argdata)
+ void go (intptr_t *argdata)
{
- extern unsigned int _dl_skip_args; /* rtld.c */
char **p;
/* Cache the information in various global variables. */
up and leave us to transfer control to USER_ENTRY. */
(*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr,
_dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)),
- &_dl_hurd_data->user_entry);
+ &_dl_hurd_data->user_entry, NULL);
/* The call above might screw a few things up.
__mach_init ();
/* Initialize frequently used global variable. */
- GL(dl_pagesize) = __getpagesize ();
+ GLRO(dl_pagesize) = __getpagesize ();
+
+#if HP_TIMING_AVAIL
+ HP_TIMING_NOW (_dl_cpuclock_offset);
+#endif
fmh(); /* XXX */
error. If STAT is non-zero, stat the file into that stat buffer. */
static error_t
open_file (const char *file_name, int flags,
- mach_port_t *port, struct stat *stat)
+ mach_port_t *port, struct stat64 *stat)
{
enum retry_type doretry;
char retryname[1024]; /* XXX string_t LOSES! */
return MACH_PORT_NULL;
}
- assert (!(flags & ~O_READ));
+ assert (!(flags & ~(O_READ | O_CLOEXEC)));
startdir = _dl_hurd_data->portarray[file_name[0] == '/' ?
INIT_PORT_CRDIR : INIT_PORT_CWDIR];
mach_msg_type_number_t nread;
data = buf;
+ nread = nbytes;
err = __io_read ((mach_port_t) fd, &data, &nread, -1, nbytes);
if (err)
return __hurd_fail (err);
return nread;
}
+libc_hidden_weak (__libc_read)
__ssize_t weak_function
__libc_write (int fd, const void *buf, size_t nbytes)
return nwrote;
}
+libc_hidden_weak (__libc_write)
/* This is only used for printing messages (see dl-misc.c). */
__ssize_t weak_function
__writev (int fd, const struct iovec *iov, int niov)
{
+ if (fd >= _hurd_init_dtablesize)
+ {
+ errno = EBADF;
+ return -1;
+ }
+
int i;
size_t total = 0;
for (i = 0; i < niov; ++i)
total += iov[i].iov_len;
- assert (fd < _hurd_init_dtablesize);
-
if (total != 0)
{
char buf[total], *bufp = buf;
}
-off_t weak_function
-__lseek (int fd, off_t offset, int whence)
+off64_t weak_function
+__libc_lseek64 (int fd, off64_t offset, int whence)
{
error_t err;
}
int weak_function
-__fxstat (int vers, int fd, struct stat *buf)
+__fxstat64 (int vers, int fd, struct stat64 *buf)
{
error_t err;
return 0;
}
+libc_hidden_def (__fxstat64)
int weak_function
-__xstat (int vers, const char *file, struct stat *buf)
+__xstat64 (int vers, const char *file, struct stat64 *buf)
{
error_t err;
mach_port_t port;
return 0;
}
+libc_hidden_def (__xstat64)
/* This function is called by the dynamic linker (rtld.c) to check
whether debugging malloc is allowed even for SUID binaries. This
}
pid_t weak_function
-__getpid ()
+__getpid (void)
{
pid_t pid, ppid;
int orphaned;
return NULL;
}
-void weak_function
+void weak_function attribute_hidden
_exit (int status)
{
__proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC],
while (__task_terminate (__mach_task_self ()))
__mach_task_self_ = (__mach_task_self) ();
}
+/* We need this alias to satisfy references from libc_pic.a objects
+ that were affected by the libc_hidden_proto declaration for _exit. */
+strong_alias (_exit, __GI__exit)
/* Try to get a machine dependent instruction which will make the
program crash. This is used in case everything else fails. */
/* Try for ever and ever. */
ABORT_INSTRUCTION;
}
+
+/* We need this alias to satisfy references from libc_pic.a objects
+ that were affected by the libc_hidden_proto declaration for abort. */
+strong_alias (abort, __GI_abort)
\f
/* This function is called by interruptible RPC stubs. For initial
dynamic linking, just use the normal mach_msg. Since this defn is
}
-/* Return an array of useful/necessary hardware capability names. */
-const struct r_strlenpair *
-internal_function
-_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
- size_t *max_capstrlen)
-{
- struct r_strlenpair *result;
-
- /* Return an empty array. Hurd has no hardware capabilities. */
- result = (struct r_strlenpair *) malloc (sizeof (*result));
- if (result == NULL)
- _dl_signal_error (ENOMEM, NULL, NULL, "cannot create capability list");
-
- result[0].str = (char *) result; /* Does not really matter. */
- result[0].len = 0;
-
- *sz = 1;
- return result;
-}
-
void weak_function
_dl_init_first (int argc, ...)
{
/* This no-op definition only gets used if libc is not linked in. */
}
+
+#endif /* SHARED */