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

[Commits] r24093 - in /fsf/trunk/libc: ./ conform/data/ locale/programs/ localedata/ localedata/locales/ manual/ ports/ ports/sysdeps/...



Author: eglibc
Date: Wed Sep 25 00:02:24 2013
New Revision: 24093

Log:
Import glibc-mainline for 2013-09-25

Added:
    fsf/trunk/libc/localedata/locales/cmn_TW
    fsf/trunk/libc/localedata/locales/hak_TW
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/conform/data/pthread.h-data
    fsf/trunk/libc/locale/programs/ld-collate.c
    fsf/trunk/libc/locale/programs/localedef.c
    fsf/trunk/libc/locale/programs/locarchive.c
    fsf/trunk/libc/locale/programs/locfile.c
    fsf/trunk/libc/locale/programs/locfile.h
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/SUPPORTED
    fsf/trunk/libc/manual/freemanuals.texi
    fsf/trunk/libc/manual/libc.texinfo
    fsf/trunk/libc/ports/ChangeLog.aarch64
    fsf/trunk/libc/ports/ChangeLog.arm
    fsf/trunk/libc/ports/sysdeps/aarch64/machine-gmon.h
    fsf/trunk/libc/ports/sysdeps/arm/nptl/tls.h
    fsf/trunk/libc/stdio-common/tst-long-dbl-fphex.c
    fsf/trunk/libc/sysdeps/mach/hurd/i386/tls.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Sep 25 00:02:24 2013
@@ -1,3 +1,72 @@
+2013-09-24  Olivier Langlois  <olivier@xxxxxxxxxxxxxxxxxxx>
+
+	* stdio-common/tst-long-dbl-fphex.c (do_test): Fix swprintf length
+	argument calculation.
+
+2013-09-24  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* conform/data/pthread.h-data [POSIX] (PTHREAD_MUTEX_INITIALIZER):
+	Expect macro.
+	[POSIX] (pthread_attr_t): Do not require type.
+	[POSIX] (pthread_cond_t): Likewise.
+	[POSIX] (pthread_condattr_t): Likewise.
+	[POSIX] (pthread_key_t): Likewise.
+	[POSIX] (pthread_mutex_t): Likewise.
+	[POSIX] (pthread_mutexattr_t): Likewise.
+	[POSIX] (pthread_once_t): Likewise.
+	[POSIX] (pthread_t): Likewise.
+	[POSIX-based standards] (pthread_atfork): Expect function.
+
+2013-09-24  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+	    Richard Sandiford  <richard@xxxxxxxxxxxxxxxx>
+
+	* locale/programs/locfile.h: Include <byteswap.h> and <stdbool.h>.
+	(swap_endianness_p): New extern variable.
+	(set_big_endian): New inline function.
+	(maybe_swap_uint32): Likewise.
+	(maybe_swap_uint32_array): Likewise.
+	(maybe_swap_uint32_obstack): Likewise.
+	* locale/programs/locfile.c: Include <stdbool.h>.
+	(swap_endianness_p): New variable.
+	(add_locale_uint32): Call maybe_swap_uint32.
+	(add_locale_uint32_array): Call maybe_swap_uint32_obstack.
+	(write_locale_data): Call maybe_swap_uint32_array.
+	* locale/programs/ld-collate.c (obstack_int32_grow): Call
+	maybe_swap_uint32.
+	(obstack_int32_grow_fast): Likewise.
+	(output_weightwc): Call maybe_swap_uint32_obstack.
+	(collate_output): Likewise.
+	* locale/programs/localedef.c (OPT_LITTLE_ENDIAN): New macro.
+	(OPT_LITTLE_ENDIAN): Likewise.
+	(options): Add --little-endian and --big-endian options.
+	(parse_opt): Handle OPT_LITTLE_ENDIAN and OPT_BIG_ENDIAN.
+	* locale/programs/locarchive.c: Include "locfile.h".
+	(GET): New macro.
+	(SET): Likewise.
+	(INC): Likewise.
+	(create_archive): Use the new macros to access fields of
+	structures directly mapped from or written to locale archives.
+	(oldlocrecentcmp): Likewise.
+	(enlarge_archive): Likewise.
+	(insert_name): Likewise.
+	(add_alias): Likewise.
+	(add_locale): Likewise.
+	(delete_locales_from_archive): Likewise.
+	(show_archive_content): Likewise.
+	(add_locale_to_archive): Likewise.  Use maybe_swap_uint32 on
+	locale data.
+
+2013-09-24  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* manual/freemanuals.texi: Updated from (newly) canonical copy at
+	http://www.gnu.org/doc/freemanuals.texi.
+	* manual/libc.texinfo (Free Manuals): Put the @appendix line here.
+
+2013-09-24  Will Newton  <will.newton@xxxxxxxxxx>
+
+	* sysdeps/mach/hurd/i386/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
+	macro.
+
 2013-09-23  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* locale/hashval.h (compute_hashval): Interpret bytes of key as

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed Sep 25 00:02:24 2013
@@ -9,10 +9,10 @@
 
 * The following bugs are resolved with this release:
 
-  13985, 14155, 14547, 14699, 15427, 15522, 15531, 15532, 15608, 15640,
-  15681, 15736, 15748, 15749, 15754, 15797, 15844, 15849, 15855, 15856,
-  15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893, 15895, 15897,
-  15905, 15909, 15919, 15921, 15923, 15939, 15963, 15966.
+  13985, 14155, 14547, 14699, 15427, 15522, 15531, 15532, 15608, 15609,
+  15610, 15640, 15681, 15736, 15748, 15749, 15754, 15797, 15844, 15849,
+  15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893,
+  15895, 15897, 15905, 15909, 15919, 15921, 15923, 15939, 15963, 15966.
 
 * CVE-2012-4412 The strcoll implementation caches indices and rules for
   large collation sequences to optimize multiple passes.  This cache
@@ -41,12 +41,16 @@
   heap when passed very large allocation size values (Bugzilla #15855,
   #15856, #15857).
 
-* New locales: ak_GH, lzh_TW, nan_TW, quz_PE.
+* New locales: ak_GH, cmn_TW, hak_TW, lzh_TW, nan_TW, quz_PE.
 
 * The LC_ADDRESS field was updated to support country_car for almost all
   supported locales.
 
 * ISO 1427 definitions were updated.
+
+* The localedef utility now supports --big-endian and --little-endian
+  command-line options to generate locales for a different system from that
+  for which the C library was built.
 
 * The configure option --disable-versioning has been removed.  Builds with
   --disable-versioning had not worked for several years.

Modified: fsf/trunk/libc/conform/data/pthread.h-data
==============================================================================
--- fsf/trunk/libc/conform/data/pthread.h-data (original)
+++ fsf/trunk/libc/conform/data/pthread.h-data Wed Sep 25 00:02:24 2013
@@ -17,11 +17,11 @@
 constant PTHREAD_PROCESS_PRIVATE
 constant PTHREAD_SCOPE_PROCESS
 constant PTHREAD_SCOPE_SYSTEM
+macro PTHREAD_MUTEX_INITIALIZER
 # ifndef POSIX
 constant PTHREAD_MUTEX_DEFAULT
 constant PTHREAD_MUTEX_ERRORCHECK
 constant PTHREAD_MUTEX_NORMAL
-macro PTHREAD_MUTEX_INITIALIZER
 constant PTHREAD_MUTEX_RECURSIVE
 macro PTHREAD_RWLOCK_INITIALIZER
 # endif
@@ -30,26 +30,27 @@
 constant PTHREAD_MUTEX_STALLED
 # endif
 
+# ifndef POSIX
 type pthread_attr_t
-# if !defined POSIX && !defined UNIX98
+#  ifndef UNIX98
 type pthread_barrier_t
 type pthread_barrierattr_t
-# endif
+#  endif
 type pthread_cond_t
 type pthread_condattr_t
 type pthread_key_t
 type pthread_mutex_t
 type pthread_mutexattr_t
 type pthread_once_t
-# if !defined POSIX
 type pthread_rwlock_t
 type pthread_rwlockattr_t
+#  ifndef UNIX98
+type pthread_spinlock_t
+#  endif
+type pthread_t
 # endif
-# if !defined POSIX && !defined UNIX98
-type pthread_spinlock_t
-# endif
-type pthread_t
 
+function int pthread_atfork (void (*) (void), void (*) (void), void (*) (void))
 function int pthread_attr_destroy (pthread_attr_t*)
 function int pthread_attr_getdetachstate (const pthread_attr_t*, int*)
 # ifndef POSIX

Modified: fsf/trunk/libc/locale/programs/ld-collate.c
==============================================================================
--- fsf/trunk/libc/locale/programs/ld-collate.c (original)
+++ fsf/trunk/libc/locale/programs/ld-collate.c Wed Sep 25 00:02:24 2013
@@ -44,6 +44,7 @@
 __attribute ((always_inline))
 obstack_int32_grow (struct obstack *obstack, int32_t data)
 {
+  data = maybe_swap_uint32 (data);
   if (sizeof (int32_t) == sizeof (int))
     obstack_int_grow (obstack, data);
   else
@@ -54,6 +55,7 @@
 __attribute ((always_inline))
 obstack_int32_grow_fast (struct obstack *obstack, int32_t data)
 {
+  data = maybe_swap_uint32 (data);
   if (sizeof (int32_t) == sizeof (int))
     obstack_int_grow_fast (obstack, data);
   else
@@ -1955,6 +1957,7 @@
       obstack_int32_grow (pool, j);
 
       obstack_grow (pool, buf, j * sizeof (int32_t));
+      maybe_swap_uint32_obstack (pool, j);
     }
 
   return retval | ((elem->section->ruleidx & 0x7f) << 24);
@@ -2479,6 +2482,7 @@
 	  obstack_int32_grow (&extrapool, runp->nwcs);
 	  obstack_grow (&extrapool, runp->wcs,
 			runp->nwcs * sizeof (uint32_t));
+	  maybe_swap_uint32_obstack (&extrapool, runp->nwcs);
 
 	  obstack_int32_grow (&extrapool, runp->wcseqorder);
 	}

Modified: fsf/trunk/libc/locale/programs/localedef.c
==============================================================================
--- fsf/trunk/libc/locale/programs/localedef.c (original)
+++ fsf/trunk/libc/locale/programs/localedef.c Wed Sep 25 00:02:24 2013
@@ -112,6 +112,8 @@
 #define OPT_REPLACE 307
 #define OPT_DELETE_FROM_ARCHIVE 308
 #define OPT_LIST_ARCHIVE 309
+#define OPT_LITTLE_ENDIAN 400
+#define OPT_BIG_ENDIAN 401
 
 /* Definitions of arguments for argp functions.  */
 static const struct argp_option options[] =
@@ -144,6 +146,10 @@
   { "list-archive", OPT_LIST_ARCHIVE, NULL, 0, N_("List content of archive") },
   { "alias-file", 'A', N_("FILE"), 0,
     N_("locale.alias file to consult when making archive")},
+  { "little-endian", OPT_LITTLE_ENDIAN, NULL, 0,
+    N_("Generate little-endian output") },
+  { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
+    N_("Generate big-endian output") },
   { NULL, 0, NULL, 0, NULL }
 };
 
