1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00
* elf/rtld.c (start_time): New global variable.  Moved from _dl_start.
	(DONT_USE_BOOTSTRAP_MAP): Define if we can use non-exported symbols
	before relocation.
	(_dl_start): Don't use local bootstrap_map variable if
	DONT_USE_BOOTSTRAP_MAP is defined.  Use GL(dl_rtld_map).  Don't
	pass bootstrap_map to _dl_start_final in this case either.  Don't
	pass start_time to _dl_start_final ever.
	(_dl_start_final): Don't copy bootstrap_map of DONT_USE_BOOTSTRAP_MAP.

	* elf/dl-deps.c (_dl_map_object_deps): Revert patch from 2002-05-28.
	This cripples the scope lists necessary to search for symbols in
	dependencies which are not in the global scope.
This commit is contained in:
Ulrich Drepper
2002-08-21 23:01:40 +00:00
parent e40b902786
commit 01d8e36dd9
2 changed files with 57 additions and 16 deletions

View File

@@ -1,8 +1,17 @@
2002-08-21 Ulrich Drepper <drepper@redhat.com> 2002-08-21 Ulrich Drepper <drepper@redhat.com>
* elf/dl-deps.c (_dl_map_object_deps): Revert patch from * elf/rtld.c (start_time): New global variable. Moved from _dl_start.
2002-05-28. This cripples the scope lists necessary to search for (DONT_USE_BOOTSTRAP_MAP): Define if we can use non-exported symbols
symbols in dependencies which are not in the global scope. before relocation.
(_dl_start): Don't use local bootstrap_map variable if
DONT_USE_BOOTSTRAP_MAP is defined. Use GL(dl_rtld_map). Don't
pass bootstrap_map to _dl_start_final in this case either. Don't
pass start_time to _dl_start_final ever.
(_dl_start_final): Don't copy bootstrap_map of DONT_USE_BOOTSTRAP_MAP.
* elf/dl-deps.c (_dl_map_object_deps): Revert patch from 2002-05-28.
This cripples the scope lists necessary to search for symbols in
dependencies which are not in the global scope.
* include/setjmp.h (__libc_longjmp): Add declaration. * include/setjmp.h (__libc_longjmp): Add declaration.

View File

