diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 715948f4..aa49c437 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -1122,42 +1122,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by) fd = path_open(name, p->rpath, buf, sizeof buf); } if (fd == -1) { - if (!sys_path) { - char *prefix = 0; - size_t prefix_len; - if (ldso.name[0]=='/') { - char *s, *t, *z; - for (s=t=z=ldso.name; *s; s++) - if (*s=='/') z=t, t=s; - prefix_len = z-ldso.name; - if (prefix_len < PATH_MAX) - prefix = ldso.name; - } - if (!prefix) { - prefix = ""; - prefix_len = 0; - } - char etc_ldso_path[prefix_len + 1 - + sizeof "/etc/ld-musl-" LDSO_ARCH ".path"]; - snprintf(etc_ldso_path, sizeof etc_ldso_path, - "%.*s/etc/ld-musl-" LDSO_ARCH ".path", - (int)prefix_len, prefix); - fd = open(etc_ldso_path, O_RDONLY|O_CLOEXEC); - if (fd>=0) { - size_t n = 0; - if (!fstat(fd, &st)) n = st.st_size; - if ((sys_path = malloc(n+1))) - sys_path[n] = 0; - if (!sys_path || read_loop(fd, sys_path, n)<0) { - free(sys_path); - sys_path = ""; - } - close(fd); - } else if (errno != ENOENT) { - sys_path = ""; - } - } - if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib"; + if (!sys_path) sys_path = "/lib/" LDSO_ARCH "-semios-linux"; fd = path_open(name, sys_path, buf, sizeof buf); } pathname = buf; @@ -1326,7 +1291,7 @@ static void extend_bfs_deps(struct dso *p) struct dso *dep = p->deps[i]; for (j=cnt=0; jndeps_direct; j++) if (!dep->deps[j]->mark) cnt++; - tmp = no_realloc ? + tmp = no_realloc ? malloc(sizeof(*tmp) * (ndeps_all+cnt+1)) : realloc(p->deps, sizeof(*tmp) * (ndeps_all+cnt+1)); if (!tmp) { @@ -1587,7 +1552,7 @@ static void do_init_fini(struct dso **queue) if (p->ctor_visitor || p->constructed) continue; p->ctor_visitor = self; - + decode_vec(p->dynv, dyn, DYN_CNT); if (dyn[0] & ((1<fini_next = fini_head; @@ -1698,7 +1663,7 @@ static void install_new_tls(void) * following stage 2 and stage 3 functions via primitive symbolic lookup * since it does not have access to their addresses to begin with. */ -/* Stage 2 of the dynamic linker is called after relative relocations +/* Stage 2 of the dynamic linker is called after relative relocations * have been processed. It can make function calls to static functions * and access string literals and static data, but cannot use extern * symbols. Its job is to perform symbolic relocations on the dynamic