Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(__libc_dlsym_private, __libc_register_dl_open_hook): New functions. …
…(__libc_dlopen_mode): Call __libc_register_dl_open_hook and __libc_register_dlfcn_hook.
  • Loading branch information
Ulrich Drepper committed Oct 18, 2004
1 parent 761bbac commit 790b6c7
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions elf/dl-libc.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 790b6c7

Please sign in to comment.