From: Rich Felker Date: Sun, 24 Jul 2011 06:19:47 +0000 (-0400) Subject: fix resolution of weak symbols (hopefully right now) and vdso X-Git-Tag: v0.8.0~85 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=427173b9325d604d30650c16f1774942130aec52;p=oweals%2Fmusl.git fix resolution of weak symbols (hopefully right now) and vdso --- diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index d8f641ae..6c4abbfe 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -92,10 +92,12 @@ static Sym *lookup(const char *s, uint32_t h, Sym *syms, uint32_t *hashtab, char } #define OK_TYPES (1<next) { @@ -103,10 +105,13 @@ static void *find_sym(struct dso *dso, const char *s, int need_def) if (!dso->global) continue; sym = lookup(s, h, dso->syms, dso->hashtab, dso->strings); if (sym && (!need_def || sym->st_shndx) && sym->st_value - && (1<<(sym->st_info&0xf) & OK_TYPES)) - return dso->base + sym->st_value; + && (1<<(sym->st_info&0xf) & OK_TYPES) + && (1<<(sym->st_info>>4) & OK_BINDS)) { + def = dso->base + sym->st_value; + if (sym->st_info>>4 == STB_GLOBAL) break; + } } - return 0; + return def; } static void do_relocs(unsigned char *base, size_t *rel, size_t rel_size, size_t stride, Sym *syms, char *strings, struct dso *dso) @@ -519,6 +524,7 @@ void *__dynlink(int argc, char **argv, size_t *got) vdso->hashtab = (void *)(vdso->base + vdso_dyn[DT_HASH]); vdso->strings = (void *)(vdso->base + vdso_dyn[DT_STRTAB]); vdso->name = "linux-gate.so.1"; + vdso->global = 1; vdso->prev = lib; lib->next = vdso;