@@ -115,6 +115,7 @@ static struct libname_list _dl_rtld_libname2;
static hp_timing_t rtld_total_time; static hp_timing_t rtld_total_time;
static hp_timing_t relocate_time; static hp_timing_t relocate_time;
static hp_timing_t load_time; static hp_timing_t load_time;
static hp_timing_t start_time;
#endif #endif
/* Additional definitions needed by TLS initialization. */ /* Additional definitions needed by TLS initialization. */
@@ -122,8 +123,22 @@ static hp_timing_t load_time;
TLS_INIT_HELPER TLS_INIT_HELPER
#endif #endif
static ElfW(Addr) _dl_start_final (void *arg, struct link_map *bootstrap_map_p, /* Before ld.so is relocated we must not access variables which need
hp_timing_t start_time); relocations. This means variables which are exported. Variables
declared as static are fine. If we can mark a variable hidden this
is fine, too. The latter is impotant here. We can avoid setting
up a temporary link map for ld.so if we can mark _rtld_global as
hidden. */
#ifdef HAVE_HIDDEN
# define DONT_USE_BOOTSTRAP_MAP 1
#endif
#ifdef DONT_USE_BOOTSTRAP_MAP
static ElfW(Addr) _dl_start_final (void *arg);
#else
static ElfW(Addr) _dl_start_final (void *arg,
struct link_map *bootstrap_map_p);
#endif
#ifdef RTLD_START #ifdef RTLD_START
RTLD_START RTLD_START
@@ -134,8 +149,11 @@ RTLD_START
static ElfW(Addr) __attribute_used__ internal_function static ElfW(Addr) __attribute_used__ internal_function
_dl_start (void *arg) _dl_start (void *arg)
{ {
#ifdef DONT_USE_BOOTSTRAP_MAP
# define bootstrap_map GL(dl_rtld_map)
#else
struct link_map bootstrap_map; struct link_map bootstrap_map;
hp_timing_t start_time; #endif
#if !defined HAVE_BUILTIN_MEMSET || defined USE_TLS #if !defined HAVE_BUILTIN_MEMSET || defined USE_TLS
size_t cnt; size_t cnt;
#endif #endif
@@ -160,14 +178,18 @@ _dl_start (void *arg)
/* Partly clean the `bootstrap_map' structure up. Don't use /* Partly clean the `bootstrap_map' structure up. Don't use
`memset' since it might not be built in or inlined and we cannot `memset' since it might not be built in or inlined and we cannot
make function calls at this point. Use '__builtin_memset' if we make function calls at this point. Use '__builtin_memset' if we
know it is available. */ know it is available. We do not have to clear the memory if we
#ifdef HAVE_BUILTIN_MEMSET do not have to use the temporary bootstrap_map. Global variables
are initialized to zero by default. */
#ifndef DONT_USE_BOOTSTRAP_MAP
# ifdef HAVE_BUILTIN_MEMSET
__builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info)); __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
#else # else
for (cnt = 0; for (cnt = 0;
cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]); cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
++cnt) ++cnt)
bootstrap_map.l_info[cnt] = 0; bootstrap_map.l_info[cnt] = 0;
# endif
#endif #endif
/* Figure out the run-time load address of the dynamic linker itself. */ /* Figure out the run-time load address of the dynamic linker itself. */
@@ -178,7 +200,7 @@ _dl_start (void *arg)
elf_get_dynamic_info (&bootstrap_map); elf_get_dynamic_info (&bootstrap_map);
#if USE_TLS #if USE_TLS
# ifndef HAVE___THREAD # if !defined HAVE___THREAD && !defined DONT_USE_BOOTSTRAP_MAP
/* Signal that we have not found TLS data so far. */ /* Signal that we have not found TLS data so far. */
bootstrap_map.l_tls_modid = 0; bootstrap_map.l_tls_modid = 0;
# endif # endif
@@ -306,7 +328,11 @@ _dl_start (void *arg)
function, that way the compiler cannot put accesses to the GOT function, that way the compiler cannot put accesses to the GOT
before ELF_DYNAMIC_RELOCATE. */ before ELF_DYNAMIC_RELOCATE. */
{ {
ElfW(Addr) entry = _dl_start_final (arg, &bootstrap_map, start_time); #ifdef DONT_USE_BOOTSTRAP_MAP
ElfW(Addr) entry = _dl_start_final (arg);
#else
ElfW(Addr) entry = _dl_start_final (arg, &bootstrap_map);
#endif
#ifndef ELF_MACHINE_START_ADDRESS #ifndef ELF_MACHINE_START_ADDRESS
# define ELF_MACHINE_START_ADDRESS(map, start) (start) # define ELF_MACHINE_START_ADDRESS(map, start) (start)
@@ -326,9 +352,13 @@ _dl_start (void *arg)
+ DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag)) + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag))
#endif #endif
#ifdef DONT_USE_BOOTSTRAP_MAP
static ElfW(Addr) static ElfW(Addr)
_dl_start_final (void *arg, struct link_map *bootstrap_map_p, _dl_start_final (void *arg)
hp_timing_t start_time) #else
static ElfW(Addr)
_dl_start_final (void *arg, struct link_map *bootstrap_map_p)
#endif
{ {
/* The use of `alloca' here looks ridiculous but it helps. The goal /* The use of `alloca' here looks ridiculous but it helps. The goal
is to avoid the function from being inlined. There is no official is to avoid the function from being inlined. There is no official
@@ -349,17 +379,19 @@ _dl_start_final (void *arg, struct link_map *bootstrap_map_p,
} }
/* Transfer data about ourselves to the permanent link_map structure. */ /* 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_addr = bootstrap_map_p->l_addr;
GL(dl_rtld_map).l_ld = bootstrap_map_p->l_ld; GL(dl_rtld_map).l_ld = bootstrap_map_p->l_ld;
GL(dl_rtld_map).l_opencount = 1;
memcpy (GL(dl_rtld_map).l_info, bootstrap_map_p->l_info, memcpy (GL(dl_rtld_map).l_info, bootstrap_map_p->l_info,
sizeof GL(dl_rtld_map).l_info); sizeof GL(dl_rtld_map).l_info);
_dl_setup_hash (&GL(dl_rtld_map));
GL(dl_rtld_map).l_mach = bootstrap_map_p->l_mach; GL(dl_rtld_map).l_mach = bootstrap_map_p->l_mach;
#endif
_dl_setup_hash (&GL(dl_rtld_map));
GL(dl_rtld_map).l_opencount = 1;
GL(dl_rtld_map).l_map_start = (ElfW(Addr)) _begin; GL(dl_rtld_map).l_map_start = (ElfW(Addr)) _begin;
GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end; GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end;
/* Copy the TLS related data if necessary. */ /* Copy the TLS related data if necessary. */
#if USE_TLS #if USE_TLS && !defined DONT_USE_BOOTSTRAP_MAP
# ifdef HAVE___THREAD # ifdef HAVE___THREAD
assert (bootstrap_map_p->l_tls_modid != 0); assert (bootstrap_map_p->l_tls_modid != 0);
# else # else