@@ -325,6 +331,12 @@
       break;
     case OPT_LIST_ARCHIVE:
       list_archive = true;
+      break;
+    case OPT_LITTLE_ENDIAN:
+      set_big_endian (false);
+      break;
+    case OPT_BIG_ENDIAN:
+      set_big_endian (true);
       break;
     case 'c':
       force_output = 1;

Modified: fsf/trunk/libc/locale/programs/locarchive.c
==============================================================================
--- fsf/trunk/libc/locale/programs/locarchive.c (original)
+++ fsf/trunk/libc/locale/programs/locarchive.c Wed Sep 25 00:02:24 2013
@@ -46,6 +46,7 @@
 #include "../localeinfo.h"
 #include "../locarchive.h"
 #include "localedef.h"
+#include "locfile.h"
 
 /* Define the hash function.  We define the function as static inline.
    We must change the name so as not to conflict with simple-hash.h.  */
@@ -72,6 +73,13 @@
 #define INITIAL_SIZE_STRINGS	7500
 #define INITIAL_NUM_LOCREC	420
 #define INITIAL_NUM_SUMS	2000
+
+
+/* Get and set values (possibly endian-swapped) in structures mapped
+   from or written directly to locale archives.  */
+#define GET(FIELD)	maybe_swap_uint32 (FIELD)
+#define SET(FIELD, VALUE)	((FIELD) = maybe_swap_uint32 (VALUE))
+#define INC(FIELD, INCREMENT)	SET (FIELD, GET (FIELD) + (INCREMENT))
 
 
 /* Size of the reserved address space area.  */
@@ -125,27 +133,31 @@
     error (EXIT_FAILURE, errno, _("cannot create temporary file: %s"), fname);
 
   /* Create the initial content of the archive.  */
-  head.magic = AR_MAGIC;
-  head.serial = 0;
-  head.namehash_offset = sizeof (struct locarhead);
-  head.namehash_used = 0;
-  head.namehash_size = next_prime (INITIAL_NUM_NAMES);
-
-  head.string_offset = (head.namehash_offset
-			+ head.namehash_size * sizeof (struct namehashent));
-  head.string_used = 0;
-  head.string_size = INITIAL_SIZE_STRINGS;
-
-  head.locrectab_offset = head.string_offset + head.string_size;
-  head.locrectab_used = 0;
-  head.locrectab_size = INITIAL_NUM_LOCREC;
-
-  head.sumhash_offset = (head.locrectab_offset
-			 + head.locrectab_size * sizeof (struct locrecent));
-  head.sumhash_used = 0;
-  head.sumhash_size = next_prime (INITIAL_NUM_SUMS);
-
-  total = head.sumhash_offset + head.sumhash_size * sizeof (struct sumhashent);
+  SET (head.magic, AR_MAGIC);
+  SET (head.serial, 0);
+  SET (head.namehash_offset, sizeof (struct locarhead));
+  SET (head.namehash_used, 0);
+  SET (head.namehash_size, next_prime (INITIAL_NUM_NAMES));
+
+  SET (head.string_offset,
+       (GET (head.namehash_offset)
+	+ GET (head.namehash_size) * sizeof (struct namehashent)));
+  SET (head.string_used, 0);
+  SET (head.string_size, INITIAL_SIZE_STRINGS);
+
+  SET (head.locrectab_offset,
+       GET (head.string_offset) + GET (head.string_size));
+  SET (head.locrectab_used, 0);
+  SET (head.locrectab_size, INITIAL_NUM_LOCREC);
+
+  SET (head.sumhash_offset,
+       (GET (head.locrectab_offset)
+	+ GET (head.locrectab_size) * sizeof (struct locrecent)));
+  SET (head.sumhash_used, 0);
+  SET (head.sumhash_size, next_prime (INITIAL_NUM_SUMS));
+
+  total = (GET (head.sumhash_offset)
+	   + GET (head.sumhash_size) * sizeof (struct sumhashent));
 
   /* Write out the header and create room for the other data structures.  */
   if (TEMP_FAILURE_RETRY (write (fd, &head, sizeof (head))) != sizeof (head))
@@ -240,10 +252,10 @@
   for (cnt = 0; cnt < __LC_LAST; ++cnt)
     if (cnt != LC_ALL)
       {
-	if (la->record[cnt].offset < start_a)
-	  start_a = la->record[cnt].offset;
-	if (la->record[cnt].offset + la->record[cnt].len > end_a)
-	  end_a = la->record[cnt].offset + la->record[cnt].len;
+	if (GET (la->record[cnt].offset) < start_a)
+	  start_a = GET (la->record[cnt].offset);
+	if (GET (la->record[cnt].offset) + GET (la->record[cnt].len) > end_a)
+	  end_a = GET (la->record[cnt].offset) + GET (la->record[cnt].len);
       }
   assert (start_a != (uint32_t)-1);
   assert (end_a != 0);
@@ -251,10 +263,10 @@
   for (cnt = 0; cnt < __LC_LAST; ++cnt)
     if (cnt != LC_ALL)
       {
-	if (lb->record[cnt].offset < start_b)
-	  start_b = lb->record[cnt].offset;
-	if (lb->record[cnt].offset + lb->record[cnt].len > end_b)
-	  end_b = lb->record[cnt].offset + lb->record[cnt].len;
+	if (GET (lb->record[cnt].offset) < start_b)
+	  start_b = GET (lb->record[cnt].offset);
+	if (GET (lb->record[cnt].offset) + GET (lb->record[cnt].len) > end_b)
+	  end_b = GET (lb->record[cnt].offset) + GET (lb->record[cnt].len);
       }
   assert (start_b != (uint32_t)-1);
   assert (end_b != 0);
@@ -371,38 +383,42 @@
 
   /* Create the new archive header.  The sizes of the various tables
      should be double from what is currently used.  */
-  newhead.namehash_size = MAX (next_prime (2 * newhead.namehash_used),
-			       newhead.namehash_size);
+  SET (newhead.namehash_size,
+       MAX (next_prime (2 * GET (newhead.namehash_used)),
+	    GET (newhead.namehash_size)));
   if (verbose)
     printf ("name: size: %u, used: %d, new: size: %u\n",
-	    head->namehash_size, head->namehash_used, newhead.namehash_size);
-
-  newhead.string_offset = (newhead.namehash_offset
-			   + (newhead.namehash_size
-			      * sizeof (struct namehashent)));
+	    GET (head->namehash_size),
+	    GET (head->namehash_used), GET (newhead.namehash_size));
+
+  SET (newhead.string_offset, (GET (newhead.namehash_offset)
+			       + (GET (newhead.namehash_size)
+				  * sizeof (struct namehashent))));
   /* Keep the string table size aligned to 4 bytes, so that
      all the struct { uint32_t } types following are happy.  */
