Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 353224
Collapse All | Expand All

(-)glibc-2.12.2/elf/dl-open.c (-4 / +20 lines)
Lines 346-352 dl_open_worker (void *a) Link Here
346
346
347
  /* If the file is not loaded now as a dependency, add the search
347
  /* If the file is not loaded now as a dependency, add the search
348
     list of the newly loaded object to the scope.  */
348
     list of the newly loaded object to the scope.  */
349
  bool any_tls = false;
349
  bool any_tls = false, any_static_tls = false;
350
  for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i)
350
  for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i)
351
    {
351
    {
352
      struct link_map *imap = new->l_searchlist.r_list[i];
352
      struct link_map *imap = new->l_searchlist.r_list[i];
Lines 426-431 dl_open_worker (void *a) Link Here
426
	  _dl_add_to_slotinfo (imap);
426
	  _dl_add_to_slotinfo (imap);
427
427
428
	  if (imap->l_need_tls_init)
428
	  if (imap->l_need_tls_init)
429
	    any_static_tls = true;
430
431
	  /* We have to bump the generation counter.  */
432
	  any_tls = true;
433
	}
434
    }
435
436
  /* We need a second pass for static tls data, because _dl_update_slotinfo
437
     must not be run while calls to _dl_add_to_slotinfo are still pending. */
438
  if (__builtin_expect (any_static_tls, 0))
439
    {
440
      for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i)
441
	{
442
	  struct link_map *imap = new->l_searchlist.r_list[i];
443
	  if (__builtin_expect (imap->l_need_tls_init, 0)
444
	      /* The following two can likely be dropped, but let's be extra
445
		 safe and copy all the conditions for now. */
446
	      && ! imap->l_init_called
447
	      && __builtin_expect (imap->l_tls_blocksize > 0, 0))
429
	    {
448
	    {
430
	      /* For static TLS we have to allocate the memory here
449
	      /* For static TLS we have to allocate the memory here
431
		 and now.  This includes allocating memory in the DTV.
450
		 and now.  This includes allocating memory in the DTV.
Lines 449-457 cannot load any more object with static Link Here
449
	      GL(dl_init_static_tls) (imap);
468
	      GL(dl_init_static_tls) (imap);
450
	      assert (imap->l_need_tls_init == 0);
469
	      assert (imap->l_need_tls_init == 0);
451
	    }
470
	    }
452
453
	  /* We have to bump the generation counter.  */
454
	  any_tls = true;
455
	}
471
	}
456
    }
472
    }
457
473

Return to bug 353224