summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-hash.c
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-11-10 15:27:26 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-11-10 15:27:26 +0000
commit0038f6a2297be2b66a0177bc74b468dddb0a89fa (patch)
tree2413de564ae1751210c6fd82924636d2b09cebda /ldso/ldso/dl-hash.c
parent0657ab0d0b7d9a879091653b2e23f0b46c3ecefa (diff)
Add RTLD_LOCAL support for dlopened libs. Reported by
Andrew de Quincey, who has been most helpful getting this sorted out, thanks. Thanks also to Peter Mazinger who did alot of testing. Removed all traces of dl_parse_copy_information() since it is no longer used.
Diffstat (limited to 'ldso/ldso/dl-hash.c')
-rw-r--r--ldso/ldso/dl-hash.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index a119e77f9..4719315ee 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -137,7 +137,7 @@ struct elf_resolve *_dl_add_elf_hash_table(const char *libname,
* This function resolves externals, and this is either called when we process
* relocations or when we call an entry in the PLT table for the first time.
*/
-char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, int type_class)
+char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class)
{
struct elf_resolve *tpnt;
int si;
@@ -148,17 +148,24 @@ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, int type_class)
char *weak_result = NULL;
elf_hash_number = _dl_elf_hash(name);
-
- /*
- NOTE! RTLD_LOCAL handling for dlopen not implemented yet.
- Everything is treated as RTLD_GLOBAL.
- */
for (; rpnt; rpnt = rpnt->next) {
tpnt = rpnt->dyn;
- if (!(tpnt->rtld_flags & RTLD_GLOBAL))
- continue;
+ if (!(tpnt->rtld_flags & RTLD_GLOBAL) && mytpnt) {
+ if (mytpnt == tpnt)
+ ;
+ else {
+ struct init_fini_list *tmp;
+
+ for (tmp = mytpnt->rtld_local; tmp; tmp = tmp->next) {
+ if (tmp->tpnt == tpnt)
+ break;
+ }
+ if (!tmp)
+ continue;
+ }
+ }
/* Don't search the executable when resolving a copy reloc. */
if ((type_class & ELF_RTYPE_CLASS_COPY) && tpnt->libtype == elf_executable)
continue;