diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-08-18 16:00:23 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-08-18 16:00:23 -0400 |
commit | 04109502c0355878d238bdba06a09b2593b2996f (patch) | |
tree | 0ad1788975d276cf02a04cf69b4f9f225e0c7e13 /src | |
parent | 53de960d6f12480a041b7b8cbf65cd1d3f3f9b23 (diff) | |
download | musl-04109502c0355878d238bdba06a09b2593b2996f.tar.gz musl-04109502c0355878d238bdba06a09b2593b2996f.tar.xz musl-04109502c0355878d238bdba06a09b2593b2996f.zip |
make dynamic linker report all failures before exiting
before, only the first library that failed to load or symbol that failed to resolve was reported, and then the dynamic linker immediately exited. when attempting to fix a library compatibility issue, this is about the worst possible behavior. now we print all errors as they occur and exit at the very end if errors were encountered.
Diffstat (limited to 'src')
-rw-r--r-- | src/ldso/dynlink.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index f55c6f10..9692c6b0 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -76,6 +76,7 @@ static int rtld_used; static int ssp_used; static int runtime; static int ldd_mode; +static int ldso_fail; static jmp_buf rtld_fail; static pthread_rwlock_t lock; static struct debug debug; @@ -171,7 +172,8 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri dso->name, name); if (runtime) longjmp(rtld_fail, 1); dprintf(2, "%s\n", errbuf); - _exit(127); + ldso_fail = 1; + continue; } sym_size = sym->st_size; } else { @@ -450,7 +452,8 @@ static void load_deps(struct dso *p) p->strings + p->dynv[i+1], p->name); if (runtime) longjmp(rtld_fail, 1); dprintf(2, "%s\n", errbuf); - _exit(127); + ldso_fail = 1; + continue; } if (runtime) { tmp = realloc(*deps, sizeof(*tmp)*(ndeps+2)); @@ -682,6 +685,7 @@ void *__dynlink(int argc, char **argv) reloc_all(app->next); reloc_all(app); + if (ldso_fail) _exit(127); if (ldd_mode) _exit(0); /* Switch to runtime mode: any further failures in the dynamic |