X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fldso%2Fdynlink.c;h=8ff8e6965f34aae9733bc01c210aed846d1bbd2b;hp=4e0b9f4e0d6d50cabbcea804118562770aa08e80;hb=c91aa03d2488ef2c48276510dec360ed9582e861;hpb=bc6a35fb7b02f068b901f22a56559996395cfd3b diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 4e0b9f4e..8ff8e696 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -80,7 +80,6 @@ void *__install_initial_tls(void *); static struct dso *head, *tail, *libc; static char *env_path, *sys_path, *r_path; -static int rtld_used; static int ssp_used; static int runtime; static int ldd_mode; @@ -182,13 +181,9 @@ static void *find_sym(struct dso *dso, const char *s, int need_def) void *def = 0; if (dso->ghashtab) { gh = gnu_hash(s); - if (gh == 0xf9040207 && !strcmp(s, "dlopen")) rtld_used = 1; - if (gh == 0xf4dc4ae && !strcmp(s, "dlsym")) rtld_used = 1; if (gh == 0x1f4039c9 && !strcmp(s, "__stack_chk_fail")) ssp_used = 1; } else { h = sysv_hash(s); - if (h == 0x6b366be && !strcmp(s, "dlopen")) rtld_used = 1; - if (h == 0x6b3afd && !strcmp(s, "dlsym")) rtld_used = 1; if (h == 0x595a4cc && !strcmp(s, "__stack_chk_fail")) ssp_used = 1; } for (; dso; dso=dso->next) { @@ -654,6 +649,16 @@ void *__copy_tls(unsigned char *mem, size_t cnt) return mem; } +void *__tls_get_addr(size_t *p) +{ + pthread_t self = __pthread_self(); + if ((size_t)self->dtv[0] < p[0]) { + // FIXME: obtain new DTV and TLS from the DSO + a_crash(); + } + return (char *)self->dtv[p[0]] + p[1]; +} + void *__dynlink(int argc, char **argv) { size_t aux[AUX_CNT] = {0}; @@ -852,12 +857,6 @@ void *__dynlink(int argc, char **argv) do_init_fini(tail); - if (!rtld_used) { - free_all(head); - free(sys_path); - reclaim((void *)builtin_dsos, 0, sizeof builtin_dsos); - } - errno = 0; return (void *)aux[AT_ENTRY]; }