From d675c525c1e3430650aa9cf941351e80b095a6a7 Mon Sep 17 00:00:00 2001 From: kan Date: Sat, 19 Oct 2002 23:03:35 +0000 Subject: Change the symbol lookup order to search RTLD_GLOBAL objects before referencing object's DAG. This makes it possible for C++ exceptions to work across shared libraries and brings us closer to the search order used by Solaris/Linux. Reviewed by: jdp Approved by: obrien MFC after: 1 month --- libexec/rtld-elf/rtld.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'libexec/rtld-elf/rtld.c') diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index d7f243a..8375a4c 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1922,12 +1922,12 @@ symlook_default(const char *name, unsigned long hash, } } - /* Search all dlopened DAGs containing the referencing object. */ - STAILQ_FOREACH(elm, &refobj->dldags, link) { - if (def != NULL && ELF_ST_BIND(def->st_info) != STB_WEAK) - break; - symp = symlook_list(name, hash, &elm->obj->dagmembers, &obj, in_plt, - &donelist); + /* Search all DAGs whose roots are RTLD_GLOBAL objects. */ + STAILQ_FOREACH(elm, &list_global, link) { + if (def != NULL && ELF_ST_BIND(def->st_info) != STB_WEAK) + break; + symp = symlook_list(name, hash, &elm->obj->dagmembers, &obj, in_plt, + &donelist); if (symp != NULL && (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK)) { def = symp; @@ -1935,12 +1935,12 @@ symlook_default(const char *name, unsigned long hash, } } - /* Search all DAGs whose roots are RTLD_GLOBAL objects. */ - STAILQ_FOREACH(elm, &list_global, link) { - if (def != NULL && ELF_ST_BIND(def->st_info) != STB_WEAK) - break; - symp = symlook_list(name, hash, &elm->obj->dagmembers, &obj, in_plt, - &donelist); + /* Search all dlopened DAGs containing the referencing object. */ + STAILQ_FOREACH(elm, &refobj->dldags, link) { + if (def != NULL && ELF_ST_BIND(def->st_info) != STB_WEAK) + break; + symp = symlook_list(name, hash, &elm->obj->dagmembers, &obj, in_plt, + &donelist); if (symp != NULL && (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK)) { def = symp; -- cgit v1.1