X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fldso%2Fdynlink.c;h=00af886512da72e383979a4faaa4cc76d3ea3c90;hb=1d8d86aeb54c0c5439eb07a4bc1b03983fb9d6e8;hp=a08300de3efbc56d66d5108bc99b65a75ebc98d4;hpb=9a4ad02214a859e93d2c980e4535378a6a74e3a6;p=musl diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index a08300de..00af8865 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -233,6 +233,10 @@ static Sym *gnu_lookup(const char *s, uint32_t h1, struct dso *dso) #define OK_TYPES (1<st_shndx) - if (need_def || (sym->st_info&0xf) == STT_TLS) + if (need_def || (sym->st_info&0xf) == STT_TLS + || ARCH_SYM_REJECT_UND(sym)) continue; if (!sym->st_value) if ((sym->st_info&0xf) != STT_TLS) @@ -640,6 +645,8 @@ static void decode_dyn(struct dso *p) p->hashtab = (void *)(p->base + dyn[DT_HASH]); if (dyn[0]&(1<rpath_orig = (void *)(p->strings + dyn[DT_RPATH]); + if (dyn[0]&(1<rpath_orig = (void *)(p->strings + dyn[DT_RUNPATH]); if (search_vec(p->dynv, dyn, DT_GNU_HASH)) p->ghashtab = (void *)(p->base + *dyn); if (search_vec(p->dynv, dyn, DT_VERSYM)) @@ -658,6 +665,11 @@ static struct dso *load_library(const char *name, struct dso *needed_by) int n_th = 0; int is_self = 0; + if (!*name) { + errno = EINVAL; + return 0; + } + /* Catch and block attempts to reload the implementation itself */ if (name[0]=='l' && name[1]=='i' && name[2]=='b') { static const char *rp, reserved[] = @@ -857,8 +869,8 @@ static void load_preload(char *s) int tmp; char *z; for (z=s; *z; s=z) { - for ( ; *s && isspace(*s); s++); - for (z=s; *z && !isspace(*z); z++); + for ( ; *s && (isspace(*s) || *s==':'); s++); + for (z=s; *z && !isspace(*z) && *z!=':'; z++); tmp = *z; *z = 0; load_library(s, 0); @@ -1116,6 +1128,7 @@ void *__dynlink(int argc, char **argv) libc.secure = 1; } libc.page_size = aux[AT_PAGESZ]; + libc.auxv = auxv; /* If the dynamic linker was invoked as a program itself, AT_BASE * will not be set. In that case, we assume the base address is @@ -1593,10 +1606,14 @@ static int invalid_dso_handle(void *h) } void *dlopen(const char *file, int mode) { + strcpy(errbuf, "Dynamic loading not supported"); + errflag = 1; return 0; } void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra) { + errflag = 1; + snprintf(errbuf, sizeof errbuf, "Symbol not found: %s", s); return 0; } int __dladdr (const void *addr, Dl_info *info)