-  newhead.string_size = MAX ((2 * newhead.string_used + 3) & -4,
-			     newhead.string_size);
-
-  newhead.locrectab_offset = newhead.string_offset + newhead.string_size;
-  newhead.locrectab_size = MAX (2 * newhead.locrectab_used,
-				newhead.locrectab_size);
-
-  newhead.sumhash_offset = (newhead.locrectab_offset
-			    + (newhead.locrectab_size
-			       * sizeof (struct locrecent)));
-  newhead.sumhash_size = MAX (next_prime (2 * newhead.sumhash_used),
-			      newhead.sumhash_size);
-
-  total = (newhead.sumhash_offset
-	   + newhead.sumhash_size * sizeof (struct sumhashent));
+  SET (newhead.string_size, MAX ((2 * GET (newhead.string_used) + 3) & -4,
+				 GET (newhead.string_size)));
+
+  SET (newhead.locrectab_offset,
+       GET (newhead.string_offset) + GET (newhead.string_size));
+  SET (newhead.locrectab_size, MAX (2 * GET (newhead.locrectab_used),
+				    GET (newhead.locrectab_size)));
+
+  SET (newhead.sumhash_offset, (GET (newhead.locrectab_offset)
+				+ (GET (newhead.locrectab_size)
+				   * sizeof (struct locrecent))));
+  SET (newhead.sumhash_size,
+       MAX (next_prime (2 * GET (newhead.sumhash_used)),
+	    GET (newhead.sumhash_size)));
+
+  total = (GET (newhead.sumhash_offset)
+	   + GET (newhead.sumhash_size) * sizeof (struct sumhashent));
 
   /* The new file is empty now.  */
-  newhead.namehash_used = 0;
-  newhead.string_used = 0;
-  newhead.locrectab_used = 0;
-  newhead.sumhash_used = 0;
+  SET (newhead.namehash_used, 0);
+  SET (newhead.string_used, 0);
+  SET (newhead.locrectab_used, 0);
+  SET (newhead.sumhash_used, 0);
 
   /* Write out the header and create room for the other data structures.  */
   if (TEMP_FAILURE_RETRY (write (fd, &newhead, sizeof (newhead)))
@@ -453,17 +469,17 @@
   /* Walk through the hash name hash table to find out what data is
      still referenced and transfer it into the new file.  */
   oldnamehashtab = (struct namehashent *) ((char *) ah->addr
-					   + head->namehash_offset);
+					   + GET (head->namehash_offset));
 
   /* Sort the old locrec table in order of data position.  */
-  struct oldlocrecent oldlocrecarray[head->namehash_size];
-  for (cnt = 0, loccnt = 0; cnt < head->namehash_size; ++cnt)
-    if (oldnamehashtab[cnt].locrec_offset != 0)
+  struct oldlocrecent oldlocrecarray[GET (head->namehash_size)];
+  for (cnt = 0, loccnt = 0; cnt < GET (head->namehash_size); ++cnt)
+    if (GET (oldnamehashtab[cnt].locrec_offset) != 0)
       {
 	oldlocrecarray[loccnt].cnt = cnt;
 	oldlocrecarray[loccnt++].locrec
 	  = (struct locrecent *) ((char *) ah->addr
-				  + oldnamehashtab[cnt].locrec_offset);
+				  + GET (oldnamehashtab[cnt].locrec_offset));
       }
   qsort (oldlocrecarray, loccnt, sizeof (struct oldlocrecent),
 	 oldlocrecentcmp);
@@ -479,9 +495,9 @@
       for (idx = 0; idx < __LC_LAST; ++idx)
 	if (idx != LC_ALL)
 	  {
-	    old_data[idx].size = oldlocrec->record[idx].len;
+	    old_data[idx].size = GET (oldlocrec->record[idx].len);
 	    old_data[idx].addr
-	      = ((char *) ah->addr + oldlocrec->record[idx].offset);
+	      = ((char *) ah->addr + GET (oldlocrec->record[idx].offset));
 
 	    __md5_buffer (old_data[idx].addr, old_data[idx].size,
 			  old_data[idx].sum);
@@ -491,20 +507,23 @@
 	{
 	  const char *oldname
 	    = ((char *) ah->addr
-	       + oldnamehashtab[oldlocrecarray[cnt - 1].cnt].name_offset);
-
-	  add_alias (&new_ah,
-		     ((char *) ah->addr
-		      + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset),
-		     0, oldname, &last_locrec_offset);
+	       + GET (oldnamehashtab[oldlocrecarray[cnt
+						    - 1].cnt].name_offset));
+
+	  add_alias
+	    (&new_ah,
+	     ((char *) ah->addr
+	      + GET (oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset)),
+	     0, oldname, &last_locrec_offset);
 	  continue;
 	}
 
       last_locrec_offset =
-	add_locale (&new_ah,
-		    ((char *) ah->addr
-		     + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset),
-		    old_data, 0);
+	add_locale
+	(&new_ah,
+	 ((char *) ah->addr
+	  + GET (oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset)),
+	 old_data, 0);
       if (last_locrec_offset == 0)
 	error (EXIT_FAILURE, 0, _("cannot extend locale archive file"));
     }
@@ -672,26 +691,28 @@
 {
   const struct locarhead *const head = ah->addr;
   struct namehashent *namehashtab
-    = (struct namehashent *) ((char *) ah->addr + head->namehash_offset);
+    = (struct namehashent *) ((char *) ah->addr
+			      + GET (head->namehash_offset));
   unsigned int insert_idx, idx, incr;
 
   /* Hash value of the locale name.  */
   uint32_t hval = archive_hashval (name, name_len);
 
   insert_idx = -1;
-  idx = hval % head->namehash_size;
-  incr = 1 + hval % (head->namehash_size - 2);
+  idx = hval % GET (head->namehash_size);
+  incr = 1 + hval % (GET (head->namehash_size) - 2);
 
   /* If the name_offset field is zero this means this is a
      deleted entry and therefore no entry can be found.  */
-  while (namehashtab[idx].name_offset != 0)
-    {
-      if (namehashtab[idx].hashval == hval
-	  && strcmp (name,
-		     (char *) ah->addr + namehashtab[idx].name_offset) == 0)
+  while (GET (namehashtab[idx].name_offset) != 0)
+    {
+      if (GET (namehashtab[idx].hashval) == hval
+	  && (strcmp (name,
+		      (char *) ah->addr + GET (namehashtab[idx].name_offset))
+	      == 0))
 	{
 	  /* Found the entry.  */
-	  if (namehashtab[idx].locrec_offset != 0 && ! replace)
+	  if (GET (namehashtab[idx].locrec_offset) != 0 && ! replace)
 	    {
 	      if (! be_quiet)
 		error (0, 0, _("locale '%s' already exists"), name);
@@ -701,26 +722,27 @@
 	  break;
 	}
 
-      if (namehashtab[idx].hashval == hval && ! be_quiet)
+      if (GET (namehashtab[idx].hashval) == hval && ! be_quiet)
 	{
 	  error (0, 0, "hash collision (%u) %s, %s",
-		 hval, name, (char *) ah->addr + namehashtab[idx].name_offset);
+		 hval, name,
+		 (char *) ah->addr + GET (namehashtab[idx].name_offset));
 	}
 
       /* Remember the first place we can insert the new entry.  */
-      if (namehashtab[idx].locrec_offset == 0 && insert_idx == -1)
+      if (GET (namehashtab[idx].locrec_offset) == 0 && insert_idx == -1)
 	insert_idx = idx;
 
       idx += incr;
-      if (idx >= head->namehash_size)
-	idx -= head->namehash_size;
+      if (idx >= GET (head->namehash_size))
+	idx -= GET (head->namehash_size);
     }
 
   /* Add as early as possible.  */
   if (insert_idx != -1)
     idx = insert_idx;
 
-  namehashtab[idx].hashval = hval; /* no-op if replacing an old entry.  */
+  SET (namehashtab[idx].hashval, hval); /* no-op if replacing an old entry.  */
   return &namehashtab[idx];
 }
 
@@ -736,12 +758,13 @@
   if (namehashent == NULL && ! replace)
     return;
 
-  if (namehashent->name_offset == 0)
+  if (GET (namehashent->name_offset) == 0)
     {
       /* We are adding a new hash entry for this alias.
 	 Determine whether we have to resize the file.  */
-      if (head->string_used + name_len + 1 > head->string_size
-	  || 100 * head->namehash_used > 75 * head->namehash_size)
+      if (GET (head->string_used) + name_len + 1 > GET (head->string_size)
+	  || (100 * GET (head->namehash_used)
+	      > 75 * GET (head->namehash_size)))
 	{
 	  /* The current archive is not large enough.  */
 	  enlarge_archive (ah, head);
@@ -749,9 +772,9 @@
 	  /* The locrecent might have moved, so we have to look up
 	     the old name afresh.  */
 	  namehashent = insert_name (ah, oldname, strlen (oldname), true);
-	  assert (namehashent->name_offset != 0);
-	  assert (namehashent->locrec_offset != 0);
-	  *locrec_offset_p = namehashent->locrec_offset;
+	  assert (GET (namehashent->name_offset) != 0);
+	  assert (GET (namehashent->locrec_offset) != 0);
+	  *locrec_offset_p = GET (namehashent->locrec_offset);
 
 	  /* Tail call to try the whole thing again.  */
 	  add_alias (ah, alias, replace, oldname, locrec_offset_p);
@@ -759,26 +782,27 @@
 	}
 
       /* Add the name string.  */
-      memcpy (ah->addr + head->string_offset + head->string_used,
+      memcpy (ah->addr + GET (head->string_offset) + GET (head->string_used),
 	      alias, name_len + 1);
-      namehashent->name_offset = head->string_offset + head->string_used;
-      head->string_used += name_len + 1;
-
-      ++head->namehash_used;
-    }
-
-  if (namehashent->locrec_offset != 0)
+      SET (namehashent->name_offset,
+	   GET (head->string_offset) + GET (head->string_used));
+      INC (head->string_used, name_len + 1);
+
+      INC (head->namehash_used, 1);
+    }
+
+  if (GET (namehashent->locrec_offset) != 0)
     {
       /* Replacing an existing entry.
 	 Mark that we are no longer using the old locrecent.  */
       struct locrecent *locrecent
 	= (struct locrecent *) ((char *) ah->addr
-				+ namehashent->locrec_offset);
-      --locrecent->refs;
+				+ GET (namehashent->locrec_offset));
+      INC (locrecent->refs, -1);
     }
 
   /* Point this entry at the locrecent installed for the main name.  */
