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

[commits] r14933 - in /fsf/trunk/libc: ./ elf/ intl/ locale/ nscd/ string/ sysdeps/generic/ sysdeps/i386/i486/bits/ sysdeps/unix/sysv/...



Author: eglibc
Date: Mon Aug 15 00:02:21 2011
New Revision: 14933

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

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/dl-libc.c
    fsf/trunk/libc/elf/dl-open.c
    fsf/trunk/libc/elf/rtld.c
    fsf/trunk/libc/intl/l10nflist.c
    fsf/trunk/libc/locale/Makefile
    fsf/trunk/libc/nscd/servicescache.c
    fsf/trunk/libc/string/strncat.c
    fsf/trunk/libc/sysdeps/generic/ldsodefs.h
    fsf/trunk/libc/sysdeps/i386/i486/bits/atomic.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Aug 15 00:02:21 2011
@@ -1,3 +1,52 @@
+2011-08-14  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* nscd/servicescache.c (cache_addserv): Make sure written is always
+	initialized.
+
+2011-08-14  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* sysdeps/i386/i486/bits/atomic.h
+	(__arch_compare_and_exchange_val_64_acq): Use RET alone at end of
+	statement expression, so as to suppress "set but not used" warning.
+	(__arch_c_compare_and_exchange_val_64_acq): Likewise.
+
+	* string/strncat.c (STRNCAT): Use prototype definition.
+
+	* locale/Makefile (locale-CPPFLAGS): Renamed CPPFLAGS-locale-programs.
+	(locale-CPPFLAGS): New variable; put LOCALEDIR, LOCALE_ALIAS_PATH and
+	-Iprograms here.
+	(cppflags-iterator.mk sequence): Use locale-programs in place of nonlib.
+	(localedef-modules): Add localedef.
+	(locale-modules): Add locale.
+
+	* sysdeps/generic/ldsodefs.h (struct unique_sym): Add a const.
+	* elf/rtld.c (dl_main): Invert order of assignment in last change,
+	to avoid a warning.
+
+2011-08-14  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sparc/bits/resource.h (RLIM_INFINITY,
+	RLIM64_INFINITY): Fix 64-bit values for 32-bit sparc.
+
+2011-08-13  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* elf/dl-open.c: Rename show_scope to _dl_schow_scope and export.
+	(dl_open_worker): Call _dl_show_scope when DL_DEBUG_SCOPES is set.
+	* elf/rtld.c (dl_main): Set l_name of vDSO.
+	Call _dl_show_scope when DL_DEBUG_SCOPES.
+	(process_dl_debug): Recognize scopes flag and also set it for all.
+	* sysdeps/generic/ldsodefs.h: Define DL_DEBUG_SCOPES.
+	Declare _dl_show_scope.
+
+	* elf/dl-libc.c (do_dlopen_args): Add caller_dlopen.
+	(do_dlopen): Pass caller_dlopen to dl_open.
+	(__libc_dlopen_mode): Initialize caller_dlopen.
+
+	* intl/l10nflist.c (_nl_normalize_codeset): Make it compile outside
+	of libc.  Make tolower call locale-independent.  Optimize a bit by
+	using isdigit instead of isalnum.
+	* locale/Makefile (locale-CPPFLAGS): Add -DNOT_IN_libc.
+
 2011-08-12  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	* elf/dl-load.c (_dl_map_object): Show in debug output whether a DSO

Modified: fsf/trunk/libc/elf/dl-libc.c
==============================================================================
--- fsf/trunk/libc/elf/dl-libc.c (original)
+++ fsf/trunk/libc/elf/dl-libc.c Mon Aug 15 00:02:21 2011
@@ -1,5 +1,6 @@
 /* Handle loading and unloading shared objects for internal libc purposes.
-   Copyright (C) 1999-2002,2004-2006,2009,2010 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002,2004-2006,2009,2010,2011
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@xxxxxxxxxxxxxxxxx>, 1999.
 
@@ -62,6 +63,8 @@
   const char *name;
   /* Opening mode.  */
   int mode;
+  /* This is the caller of the dlopen() function.  */
+  const void *caller_dlopen;
 
   /* Return from do_dlopen.  */
   struct link_map *map;
@@ -83,8 +86,9 @@
 {
   struct do_dlopen_args *args = (struct do_dlopen_args *) ptr;
   /* Open and relocate the shared object.  */
-  args->map = GLRO(dl_open) (args->name, args->mode, NULL, __LM_ID_CALLER,
-			     __libc_argc, __libc_argv, __environ);
+  args->map = GLRO(dl_open) (args->name, args->mode, args->caller_dlopen,
+			     __LM_ID_CALLER, __libc_argc, __libc_argv,
+			     __environ);
 }
 
 static void
@@ -153,6 +157,7 @@
   struct do_dlopen_args args;
   args.name = name;
   args.mode = mode;
+  args.caller_dlopen = RETURN_ADDRESS (0);
 
 #ifdef SHARED
   if (__builtin_expect (_dl_open_hook != NULL, 0))

Modified: fsf/trunk/libc/elf/dl-open.c
==============================================================================
--- fsf/trunk/libc/elf/dl-open.c (original)
+++ fsf/trunk/libc/elf/dl-open.c Mon Aug 15 00:02:21 2011
@@ -46,12 +46,6 @@
 
 extern int __libc_multiple_libcs;	/* Defined in init-first.c.  */
 
-/* Undefine the following for debugging.  */
-/* #define SCOPE_DEBUG 1 */
-#ifdef SCOPE_DEBUG
-static void show_scope (struct link_map *new);
-#endif
-
 /* We must be carefull not to leave us in an inconsistent state.  Thus we
    catch any error and re-raise it after cleaning up.  */
 
@@ -269,10 +263,6 @@
       (void) _dl_check_map_versions (new->l_searchlist.r_list[i]->l_real,
 				     0, 0);
 
-#ifdef SCOPE_DEBUG
-  show_scope (new);
-#endif
-
 #ifdef SHARED
   /* Auditing checkpoint: we have added all objects.  */
   if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
@@ -414,6 +404,10 @@
 	  imap->l_scope[cnt + 1] = NULL;
 	  atomic_write_barrier ();
 	  imap->l_scope[cnt] = &new->l_searchlist;
+
+	  /* Print scope information.  */
+	  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+	    _dl_show_scope (imap);
 	}
       /* Only add TLS memory if this object is loaded now and
 	 therefore is not yet initialized.  */
@@ -499,6 +493,10 @@
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
     _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
 		      new->l_name, new->l_ns, new->l_direct_opencount);
+
+  /* Print scope information.  */
+  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+    _dl_show_scope (new);
 }
 
 
@@ -635,33 +633,32 @@
 }
 
 
-#ifdef SCOPE_DEBUG
-#include <unistd.h>
-
-static void
-show_scope (struct link_map *new)
+void
+_dl_show_scope (struct link_map *l)
 {
-  int scope_cnt;
-
-  for (scope_cnt = 0; new->l_scope[scope_cnt] != NULL; ++scope_cnt)
-    {
-      char numbuf[2];
-      unsigned int cnt;
-
-      numbuf[0] = '0' + scope_cnt;
-      numbuf[1] = '\0';
-      _dl_printf ("scope %s:", numbuf);
-
-      for (cnt = 0; cnt < new->l_scope[scope_cnt]->r_nlist; ++cnt)
-	if (*new->l_scope[scope_cnt]->r_list[cnt]->l_name)
-	  _dl_printf (" %s", new->l_scope[scope_cnt]->r_list[cnt]->l_name);
-	else
-	  _dl_printf (" <main>");
-
-      _dl_printf ("\n");
-    }
+  _dl_debug_printf ("object=%s [%lu]\n",
+		    *l->l_name ? l->l_name : rtld_progname, l->l_ns);
+  if (l->l_scope != NULL)
+    for (int scope_cnt = 0; l->l_scope[scope_cnt] != NULL; ++scope_cnt)
+      {
+	char numbuf[2];
+	unsigned int cnt;
+
+	numbuf[0] = '0' + scope_cnt;
+	numbuf[1] = '\0';
+	_dl_debug_printf (" scope %s:", numbuf);
+
+	for (cnt = 0; cnt < l->l_scope[scope_cnt]->r_nlist; ++cnt)
+	  if (*l->l_scope[scope_cnt]->r_list[cnt]->l_name)
+	    _dl_debug_printf_c (" %s",
+				l->l_scope[scope_cnt]->r_list[cnt]->l_name);
+	  else
+	    _dl_debug_printf_c (" %s", rtld_progname);
+
+	_dl_debug_printf_c ("\n");
+      }
+  _dl_debug_printf ("\n");
 }
-#endif
 
 #ifdef IS_IN_rtld
 /* Return non-zero if ADDR lies within one of L's segments.  */

Modified: fsf/trunk/libc/elf/rtld.c
==============================================================================
--- fsf/trunk/libc/elf/rtld.c (original)
+++ fsf/trunk/libc/elf/rtld.c Mon Aug 15 00:02:21 2011
@@ -1391,7 +1391,7 @@
 	      char *copy = malloc (len);
 	      if (copy == NULL)
 		_dl_fatal_printf ("out of memory\n");
