[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r13781 - in /fsf/trunk/libc: ./ elf/



Author: eglibc
Date: Fri May 13 00:03:10 2011
New Revision: 13781

Log:
Import glibc-mainline for 2011-05-13

Added:
    fsf/trunk/libc/elf/tst-unique4.cc   (with props)
    fsf/trunk/libc/elf/tst-unique4.h   (with props)
    fsf/trunk/libc/elf/tst-unique4lib.cc   (with props)
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/elf/Makefile
    fsf/trunk/libc/elf/dl-lookup.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri May 13 00:03:10 2011
@@ -1,3 +1,16 @@
+2011-05-12  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12511]
+	* elf/dl-lookup.c (enter): Don't test for copy relocation here and
+	don't set DF_1_NODELETE here.
+	(do_lookup_x): When entering new entry test for copy relocation
+	and if necessary set DF_1_NODELETE flag.
+	* elf/tst-unique4.cc: New file.
+	* elf/tst-unique4.h: New file.
+	* elf/tst-unique4lib.cc: New file.
+	* elf/Makefile: Add rules to build and run tst-unique4.
+	Patch by Piotr Bury <pbury@xxxxxxxxxxx>.
+
 2011-05-11  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	[BZ #12052]

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri May 13 00:03:10 2011
@@ -11,9 +11,9 @@
 
   386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947,
   12052, 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454,
-  12460, 12469, 12489, 12509, 12510, 12518, 12527, 12541, 12545, 12551,
-  12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655, 12660,
-  12681, 12685, 12711, 12713, 12714, 12717, 12723, 12734, 12738
+  12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545,
+  12551, 12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655,
+  12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12734, 12738
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.

Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Fri May 13 00:03:10 2011
@@ -201,7 +201,7 @@
 	 unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
 	 tst-audit1 tst-audit2 \
 	 tst-stackguard1 tst-addr1 tst-thrlock \
-	 tst-unique1 tst-unique2 tst-unique3 \
+	 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
 	 tst-initorder
 #	 reldep9
 test-srcs = tst-pathopt
@@ -259,6 +259,7 @@
 		tst-unique1mod1 tst-unique1mod2 \
 		tst-unique2mod1 tst-unique2mod2 \
 		tst-unique3lib tst-unique3lib2 \
+		tst-unique4lib \
 		tst-initordera1 tst-initorderb1 \
 		tst-initordera2 tst-initorderb2 \
 		tst-initordera3 tst-initordera4
@@ -1185,6 +1186,8 @@
 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
 
+$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
+
 $(objpfx)tst-initorder.out: $(objpfx)tst-initorder
 	$(elf-objpfx)${rtld-installed-name} \
 	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \

Modified: fsf/trunk/libc/elf/dl-lookup.c
==============================================================================
--- fsf/trunk/libc/elf/dl-lookup.c (original)
+++ fsf/trunk/libc/elf/dl-lookup.c Fri May 13 00:03:10 2011
@@ -312,39 +312,21 @@
 		 definition we have to use it.  */
 	      void enter (struct unique_sym *table, size_t size,
 			  unsigned int hash, const char *name,
-			  const ElfW(Sym) *sym, struct link_map *map)
+			  const ElfW(Sym) *sym, const struct link_map *map)
 	      {
 		size_t idx = hash % size;
 		size_t hash2 = 1 + hash % (size - 2);
-		while (1)
+		while (table[idx].name != NULL)
 		  {
-		    if (table[idx].name == NULL)
-		      {
-			table[idx].hashval = hash;
-			table[idx].name = name;
-			if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
-			  {
-			    table[idx].sym = ref;
-			    table[idx].map = undef_map;
-			  }
-			else
-			  {
-			    table[idx].sym = sym;
-			    table[idx].map = map;
-
-			    if (map->l_type == lt_loaded)
-			      /* Make sure we don't unload this object by
-				 setting the appropriate flag.  */
-			      map->l_flags_1 |= DF_1_NODELETE;
-			  }
-
-			return;
-		      }
-
 		    idx += hash2;
 		    if (idx >= size)
 		      idx -= size;
 		  }
+
+		table[idx].hashval = hash;
+		table[idx].name = name;
+		table[idx].sym = sym;
+		table[idx].map = map;
 	      }
 
 	      struct unique_sym_table *tab
