diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-02-01 01:33:04 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-02-01 01:33:04 +0000 |
commit | 5688da55372193e5941f0240e6ea759d28483970 (patch) | |
tree | 07e201b5db41088611a28d339926c7a953fa7391 /elf/rtld.c | |
parent | a204ea3607d148c7b83dec5b54496762a99699d8 (diff) | |
download | glibc-5688da55372193e5941f0240e6ea759d28483970.tar.gz glibc-5688da55372193e5941f0240e6ea759d28483970.tar.xz glibc-5688da55372193e5941f0240e6ea759d28483970.zip |
Update.
* sysdeps/generic/ldsodefs.h: Add _dl_load_lock, _dl_lazy, _dl_dynamic_weak, _dl_fpu_control, _dl_cpuclock_offset, and _dl_debug_fd to rtld_global. * elf/Versions: Likewise. * elf/dl-close.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-misc.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-support.c: Likewise. * elf/do-lookup.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/ia64/Versions: Likewise. * sysdeps/unix/clock_gettime.c: Likewise. * sysdeps/unix/clock_settime.c: Likewise. * sysdeps/unix/sysv/linux/init-first.c: Likewise. * sysdeps/sparc/Versions: Removed. * sysdeps/i386/i686/Versions : Removed. * sysdeps/x86_64/Versions: Removed. * configure.in: Define HAVE_PROTECTED if .protected is available. * config.h.in: Add entry for HAVE_PROTECTED. 2002-01-31 Jakub Jelinek <jakub@redhat.com. * sysdeps/alpha/dl-machine.h: Move global variables for SHARED code in struct _rtld_global. Export this struct, remove all exports for the signal variables. * sysdeps/arm/dl-machine: Likewise. * sysdeps/generic/dl-origin: Likewise. * sysdeps/generic/dl-sysdep: Likewise. * sysdeps/generic/dl-cache: Likewise. * sysdeps/hppa/dl-fptr: Likewise. * sysdeps/hppa/dl-machine: Likewise. * sysdeps/cris/dl-machine: Likewise. * sysdeps/i386/dl-machine: Likewise. * sysdeps/ia64/dl-machine: Likewise. * sysdeps/m68k/dl-machine: Likewise. * sysdeps/mach/hurd/dl-sysdep: Likewise. * sysdeps/mips/mips64/dl-machine: Likewise. * sysdeps/mips/dl-machine: Likewise. * sysdeps/powerpc/elf/libc-start: Likewise. * sysdeps/powerpc/dl-machine: Likewise. * sysdeps/powerpc/dl-start: Likewise. * sysdeps/sparc/sparc32/dl-machine: Likewise. * sysdeps/sparc/sparc64/dl-machine: Likewise. * sysdeps/sh/dl-machine: Likewise. * sysdeps/s390/s390-32/dl-machine: Likewise. * sysdeps/s390/s390-64/dl-machine: Likewise. * sysdeps/unix/sysv/aix/libc-start: Likewise. * sysdeps/unix/sysv/aix/start-libc: Likewise. * sysdeps/unix/sysv/linux/ia64/dl-static: Likewise. * sysdeps/unix/sysv/linux/m68k/getpagesize: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize: Likewise. * sysdeps/x86_64/dl-machine: Likewise. 2002-01-31 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r-- | elf/rtld.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index 050d7fae8a..e4c2c6e0ad 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -33,6 +33,8 @@ #include "dynamic-link.h" #include "dl-librecon.h" #include <unsecvars.h> +#include <dl-cache.h> +#include <dl-procinfo.h> #include <assert.h> @@ -58,25 +60,6 @@ static void process_envvars (enum mode *modep); int _dl_argc; char **_dl_argv; unsigned int _dl_skip_args; /* Nonzero if we were run directly. */ -fpu_control_t _dl_fpu_control = _FPU_DEFAULT; -int _dl_lazy = 1; -/* XXX I know about at least one case where we depend on the old weak - behavior (it has to do with librt). Until we get DSO groups implemented - we have to make this the default. Bummer. --drepper */ -#if 0 -int _dl_dynamic_weak; -#else -int _dl_dynamic_weak = 1; -#endif - -/* During the program run we must not modify the global data of - loaded shared object simultanously in two threads. Therefore we - protect `_dl_open' and `_dl_close' in dl-close.c. - - This must be a recursive lock since the initializer function of - the loaded object might as well require a call to this function. - At this time it is not anymore a problem to modify the tables. */ -__libc_lock_define_initialized_recursive (, _dl_load_lock) /* Set nonzero during loading and initialization of executable and libraries, cleared before the executable's entry point runs. This @@ -89,7 +72,26 @@ int _dl_starting_up; /* This is the structure which defines all variables global to ld.so (except those which cannot be added for some reason). */ -struct rtld_global _rtld_global; +struct rtld_global _rtld_global = + { + ._dl_debug_fd = STDERR_FILENO, +#if 1 + /* XXX I know about at least one case where we depend on the old + weak behavior (it has to do with librt). Until we get DSO + groups implemented we have to make this the default. + Bummer. --drepper */ + ._dl_dynamic_weak = 1, +#endif + ._dl_lazy = 1, + ._dl_fpu_control = _FPU_DEFAULT, + ._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID, + ._dl_hwcap_mask = HWCAP_IMPORTANT, + ._dl_load_lock = _LIBC_LOCK_RECURSIVE_INITIALIZER + }; +/* There must only be the definition in ld.so itself. */ +#ifdef HAVE_PROTECTED +asm (".protected _rtld_global"); +#endif static void dl_main (const ElfW(Phdr) *phdr, @@ -418,7 +420,7 @@ dl_main (const ElfW(Phdr) *phdr, if (! strcmp (_dl_argv[1], "--list")) { mode = list; - _dl_lazy = -1; /* This means do no dependency analysis. */ + GL(dl_lazy) = -1; /* This means do no dependency analysis. */ ++_dl_skip_args; --_dl_argc; @@ -941,13 +943,13 @@ of this helper program; chances are you did not intend to run this program.\n\ else { /* If LD_WARN is set warn about undefined symbols. */ - if (_dl_lazy >= 0 && GL(dl_verbose)) + if (GL(dl_lazy) >= 0 && GL(dl_verbose)) { /* We have to do symbol dependency testing. */ struct relocate_args args; struct link_map *l; - args.lazy = _dl_lazy; + args.lazy = GL(dl_lazy); l = GL(dl_loaded); while (l->l_next) @@ -1142,7 +1144,7 @@ of this helper program; chances are you did not intend to run this program.\n\ #endif /* If we are profiling we also must do lazy reloaction. */ - _dl_lazy |= consider_profiling; + GL(dl_lazy) |= consider_profiling; l = GL(dl_loaded); while (l->l_next) @@ -1163,7 +1165,7 @@ of this helper program; chances are you did not intend to run this program.\n\ } if (l != &GL(dl_rtld_map)) - _dl_relocate_object (l, l->l_scope, _dl_lazy, consider_profiling); + _dl_relocate_object (l, l->l_scope, GL(dl_lazy), consider_profiling); l = l->l_prev; } @@ -1327,6 +1329,7 @@ process_dl_debug (const char *dl_debug) && debopts[cnt].name[len] == '\0') { GL(dl_debug_mask) |= debopts[cnt].mask; + any_debug = 1; break; } @@ -1428,7 +1431,7 @@ process_envvars (enum mode *modep) /* Do we bind early? */ if (memcmp (envline, "BIND_NOW", 8) == 0) { - _dl_lazy = envline[9] == '\0'; + GL(dl_lazy) = envline[9] == '\0'; break; } if (memcmp (envline, "BIND_NOT", 8) == 0) @@ -1471,7 +1474,7 @@ process_envvars (enum mode *modep) } if (memcmp (envline, "DYNAMIC_WEAK", 12) == 0) - _dl_dynamic_weak = 1; + GL(dl_dynamic_weak) = 1; break; case 14: @@ -1553,10 +1556,10 @@ process_envvars (enum mode *modep) *--startp = '.'; startp = memcpy (startp - name_len, debug_output, name_len); - _dl_debug_fd = __open (startp, flags, DEFFILEMODE); - if (_dl_debug_fd == -1) + GL(dl_debug_fd) = __open (startp, flags, DEFFILEMODE); + if (GL(dl_debug_fd) == -1) /* We use standard output if opening the file failed. */ - _dl_debug_fd = STDOUT_FILENO; + GL(dl_debug_fd) = STDOUT_FILENO; } } |