diff options
author | Roland McGrath <roland@gnu.org> | 1996-06-16 02:18:58 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-06-16 02:18:58 +0000 |
commit | f9496a7b54c27580d4b30cc2b2b40e86738b2b81 (patch) | |
tree | 67da370e3ecc6c9280f20cac507b5fc75700fc3a /elf/rtld.c | |
parent | a23db8e4af794430fe69c17bd884f03669d307d7 (diff) | |
download | glibc-f9496a7b54c27580d4b30cc2b2b40e86738b2b81.tar glibc-f9496a7b54c27580d4b30cc2b2b40e86738b2b81.tar.gz glibc-f9496a7b54c27580d4b30cc2b2b40e86738b2b81.tar.bz2 glibc-f9496a7b54c27580d4b30cc2b2b40e86738b2b81.zip |
* elf/dl-deps.c (_dl_map_object_deps): Set MAP's mark bit before loop.
Set mark bits of deps as opened, instead of as scanned.
* elf/rtld.c (dl_main): Remove _dl_rtld_map from chain unconditionally.
Then if it has a nonzero l_opencount, add it back in search order.
* elf/dl-load.c (_dl_map_object): Don't use _dl_loaded's DT_RPATH if
it ain't got one!
Diffstat (limited to 'elf/rtld.c')
-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 fb92809ff5..f20602d090 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -243,17 +243,30 @@ of this helper program; chances are you did not intend to run this program.\n", __close (_dl_zerofd); _dl_zerofd = -1; - /* XXX if kept, move it so l_next list is in dep order because - it will determine gdb's search order. - Perhaps do this always, so later dlopen by name finds it? - XXX But then gdb always considers it present. */ - if (_dl_rtld_map.l_opencount == 0) + /* Remove _dl_rtld_map from the chain. */ + _dl_rtld_map.l_prev->l_next = _dl_rtld_map.l_next; + if (_dl_rtld_map.l_next) + _dl_rtld_map.l_next->l_prev = _dl_rtld_map.l_prev; + + if (_dl_rtld_map.l_opencount) { - /* No DT_NEEDED entry referred to the interpreter object itself, - so remove it from the list of visible objects. */ - _dl_rtld_map.l_prev->l_next = _dl_rtld_map.l_next; + /* Some DT_NEEDED entry referred to the interpreter object itself, so + put it back in the list of visible objects. We insert it into the + chain in symbol search order because gdb uses the chain's order as + its symbol search order. */ + unsigned int i = 1; + while (l->l_searchlist[i] != &_dl_rtld_map) + ++i; + _dl_rtld_map.l_prev = l->l_searchlist[i - 1]; + _dl_rtld_map.l_next = (i + 1 < l->l_nsearchlist ? + l->l_searchlist[i + 1] : NULL); + assert (_dl_rtld_map.l_prev->l_next == _dl_rtld_map.l_next); + _dl_rtld_map.l_prev->l_next = &_dl_rtld_map; if (_dl_rtld_map.l_next) - _dl_rtld_map.l_next->l_prev = _dl_rtld_map.l_prev; + { + assert (_dl_rtld_map.l_next->l_prev == _dl_rtld_map.l_prev); + _dl_rtld_map.l_next->l_prev = &_dl_rtld_map; + } } if (list_only) |