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

[commits] r15029 - in /fsf/trunk/libc: ./ dlfcn/ elf/ sysdeps/unix/sysv/linux/i386/ sysdeps/unix/sysv/linux/sparc/sparc32/ sysdeps/uni...



Author: eglibc
Date: Tue Aug 23 00:02:13 2011
New Revision: 15029

Log:
Import glibc-mainline for 2011-08-23

Added:
    fsf/trunk/libc/elf/tst-initorder2.c
    fsf/trunk/libc/elf/tst-initorder2.exp
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/dlfcn/Makefile
    fsf/trunk/libc/elf/Makefile
    fsf/trunk/libc/elf/dl-deps.c
    fsf/trunk/libc/elf/dl-fini.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/scandir64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Aug 23 00:02:13 2011
@@ -1,3 +1,35 @@
+2011-08-22  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S: Fix
+	sigaltstack check, add missing cfi directives.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S: Add
+	missing cfi directives, and sigaltstack handling.
+
+2011-08-16  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	[BZ #11724]
+	* elf/dl-deps.c (_dl_map_object_deps): Only assume cycle when
+	object is seen twice.
+	* elf/dl-fini.c (_dl_sort_fini): Likewise.
+
+	* elf/Makefile (distribute): Add tst-initorder2.c.
+	(tests): Add tst-initorder2.
+	(modules-names): Add tst-initorder2a tst-initorder2b
+	tst-initorder2c tst-initorder2d.  Add rules to build them.
+	($(objpfx)tst-initorder2.out): New rule.
+	* elf/tst-initorder2.c: New file.
+	* elf/tst-initorder2.exp: New file.
+
+2011-08-22  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/i386/scandir64.c: Include <string.h>.
+
+	* elf/dl-deps.c (_dl_map_object_deps): Move check for missing
+	dependencies back to end of function.
+
+	* dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Readd
+	$(elfobjdir)/ld.so.
+
 2011-08-21  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/x86_64/gettimeofday.S: Removed.

Modified: fsf/trunk/libc/dlfcn/Makefile
==============================================================================
--- fsf/trunk/libc/dlfcn/Makefile (original)
+++ fsf/trunk/libc/dlfcn/Makefile Tue Aug 23 00:02:13 2011
@@ -124,7 +124,8 @@
 $(objpfx)bug-atexit2: $(libdl)
 $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
 
-LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(common-objpfx)libc_nonshared.a
+LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(elfobjdir)/ld.so \
+			    $(common-objpfx)libc_nonshared.a
 $(objpfx)bug-atexit3: $(libdl)
 $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
 

Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Tue Aug 23 00:02:13 2011
@@ -120,9 +120,10 @@
 		   ifuncmain7pie.c ifuncmain7static.c \
 		   tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \
 		   tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c \
-			 tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
-			 tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
-			 tst-initorder.c
+		   tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
+		   tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
+		   tst-initorder.c \
+		   tst-initorder2.c
 
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -227,7 +228,7 @@
 	 tst-audit1 tst-audit2 \
 	 tst-stackguard1 tst-addr1 tst-thrlock \
 	 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
-	 tst-initorder
+	 tst-initorder tst-initorder2
 #	 reldep9
 test-srcs = tst-pathopt
 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
@@ -288,7 +289,8 @@
 		tst-unique4lib \
 		tst-initordera1 tst-initorderb1 \
 		tst-initordera2 tst-initorderb2 \
-		tst-initordera3 tst-initordera4
+		tst-initordera3 tst-initordera4 \
+		tst-initorder2a tst-initorder2b tst-initorder2c tst-initorder2d
 ifeq (yes,$(have-initfini-array))
 modules-names += tst-array2dep tst-array5dep
 endif
@@ -1157,6 +1159,23 @@
 	  $< > $@
 	cmp $@ tst-initorder.exp > /dev/null
 
+$(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
+$(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
+$(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
+$(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
+define o-iterator-doit
+$(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
+$$(compile-command.c) -DNAME=\"$o\"
+endef
+object-suffixes-left := a b c d
+include $(o-iterator)
+
+$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
+	$(elf-objpfx)${rtld-installed-name} \
+	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+	  $< > $@
+	cmp $@ tst-initorder2.exp > /dev/null
+
 ifeq (yes,$(config-cflags-avx))
 AVX-CFLAGS=-mavx
 ifeq (yes,$(config-cflags-novzeroupper))

Modified: fsf/trunk/libc/elf/dl-deps.c
==============================================================================
--- fsf/trunk/libc/elf/dl-deps.c (original)
+++ fsf/trunk/libc/elf/dl-deps.c Tue Aug 23 00:02:13 2011
@@ -491,10 +491,6 @@
   if (errno == 0 && errno_saved != 0)
     __set_errno (errno_saved);
 
-  if (errno_reason)
-    _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
-		      NULL, errstring);
-
   struct link_map **old_l_initfini = NULL;
   if (map->l_initfini != NULL && map->l_type == lt_loaded)
     {
@@ -626,12 +622,12 @@
       /* We can skip looking for the binary itself which is at the front
 	 of the search list.  */
       i = 1;
-      bool seen[nlist];
-      memset (seen, false, nlist * sizeof (seen[0]));
+      char seen[nlist];
+      memset (seen, 0, nlist * sizeof (seen[0]));
       while (1)
 	{
 	  /* Keep track of which object we looked at this round.  */
-	  seen[i] = true;
+	  seen[i] += seen[i] < 2;
 	  struct link_map *thisp = l_initfini[i];
 
 	  /* Find the last object in the list for which the current one is
@@ -652,15 +648,16 @@
 			       (k - i) * sizeof (l_initfini[0]));
 		      l_initfini[k] = thisp;
 
-		      if (seen[i + 1])
+		      if (seen[i + 1] > 1)
 			{
 			  ++i;
 			  goto next_clear;
 			}
 
+		      char this_seen = seen[i];
 		      memmove (&seen[i], &seen[i + 1],
 			       (k - i) * sizeof (seen[0]));
-		      seen[k] = true;
+		      seen[k] = this_seen;
 
 		      goto next;
 		    }
@@ -671,7 +668,7 @@
 	  if (++i == nlist)
 	    break;
 	next_clear:
-	  memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
+	  memset (&seen[i], 0, (nlist - i) * sizeof (seen[0]));
 
 	next:;
 	}
@@ -690,4 +687,8 @@
     }
   if (old_l_initfini != NULL)
       map->l_orig_initfini = old_l_initfini;
+
+  if (errno_reason)
+    _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
+		      NULL, errstring);
 }

Modified: fsf/trunk/libc/elf/dl-fini.c
==============================================================================
--- fsf/trunk/libc/elf/dl-fini.c (original)
+++ fsf/trunk/libc/elf/dl-fini.c Tue Aug 23 00:02:13 2011
@@ -39,12 +39,12 @@
   /* We can skip looking for the binary itself which is at the front
      of the search list for the main namespace.  */
   unsigned int i = ns == LM_ID_BASE;
-  bool seen[nmaps];
-  memset (seen, false, nmaps * sizeof (seen[0]));
+  char seen[nmaps];
+  memset (seen, 0, nmaps * sizeof (seen[0]));
   while (1)
     {
       /* Keep track of which object we looked at this round.  */
-      seen[i] = true;
+      seen[i] += seen[i] < 2;
       struct link_map *thisp = maps[i];
 
       /* Do not handle ld.so in secondary namespaces and object which
@@ -79,14 +79,15 @@
 		      used[k] = here_used;
 		    }
 
-		  if (seen[i + 1])
+		  if (seen[i + 1] > 1)
 		    {
 		      ++i;
 		      goto next_clear;
 		    }
 
+		  char this_seen = seen[i];
 		  memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
-		  seen[k] = true;
+		  seen[k] = this_seen;
 
 		  goto next;
 		}
@@ -96,7 +97,7 @@
 	      unsigned int m = maps[k]->l_reldeps->act;
 	      struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
 
-	    /* Look through the relocation dependencies of the object.  */
+	      /* Look through the relocation dependencies of the object.  */
 	      while (m-- > 0)
 		if (__builtin_expect (relmaps[m] == thisp, 0))
 		  goto move;
@@ -109,7 +110,7 @@
       if (++i == nmaps)
 	break;
     next_clear:
-      memset (&seen[i], false, (nmaps - i) * sizeof (seen[0]));
+      memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
 
     next:;
     }

Added: fsf/trunk/libc/elf/tst-initorder2.c
==============================================================================
--- fsf/trunk/libc/elf/tst-initorder2.c (added)
+++ fsf/trunk/libc/elf/tst-initorder2.c Tue Aug 23 00:02:13 2011
@@ -1,0 +1,20 @@
+#include <stdio.h>
+
+#ifndef NAME
+int
+main (void)
+{
+  puts ("main");
+}
+#else
+static void __attribute__ ((constructor))
+init (void)
+{
+  puts ("init: " NAME);
+}
+static void __attribute__ ((destructor))
+fini (void)
+{
+  puts ("fini: " NAME);
+}
+#endif

Added: fsf/trunk/libc/elf/tst-initorder2.exp
==============================================================================
--- fsf/trunk/libc/elf/tst-initorder2.exp (added)
+++ fsf/trunk/libc/elf/tst-initorder2.exp Tue Aug 23 00:02:13 2011
@@ -1,0 +1,9 @@
+init: d
+init: c
+init: b
+init: a
+main
+fini: a
+fini: b
+fini: c
+fini: d

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/scandir64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/scandir64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/scandir64.c Tue Aug 23 00:02:13 2011
@@ -35,6 +35,7 @@
 versioned_symbol (libc, __scandir64, scandir64, GLIBC_2_2);
 
 #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+# include <string.h>
 # include <errno.h>
 # include "olddirent.h"
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/____longjmp_chk.S Tue Aug 23 00:02:13 2011
@@ -41,10 +41,14 @@
 	 nop
 
 	save	%sp, -80, %sp
+	cfi_remember_state
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	clr	%o0
 	add	%sp, 64, %o1
-	set	__NR_sigaltstack, %g1
+	LOADSYSCALL(sigaltstack)
 	ta	0x10
 	bcs	.Lok
 	 ld	[%sp + 64 + 4], %o2
@@ -54,8 +58,8 @@
 
 	ld	[%sp + 64 + 8], %o1
 	add	%o0, %o1, %o0
-	sub	%o0, %g3, %o0
-	cmp	%o1, %o0
+	sub	%o0, %g5, %o0
+	cmp	%o0, %o1
 	bgeu	.Lok
 	 nop
 
@@ -76,6 +80,7 @@
 
 .Lok:
 	restore
+	cfi_restore_state
 
 .Lok_norestore:
 	ld	ENV(o0,JB_FP), %g3	/* Cache target FP in register %g3.  */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/____longjmp_chk.S Tue Aug 23 00:02:13 2011
@@ -40,8 +40,29 @@
 	bleu,pt	%xcc, .Lok
 	 nop
 
-	save	%sp, -128, %sp
+	save	%sp, -208, %sp
+	cfi_remember_state
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+	add	%fp, 2023, %o1
+	clr	%o0
+	LOADSYSCALL(sigaltstack)
+	ta	0x6d
+	bcs,pn	%xcc, .Lok2
+	 lduw	[%fp + 2031], %l2
+	andcc	%l2, 0x1, %g0
+	be,pn	%xcc, .Lfail
+	 ldx	[%fp + 2023], %l0
+	ldx	[%fp + 2039], %l1
+	sub	%l0, STACK_BIAS, %l0
+	add	%l0, %l1, %l0
+	sub	%l0, %i2, %l0
+	cmp	%l0, %l1
+	bgeu,pt	%xcc, .Lok2
+	 nop
 
+.Lfail:
 #ifdef PIC
 1:	call	2f
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
@@ -56,7 +77,8 @@
 	call	HIDDEN_JUMPTARGET(__fortify_fail)
 	 nop
 
-	restore
+.Lok2:	restore
+	cfi_restore_state
 
 .Lok:
 	/* Modify the context with the value we want to return.  */