diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-12-31 06:09:08 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-12-31 06:09:08 +0000 |
commit | c77a447822c8ccc6866216bad737189fff3a0b93 (patch) | |
tree | 83529a631cd6887c71795711ce58620d57bf7d7b /elf/dl-deps.c | |
parent | d9af88677f42690b7ad4cacecc7f9b6a62fe50ce (diff) | |
download | glibc-c77a447822c8ccc6866216bad737189fff3a0b93.tar glibc-c77a447822c8ccc6866216bad737189fff3a0b93.tar.gz glibc-c77a447822c8ccc6866216bad737189fff3a0b93.tar.bz2 glibc-c77a447822c8ccc6866216bad737189fff3a0b93.zip |
Update.
2000-12-30 Ulrich Drepper <drepper@redhat.com>
* elf/dl-close.c (_dl_close): We can ignore the NODELETE flag if the
object was not yet initialized.
2000-12-28 H.J. Lu <hjl@gnu.org>
* elf/dl-deps.c (_dl_map_object_deps): Make sure the DSO state
is always consistent even if its dependency is failed.
* elf/dl-open.c (_dl_open): Increment the open count before
calling _dl_close () in case of failure.
* elf/neededtest4.c: New file.
* elf/neededobj5.c: New file.
* elf/neededobj6.c: New file.
* elf/Makefile (distribute): Add neededobj5.c and neededobj6.c.
(tests): Add neededtest4.
(modules-names): Add neededobj5 and neededobj6.
($(objpfx)neededobj6.so): New target.
($(objpfx)neededtest4): New target.
($(objpfx)neededtest4.out): New target.
Diffstat (limited to 'elf/dl-deps.c')
-rw-r--r-- | elf/dl-deps.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c index df1db89796..d7239819a2 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -141,6 +141,10 @@ _dl_map_object_deps (struct link_map *map, struct list known[1 + npreloads + 1]; struct list *runp, *utail, *dtail; unsigned int nlist, nduplist, i; + /* Object name. */ + const char *name; + int errno_saved; + int errno_reason; auto inline void preload (struct link_map *map); @@ -192,6 +196,10 @@ _dl_map_object_deps (struct link_map *map, The whole process is complicated by the fact that we better should use alloca for the temporary list elements. But using alloca means we cannot use recursive function calls. */ + errno_saved = errno; + errno_reason = 0; + errno = 0; + name = NULL; for (runp = known; runp; ) { struct link_map *l = runp->map; @@ -227,15 +235,24 @@ _dl_map_object_deps (struct link_map *map, struct link_map *dep; /* Allocate new entry. */ struct list *newp; - /* Object name. */ - const char *name; + const char *objname; + const char *errstring; /* Recognize DSTs. */ name = expand_dst (l, strtab + d->d_un.d_val, 0); + /* Store the tag in the argument structure. */ + args.name = name; - dep = _dl_map_object (l, name, 0, - l->l_type == lt_executable ? lt_library : - l->l_type, trace_mode, 0); + if (_dl_catch_error (&objname, &errstring, openaux, &args)) + { + if (errno) + errno_reason = errno; + else + errno_reason = -1; + goto out; + } + else + dep = args.aux; /* Add it in any case to the duplicate list. */ newp = alloca (sizeof (struct list)); @@ -266,18 +283,15 @@ _dl_map_object_deps (struct link_map *map, const char *objname; const char *errstring; struct list *newp; - /* Object name. */ - const char *name; /* Recognize DSTs. */ name = expand_dst (l, strtab + d->d_un.d_val, d->d_tag == DT_AUXILIARY); + /* Store the tag in the argument structure. */ + args.name = name; if (d->d_tag == DT_AUXILIARY) { - /* Store the tag in the argument structure. */ - args.name = name; - /* Say that we are about to load an auxiliary library. */ if (__builtin_expect (_dl_debug_libs, 0)) _dl_debug_message (1, "load auxiliary object=", @@ -310,10 +324,14 @@ _dl_map_object_deps (struct link_map *map, "\n", NULL); /* For filter objects the dependency must be available. */ - args.aux = _dl_map_object (l, name, 0, - (l->l_type == lt_executable - ? lt_library : l->l_type), - trace_mode, 0); + if (_dl_catch_error (&objname, &errstring, openaux, &args)) + { + if (errno) + errno_reason = errno; + else + errno_reason = -1; + goto out; + } } /* The auxiliary object is actually available. @@ -460,6 +478,10 @@ _dl_map_object_deps (struct link_map *map, while (runp != NULL && runp->done); } +out: + if (errno == 0 && errno_saved != 0) + __set_errno (errno_saved); + if (map->l_initfini != NULL && map->l_type == lt_loaded) { /* This object was previously loaded as a dependency and we have @@ -558,4 +580,8 @@ _dl_map_object_deps (struct link_map *map, } /* Terminate the list of dependencies. */ map->l_initfini[nlist] = NULL; + + if (errno_reason) + _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, + name ?: "", N_("cannot load shared object file")); } |