Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 52374 | Differences between
and this patch

Collapse All | Expand All

(-)glibc-2.3.4.az/elf/Makefile (-3 / +8 lines)
Lines 152-158 tests += loadtest restest1 preloadtest l Link Here
152
	 neededtest3 neededtest4 unload2 lateglobal initfirst global \
152
	 neededtest3 neededtest4 unload2 lateglobal initfirst global \
153
	 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
153
	 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
154
	 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
154
	 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
155
	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
155
	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 tst-align \
156
	 $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
156
	 $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
157
	 tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3
157
	 tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3
158
#	 reldep9
158
#	 reldep9
Lines 182-187 modules-names = testobj1 testobj2 testob Link Here
182
		tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
182
		tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
183
		tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
183
		tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
184
		tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
184
		tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
185
		tst-tlsmod15a tst-tlsmod15b \
185
		circlemod1 circlemod1a circlemod2 circlemod2a \
186
		circlemod1 circlemod1a circlemod2 circlemod2a \
186
		circlemod3 circlemod3a \
187
		circlemod3 circlemod3a \
187
		reldep8mod1 reldep8mod2 reldep8mod3 \
188
		reldep8mod1 reldep8mod2 reldep8mod3 \
Lines 454-459 tst-tlsmod10.so-no-z-defs = yes Link Here
454
tst-tlsmod12.so-no-z-defs = yes
455
tst-tlsmod12.so-no-z-defs = yes
455
tst-tlsmod14a.so-no-z-defs = yes
456
tst-tlsmod14a.so-no-z-defs = yes
456
tst-tlsmod14b.so-no-z-defs = yes
457
tst-tlsmod14b.so-no-z-defs = yes
458
tst-tlsmod15a.so-no-z-defs = yes
457
circlemod2.so-no-z-defs = yes
459
circlemod2.so-no-z-defs = yes
458
circlemod3.so-no-z-defs = yes
460
circlemod3.so-no-z-defs = yes
459
circlemod3a.so-no-z-defs = yes
461
circlemod3a.so-no-z-defs = yes
Lines 664-671 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod1 Link Here
664
$(objpfx)tst-tls13: $(libdl)
666
$(objpfx)tst-tls13: $(libdl)
665
$(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
667
$(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
666
668
667
$(objpfx)tst-tls14:  $(objpfx)tst-tlsmod14a.so $(libdl)
669
$(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
668
$(objpfx)tst-tls14.out:$(objpfx)tst-tlsmod14b.so
670
$(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
671
672
$(objpfx)tst-tls15: $(libdl)
673
$(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
669
674
670
CFLAGS-tst-align.c = $(stack-align-test-flags)
675
CFLAGS-tst-align.c = $(stack-align-test-flags)
671
CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
676
CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
(-)glibc-2.3.4.az/elf/tst-tls15.c (+32 lines)
Line 0 Link Here
1
#include <dlfcn.h>
2
#include <stdio.h>
3
4
static int
5
do_test (void)
6
{
7
  void *h = dlopen ("tst-tlsmod15a.so", RTLD_NOW);
8
  if (h != NULL)
9
    {
10
      puts ("unexpectedly succeeded to open tst-tlsmod15a.so");
11
      exit (1);
12
    }
13
14
  h = dlopen ("tst-tlsmod15b.so", RTLD_NOW);
15
  if (h == NULL)
16
    {
17
      puts ("failed to open tst-tlsmod15b.so");
18
      exit (1);
19
    }
20
21
  int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso");
22
  if (fp == NULL)
23
    {
24
      puts ("cannot find in_dso");
25
      exit (1);
26
    }
27
28
  return fp ();
29
}
30
31
#define TEST_FUNCTION do_test ()
32
#include "../test-skeleton.c"
(-)glibc-2.3.4.az/elf/tst-tlsmod15a.c (+6 lines)
Line 0 Link Here
1
extern int nonexistent_dummy_var;
2
int *
3
foo (void)
4
{
5
  return &nonexistent_dummy_var;
6
}
(-)glibc-2.3.4.az/elf/tst-tlsmod15b.c (+17 lines)
Line 0 Link Here
1
#include "tst-tls10.h"
2
3
#ifdef USE_TLS__THREAD
4
__thread int mod15b_var __attribute__((tls_model("initial-exec")));
5
6
int
7
in_dso (void)
8
{
9
  return mod15b_var;
10
}
11
#else
12
int
13
in_dso (void)
14
{
15
  return 0;
16
}
17
#endif
(-)glibc-2.3.4.az/sysdeps/generic/dl-tls.c (-24 / +25 lines)
Lines 65-98 _dl_next_tls_modid (void) Link Here
65
      /* Note that this branch will never be executed during program
65
      /* Note that this branch will never be executed during program
66
	 start since there are no gaps at that time.  Therefore it
66
	 start since there are no gaps at that time.  Therefore it
67
	 does not matter that the dl_tls_dtv_slotinfo is not allocated
67
	 does not matter that the dl_tls_dtv_slotinfo is not allocated
68
	 yet when the function is called for the first times.  */
68
	 yet when the function is called for the first times.
69
      result = GL(dl_tls_static_nelem) + 1;
70
      /* If the following would not be true we mustn't have assumed
71
	 there is a gap.  */
72
      assert (result <= GL(dl_tls_max_dtv_idx));
73
      do
74
	{
75
	  while (result - disp < runp->len)
76
	    {
77
	      if (runp->slotinfo[result - disp].map == NULL)
78
		break;
79
80
	      ++result;
81
	      assert (result <= GL(dl_tls_max_dtv_idx) + 1);
82
	    }
83
69
84
	  if (result - disp < runp->len)
70
	 NB: the offset +1 is due to the fact that DTV[0] is used
85
	    break;
71
	 for something else.  */
86
72
      result = GL(dl_tls_static_nelem) + 1;
87
	  disp += runp->len;
73
      if (result <= GL(dl_tls_max_dtv_idx))
88
	}
74
	do
89
      while ((runp = runp->next) != NULL);
75
	  {
76
	    while (result - disp < runp->len)
77
	      {
78
		if (runp->slotinfo[result - disp].map == NULL)
79
		  break;
80
81
		++result;
82
		assert (result <= GL(dl_tls_max_dtv_idx) + 1);
83
	      }
84
85
	    if (result - disp < runp->len)
86
	      break;
87
88
	    disp += runp->len;
89
	  }
90
	while ((runp = runp->next) != NULL);
90
91
91
      if (result >= GL(dl_tls_max_dtv_idx))
92
      if (result > GL(dl_tls_max_dtv_idx))
92
	{
93
	{
93
	  /* The new index must indeed be exactly one higher than the
94
	  /* The new index must indeed be exactly one higher than the
94
	     previous high.  */
95
	     previous high.  */
95
	  assert (result == GL(dl_tls_max_dtv_idx));
96
	  assert (result == GL(dl_tls_max_dtv_idx) + 1);
96
97
97
	  /* There is no gap anymore.  */
98
	  /* There is no gap anymore.  */
98
	  GL(dl_tls_dtv_gaps) = false;
99
	  GL(dl_tls_dtv_gaps) = false;
Lines 577-583 __tls_get_addr (GET_ADDR_ARGS) Link Here
577
	    {
578
	    {
578
	      size_t cnt;
579
	      size_t cnt;
579
580
580
	      for (cnt = total = 0 ? 1 : 0; cnt < listp->len; ++cnt)
581
	      for (cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt)
581
		{
582
		{
582
		  size_t gen = listp->slotinfo[cnt].gen;
583
		  size_t gen = listp->slotinfo[cnt].gen;
583
		  struct link_map *map;
584
		  struct link_map *map;

Return to bug 52374