-  namehashent->locrec_offset = locrec_offset;
+  SET (namehashent->locrec_offset, locrec_offset);
 }
 
 static int			/* qsort comparator used below */
@@ -819,7 +843,7 @@
 
   head = ah->addr;
   sumhashtab = (struct sumhashent *) ((char *) ah->addr
-				      + head->sumhash_offset);
+				      + GET (head->sumhash_offset));
 
   memset (file_offsets, 0, sizeof (file_offsets));
 
@@ -877,10 +901,10 @@
 	   table.  */
 	hval = archive_hashval (data[cnt].sum, 16);
 
-	idx = hval % head->sumhash_size;
-	incr = 1 + hval % (head->sumhash_size - 2);
-
-	while (sumhashtab[idx].file_offset != 0)
+	idx = hval % GET (head->sumhash_size);
+	incr = 1 + hval % (GET (head->sumhash_size) - 2);
+
+	while (GET (sumhashtab[idx].file_offset) != 0)
 	  {
 	    if (memcmp (data[cnt].sum, sumhashtab[idx].sum, 16) == 0)
 	      {
@@ -890,40 +914,42 @@
 		   Unfortunately the sumhashent record does not include
 		   the size of the stored data.  So we have to search for
 		   it.  */
-		locrecent = (struct locrecent *) ((char *) ah->addr
-						  + head->locrectab_offset);
+		locrecent
+		  = (struct locrecent *) ((char *) ah->addr
+					  + GET (head->locrectab_offset));
 		size_t iloc;
-		for (iloc = 0; iloc < head->locrectab_used; ++iloc)
-		  if (locrecent[iloc].refs != 0
-		      && (locrecent[iloc].record[cnt].offset
-			  == sumhashtab[idx].file_offset))
+		for (iloc = 0; iloc < GET (head->locrectab_used); ++iloc)
+		  if (GET (locrecent[iloc].refs) != 0
+		      && (GET (locrecent[iloc].record[cnt].offset)
+			  == GET (sumhashtab[idx].file_offset)))
 		    break;
 
-		if (iloc != head->locrectab_used
-		    && data[cnt].size == locrecent[iloc].record[cnt].len
+		if (iloc != GET (head->locrectab_used)
+		    && data[cnt].size == GET (locrecent[iloc].record[cnt].len)
 		    /* We have to compare the content.  Either we can
 		       have the data mmaped or we have to read from
 		       the file.  */
-		    && (file_data_available_p (ah, sumhashtab[idx].file_offset,
-					       data[cnt].size)
+		    && (file_data_available_p
+			(ah, GET (sumhashtab[idx].file_offset),
+			 data[cnt].size)
 			? memcmp (data[cnt].addr,
 				  (char *) ah->addr
-				  + sumhashtab[idx].file_offset,
+				  + GET (sumhashtab[idx].file_offset),
 				  data[cnt].size) == 0
 			: compare_from_file (ah, data[cnt].addr,
-					     sumhashtab[idx].file_offset,
+					     GET (sumhashtab[idx].file_offset),
 					     data[cnt].size) == 0))
 		  {
 		    /* Found it.  */
-		    file_offsets[cnt] = sumhashtab[idx].file_offset;
+		    file_offsets[cnt] = GET (sumhashtab[idx].file_offset);
 		    --num_new_offsets;
 		    break;
 		  }
 	      }
 
 	    idx += incr;
-	    if (idx >= head->sumhash_size)
-	      idx -= head->sumhash_size;
+	    if (idx >= GET (head->sumhash_size))
+	      idx -= GET (head->sumhash_size);
 	  }
       }
 
@@ -933,11 +959,14 @@
     return 0;
 
   /* Determine whether we have to resize the file.  */
-  if (100 * (head->sumhash_used + num_new_offsets) > 75 * head->sumhash_size
-      || (namehashent->locrec_offset == 0
-	  && (head->locrectab_used == head->locrectab_size
-	      || head->string_used + name_len + 1 > head->string_size
-	      || 100 * head->namehash_used > 75 * head->namehash_size)))
+  if ((100 * (GET (head->sumhash_used) + num_new_offsets)
+       > 75 * GET (head->sumhash_size))
+      || (GET (namehashent->locrec_offset) == 0
+	  && (GET (head->locrectab_used) == GET (head->locrectab_size)
+	      || (GET (head->string_used) + name_len + 1
+		  > GET (head->string_size))
+	      || (100 * GET (head->namehash_used)
+		  > 75 * GET (head->namehash_size)))))
     {
       /* The current archive is not large enough.  */
       enlarge_archive (ah, head);
@@ -1000,20 +1029,20 @@
 	/* Add the hash value to the hash table.  */
 	md5hval = archive_hashval (data[cnt].sum, 16);
 
-	idx = md5hval % head->sumhash_size;
-	incr = 1 + md5hval % (head->sumhash_size - 2);
-
-	while (sumhashtab[idx].file_offset != 0)
+	idx = md5hval % GET (head->sumhash_size);
+	incr = 1 + md5hval % (GET (head->sumhash_size) - 2);
+
+	while (GET (sumhashtab[idx].file_offset) != 0)
 	  {
 	    idx += incr;
-	    if (idx >= head->sumhash_size)
-	      idx -= head->sumhash_size;
+	    if (idx >= GET (head->sumhash_size))
+	      idx -= GET (head->sumhash_size);
 	  }
 
 	memcpy (sumhashtab[idx].sum, data[cnt].sum, 16);
-	sumhashtab[idx].file_offset = file_offsets[cnt];
-
-	++head->sumhash_used;
+	SET (sumhashtab[idx].file_offset, file_offsets[cnt]);
+
+	INC (head->sumhash_used, 1);
       }
 
   lastoffset = file_offsets[LC_ALL];
@@ -1024,25 +1053,28 @@
 	lastoffset += (data[cnt].size + 15) & -16;
       }
 
-  if (namehashent->name_offset == 0)
+  if (GET (namehashent->name_offset) == 0)
     {
       /* Add the name string.  */
-      memcpy ((char *) ah->addr + head->string_offset + head->string_used,
+      memcpy ((char *) ah->addr + GET (head->string_offset)
+	      + GET (head->string_used),
 	      name, name_len + 1);
-      namehashent->name_offset = head->string_offset + head->string_used;
-      head->string_used += name_len + 1;
-      ++head->namehash_used;
-    }
-
-  if (namehashent->locrec_offset == 0)
+      SET (namehashent->name_offset,
+	   GET (head->string_offset) + GET (head->string_used));
+      INC (head->string_used, name_len + 1);
+      INC (head->namehash_used, 1);
+    }
+
+  if (GET (namehashent->locrec_offset == 0))
     {
       /* Allocate a name location record.  */
-      namehashent->locrec_offset = (head->locrectab_offset
-				    + (head->locrectab_used++
-				       * sizeof (struct locrecent)));
+      SET (namehashent->locrec_offset, (GET (head->locrectab_offset)
+					+ (GET (head->locrectab_used)
+					   * sizeof (struct locrecent))));
+      INC (head->locrectab_used, 1);
       locrecent = (struct locrecent *) ((char *) ah->addr
-					+ namehashent->locrec_offset);
-      locrecent->refs = 1;
+					+ GET (namehashent->locrec_offset));
+      SET (locrecent->refs, 1);
     }
   else
     {
@@ -1050,27 +1082,29 @@
 	 we still need a new one.  If not, reuse the old one.  */
 
       locrecent = (struct locrecent *) ((char *) ah->addr
-					+ namehashent->locrec_offset);
-      if (locrecent->refs > 1)
-	{
-	  --locrecent->refs;
-	  namehashent->locrec_offset = (head->locrectab_offset
-					+ (head->locrectab_used++
-					   * sizeof (struct locrecent)));
-	  locrecent = (struct locrecent *) ((char *) ah->addr
-					    + namehashent->locrec_offset);
-	  locrecent->refs = 1;
+					+ GET (namehashent->locrec_offset));
+      if (GET (locrecent->refs) > 1)
+	{
+	  INC (locrecent->refs, -1);
+	  SET (namehashent->locrec_offset, (GET (head->locrectab_offset)
+					    + (GET (head->locrectab_used)
+					       * sizeof (struct locrecent))));
+	  INC (head->locrectab_used, 1);
+	  locrecent
+	    = (struct locrecent *) ((char *) ah->addr
+				    + GET (namehashent->locrec_offset));
+	  SET (locrecent->refs, 1);
 	}
     }
 
   /* Fill in the table with the locations of the locale data.  */
   for (cnt = 0; cnt < __LC_LAST; ++cnt)
     {
-      locrecent->record[cnt].offset = file_offsets[cnt];
-      locrecent->record[cnt].len = data[cnt].size;
-    }
-
-  return namehashent->locrec_offset;
+      SET (locrecent->record[cnt].offset, file_offsets[cnt]);
+      SET (locrecent->record[cnt].len, data[cnt].size);
+    }
+
+  return GET (namehashent->locrec_offset);
 }
 
 
