X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ldso%2Fdynlink.c;h=87f3b7f8cd47bc3bc6e358e22c7411bf281e1c08;hb=6d70c08a2c37745df637b231711f6dec79dbc6e1;hp=26a60b4ccb958a9d677308f90a1fd13a5b8e552b;hpb=5552ce52000855906a5cb4f08f2e456573cca51f;p=musl diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 26a60b4c..87f3b7f8 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -1519,7 +1519,7 @@ _Noreturn void __dls3(size_t *sp) } } if (app.tls.size) { - libc.tls_head = &app.tls; + libc.tls_head = tls_tail = &app.tls; app.tls_id = tls_cnt = 1; #ifdef TLS_ABOVE_TP app.tls.offset = 0; @@ -1582,11 +1582,14 @@ _Noreturn void __dls3(size_t *sp) load_deps(&app); make_global(&app); -#ifndef DYNAMIC_IS_RO - for (i=0; app.dynv[i]; i+=2) - if (app.dynv[i]==DT_DEBUG) + for (i=0; app.dynv[i]; i+=2) { + if (!DT_DEBUG_INDIRECT && app.dynv[i]==DT_DEBUG) app.dynv[i+1] = (size_t)&debug; -#endif + if (DT_DEBUG_INDIRECT && app.dynv[i]==DT_DEBUG_INDIRECT) { + size_t *ptr = (size_t *) app.dynv[i+1]; + *ptr = (size_t)&debug; + } + } /* The main program must be relocated LAST since it may contin * copy relocations which depend on libraries' relocations. */