From 167d5acc0d83877cb8651571fd27d8367281a5b9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 20 Mar 2005 22:25:59 +0000 Subject: [BZ #786] 2005-03-15 Jakub Jelinek [BZ #786] * sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Handle GL(dl_tls_static_nelem) == GL(dl_tls_max_dtv_idx). * elf/Makefile: Add rules to build and run tst-tls15. * elf/tst-tls15.c: New test. * elf/tst-tlsmod15a.c: New file. * elf/tst-tlsmod15b.c: New file. 2005-03-20 Ulrich Drepper * elf/rtld.c (dl_main): Always call init_tls if we have audit modules. --- sysdeps/generic/dl-tls.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'sysdeps/generic') diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c index fdd569b587..4fed570d5c 100644 --- a/sysdeps/generic/dl-tls.c +++ b/sysdeps/generic/dl-tls.c @@ -71,26 +71,24 @@ _dl_next_tls_modid (void) NB: the offset +1 is due to the fact that DTV[0] is used for something else. */ result = GL(dl_tls_static_nelem) + 1; - /* If the following would not be true we mustn't have assumed - there is a gap. */ - assert (result <= GL(dl_tls_max_dtv_idx)); - do - { - while (result - disp < runp->len) - { - if (runp->slotinfo[result - disp].map == NULL) - break; - - ++result; - assert (result <= GL(dl_tls_max_dtv_idx) + 1); - } - - if (result - disp < runp->len) - break; - - disp += runp->len; - } - while ((runp = runp->next) != NULL); + if (result <= GL(dl_tls_max_dtv_idx)) + do + { + while (result - disp < runp->len) + { + if (runp->slotinfo[result - disp].map == NULL) + break; + + ++result; + assert (result <= GL(dl_tls_max_dtv_idx) + 1); + } + + if (result - disp < runp->len) + break; + + disp += runp->len; + } + while ((runp = runp->next) != NULL); if (result > GL(dl_tls_max_dtv_idx)) { -- cgit v1.2.3