X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fldso%2Fdynlink.c;h=527b36bd12cdc6c01764e7a6cf79e470300d4d2a;hp=1cab8d125185ff8e518e0865b3a2ffd811371c01;hb=bf30100ad7e208dbac5835b38881c98ceb5b928f;hpb=97507bde474b0091a28628a7dae943c377758d49 diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 1cab8d12..527b36bd 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -189,7 +189,7 @@ static void *map_library(int fd, size_t *lenp, unsigned char **basep, size_t *dy * the length of the file. This is okay because we will not * use the invalid part; we just need to reserve the right * amount of virtual address space to map over later. */ - map = mmap(0, map_len, prot, MAP_PRIVATE, fd, off_start); + map = mmap((void *)addr_min, map_len, prot, MAP_PRIVATE, fd, off_start); if (map==MAP_FAILED) return 0; base = map - addr_min; ph = (void *)((char *)buf + eh->e_phoff); @@ -462,6 +462,7 @@ void *__dynlink(int argc, char **argv, size_t *got) load_deps(head); make_global(head); + reloc_all(head->next); reloc_all(head); if (rtld_used) { @@ -473,6 +474,7 @@ void *__dynlink(int argc, char **argv, size_t *got) *libc->prev->next = *libc; libc = libc->prev->next; if (libc->next) libc->next->prev = libc; + if (tail == &lib) tail = libc; } else { free_all(head); free(sys_path); @@ -509,7 +511,7 @@ void *dlopen(const char *file, int mode) } p = load_library(file); - if (!p) return 0; + if (!p) goto end; /* First load handling */ if (!p->deps) { @@ -531,8 +533,8 @@ void *dlopen(const char *file, int mode) p->global = 1; } +end: pthread_rwlock_unlock(&lock); - return p; }