diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-08-11 08:57:41 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-08-11 08:57:41 +0000 |
commit | 67c94753e3f2ec372483cd41fbcc1bcdc04053fb (patch) | |
tree | 253f8967708078bd2fc0f24dcdae28d14f47e668 /elf | |
parent | 6ae9b99ef23691204c5e1e8128425f1a78465a4f (diff) | |
download | glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.tar glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.tar.gz glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.tar.bz2 glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.zip |
Update.
2001-08-11 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (ptmalloc_init): Don't call getenv five times.
Instead use new function next_env_entry which iterates over the
environment once.
* sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Only set
_dl_profile_map for the right object.
* elf/dl-reloc.c (_dl_relocate_object): Allocate l_reloc_result
only if consider_profiling is != 0, not if _dl_profile != NULL.
* sysdeps/generic/dl-environ.c (_dl_next_ld_env_entry): Optimize a bit.
Now returns pointer to first character set "LD_".
* elf/rtld.c (process_envvars): Adjust for change above.
* sysdeps/unix/sysv/linux/dl-librecon.h (EXTRA_LD_ENVVARS): Likewise.
* sysdeps/unix/sysv/linux/i386/dl-librecon.h (EXTRA_LD_ENVVARS):
Likewise.
2001-08-10 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c (grow_heap): Use mmap() rather than mprotect()
to allocate new memory, for better performance with Linux-2.4.x.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-reloc.c | 2 | ||||
-rw-r--r-- | elf/rtld.c | 62 |
2 files changed, 33 insertions, 31 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index c829de797f..dbbc19c233 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -91,7 +91,7 @@ cannot make segment writable for relocation")); #include "dynamic-link.h" ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling); - if (__builtin_expect (_dl_profile != NULL, 0)) + if (__builtin_expect (consider_profiling, 0)) { /* Allocate the array which will contain the already found relocations. If the shared object lacks a PLT (for example diff --git a/elf/rtld.c b/elf/rtld.c index 2eddb5a40a..b32de61888 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1282,10 +1282,12 @@ warning: debug option `%s' unknown; try LD_DEBUG=help\n", startp); /* Process all environments variables the dynamic linker must recognize. Since all of them start with `LD_' we are a bit smarter while finding all the entries. */ +extern char **_environ; + static void process_envvars (enum mode *modep) { - char **runp = NULL; + char **runp = _environ; char *envline; enum mode mode = normal; char *debug_output = NULL; @@ -1301,98 +1303,98 @@ process_envvars (enum mode *modep) /* This is a "LD_" variable at the end of the string without a '=' character. Ignore it since otherwise we will access invalid memory below. */ - break; + continue; - switch (len - 3) + switch (len) { case 4: /* Warning level, verbose or not. */ - if (memcmp (&envline[3], "WARN", 4) == 0) - _dl_verbose = envline[8] != '\0'; + if (memcmp (envline, "WARN", 4) == 0) + _dl_verbose = envline[5] != '\0'; break; case 5: /* Debugging of the dynamic linker? */ - if (memcmp (&envline[3], "DEBUG", 5) == 0) - process_dl_debug (&envline[9]); + if (memcmp (envline, "DEBUG", 5) == 0) + process_dl_debug (&envline[6]); break; case 7: /* Print information about versions. */ - if (memcmp (&envline[3], "VERBOSE", 7) == 0) + if (memcmp (envline, "VERBOSE", 7) == 0) { - version_info = envline[11] != '\0'; + version_info = envline[8] != '\0'; break; } /* List of objects to be preloaded. */ - if (memcmp (&envline[3], "PRELOAD", 7) == 0) + if (memcmp (envline, "PRELOAD", 7) == 0) { - preloadlist = &envline[11]; + preloadlist = &envline[8]; break; } /* Which shared object shall be profiled. */ - if (memcmp (&envline[3], "PROFILE", 7) == 0) - _dl_profile = &envline[11]; + if (memcmp (envline, "PROFILE", 7) == 0) + _dl_profile = &envline[8]; break; case 8: /* Do we bind early? */ - if (memcmp (&envline[3], "BIND_NOW", 8) == 0) + if (memcmp (envline, "BIND_NOW", 8) == 0) { - _dl_lazy = envline[12] == '\0'; + _dl_lazy = envline[9] == '\0'; break; } - if (memcmp (&envline[3], "BIND_NOT", 8) == 0) - _dl_bind_not = envline[12] != '\0'; + if (memcmp (envline, "BIND_NOT", 8) == 0) + _dl_bind_not = envline[9] != '\0'; break; case 9: /* Test whether we want to see the content of the auxiliary array passed up from the kernel. */ - if (memcmp (&envline[3], "SHOW_AUXV", 9) == 0) + if (memcmp (envline, "SHOW_AUXV", 9) == 0) _dl_show_auxv (); break; case 10: /* Mask for the important hardware capabilities. */ - if (memcmp (&envline[3], "HWCAP_MASK", 10) == 0) - _dl_hwcap_mask = __strtoul_internal (&envline[14], NULL, 0, 0); + if (memcmp (envline, "HWCAP_MASK", 10) == 0) + _dl_hwcap_mask = __strtoul_internal (&envline[11], NULL, 0, 0); break; case 11: /* Path where the binary is found. */ if (!__libc_enable_secure - && memcmp (&envline[3], "ORIGIN_PATH", 11) == 0) - _dl_origin_path = &envline[15]; + && memcmp (envline, "ORIGIN_PATH", 11) == 0) + _dl_origin_path = &envline[12]; break; case 12: /* The library search path. */ - if (memcmp (&envline[3], "LIBRARY_PATH", 12) == 0) + if (memcmp (envline, "LIBRARY_PATH", 12) == 0) { - library_path = &envline[16]; + library_path = &envline[13]; break; } /* Where to place the profiling data file. */ - if (memcmp (&envline[3], "DEBUG_OUTPUT", 12) == 0) + if (memcmp (envline, "DEBUG_OUTPUT", 12) == 0) { - debug_output = &envline[16]; + debug_output = &envline[13]; break; } - if (memcmp (&envline[3], "DYNAMIC_WEAK", 12) == 0) + if (memcmp (envline, "DYNAMIC_WEAK", 12) == 0) _dl_dynamic_weak = 1; break; case 14: /* Where to place the profiling data file. */ if (!__libc_enable_secure - && memcmp (&envline[3], "PROFILE_OUTPUT", 14) == 0) + && memcmp (envline, "PROFILE_OUTPUT", 14) == 0) { - _dl_profile_output = &envline[18]; + _dl_profile_output = &envline[15]; if (*_dl_profile_output == '\0') _dl_profile_output = "/var/tmp"; } @@ -1400,7 +1402,7 @@ process_envvars (enum mode *modep) case 20: /* The mode of the dynamic linker can be set. */ - if (memcmp (&envline[3], "TRACE_LOADED_OBJECTS", 20) == 0) + if (memcmp (envline, "TRACE_LOADED_OBJECTS", 20) == 0) mode = trace; break; |