fix regression in dynamic-linked tls when both main app & libs have tls

commit d56460c939 introduced this bug by
setting up the tls module chain incorrectly when the main app has tls.
the singly-linked list head pointer was setup correctly, but the tail
pointer was not, so the first attempt to append to the list (for a
shared library with tls) would treat the list as empty and effectively
removed the main app from the list. this left all tls module id
numbers off-by-one.

this bug did not appear in any released versions.
This commit is contained in:
Rich Felker 2016-01-30 14:34:45 -05:00
parent 1563587b45
commit 140ad50cbf
1 changed files with 1 additions and 1 deletions

View File

@ -1519,7 +1519,7 @@ _Noreturn void __dls3(size_t *sp)
} }
} }
if (app.tls.size) { if (app.tls.size) {
libc.tls_head = &app.tls; libc.tls_head = tls_tail = &app.tls;
app.tls_id = tls_cnt = 1; app.tls_id = tls_cnt = 1;
#ifdef TLS_ABOVE_TP #ifdef TLS_ABOVE_TP
app.tls.offset = 0; app.tls.offset = 0;