From 4874b009bd4c92e46bd9bd2be1d4c4e0a7c4516e Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 17 Sep 2002 05:42:29 +0000 Subject: [PATCH] * include/unistd.h: Uncomment libc_hidden_proto for _exit. * sysdeps/mach/hurd/_exit.c: Add libc_hidden_def. * sysdeps/generic/_exit.c: Likewise. 2002-09-12 Jakub Jelinek * elf/rtld.c (struct dl_start_final_info): New. (_dl_start_final): Change second argument to struct dl_start_final_info *. Set start_time from info. (_dl_start): Remove bootstrap_map variable, add info. Define bootstrap_map as macro. If not DONT_USE_BOOTSTRAP_MAP, store HP_TIMING_NOW result into info.start_time. --- ChangeLog | 15 +++++++++++++++ elf/rtld.c | 49 +++++++++++++++++++++++++++++++---------------- include/unistd.h | 5 +---- sysdeps/generic/_exit.c | 3 ++- sysdeps/mach/hurd/_exit.c | 3 ++- 5 files changed, 52 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dc845d..26c69f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2002-09-16 Roland McGrath + + * include/unistd.h: Uncomment libc_hidden_proto for _exit. + * sysdeps/mach/hurd/_exit.c: Add libc_hidden_def. + * sysdeps/generic/_exit.c: Likewise. + +2002-09-12 Jakub Jelinek + + * elf/rtld.c (struct dl_start_final_info): New. + (_dl_start_final): Change second argument to struct + dl_start_final_info *. Set start_time from info. + (_dl_start): Remove bootstrap_map variable, add info. + Define bootstrap_map as macro. If not DONT_USE_BOOTSTRAP_MAP, + store HP_TIMING_NOW result into info.start_time. + 2002-09-16 Andreas Jaeger * sysdeps/unix/sysv/linux/_exit.c: Add libc_hidden_def and weak_alias diff --git a/elf/rtld.c b/elf/rtld.c index ea9cee1..2d20696 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -146,8 +146,15 @@ TLS_INIT_HELPER #ifdef DONT_USE_BOOTSTRAP_MAP static ElfW(Addr) _dl_start_final (void *arg); #else +struct dl_start_final_info +{ + struct link_map l; +#if !defined HP_TIMING_NONAVAIL && HP_TIMING_INLINE + hp_timing_t start_time; +#endif +}; static ElfW(Addr) _dl_start_final (void *arg, - struct link_map *bootstrap_map_p); + struct dl_start_final_info *info); #endif /* These defined magically in the linker script. */ @@ -181,7 +188,7 @@ static inline ElfW(Addr) __attribute__ ((always_inline)) _dl_start_final (void *arg) #else static ElfW(Addr) __attribute__ ((noinline)) -_dl_start_final (void *arg, struct link_map *bootstrap_map_p) +_dl_start_final (void *arg, struct dl_start_final_info *info) #endif { ElfW(Addr) start_addr; @@ -191,6 +198,10 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p) /* If it hasn't happen yet record the startup time. */ if (! HP_TIMING_INLINE) HP_TIMING_NOW (start_time); +#ifndef DONT_USE_BOOTSTRAP_MAP + else + start_time = info->start_time; +#endif /* Initialize the timing functions. */ HP_TIMING_DIFF_INIT (); @@ -198,11 +209,11 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p) /* Transfer data about ourselves to the permanent link_map structure. */ #ifndef DONT_USE_BOOTSTRAP_MAP - GL(dl_rtld_map).l_addr = bootstrap_map_p->l_addr; - GL(dl_rtld_map).l_ld = bootstrap_map_p->l_ld; - memcpy (GL(dl_rtld_map).l_info, bootstrap_map_p->l_info, + GL(dl_rtld_map).l_addr = info->l.l_addr; + GL(dl_rtld_map).l_ld = info->l.l_ld; + memcpy (GL(dl_rtld_map).l_info, info->l.l_info, sizeof GL(dl_rtld_map).l_info); - GL(dl_rtld_map).l_mach = bootstrap_map_p->l_mach; + GL(dl_rtld_map).l_mach = info->l.l_mach; #endif _dl_setup_hash (&GL(dl_rtld_map)); GL(dl_rtld_map).l_opencount = 1; @@ -211,20 +222,19 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p) /* Copy the TLS related data if necessary. */ #if USE_TLS && !defined DONT_USE_BOOTSTRAP_MAP # ifdef HAVE___THREAD - assert (bootstrap_map_p->l_tls_modid != 0); + assert (info->l.l_tls_modid != 0); # else - if (bootstrap_map_p->l_tls_modid != 0) + if (info->l.l_tls_modid != 0) # endif { - GL(dl_rtld_map).l_tls_blocksize = bootstrap_map_p->l_tls_blocksize; - GL(dl_rtld_map).l_tls_align = bootstrap_map_p->l_tls_align; - GL(dl_rtld_map).l_tls_initimage_size - = bootstrap_map_p->l_tls_initimage_size; - GL(dl_rtld_map).l_tls_initimage = bootstrap_map_p->l_tls_initimage; - GL(dl_rtld_map).l_tls_offset = bootstrap_map_p->l_tls_offset; + GL(dl_rtld_map).l_tls_blocksize = info->l.l_tls_blocksize; + GL(dl_rtld_map).l_tls_align = info->l.l_tls_align; + GL(dl_rtld_map).l_tls_initimage_size = info->l.l_tls_initimage_size; + GL(dl_rtld_map).l_tls_initimage = info->l.l_tls_initimage; + GL(dl_rtld_map).l_tls_offset = info->l.l_tls_offset; GL(dl_rtld_map).l_tls_modid = 1; GL(dl_rtld_map).l_tls_tp_initialized - = bootstrap_map_p->l_tls_tp_initialized; + = info->l.l_tls_tp_initialized; } #endif @@ -263,7 +273,8 @@ _dl_start (void *arg) #ifdef DONT_USE_BOOTSTRAP_MAP # define bootstrap_map GL(dl_rtld_map) #else - struct link_map bootstrap_map; + struct dl_start_final_info info; +# define bootstrap_map info.l #endif #if !defined HAVE_BUILTIN_MEMSET || defined USE_TLS size_t cnt; @@ -284,7 +295,11 @@ _dl_start (void *arg) #include "dynamic-link.h" if (HP_TIMING_INLINE && HP_TIMING_AVAIL) +#ifdef DONT_USE_BOOTSTRAP_MAP HP_TIMING_NOW (start_time); +#else + HP_TIMING_NOW (info.start_time); +#endif /* Partly clean the `bootstrap_map' structure up. Don't use `memset' since it might not be built in or inlined and we cannot @@ -450,7 +465,7 @@ _dl_start (void *arg) #ifdef DONT_USE_BOOTSTRAP_MAP ElfW(Addr) entry = _dl_start_final (arg); #else - ElfW(Addr) entry = _dl_start_final (arg, &bootstrap_map); + ElfW(Addr) entry = _dl_start_final (arg, &info); #endif #ifndef ELF_MACHINE_START_ADDRESS diff --git a/include/unistd.h b/include/unistd.h index 26993d4..1df80fd 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,10 +1,7 @@ #ifndef _UNISTD_H # include -// XXX Normally we should be able to hide _exit. But in the thread library -// XXX we might need to overload this function so that all threads can be -// XXX killed. -// libc_hidden_proto (_exit) +libc_hidden_proto (_exit) libc_hidden_proto (alarm) libc_hidden_proto (confstr) libc_hidden_proto (execl) diff --git a/sysdeps/generic/_exit.c b/sysdeps/generic/_exit.c index 64e8b99..673667d 100644 --- a/sysdeps/generic/_exit.c +++ b/sysdeps/generic/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 94, 95, 96, 97, 99 Free Software Foundation, Inc. +/* Copyright (C) 1991,94,95,96,97,99,2002 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 @@ -29,6 +29,7 @@ _exit (status) status &= 0xff; abort (); } +libc_hidden_def (_exit) weak_alias (_exit, _Exit) stub_warning (_exit) diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c index 5740c16..af0337b 100644 --- a/sysdeps/mach/hurd/_exit.c +++ b/sysdeps/mach/hurd/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 94, 95, 96, 97, 99 Free Software Foundation, Inc. +/* Copyright (C) 1993,94,95,96,97,99,2002 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 @@ -52,4 +52,5 @@ _exit (status) { _hurd_exit (W_EXITCODE (status, 0)); } +libc_hidden_def (_exit) weak_alias (_exit, _Exit) -- 2.7.4