X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fldso%2Fdynlink.c;h=9692c6b0138080f9a1d1da74403b9d6508977c36;hb=a749ba3adc2f3b4abfc68b21d4c3741b20c8f657;hp=6801d5fd6762f01f74ef894aadfdfa8598a3206e;hpb=59f4086cb157ab15ab59474d7cfab3a5cb92c5bd;p=musl diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 6801d5fd..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,9 +172,12 @@ 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 { + sym_val = sym_size = 0; } do_single_reloc(reloc_addr, type, sym_val, sym_size, base, rel[2]); } @@ -448,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)); @@ -680,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 @@ -688,9 +694,11 @@ void *__dynlink(int argc, char **argv) * all memory used by the dynamic linker. */ runtime = 1; +#ifndef DYNAMIC_IS_RO for (i=0; app->dynv[i]; i+=2) if (app->dynv[i]==DT_DEBUG) app->dynv[i+1] = (size_t)&debug; +#endif debug.ver = 1; debug.bp = _dl_debug_state; debug.head = head; @@ -799,7 +807,7 @@ static void *do_dlsym(struct dso *p, const char *s, void *ra) if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES)) return p->base + sym->st_value; if (p->deps) for (i=0; p->deps[i]; i++) { - sym = lookup(s, h, p); + sym = lookup(s, h, p->deps[i]); if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES)) return p->deps[i]->base + sym->st_value; }