diff options
author | Roland McGrath <roland@gnu.org> | 1995-11-22 10:00:23 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-11-22 10:00:23 +0000 |
commit | 1a3a58fd763828c347baa92c378e2498efc12a9e (patch) | |
tree | ea33cd3a194cf9474e025d81c4619575096927f0 /elf/rtld.c | |
parent | 91c7b85dc8fc310d4dcbe205861735a6748fecb4 (diff) | |
download | glibc-1a3a58fd763828c347baa92c378e2498efc12a9e.tar.gz glibc-1a3a58fd763828c347baa92c378e2498efc12a9e.tar.xz glibc-1a3a58fd763828c347baa92c378e2498efc12a9e.zip |
Tue Nov 21 14:12:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-951122
* malloc/malloc.c (align): Don't check contiguity and call abort. * hurd/hurdsig.c (post_reply): Function removed. (abort_thread, abort_all_rpcs, _hurdsig_abort_rpcs): Don't call it. Take single callback fn arg instead of reply port and type. (_hurd_internal_post_signal): Callers changed. Cache reply stub fn ptr in local var before UNTRACED might be changed. * sysdeps/mach/hurd/mmap.c: Cope with a null write memobj for PROT_READ|PROT_WRITE copy mapping. Pass a proper vm_inherit_t to vm_map. * elf/rtld.c (_dl_start): For --list, do output and exit before relocating.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r-- | elf/rtld.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index d0c25b4db4..cf9517d527 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -130,7 +130,6 @@ dl_main (const Elf32_Phdr *phdr, const char *interpreter_name; int lazy; int list_only = 0; - __typeof (_exit) *volatile exitfn; if (*user_entry == (Elf32_Addr) &_start) { @@ -294,12 +293,35 @@ of this helper program; chances are you did not intend to run this program.\n", rtld_map.l_next->l_prev = &rtld_map; } - lazy = !_dl_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0'; + if (list_only) + { + /* We were run just to list the shared libraries. It is + important that we do this before real relocation, because the + functions we call below for output may no longer work properly + after relocation. */ + + if (! _dl_loaded->l_info[DT_NEEDED]) + { + _dl_sysdep_message (_dl_loaded->l_name, ": statically linked\n", + NULL); + _exit (1); + } + + for (l = _dl_loaded->l_next; l; l = l->l_next) + { + char buf[20], *bp; + buf[sizeof buf - 1] = '\0'; + bp = _itoa (l->l_addr, &buf[sizeof buf - 1], 16, 0); + while (&buf[sizeof buf - 1] - bp < sizeof l->l_addr * 2) + *--bp = '0'; + _dl_sysdep_message ("\t", l->l_libname, " => ", l->l_name, + " (0x", bp, ")\n", NULL); + } + + _exit (0); + } - /* Fetch this value now, before real relocation. For --list, it will - be called below, and the finally-linked version is not the right - one. */ - exitfn = &_exit; + lazy = !_dl_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0'; /* Do any necessary cleanups for the startup OS interface code. We do these now so that no calls are made after real relocation @@ -324,29 +346,6 @@ of this helper program; chances are you did not intend to run this program.\n", dl_r_debug.r_map = _dl_loaded; dl_r_debug.r_brk = (Elf32_Addr) &_dl_r_debug_state; - if (list_only) - { - if (! _dl_loaded->l_info[DT_NEEDED]) - { - _dl_sysdep_message (_dl_loaded->l_name, ": statically linked\n", - NULL); - (*exitfn) (1); - } - - for (l = _dl_loaded->l_next; l; l = l->l_next) - { - char buf[20], *bp; - buf[sizeof buf - 1] = '\0'; - bp = _itoa (l->l_addr, &buf[sizeof buf - 1], 16, 0); - while (&buf[sizeof buf - 1] - bp < sizeof l->l_addr * 2) - *--bp = '0'; - _dl_sysdep_message ("\t", l->l_libname, " => ", l->l_name, - " (0x", bp, ")\n", NULL); - } - - (*exitfn) (0); - } - if (rtld_map.l_info[DT_INIT]) { /* Call the initializer for the compatibility version of the |