@@ -450,8 +432,19 @@
 		  tab->free = free;
 		}
 
-	      enter (entries, size, new_hash, strtab + sym->st_name, sym,
-		     (struct link_map *) map);
+	      if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+		enter (entries, size, new_hash, strtab + sym->st_name, ref,
+		       undef_map);
+	      else
+		{
+		  enter (entries, size, new_hash, strtab + sym->st_name, sym,
+			 map);
+
+		  if (map->l_type == lt_loaded)
+		    /* Make sure we don't unload this object by
+		       setting the appropriate flag.  */
+		    ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
+		}
 	      ++tab->n_elements;
 
 	      __rtld_lock_unlock_recursive (tab->lock);

Added: fsf/trunk/libc/elf/tst-unique4.cc
==============================================================================
--- fsf/trunk/libc/elf/tst-unique4.cc (added)
+++ fsf/trunk/libc/elf/tst-unique4.cc Fri May 13 00:03:10 2011
@@ -1,0 +1,27 @@
+// BZ 12511
+#include "tst-unique4.h"
+#include <cstdio>
+
+static int a[24] =
+  {
+    S<1>::i, S<2>::i, S<3>::i, S<4>::i, S<5>::i, S<6>::i, S<7>::i, S<8>::i,
+    S<9>::i, S<10>::i, S<11>::i, S<12>::i, S<13>::i, S<14>::i, S<15>::i,
+    S<16>::i, S<17>::i, S<18>::i, S<19>::i, S<20>::i, S<21>::i, S<22>::i,
+    S<23>::i, S<24>::i
+  };
+
+int
+main (void)
+{
+  int result = 0;
+  for (int i = 0; i < 24; ++i)
+    {
+      printf("%d ", a[i]);
+      result |= a[i] != i + 1;
+    }
+
+  printf("\n%d\n", S<1>::j);
+  result |= S<1>::j != -1;
+
+  return result;
+}

Propchange: fsf/trunk/libc/elf/tst-unique4.cc
------------------------------------------------------------------------------
    svn:mime-type = text/cpp

Added: fsf/trunk/libc/elf/tst-unique4.h
==============================================================================
--- fsf/trunk/libc/elf/tst-unique4.h (added)
+++ fsf/trunk/libc/elf/tst-unique4.h Fri May 13 00:03:10 2011
@@ -1,0 +1,7 @@
+// BZ 12511
+template<int N>
+struct S
+{
+  static int i;
+  static const int j;
+};

Propchange: fsf/trunk/libc/elf/tst-unique4.h
------------------------------------------------------------------------------
    svn:mime-type = text/cpp

Added: fsf/trunk/libc/elf/tst-unique4lib.cc
==============================================================================
--- fsf/trunk/libc/elf/tst-unique4lib.cc (added)
+++ fsf/trunk/libc/elf/tst-unique4lib.cc Fri May 13 00:03:10 2011
@@ -1,0 +1,17 @@
+// BZ 12511
+#include "tst-unique4.h"
+
+template<int N>
+int S<N>::i = N;
+template<int N>
+const int S<N>::j __attribute__ ((used)) = -1;
+
+static int a[24] =
+  {
+    S<1>::i, S<2>::i, S<3>::i, S<4>::i, S<5>::i, S<6>::i, S<7>::i, S<8>::i,
+    S<9>::i, S<10>::i, S<11>::i, S<12>::i, S<13>::i, S<14>::i, S<15>::i,
+    S<16>::i, S<17>::i, S<18>::i, S<19>::i, S<20>::i, S<21>::i, S<22>::i,
+    S<23>::i, S<24>::i
+  };
+
+static int b = S<1>::j;

Propchange: fsf/trunk/libc/elf/tst-unique4lib.cc
------------------------------------------------------------------------------
    svn:mime-type = text/cpp