@@ -1129,7 +1163,8 @@
 	unsigned int strindex[0];
       } *filedata = data[LC_CTYPE].addr;
       codeset = (char *) filedata
-	+ filedata->strindex[_NL_ITEM_INDEX (_NL_CTYPE_CODESET_NAME)];
+	+ maybe_swap_uint32 (filedata->strindex[_NL_ITEM_INDEX
+						(_NL_CTYPE_CODESET_NAME)]);
       char *normalized_codeset_name = NULL;
 
       normalized_codeset = _nl_normalize_codeset (codeset, strlen (codeset));
@@ -1492,7 +1527,7 @@
 
   head = ah.addr;
   namehashtab = (struct namehashent *) ((char *) ah.addr
-					+ head->namehash_offset);
+					+ GET (head->namehash_offset));
 
   while (nlist-- > 0)
     {
@@ -1504,30 +1539,31 @@
       /* Search for this locale in the archive.  */
       hval = archive_hashval (locname, strlen (locname));
 
-      idx = hval % head->namehash_size;
-      incr = 1 + hval % (head->namehash_size - 2);
+      idx = hval % GET (head->namehash_size);
+      incr = 1 + hval % (GET (head->namehash_size) - 2);
 
       /* If the name_offset field is zero this means this is no
 	 deleted entry and therefore no entry can be found.  */
-      while (namehashtab[idx].name_offset != 0)
-	{
-	  if (namehashtab[idx].hashval == hval
+      while (GET (namehashtab[idx].name_offset) != 0)
+	{
+	  if (GET (namehashtab[idx].hashval) == hval
 	      && (strcmp (locname,
-			  (char *) ah.addr + namehashtab[idx].name_offset)
+			  ((char *) ah.addr
+			   + GET (namehashtab[idx].name_offset)))
 		  == 0))
 	    {
 	      /* Found the entry.  Now mark it as removed by zero-ing
 		 the reference to the locale record.  */
-	      namehashtab[idx].locrec_offset = 0;
+	      SET (namehashtab[idx].locrec_offset, 0);
 	      break;
 	    }
 
 	  idx += incr;
-	  if (idx >= head->namehash_size)
-	    idx -= head->namehash_size;
-	}
-
-      if (namehashtab[idx].name_offset == 0 && ! be_quiet)
+	  if (idx >= GET (head->namehash_size))
+	    idx -= GET (head->namehash_size);
+	}
+
+      if (GET (namehashtab[idx].name_offset) == 0 && ! be_quiet)
 	error (0, 0, _("locale \"%s\" not in archive"), locname);
     }
 
@@ -1590,17 +1626,17 @@
 
   head = ah.addr;
 
-  names = (struct nameent *) xmalloc (head->namehash_used
+  names = (struct nameent *) xmalloc (GET (head->namehash_used)
 				      * sizeof (struct nameent));
 
   namehashtab = (struct namehashent *) ((char *) ah.addr
-					+ head->namehash_offset);
-  for (cnt = used = 0; cnt < head->namehash_size; ++cnt)
-    if (namehashtab[cnt].locrec_offset != 0)
+					+ GET (head->namehash_offset));
+  for (cnt = used = 0; cnt < GET (head->namehash_size); ++cnt)
+    if (GET (namehashtab[cnt].locrec_offset) != 0)
       {
-	assert (used < head->namehash_used);
-	names[used].name = ah.addr + namehashtab[cnt].name_offset;
-	names[used++].locrec_offset = namehashtab[cnt].locrec_offset;
+	assert (used < GET (head->namehash_used));
+	names[used].name = ah.addr + GET (namehashtab[cnt].name_offset);
+	names[used++].locrec_offset = GET (namehashtab[cnt].locrec_offset);
       }
 
   /* Sort the names.  */
@@ -1612,17 +1648,17 @@
       struct sumhashent *sumhashtab;
       int sumused;
 
-      files = (struct dataent *) xmalloc (head->sumhash_used
+      files = (struct dataent *) xmalloc (GET (head->sumhash_used)
 					  * sizeof (struct dataent));
 
       sumhashtab = (struct sumhashent *) ((char *) ah.addr
-					  + head->sumhash_offset);
-      for (cnt = sumused = 0; cnt < head->sumhash_size; ++cnt)
-	if (sumhashtab[cnt].file_offset != 0)
+					  + GET (head->sumhash_offset));
+      for (cnt = sumused = 0; cnt < GET (head->sumhash_size); ++cnt)
+	if (GET (sumhashtab[cnt].file_offset) != 0)
 	  {
-	    assert (sumused < head->sumhash_used);
+	    assert (sumused < GET (head->sumhash_used));
 	    files[sumused].sum = (const unsigned char *) sumhashtab[cnt].sum;
-	    files[sumused].file_offset = sumhashtab[cnt].file_offset;
+	    files[sumused].file_offset = GET (sumhashtab[cnt].file_offset);
 	    files[sumused++].nlink = 0;
 	  }
 
@@ -1638,18 +1674,19 @@
 	  locrec = (struct locrecent *) ((char *) ah.addr
 					 + names[cnt].locrec_offset);
 	  for (idx = 0; idx < __LC_LAST; ++idx)
