* 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);
load_deps(head);
make_global(head);
+ reloc_all(head->next);
reloc_all(head);
if (rtld_used) {
*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);
}
p = load_library(file);
- if (!p) return 0;
+ if (!p) goto end;
/* First load handling */
if (!p->deps) {
p->global = 1;
}
+end:
pthread_rwlock_unlock(&lock);
-
return p;
}
size_t i;
uint32_t h;
Sym *sym;
- if (p == head) return find_sym(head, s, 0);
+ if (p == head || p == RTLD_DEFAULT)
+ return find_sym(head, s, 0);
h = hash(s);
sym = lookup(s, h, p->syms, p->hashtab, p->strings);
if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES))