diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | elf/dl-misc.c | 22 | ||||
-rw-r--r-- | elf/dl-open.c | 20 | ||||
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 17 |
4 files changed, 45 insertions, 18 deletions
@@ -1,5 +1,9 @@ 2004-03-04 Ulrich Drepper <drepper@redhat.com> + * sysdeps/generic/ldsodefs.h: Don't define _dl_name_match_p as inline. + * elf/dl-misc.c: Define _dl_name_match_p here. + * elf/dl-open.c (check_libc_caller): Don't use _dl_name_match_p. + * elf/dl-open.c (dl_open_worker): Check that _dl_open is called from the right place. diff --git a/elf/dl-misc.c b/elf/dl-misc.c index eacd3a440f..c5209fbce4 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -1,5 +1,5 @@ /* Miscellaneous support functions for dynamic linker - Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -304,3 +304,23 @@ _dl_dprintf (int fd, const char *fmt, ...) _dl_debug_vdprintf (fd, 0, fmt, arg); va_end (arg); } + + +/* Test whether given NAME matches any of the names of the given object. */ +int +internal_function +_dl_name_match_p (const char *name, struct link_map *map) +{ + if (strcmp (name, map->l_name) == 0) + return 1; + + struct libname_list *runp = map->l_libname; + + while (runp != NULL) + if (strcmp (name, runp->name) == 0) + return 1; + else + runp = runp->next; + + return 0; +} diff --git a/elf/dl-open.c b/elf/dl-open.c index 4a322e28e8..9befbc41cf 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -177,16 +177,32 @@ check_libc_caller (const void *caller) struct link_map *l; for (l = GL(dl_loaded); l != NULL; l = l->l_next) - if (_dl_name_match_p (expected1, l)) + if (strcmp (expected1, l->l_name) == 0) { + is_1: expected1_from = (const void *) l->l_map_start; expected1_to = (const void *) l->l_map_end; } - else if (_dl_name_match_p (expected2, l)) + else if (strcmp (expected1, l->l_name) == 0) { + is_2: expected2_from = (const void *) l->l_map_start; expected2_to = (const void *) l->l_map_end; } + else + { + struct libname_list *runp = l->l_libname; + + while (runp != NULL) + { + if (strcmp (expected1, runp->name) == 0) + goto is_1; + else if (strcmp (expected2, runp->name) == 0) + goto is_2; + + runp = runp->next; + } + } assert (expected1_from != NULL); } diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index a3d7935ee2..d7a6093b21 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -172,21 +172,8 @@ struct libname_list /* Test whether given NAME matches any of the names of the given object. */ -static __inline int -__attribute__ ((unused, always_inline)) -_dl_name_match_p (const char *__name, struct link_map *__map) -{ - int __found = strcmp (__name, __map->l_name) == 0; - struct libname_list *__runp = __map->l_libname; - - while (! __found && __runp != NULL) - if (strcmp (__name, __runp->name) == 0) - __found = 1; - else - __runp = __runp->next; - - return __found; -} +extern int _dl_name_match_p (const char *__name, struct link_map *__map) + internal_function; /* Function used as argument for `_dl_receive_error' function. The arguments are the error code, error string, and the objname the |