diff options
author | Roland McGrath <roland@gnu.org> | 1996-03-27 23:23:59 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-03-27 23:23:59 +0000 |
commit | 53f770e0f9d405ea8d1888254c6f7ce431b04c6e (patch) | |
tree | 5f70c2032007667e315d94e29320f2c8d650f448 /elf | |
parent | 3ef987a23c3d81079cfccdc217997a13fd9c1cd1 (diff) | |
download | glibc-53f770e0f9d405ea8d1888254c6f7ce431b04c6e.tar glibc-53f770e0f9d405ea8d1888254c6f7ce431b04c6e.tar.gz glibc-53f770e0f9d405ea8d1888254c6f7ce431b04c6e.tar.bz2 glibc-53f770e0f9d405ea8d1888254c6f7ce431b04c6e.zip |
Wed Mar 27 14:52:11 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* elf/rtld.c (dl_main): Call _dl_sysdep_start_cleanup after
_dl_relocate_object loop. Avoid relocating RTLD_MAP in that loop, and
do it individually if necessary after _dl_sysdep_start_cleanup call.
* stdlib/Makefile (mpn-routines): Add divrem.
Tue Mar 26 22:54:14 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* stdio-common/printf_fp.c (__printf_fp): Use mpn_divmod
instead of __mpn_divmod.
Wed Mar 27 10:26:21 1996 David Mosberger-Tang <davidm@azstarnet.com>
* sysdeps/alpha/setjmp.S: Must establish global pointer before
address of __sigsetjmp_aux can be loaded.
Wed Mar 27 02:23:19 1996 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* sysdeps/i386/i586/memset.S: New file. Highly optimized
version for i586 contributed by Torbjorn Granlund.
Adapted for use as bzero.
* sysdeps/i386/i586/bzero.S: Use sysdeps/i386/i586/memset.S
code to implement bzero().
Tue Mar 26 20:01:17 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* stdlib/Makefile (mpn-routines): Remove divmod.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/rtld.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index 23e0d35d78..d727e1361f 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -339,23 +339,36 @@ of this helper program; chances are you did not intend to run this program.\n", 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 - which might be resolved to different functions than we expect. */ - _dl_sysdep_start_cleanup (); - - /* Now we have all the objects loaded. Relocate them all. - We do this in reverse order so that copy relocs of earlier - objects overwrite the data written by later objects. */ + /* Now we have all the objects loaded. Relocate them all except for + the dynamic linker itself. We do this in reverse order so that + copy relocs of earlier objects overwrite the data written by later + objects. We do not re-relocate the dynamic linker itself in this + loop because that could result in the GOT entries for functions we + call being changed, and that would break us. It is safe to + relocate the dynamic linker out of order because it has no copy + relocs (we know that because it is self-contained). */ l = _dl_loaded; while (l->l_next) l = l->l_next; do { - _dl_relocate_object (l, lazy); + if (l != &rtld_map) + _dl_relocate_object (l, lazy); l = l->l_prev; } while (l); + /* Do any necessary cleanups for the startup OS interface code. + We do these now so that no calls are made after rtld re-relocation + which might be resolved to different functions than we expect. + We cannot do this before relocating the other objects because + _dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */ + _dl_sysdep_start_cleanup (); + + if (rtld_map.l_opencount > 0) + /* There was an explicit ref to the dynamic linker as a shared lib. + Re-relocate ourselves with user-controlled symbol definitions. */ + _dl_relocate_object (&rtld_map, lazy); + /* Tell the debugger where to find the map of loaded objects. */ dl_r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */; dl_r_debug.r_ldbase = rtld_map.l_addr; /* Record our load address. */ |