-	      l->l_libname->name = memcpy (copy, dsoname, len);
+	      l->l_libname->name = l->l_name = memcpy (copy, dsoname, len);
 	    }
 
 	  /* Add the vDSO to the object list.  */
@@ -2190,6 +2190,15 @@
   /* Remember the last search directory added at startup, now that
      malloc will no longer be the one from dl-minimal.c.  */
   GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
+
+  /* Print scope information.  */
+  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
+    {
+      _dl_debug_printf ("\nInitial object scopes\n");
+
+      for (struct link_map *l = main_map; l != NULL; l = l->l_next)
+	_dl_show_scope (l);
+    }
 
   if (prelinked)
     {
@@ -2431,9 +2440,12 @@
 	DL_DEBUG_BINDINGS | DL_DEBUG_IMPCALLS },
       { LEN_AND_STR ("versions"), "display version dependencies",
 	DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
+      { LEN_AND_STR ("scopes"), "display scope information",
+	DL_DEBUG_SCOPES },
       { LEN_AND_STR ("all"), "all previous options combined",
 	DL_DEBUG_LIBS | DL_DEBUG_RELOC | DL_DEBUG_FILES | DL_DEBUG_SYMBOLS
-	| DL_DEBUG_BINDINGS | DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS },
+	| DL_DEBUG_BINDINGS | DL_DEBUG_VERSIONS | DL_DEBUG_IMPCALLS
+	| DL_DEBUG_SCOPES },
       { LEN_AND_STR ("statistics"), "display relocation statistics",
 	DL_DEBUG_STATISTICS },
       { LEN_AND_STR ("unused"), "determined unused DSOs",

Modified: fsf/trunk/libc/intl/l10nflist.c
==============================================================================
--- fsf/trunk/libc/intl/l10nflist.c (original)
+++ fsf/trunk/libc/intl/l10nflist.c Mon Aug 15 00:02:21 2011
@@ -334,13 +334,18 @@
   char *retval;
   char *wp;
   size_t cnt;
+#ifdef NOT_IN_libc
+  locale_t locale = newlocale (0, "C", NULL);
+#else
+# define locale _nl_C_locobj_ptr
+#endif
 
   for (cnt = 0; cnt < name_len; ++cnt)
-    if (__isalnum_l ((unsigned char) codeset[cnt], _nl_C_locobj_ptr))
+    if (__isalnum_l ((unsigned char) codeset[cnt], locale))
       {
 	++len;
 
-	if (__isalpha_l ((unsigned char) codeset[cnt], _nl_C_locobj_ptr))
+	if (! __isdigit_l ((unsigned char) codeset[cnt], locale))
 	  only_digit = 0;
       }
 
@@ -348,15 +353,14 @@
 
   if (retval != NULL)
     {
+      wp = retval;
       if (only_digit)
-	wp = stpcpy (retval, "iso");
-      else
-	wp = retval;
+	wp = stpcpy (wp, "iso");
 
       for (cnt = 0; cnt < name_len; ++cnt)
-	if (__isalpha_l ((unsigned char) codeset[cnt], _nl_C_locobj_ptr))
-	  *wp++ = tolower ((unsigned char) codeset[cnt]);
-	else if (__isdigit_l ((unsigned char) codeset[cnt], _nl_C_locobj_ptr))
+	if (__isalpha_l ((unsigned char) codeset[cnt], locale))
+	  *wp++ = __tolower_l ((unsigned char) codeset[cnt], locale);
+	else if (__isdigit_l ((unsigned char) codeset[cnt], locale))
 	  *wp++ = codeset[cnt];
 
       *wp = '\0';

Modified: fsf/trunk/libc/locale/Makefile
==============================================================================
--- fsf/trunk/libc/locale/Makefile (original)
+++ fsf/trunk/libc/locale/Makefile Mon Aug 15 00:02:21 2011
@@ -1,4 +1,5 @@
-# Copyright (C) 1991,1992,1995-2003,2005,2009 Free Software Foundation, Inc.
+# Copyright (C) 1991,1992,1995-2003,2005,2009,2011
+# Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -59,10 +60,11 @@
 vpath %.h programs
 vpath %.gperf programs
 
-localedef-modules	:= $(categories:%=ld-%) charmap linereader locfile \
+localedef-modules	:= localedef $(categories:%=ld-%) \
+			   charmap linereader locfile \
 			   repertoire locarchive
 localedef-aux		:= md5
-locale-modules		:= locale-spec
+locale-modules		:= locale locale-spec
 lib-modules		:= charmap-dir simple-hash xmalloc xstrdup
 
 
@@ -90,22 +92,27 @@
 
 localepath = "$(localedir):$(i18ndir)"
 
-locale-CPPFLAGS := -DLOCALE_PATH='$(localepath)' \
-		   -DLOCALEDIR='"$(localedir)"' \
-		   -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
-		   -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
-		   -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
-		   -DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
-		   -Iprograms
+# -Iprograms doesn't really belong here, but this gets it at the head
+# of the list instead of the tail, where CPPFLAGS-$(lib) gets added.
+# We need it before the standard -I's to see programs/config.h first.
+locale-CPPFLAGS = -DLOCALEDIR='"$(localedir)"' \
+		  -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
+		  -Iprograms
+
+CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
+			   -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
+			   -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
+			   -DLOCSRCDIR='"$(i18ndir)/locales"' \
+			   -DHAVE_CONFIG_H -DNOT_IN_libc
 
 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-charmap-dir.c = -Wno-write-strings
 
-# This makes sure -DNOT_IN_libc is passed for all these modules.
+# This makes sure -DNOT_IN_libc et al are passed for all these modules.
 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
 				$(locale-modules) $(lib-modules))
-lib := nonlib
+lib := locale-programs
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.

Modified: fsf/trunk/libc/nscd/servicescache.c
==============================================================================
--- fsf/trunk/libc/nscd/servicescache.c (original)
+++ fsf/trunk/libc/nscd/servicescache.c Mon Aug 15 00:02:21 2011
@@ -102,7 +102,7 @@
 	{
 	  /* We have no data.  This means we send the standard reply for this
 	     case.  */
-	  total = sizeof (notfound);
+	  written = total = sizeof (notfound);
 
 	  if (fd != -1)
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,

Modified: fsf/trunk/libc/string/strncat.c
==============================================================================
--- fsf/trunk/libc/string/strncat.c (original)
+++ fsf/trunk/libc/string/strncat.c Mon Aug 15 00:02:21 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1997,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,10 +29,7 @@
 #endif
 
 char *
-STRNCAT (s1, s2, n)
-     char *s1;
-     const char *s2;
-     size_t n;
+STRNCAT (char *s1, const char *s2, size_t n)
 {
   reg_char c;
   char *s = s1;

Modified: fsf/trunk/libc/sysdeps/generic/ldsodefs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/ldsodefs.h (original)
+++ fsf/trunk/libc/sysdeps/generic/ldsodefs.h Mon Aug 15 00:02:21 2011
@@ -396,7 +396,7 @@
 	uint32_t hashval;
 	const char *name;
 	const ElfW(Sym) *sym;
-	struct link_map *map;
+	const struct link_map *map;
       } *entries;
       size_t size;
       size_t n_elements;
@@ -556,9 +556,10 @@
 #define DL_DEBUG_FILES      (1 << 6)
 #define DL_DEBUG_STATISTICS (1 << 7)
 #define DL_DEBUG_UNUSED	    (1 << 8)
+#define DL_DEBUG_SCOPES	    (1 << 9)
 /* These two are used only internally.  */
-#define DL_DEBUG_HELP       (1 << 9)
-#define DL_DEBUG_PRELINK    (1 << 10)
+#define DL_DEBUG_HELP       (1 << 10)
+#define DL_DEBUG_PRELINK    (1 << 11)
 
   /* OS version.  */
   EXTERN unsigned int _dl_osversion;
@@ -1104,6 +1105,9 @@
 extern int _dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
      internal_function attribute_hidden;
 
+/* Show show of an object.  */
+extern void _dl_show_scope (struct link_map *new);
+
 __END_DECLS
 
 #endif /* ldsodefs.h */

Modified: fsf/trunk/libc/sysdeps/i386/i486/bits/atomic.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i486/bits/atomic.h (original)
+++ fsf/trunk/libc/sysdeps/i386/i486/bits/atomic.h Mon Aug 15 00:02:21 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004,2006,2007,2009,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -125,10 +125,18 @@
    really going to be used the code below can be used on Intel Pentium
    and later, but NOT on i486.  */
 #if 1
-# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-  ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
-# define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-  ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
+# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval)	      \
+  ({ __typeof (*mem) ret = *(mem);					      \
+     abort ();								      \
+     ret = (newval);							      \
+     ret = (oldval);							      \
+     ret; })
+# define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval)	      \
+  ({ __typeof (*mem) ret = *(mem);					      \
+     abort ();								      \
+     ret = (newval);							      \
+     ret = (oldval);							      \
+     ret; })
 #else
 # ifdef __PIC__
 #  define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h Mon Aug 15 00:02:21 2011
@@ -130,11 +130,11 @@
 #ifndef __USE_FILE_OFFSET64
 # define RLIM_INFINITY ((long int)(~0UL >> 1))
 #else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+# define RLIM_INFINITY 0xffffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0xffffffffffffffffLL
 #endif
 
 #endif