-	    if (locrec->record[LC_ALL].offset != 0
+	    if (GET (locrec->record[LC_ALL].offset) != 0
 		? (idx == LC_ALL
-		   || (locrec->record[idx].offset
-		       < locrec->record[LC_ALL].offset)
-		   || (locrec->record[idx].offset + locrec->record[idx].len
-		       > (locrec->record[LC_ALL].offset
-			  + locrec->record[LC_ALL].len)))
+		   || (GET (locrec->record[idx].offset)
+		       < GET (locrec->record[LC_ALL].offset))
+		   || ((GET (locrec->record[idx].offset)
+			+ GET (locrec->record[idx].len))
+		       > (GET (locrec->record[LC_ALL].offset)
+			  + GET (locrec->record[LC_ALL].len))))
 		: idx != LC_ALL)
 	      {
 		struct dataent *data, dataent;
 
-		dataent.file_offset = locrec->record[idx].offset;
+		dataent.file_offset = GET (locrec->record[idx].offset);
 		data = (struct dataent *) bsearch (&dataent, files, sumused,
 						   sizeof (struct dataent),
 						   dataentcmp);
@@ -1671,21 +1708,24 @@
 	      {
 		struct dataent *data, dataent;
 
-		dataent.file_offset = locrec->record[idx].offset;
-		if (locrec->record[LC_ALL].offset != 0
-		    && dataent.file_offset >= locrec->record[LC_ALL].offset
-		    && (dataent.file_offset + locrec->record[idx].len
-			<= (locrec->record[LC_ALL].offset
-			    + locrec->record[LC_ALL].len)))
-		  dataent.file_offset = locrec->record[LC_ALL].offset;
+		dataent.file_offset = GET (locrec->record[idx].offset);
+		if (GET (locrec->record[LC_ALL].offset) != 0
+		    && (dataent.file_offset
+			>= GET (locrec->record[LC_ALL].offset))
+		    && (dataent.file_offset + GET (locrec->record[idx].len)
+			<= (GET (locrec->record[LC_ALL].offset)
+			    + GET (locrec->record[LC_ALL].len))))
+		  dataent.file_offset = GET (locrec->record[LC_ALL].offset);
 
 		data = (struct dataent *) bsearch (&dataent, files, sumused,
 						   sizeof (struct dataent),
 						   dataentcmp);
 		printf ("%6d %7x %3d%c ",
-			locrec->record[idx].len, locrec->record[idx].offset,
+			GET (locrec->record[idx].len),
+			GET (locrec->record[idx].offset),
 			data->nlink,
-			dataent.file_offset == locrec->record[LC_ALL].offset
+			(dataent.file_offset
+			 == GET (locrec->record[LC_ALL].offset))
 			? '+' : ' ');
 		for (i = 0; i < 16; i += 4)
 		    printf ("%02x%02x%02x%02x",

Modified: fsf/trunk/libc/locale/programs/locfile.c
==============================================================================
--- fsf/trunk/libc/locale/programs/locfile.c (original)
+++ fsf/trunk/libc/locale/programs/locfile.c Wed Sep 25 00:02:24 2013
@@ -22,6 +22,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -538,6 +539,10 @@
   return ret;
 }
 
+/* True if the locale files use the opposite endianness to the
+   machine running localedef.  */
+bool swap_endianness_p;
+
 /* When called outside a start_locale_structure/end_locale_structure
    or start_locale_prelude/end_locale_prelude block, record that the
    next byte in FILE's obstack will be the first byte of a new element.
@@ -624,6 +629,7 @@
 {
   align_locale_data (file, sizeof (uint32_t));
   record_offset (file);
+  value = maybe_swap_uint32 (value);
   obstack_grow (&file->data, &value, sizeof (value));
 }
 
@@ -636,6 +642,7 @@
   align_locale_data (file, sizeof (uint32_t));
   record_offset (file);
   obstack_grow (&file->data, data, n_elems * sizeof (uint32_t));
+  maybe_swap_uint32_obstack (&file->data, n_elems);
 }
 
 /* Record that FILE's next element is the single byte given by VALUE.  */
@@ -708,6 +715,8 @@
   vec[1].iov_base = file->offsets;
   vec[2].iov_len = obstack_object_size (&file->data);
   vec[2].iov_base = obstack_finish (&file->data);
+  maybe_swap_uint32_array (vec[0].iov_base, 2);
+  maybe_swap_uint32_array (vec[1].iov_base, file->n_elements);
   n_elem = 3;
   if (! no_archive)
     {

Modified: fsf/trunk/libc/locale/programs/locfile.h
==============================================================================
--- fsf/trunk/libc/locale/programs/locfile.h (original)
+++ fsf/trunk/libc/locale/programs/locfile.h Wed Sep 25 00:02:24 2013
@@ -18,6 +18,8 @@
 #ifndef _LOCFILE_H
 #define _LOCFILE_H	1
 
+#include <byteswap.h>
+#include <stdbool.h>
 #include <stdint.h>
 #include <sys/uio.h>
 
@@ -66,6 +68,41 @@
 				  const struct charmap_t *charmap,
 				  const char *locname,
 				  const char *output_path);
+
+extern bool swap_endianness_p;
+
+/* Change the output to be big-endian if BIG_ENDIAN is true and
+   little-endian otherwise.  */
+static inline void
+set_big_endian (bool big_endian)
+{
+  swap_endianness_p = (big_endian != (__BYTE_ORDER == __BIG_ENDIAN));
+}
+
+/* Munge VALUE so that, when stored, it has the correct byte order
+   for the output files.  */
+static inline uint32_t
+maybe_swap_uint32 (uint32_t value)
+{
+  return swap_endianness_p ? bswap_32 (value) : value;
+}
+
+/* Likewise, but munge an array of N uint32_ts starting at ARRAY.  */
+static inline void
+maybe_swap_uint32_array (uint32_t *array, size_t n)
+{
+  if (swap_endianness_p)
+    while (n-- > 0)
+      array[n] = bswap_32 (array[n]);
+}
+
+/* Like maybe_swap_uint32_array, but the array of N elements is at
+   the end of OBSTACK's current object.  */
+static inline void
+maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
+{
+  maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
+}
 
 /* Write out the data.  */
 extern void init_locale_data (struct locale_file *file, size_t n_elements);

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Wed Sep 25 00:02:24 2013
@@ -1,10 +1,22 @@
-2013-09-21  Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+2013-09-23  Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+
+    [BZ#15609]
+    * locales/cmn_TW: New locale for cmn_TW.
+    * SUPPORTED: Add cmn_TW.
+
+2013-09-23  Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
 
     [BZ#15608]
-    * locales/nan_TW: New locale for lzh_TW.
+    * locales/hak_TW: New locale for hak_TW.
+    * SUPPORTED: Add hak_TW.
+
+2013-09-23  Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+
+    [BZ#15608]
+    * locales/lzh_TW: New locale for lzh_TW.
     * SUPPORTED: Add lzh_TW.
 
-2013-09-21  Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+2013-09-23  Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
 
     [BZ#15608]
     * locales/nan_TW: New locale for nan_TW.

Modified: fsf/trunk/libc/localedata/SUPPORTED
==============================================================================
--- fsf/trunk/libc/localedata/SUPPORTED (original)
+++ fsf/trunk/libc/localedata/SUPPORTED Wed Sep 25 00:02:24 2013
@@ -81,6 +81,7 @@
 ca_FR/ISO-8859-15 \
 ca_IT.UTF-8/UTF-8 \
 ca_IT/ISO-8859-15 \
+cmn_TW/UTF-8 \
 crh_UA/UTF-8 \
 cs_CZ.UTF-8/UTF-8 \
 cs_CZ/ISO-8859-2 \
@@ -230,6 +231,7 @@
 gv_GB.UTF-8/UTF-8 \
 gv_GB/ISO-8859-1 \
 ha_NG/UTF-8 \
+hak_TW/UTF-8 \
 he_IL.UTF-8/UTF-8 \
 he_IL/ISO-8859-8 \
 hi_IN/UTF-8 \

Added: fsf/trunk/libc/localedata/locales/cmn_TW
==============================================================================
--- fsf/trunk/libc/localedata/locales/cmn_TW (added)
+++ fsf/trunk/libc/localedata/locales/cmn_TW Wed Sep 25 00:02:24 2013
@@ -1,0 +1,220 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Mandarin Chinese locale for the Republic of China
+%
+% Prepared and contributed to glibc by Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+%
+% build with: localedef -f UTF-8 -i cmn_TW cmn_TW
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title        "Mandarin Chinese locale for the Republic of China"
+source       ""
+address      ""
+contact      ""
+email        "bug-glibc-locales@xxxxxxx"
+tel          ""
+fax          ""
+language     "Mandarin Chinese"
+territory    "Republic of China"
+revision     "0.1"
+date         "2013-06-02"
+%
+category  "cmn_TW:2000";LC_IDENTIFICATION
+category  "cmn_TW:2000";LC_CTYPE
+category  "cmn_TW:2000";LC_COLLATE
+category  "cmn_TW:2000";LC_TIME
+category  "cmn_TW:2000";LC_NUMERIC
+category  "cmn_TW:2000";LC_MONETARY
+category  "cmn_TW:2000";LC_PAPER
+category  "cmn_TW:2000";LC_MEASUREMENT
+category  "cmn_TW:2000";LC_MESSAGES
+category  "cmn_TW:2000";LC_NAME
+category  "cmn_TW:2000";LC_ADDRESS
+category  "cmn_TW:2000";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+class	"hanzi"; /
+<U3007>;/
+<U3400>..<U4DBF>;/
+<U4E00>..<U9FA5>;/
+<UF900>..<UFA6A>;/
+<U00020000>..<U0002A6D6>;/
+<U0002F800>..<U0002FA1D>
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ
+mon           "<U4E00><U6708>";/
+     "<U4E8C><U6708>";/
+     "<U4E09><U6708>";/
+     "<U56DB><U6708>";/
+     "<U4E94><U6708>";/
+     "<U516D><U6708>";/
+     "<U4E03><U6708>";/
+     "<U516B><U6708>";/
+     "<U4E5D><U6708>";/
+     "<U5341><U6708>";/
+     "<U5341><U4E00><U6708>";/
+     "<U5341><U4E8C><U6708>"
+%  1ÃÂÂ,  2ÃÂÂ,  3ÃÂÂ,  4ÃÂÂ,  5ÃÂÂ,  6ÃÂÂ,  7ÃÂÂ,  8ÃÂÂ,  9ÃÂÂ, 10ÃÂÂ, 11ÃÂÂ, 12ÃÂÂ
+abmon         "<U0020><U0031><U6708>";/
+       "<U0020><U0032><U6708>";/
+       "<U0020><U0033><U6708>";/
+       "<U0020><U0034><U6708>";/
+       "<U0020><U0035><U6708>";/
+       "<U0020><U0036><U6708>";/
+       "<U0020><U0037><U6708>";/
+       "<U0020><U0038><U6708>";/
+       "<U0020><U0039><U6708>";/
+       "<U0031><U0030><U6708>";/
+       "<U0031><U0031><U6708>";/
+       "<U0031><U0032><U6708>"
+% ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ
+day           "<U661F><U671F><U65E5>";/
+     "<U661F><U671F><U4E00>";/
+     "<U661F><U671F><U4E8C>";/
+     "<U661F><U671F><U4E09>";/
+     "<U661F><U671F><U56DB>";/
+     "<U661F><U671F><U4E94>";/
+     "<U661F><U671F><U516D>"
+% ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ
+abday         "<U65E5>";/
+       "<U4E00>";/
+       "<U4E8C>";/
+       "<U4E09>";/
+       "<U56DB>";/
+       "<U4E94>";/
+       "<U516D>"
+% %YÃÂÂ%mÃÂÂ%dÃÂÂ (%A) %HÃÂÂ%MÃÂÂ%SÃÂÂ
+d_t_fmt       "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5><U0020><U0028><U0025><U0041><U0029><U0020><U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %YÃÂÂ%mÃÂÂ%dÃÂÂ
+d_fmt         "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5>"
+% %HÃÂÂ%MÃÂÂ%SÃÂÂ
+t_fmt         "<U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% ÃÂÂÃÂÂ, ÃÂÂÃÂÂ
+am_pm         "<U4E0A><U5348>";/
+       "<U4E0B><U5348>"
+% %p %IÃÂÂ%MÃÂÂ%SÃÂÂ
+t_fmt_ampm    "<U0025><U0070><U0020><U0025><U0049><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %YÃÂÂ %b %eÃÂÂ %A %H:%M:%S %Z
+date_fmt      "<U0025><U0059><U5E74><U0020><U0025><U0062><U0020><U0025><U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A>"
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping      4
+END LC_NUMERIC
+
+LC_MONETARY
+% NT$
+currency_symbol    "<U004E><U0054><U0024>"
+% TWD
+int_curr_symbol    "<U0054><U0057><U0044><U0020>"
+% .
+mon_decimal_point  "<U002E>"
+% ,
+mon_thousands_sep  "<U002C>"
+mon_grouping       4
+positive_sign      ""
+% -
+negative_sign      "<U002D>"
+frac_digits        2
+int_frac_digits    2
+p_cs_precedes      1
+p_sep_by_space     0
+n_cs_precedes      1
+n_sep_by_space     0
+p_sign_posn        1
+n_sign_posn        1
+int_p_cs_precedes  1
+int_p_sep_by_space 0
+int_n_cs_precedes  1
+int_n_sep_by_space 0
+int_p_sign_posn    1
+int_n_sign_posn    1
+END LC_MONETARY
+
+LC_PAPER
+height 297
+width  210
+END LC_PAPER
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yYÃÂÂ]
+yesexpr "<U005E><U005B><U0079><U0059><U662F><U005D>"
+% ^[nNÃÂÂÃÂÂ]
+noexpr  "<U005E><U005B><U006E><U004E><U4E0D><U5426><U005D>"
+END LC_MESSAGES
+
+LC_NAME
+% %f%t%g%t%d
+name_fmt  "<U0025><U0066><U0025><U0074><U0025><U0067><U0025><U0074><U0025><U0064>"
+% ÃÂÂ
+name_gen  "<U541B>"
+% ÃÂÂÃÂÂ
+name_miss "<U5C0F><U59D0>"
+% ÃÂÂÃÂÂ
+name_mr   "<U5148><U751F>"
+% ÃÂÂÃÂÂ
+name_mrs  "<U592B><U4EBA>"
+% ÃÂÂÃÂÂ
+name_ms   "<U5973><U58EB>"
+END LC_NAME
+
+LC_ADDRESS
+% %c%N%T%N%s %h %e %r%N%b%N%d%N%f%N%a%N
+postal_fmt   "<U0025><U0063><U0025><U004E><U0025><U0054><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>"
+% ÃÂÂÃÂÂÃÂÂÃÂÂ
+country_name "<U4E2D><U83EF><U6C11><U570B>"
+% TW
+country_post "<U0054><U0057>"
+% TW
+country_ab2  "<U0054><U0057>"
+% TWN
+country_ab3  "<U0054><U0057><U004E>"
+country_num  158
+country_isbn 957
+% ÃÂÂÃÂÂÃÂÂÃÂÂ
+lang_name    "<U6F22><U8A9E><U5B98><U8A71>"
+% cmn
+lang_term    "<U0063><U006D><U006E>"
+% cmn
+lang_lib     "<U0063><U006D><U006E>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c-%a-%l
+tel_int_fmt "<U002B><U0025><U0063><U002D><U0025><U0061><U002D><U0025><U006C>"
+% %A-%l
+tel_dom_fmt "<U0025><U0041><U002D><U0025><U006C>"
+% 00
+int_select  "<U0030><U0030>"
+% 886
+int_prefix  "<U0038><U0038><U0036>"
+END LC_TELEPHONE

Added: fsf/trunk/libc/localedata/locales/hak_TW
==============================================================================
--- fsf/trunk/libc/localedata/locales/hak_TW (added)
+++ fsf/trunk/libc/localedata/locales/hak_TW Wed Sep 25 00:02:24 2013
@@ -1,0 +1,219 @@
+comment_char %
+escape_char /
+% Charset: UTF-8
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Hakka Chinese locale for the Republic of China
+%
+% Prepared and contributed to glibc by Wei-Lun Chao <bluebat@xxxxxxxxxxxxxx>
+%
+% build with: localedef -f UTF-8 -i hak_TW hak_TW
+%
+% This file is a part of GNU C Library (glibc) and contains locale data. The
+% Free Software Foundation does not claim any copyright interest in the
+% locale data contained in this file. The foregoing does not affect the
+% license of GNU C Library (glibc) as a whole. It does not exempt you from the
+% conditions of the license if your use would otherwise be governed by
+% that license.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+LC_IDENTIFICATION
+title        "Hakka Chinese locale for the Republic of China"
+source       ""
+address      ""
+contact      ""
+email        "bug-glibc-locales@xxxxxxx"
+tel          ""
+fax          ""
+language     "Hakka Chinese"
+territory    "Republic of China"
+revision     "0.1"
+date         "2013-06-02"
+%
+category  "hak_TW:2000";LC_IDENTIFICATION
+category  "hak_TW:2000";LC_CTYPE
+category  "hak_TW:2000";LC_COLLATE
+category  "hak_TW:2000";LC_TIME
+category  "hak_TW:2000";LC_NUMERIC
+category  "hak_TW:2000";LC_MONETARY
+category  "hak_TW:2000";LC_PAPER
+category  "hak_TW:2000";LC_MEASUREMENT
+category  "hak_TW:2000";LC_MESSAGES
+category  "hak_TW:2000";LC_NAME
+category  "hak_TW:2000";LC_ADDRESS
+category  "hak_TW:2000";LC_TELEPHONE
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+class	"hanzi"; /
+<U3007>;/
+<U3400>..<U4DBF>;/
+<U4E00>..<U9FA5>;/
+<UF900>..<UFA6A>;/
+<U00020000>..<U0002A6D6>;/
+<U0002F800>..<U0002FA1D>
+END LC_CTYPE
+
+LC_COLLATE
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_TIME
+% ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ
+mon           "<U4E00><U6708>";/
+     "<U4E8C><U6708>";/
+     "<U4E09><U6708>";/
+     "<U56DB><U6708>";/
+     "<U4E94><U6708>";/
+     "<U516D><U6708>";/
+     "<U4E03><U6708>";/
+     "<U516B><U6708>";/
+     "<U4E5D><U6708>";/
+     "<U5341><U6708>";/
+     "<U5341><U4E00><U6708>";/
+     "<U5341><U4E8C><U6708>"
+%  1ÃÂÂ,  2ÃÂÂ,  3ÃÂÂ,  4ÃÂÂ,  5ÃÂÂ,  6ÃÂÂ,  7ÃÂÂ,  8ÃÂÂ,  9ÃÂÂ, 10ÃÂÂ, 11ÃÂÂ, 12ÃÂÂ
+abmon         "<U0020><U0031><U6708>";/
+       "<U0020><U0032><U6708>";/
+       "<U0020><U0033><U6708>";/
+       "<U0020><U0034><U6708>";/
+       "<U0020><U0035><U6708>";/
+       "<U0020><U0036><U6708>";/
+       "<U0020><U0037><U6708>";/
+       "<U0020><U0038><U6708>";/
+       "<U0020><U0039><U6708>";/
+       "<U0031><U0030><U6708>";/
+       "<U0031><U0031><U6708>";/
+       "<U0031><U0032><U6708>"
+% ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ, ÃÂÂÃÂÂÃÂÂ
+day           "<U79AE><U62DC><U65E5>";/
+     "<U79AE><U62DC><U4E00>";/
+     "<U79AE><U62DC><U4E8C>";/
+     "<U79AE><U62DC><U4E09>";/
+     "<U79AE><U62DC><U56DB>";/
+     "<U79AE><U62DC><U4E94>";/
+     "<U79AE><U62DC><U516D>"
+% ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ, ÃÂÂ
+abday         "<U65E5>";/
+       "<U4E00>";/
+       "<U4E8C>";/
+       "<U4E09>";/
+       "<U56DB>";/
+       "<U4E94>";/
+       "<U516D>"
+% %YÃÂÂ%mÃÂÂ%dÃÂÂ (%A) %HÃÂÂ%MÃÂÂ%SÃÂÂ
+d_t_fmt       "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5><U0020><U0028><U0025><U0041><U0029><U0020><U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %YÃÂÂ%mÃÂÂ%dÃÂÂ
+d_fmt         "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5>"
+% %HÃÂÂ%MÃÂÂ%SÃÂÂ
+t_fmt         "<U0025><U0048><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% ÃÂÂÃÂÂ, ÃÂÂÃÂÂ
+am_pm         "<U4E0A><U665D>";"<U4E0B><U665D>"
+% %p %IÃÂÂ%MÃÂÂ%SÃÂÂ
+t_fmt_ampm    "<U0025><U0070><U0020><U0025><U0049><U9EDE><U0025><U004D><U5206><U0025><U0053><U79D2>"
+% %YÃÂÂ %b %eÃÂÂ %A %H:%M:%S %Z
+date_fmt      "<U0025><U0059><U5E74><U0020><U0025><U0062><U0020><U0025><U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A>"
+END LC_TIME
+
+LC_NUMERIC
+% .
+decimal_point "<U002E>"
+% ,
+thousands_sep "<U002C>"
+grouping      4
+END LC_NUMERIC
+
+LC_MONETARY
+% NT$
+currency_symbol    "<U004E><U0054><U0024>"
+% TWD
+int_curr_symbol    "<U0054><U0057><U0044><U0020>"
+% .
+mon_decimal_point  "<U002E>"
+% ,
+mon_thousands_sep  "<U002C>"
+mon_grouping       4
+positive_sign      ""
+% -
+negative_sign      "<U002D>"
+frac_digits        2
+int_frac_digits    2
+p_cs_precedes      1
+p_sep_by_space     0
+n_cs_precedes      1
+n_sep_by_space     0
+p_sign_posn        1
+n_sign_posn        1
+int_p_cs_precedes  1
+int_p_sep_by_space 0
+int_n_cs_precedes  1
+int_n_sep_by_space 0
+int_p_sign_posn    1
+int_n_sign_posn    1
+END LC_MONETARY
+
+LC_PAPER
+height 297
+width  210
+END LC_PAPER
+
+LC_MEASUREMENT
+measurement 1
+END LC_MEASUREMENT
+
+LC_MESSAGES
+% ^[yYÃÂÂ]
+yesexpr "<U005E><U005B><U0079><U0059><U4FC2><U005D>"
+% ^[nNÃÂÂ]
+noexpr  "<U005E><U005B><U006E><U004E><U6BCB><U005D>"
+END LC_MESSAGES
+
+LC_NAME
+% %f%t%g%t%d
+name_fmt  "<U0025><U0066><U0025><U0074><U0025><U0067><U0025><U0074><U0025><U0064>"
+% ÃÂÂ
+name_gen  "<U541B>"
+% ÃÂÂÃÂÂ
+name_miss "<U5C0F><U59D0>"
+% ÃÂÂÃÂÂ
+name_mr   "<U5148><U751F>"
+% ÃÂÂÃÂÂ
+name_mrs  "<U592B><U4EBA>"
+% ÃÂÂÃÂÂ
+name_ms   "<U5973><U58EB>"
+END LC_NAME
+
+LC_ADDRESS
+% %c%N%T%N%s %h %e %r%N%b%N%d%N%f%N%a%N
+postal_fmt   "<U0025><U0063><U0025><U004E><U0025><U0054><U0025><U004E><U0025><U0073><U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0064><U0025><U004E><U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>"
+% ÃÂÂÃÂÂÃÂÂÃÂÂ
+country_name "<U4E2D><U83EF><U6C11><U570B>"
+% TW
+country_post "<U0054><U0057>"
+% TW
+country_ab2  "<U0054><U0057>"
+% TWN
+country_ab3  "<U0054><U0057><U004E>"
+country_num  158
+country_isbn 957
+% ÃÂÂÃÂÂÃÂÂÃÂÂÃÂÂ
+lang_name    "<U6F22><U8A9E><U5BA2><U5BB6><U8A9E>"
+% hak
+lang_term    "<U0068><U0061><U006B>"
+% hak
+lang_lib     "<U0068><U0061><U006B>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% +%c-%a-%l
+tel_int_fmt "<U002B><U0025><U0063><U002D><U0025><U0061><U002D><U0025><U006C>"
+% %A-%l
+tel_dom_fmt "<U0025><U0041><U002D><U0025><U006C>"
+% 00
+int_select  "<U0030><U0030>"
+% 886
+int_prefix  "<U0038><U0038><U0036>"
+END LC_TELEPHONE

Modified: fsf/trunk/libc/manual/freemanuals.texi
==============================================================================
--- fsf/trunk/libc/manual/freemanuals.texi (original)
+++ fsf/trunk/libc/manual/freemanuals.texi Wed Sep 25 00:02:24 2013
@@ -1,4 +1,7 @@
-@appendix Free Software Needs Free Documentation
+@c freemanuals.texi - blurb for free documentation.
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
+
 @cindex free documentation
 
 The biggest deficiency in the free software community today is not in

Modified: fsf/trunk/libc/manual/libc.texinfo
==============================================================================
--- fsf/trunk/libc/manual/libc.texinfo (original)
+++ fsf/trunk/libc/manual/libc.texinfo Wed Sep 25 00:02:24 2013
@@ -118,6 +118,7 @@
 @include chapters.texi
 
 @node Free Manuals, Copying, Contributors, Top
+@appendix Free Software Needs Free Documentation
 @include freemanuals.texi
 
 @node Copying, Documentation License, Free Manuals, Top

Modified: fsf/trunk/libc/ports/ChangeLog.aarch64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.aarch64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.aarch64 Wed Sep 25 00:02:24 2013
@@ -1,3 +1,12 @@
+2013-09-24  Venkataramanan Kumar  <venkataramanan.kumar@xxxxxxxxxx>
+
+	* sysdeps/aarch64/machine-gmon.h (__mcount): Accept parameter and
+	pass it to mcount_internal.
+
+2013-09-24 Venkataramanan Kumar  <venkataramanan.kumar@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h: New file.
+
 2013-07-26  Marcus Shawcroft  <marcus.shawcroft@xxxxxxxxxx>
 
 	* sysdeps/aarch64/Versions: New file.

Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Wed Sep 25 00:02:24 2013
@@ -1,3 +1,8 @@
+2013-09-24  Will Newton  <will.newton@xxxxxxxxxx>
+
+	* ports/sysdeps/arm/nptl/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
+	macro.
+
 2013-09-20  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
 
 	* sysdeps/arm/armv6t2/ffs.S (__ffs): Define as hidden.

Modified: fsf/trunk/libc/ports/sysdeps/aarch64/machine-gmon.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/aarch64/machine-gmon.h (original)
+++ fsf/trunk/libc/ports/sysdeps/aarch64/machine-gmon.h Wed Sep 25 00:02:24 2013
@@ -16,10 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* GCC version 2 gives us a perfect magical function to get
-   just the information we need:
-     void *__builtin_return_address (unsigned int N)
-   returns the return address of the frame N frames up.  */
+/* Accept 'frompc' address as argument from the function that calls
+   __mcount for profiling.  Use  __builtin_return_address (0)
+   for the 'selfpc' address.  */
 
 #include <sysdep.h>
 
@@ -28,8 +27,8 @@
 #define _MCOUNT_DECL(frompc, selfpc) \
 static inline void mcount_internal (u_long frompc, u_long selfpc)
 
-#define MCOUNT \
-void __mcount (void)							      \
-{									      \
-  mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \
+#define MCOUNT                                                    \
+void __mcount (void *frompc)                                      \
+{                                                                 \
+  mcount_internal ((u_long) frompc, (u_long) RETURN_ADDRESS (0)); \
 }

Modified: fsf/trunk/libc/ports/sysdeps/arm/nptl/tls.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/arm/nptl/tls.h (original)
+++ fsf/trunk/libc/ports/sysdeps/arm/nptl/tls.h Wed Sep 25 00:02:24 2013
@@ -119,10 +119,6 @@
 #define THREAD_SETMEM_NC(descr, member, idx, value) \
   descr->member[idx] = (value)
 
-/* Initializing the thread pointer will generate a SIGILL if the syscall
-   is not available.  */
-#define TLS_INIT_TP_EXPENSIVE 1
-
 /* Get and set the global scope generation counter in struct pthread.  */
 #define THREAD_GSCOPE_FLAG_UNUSED 0
 #define THREAD_GSCOPE_FLAG_USED   1

Added: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (added)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h Wed Sep 25 00:02:24 2013
@@ -1,0 +1,35 @@
+/* AArch64 definitions for signal handling calling conventions.
+   Copyright (C) 1996-2013 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/ucontext.h>
+#include "kernel-features.h"
+
+#define SIGCONTEXT siginfo_t *_si, struct ucontext *
+#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.pc)
+
+/* There is no reliable way to get the sigcontext unless we use a
+   three-argument signal handler.  */
+#define __sigaction(sig, act, oact) ({ \
+  (act)->sa_flags |= SA_SIGINFO; \
+  (__sigaction) (sig, act, oact); \
+})
+
+#define sigaction(sig, act, oact) ({ \
+  (act)->sa_flags |= SA_SIGINFO; \
+  (sigaction) (sig, act, oact); \
+})

Modified: fsf/trunk/libc/stdio-common/tst-long-dbl-fphex.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tst-long-dbl-fphex.c (original)
+++ fsf/trunk/libc/stdio-common/tst-long-dbl-fphex.c Wed Sep 25 00:02:24 2013
@@ -28,9 +28,9 @@
   int result = 0;
   const long double x = 24.5;
   wchar_t a[16];
-  swprintf (a, sizeof (a), L"%La\n", x);
+  swprintf (a, sizeof a / sizeof a[0], L"%La\n", x);
   wchar_t A[16];
-  swprintf (A, sizeof (A) / sizeof (A[0]), L"%LA\n", x);
+  swprintf (A, sizeof A / sizeof A[0], L"%LA\n", x);
 
   /* Here wprintf can return four valid variants.  We must accept all
      of them.  */

Modified: fsf/trunk/libc/sysdeps/mach/hurd/i386/tls.h
==============================================================================
--- fsf/trunk/libc/sysdeps/mach/hurd/i386/tls.h (original)
+++ fsf/trunk/libc/sysdeps/mach/hurd/i386/tls.h Wed Sep 25 00:02:24 2013
@@ -118,7 +118,6 @@
    operation can cause a failure 'errno' must not be touched.  */
 # define TLS_INIT_TP(descr, secondcall) \
     _hurd_tls_init ((tcbhead_t *) (descr), (secondcall))
-# define TLS_INIT_TP_EXPENSIVE 1
 
 /* Return the TCB address of the current thread.  */
 # define THREAD_SELF							      \

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits