summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-18 23:30:23 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-18 23:30:23 +0000
commite9e4030ae5f685547a9f7ead1362c7526aa88b80 (patch)
tree5191067336dc7eed72c15bd9ebdcf9e5ec6af35c /elf
parentc78cb58c50d04f98c752ee576a0f8e1daae78d38 (diff)
Updated to fedora-glibc-20041018T0940cvs/fedora-glibc-2_3_3-70
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-libc.c38
-rw-r--r--elf/dl-open.c10
2 files changed, 34 insertions, 14 deletions
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index 2602feb2c1..8a3f542e01 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -121,7 +121,6 @@ do_dlsym_private (void *ptr)
vers.hidden = 1;
/* vers.hash = _dl_elf_hash (version); */
vers.hash = 0x0963cf85;
- /* FIXME: Shouldn't we use libc.so.6* here? */
vers.filename = NULL;
struct do_dlsym_args *args = (struct do_dlsym_args *) ptr;
@@ -156,23 +155,36 @@ __libc_dlopen_mode (const char *name, int mode)
if (dlerror_run (do_dlopen, &args))
return NULL;
+ __libc_register_dl_open_hook (args.map);
+ __libc_register_dlfcn_hook (args.map);
+ return (void *) args.map;
+#endif
+}
+libc_hidden_def (__libc_dlopen_mode)
+
+#ifndef SHARED
+void *
+__libc_dlsym_private (struct link_map *map, const char *name)
+{
struct do_dlsym_args sargs;
- sargs.map = args.map;
- sargs.name = "_dl_open_hook";
+ sargs.map = map;
+ sargs.name = name;
if (! dlerror_run (do_dlsym_private, &sargs))
- {
- struct dl_open_hook **hook
- = (struct dl_open_hook **)
- (DL_SYMBOL_ADDRESS (sargs.loadbase, sargs.ref));
- if (hook != NULL)
- *hook = &_dl_open_hook;
- }
+ return DL_SYMBOL_ADDRESS (sargs.loadbase, sargs.ref);
+ return NULL;
+}
- return (void *) args.map;
-#endif
+void
+__libc_register_dl_open_hook (struct link_map *map)
+{
+ struct dl_open_hook **hook;
+
+ hook = (struct dl_open_hook **) __libc_dlsym_private (map, "_dl_open_hook");
+ if (hook != NULL)
+ *hook = &_dl_open_hook;
}
-libc_hidden_def (__libc_dlopen_mode)
+#endif
void *
__libc_dlsym (void *map, const char *name)
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 34e2aff15e..2ab1e307a4 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -207,7 +207,15 @@ dl_open_worker (void *a)
found_caller:
if (args->nsid == __LM_ID_CALLER)
- args->nsid = call_map->l_ns;
+ {
+#ifndef SHARED
+ /* In statically linked apps there might be no loaded object. */
+ if (call_map == NULL)
+ args->nsid = LM_ID_BASE;
+ else
+#endif
+ args->nsid = call_map->l_ns;
+ }
}
/* Maybe we have to expand a DST. */