about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-04-27 14:33:59 +0000
committerJakub Jelinek <jakub@redhat.com>2009-04-27 14:33:59 +0000
commit83489168c2447e3fe351dbb302b1026dc9fc512c (patch)
tree8c0029fbf2d97cd352310c6a793bb15745a24ec4
parent51211e710a024163f91ffd5ed29908faa3cd41e7 (diff)
downloadglibc-83489168c2447e3fe351dbb302b1026dc9fc512c.tar.gz
glibc-83489168c2447e3fe351dbb302b1026dc9fc512c.tar.xz
glibc-83489168c2447e3fe351dbb302b1026dc9fc512c.zip
Updated to fedora-glibc-20090427T1419 cvs/fedora-glibc-2_9_90-22
-rw-r--r--ChangeLog135
-rw-r--r--debug/vasprintf_chk.c6
-rw-r--r--debug/vsnprintf_chk.c6
-rw-r--r--debug/vsprintf_chk.c6
-rw-r--r--elf/dl-load.c3
-rw-r--r--elf/dl-profile.c53
-rw-r--r--elf/dl-runtime.c8
-rw-r--r--elf/sprof.c67
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in7
-rw-r--r--gmon/gmon.c52
-rw-r--r--include/features.h2
-rw-r--r--inet/inet6_option.c5
-rw-r--r--inet/rcmd.c21
-rw-r--r--inet/rexec.c13
-rw-r--r--libio/iovsprintf.c8
-rw-r--r--libio/iovsscanf.c6
-rw-r--r--libio/strfile.h4
-rw-r--r--libio/tst-widetext.input41
-rw-r--r--libio/vasprintf.c7
-rw-r--r--libio/vsnprintf.c6
-rw-r--r--locale/programs/locarchive.c43
-rw-r--r--localedata/ChangeLog31
-rw-r--r--localedata/locales/cs_CZ6
-rw-r--r--localedata/locales/csb_PL2
-rw-r--r--localedata/locales/da_DK6
-rw-r--r--localedata/locales/de_DE6
-rw-r--r--localedata/locales/en_GB2
-rw-r--r--localedata/locales/et_EE2
-rw-r--r--localedata/locales/fr_FR6
-rw-r--r--localedata/locales/fur_IT6
-rw-r--r--localedata/locales/fy_DE6
-rw-r--r--localedata/locales/ht_HT6
-rw-r--r--localedata/locales/hu_HU6
-rw-r--r--localedata/locales/li_BE6
-rw-r--r--localedata/locales/li_NL6
-rw-r--r--localedata/locales/mk_MK6
-rw-r--r--localedata/locales/nb_NO6
-rw-r--r--localedata/locales/nds_DE6
-rw-r--r--localedata/locales/nds_NL6
-rw-r--r--localedata/locales/nn_NO6
-rw-r--r--localedata/locales/pl_PL6
-rw-r--r--localedata/locales/sc_IT6
-rw-r--r--localedata/locales/sk_SK6
-rw-r--r--localedata/locales/sr_ME2
-rw-r--r--localedata/locales/sr_RS2
-rw-r--r--localedata/locales/sr_RS@latin2
-rw-r--r--localedata/locales/uk_UA8
-rw-r--r--math/libm-test.inc48
-rw-r--r--math/w_fmod.c5
-rw-r--r--math/w_fmodf.c8
-rw-r--r--math/w_fmodl.c5
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/sem_open.c19
-rw-r--r--nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c8
-rw-r--r--nscd/connections.c4
-rw-r--r--nscd/nscd_helper.c7
-rw-r--r--nss/nsswitch.c10
-rw-r--r--posix/bits/posix1_lim.h12
-rw-r--r--stdio-common/isoc99_vsscanf.c6
-rw-r--r--stdio-common/stdio_lim.h.in6
-rw-r--r--stdlib/strfmon_l.c13
-rw-r--r--stdlib/strtod_l.c3
-rw-r--r--stdlib/tst-strtod.c6
-rw-r--r--sunrpc/clnt_raw.c16
-rw-r--r--sysdeps/i386/fpu/s_cos.S27
-rw-r--r--sysdeps/i386/fpu/s_cosf.S27
-rw-r--r--sysdeps/i386/fpu/s_cosl.S29
-rw-r--r--sysdeps/i386/fpu/s_sin.S27
-rw-r--r--sysdeps/i386/fpu/s_sinf.S27
-rw-r--r--sysdeps/i386/fpu/s_sinl.S29
-rw-r--r--sysdeps/i386/fpu/s_tan.S27
-rw-r--r--sysdeps/i386/fpu/s_tanf.S27
-rw-r--r--sysdeps/i386/fpu/s_tanl.S29
-rw-r--r--sysdeps/ieee754/dbl-64/s_expm1.c6
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c15
-rw-r--r--sysdeps/ieee754/dbl-64/s_tan.c31
-rw-r--r--sysdeps/ieee754/flt-32/s_cosf.c9
-rw-r--r--sysdeps/ieee754/flt-32/s_expm1f.c6
-rw-r--r--sysdeps/ieee754/flt-32/s_sinf.c9
-rw-r--r--sysdeps/ieee754/flt-32/s_tanf.c9
-rw-r--r--sysdeps/ieee754/k_standard.c10
-rw-r--r--sysdeps/ieee754/ldbl-96/s_cosl.c7
-rw-r--r--sysdeps/ieee754/ldbl-96/s_sinl.c7
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h2
-rw-r--r--sysdeps/unix/sysv/linux/readv.c2
-rw-r--r--sysdeps/unix/sysv/linux/writev.c2
-rw-r--r--sysdeps/x86_64/dl-machine.h2
-rw-r--r--sysdeps/x86_64/fpu/s_cosl.S16
-rw-r--r--sysdeps/x86_64/fpu/s_expm1l.S6
-rw-r--r--sysdeps/x86_64/fpu/s_sinl.S14
-rw-r--r--sysdeps/x86_64/fpu/s_tanl.S14
92 files changed, 962 insertions, 300 deletions
diff --git a/ChangeLog b/ChangeLog
index 07881f54ea..1f353b7ad8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,138 @@
+2009-04-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* locale/programs/locarchive.c (create_archive): Add MAP_PRIVATE
+	to MAP_ANON in PROT_NONE mmap64 call.
+	(open_archive): Likewise.
+	(file_data_available_p): Use mmap64 instead of mremap.
+	(enlarge_archive): Likewise.  Update head if ah->addr changed.
+	Attempt to reserve address space after mmap64 region.
+
+2009-04-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/ieee754/dbl-64/s_expm1.c: Set errno for overflow.
+	* sysdeps/ieee754/flt-32/s_expm1f.c: Likewise.
+	* sysdeps/x86_64/fpu/s_expm1l.S: Likewise.
+
+	* sysdeps/ieee754/k_standard.c (__kernel_standard): Pole errors in
+	atanh should set ERANGE.
+
+	[BZ #10087]
+	* elf/dl-runtime.c (_dl_fixup): Use DL_FIXUP_VALUE_ADDR to access
+	result of lookup to make call to implement STT_GNU_IFUNC.
+	(_dl_profile_fixup): Likewise.
+	Patch by H.J. Lu <hjl.tools@gmail.com>.
+
+	* nscd/connections.c (send_ro_fd): Define temporary variable to avoid
+	warning.
+
+	* sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inline
+	from definition.
+
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define
+	label if it is not used.
+
+	* elf/dl-profile.c (_dl_start_profile): Define real-type variant
+	of gmon_hist_hdr and gmon_hdr structures and use them.
+	* elf/sprof.c: Likewise.
+
+	* elf/dl-load.c (open_verify): Add temporary variable to avoid
+	warning.
+
+	* nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings.
+
+	* sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition
+	to avoid cast.
+
+	* inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings.
+	* inet/rcmd.c (rcmd_af): Make from a union of the various needed types
+	to avoid warnings.
+	(iruserok_af): Use ss_family instead of casts.
+
+	* gmon/gmon.c (write_hist): Define real-type variant of
+	gmon_hist_hdr structure and use it.
+	(write_gmon): Likewise for gmon_hdr.
+
+	* sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement
+	function if we are not going to define it.
+	* sysdeps/unix/sysv/linux/writev.c: Likewise.
+
+	* inet/inet6_option.c (option_alloc): Add temporary variable to
+	avoid warning.
+
+	* libio/strfile.h (struct _IO_streambuf): Use correct type and
+	name of VTable element.
+	* libio/iovsprintf.c: Avoid casts to avoid warnings.
+	* libio/iovsscanf.c: Likewise.
+	* libio/vasprintf.c: Likewise.
+	* libio/vsnprintf.c: Likewise.
+	* stdio-common/isoc99_vsscanf.c: Likewise.
+	* stdlib/strfmon_l.c: Likewise.
+	* debug/vasprintf_chk.c: Likewise.
+	* debug/vsnprintf_chk.c: Likewise.
+	* debug/vsprintf_chk.c: Likewise.
+
+	* nss/nsswitch.c (__nss_lookup_function): En/Decrypt cached
+	function pointers.
+
+2009-04-26  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/ieee754/dbl-64/s_tan.c (tan): Fix -Wsequence-point warnings.
+
+2009-04-25  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/bits/posix1_lim.h: Cleanup namespace a bit.
+
+	* sysdeps/i386/fpu/s_tan.S: Set errno for ±Inf.
+	* sysdeps/i386/fpu/s_tanf.S: Likewise.
+	* sysdeps/i386/fpu/s_tanl.S: Likewise.
+	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
+	* sysdeps/ieee754/flt-32/s_tanf.c: Likewise.
+	* sysdeps/x86_64/fpu/s_tanl.S: Likewise.
+	* math/libm-test.inc: Add tests for errno after tan calls with
+	±Inf.
+
+	* sysdeps/ieee754/k_standard.c (__kernel_standard): Use correct
+	errno value vor pow(+-0,neg).
+	* math/libm-test.inc (pow_test): Add tests for errno value for
+	pole errors.
+
+	* math/w_fmod.c: Also handle x=±Inf as error.
+	* math/w_fmodf.c: Likewise.
+	* math/w_fmodl.c: Likewise.
+	* math/libm-test.inc (fmod_test): Add tests for errno after calls for
+	x=±Inf or y=0.
+
+	* sysdeps/i386/fpu/s_cos.S: Set errno for ±Inf.
+	* sysdeps/i386/fpu/s_cosf.S: Likewise.
+	* sysdeps/i386/fpu/s_cosl.S: Likewise.
+	* sysdeps/i386/fpu/s_sin.S: Likewise.
+	* sysdeps/i386/fpu/s_sinf.S: Likewise.
+	* sysdeps/i386/fpu/s_sinl.S: Likewise.
+	* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
+	* sysdeps/ieee754/flt-32/s_cosf.c: Likewise.
+	* sysdeps/ieee754/flt-32/s_sinf.c: Likewise.
+	* sysdeps/ieee754/ldbl-96/s_cosl.c: Likewise.
+	* sysdeps/ieee754/ldbl-96/s_sinl.c: Likewise.
+	* sysdeps/x86_64/fpu/s_cosl.S: Likewise.
+	* sysdeps/x86_64/fpu/s_sinl.S: Likewise.
+	* math/libm-test.inc: Add tests for errno after sin/cos calls with
+	±Inf.
+
+	* stdlib/strtod_l.c (round_and_return): We have to set errno to
+	ERANGE for underflows.
+	* stdlib/tst-strtod.c (tests): Two tests should set errno to ERANGE.
+
+	* stdio-common/stdio_lim.h.in (L_cuserid): Not part of POSIX since
+	the 2001 revision.
+
+	* libio/tst-widetext.input: Remove surrogates.
+
+	* include/features.h: _POSIX_C_SOURCE >= 200112L implies C99.
+
+	* sysdeps/ieee754/k_standard.c (__kernel_standard): Pole errors
+	for lgamma should set errno to ERANGE, not EDOM.
+	* math/libm-test.inc (lgamma_test): Check errno for pole errors.
+
 2009-04-24  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #10093]
diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c
index 6105516d59..bdd3acf3bb 100644
--- a/debug/vasprintf_chk.c
+++ b/debug/vasprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1997,1999-2002,2004,2006,2008
+/* Copyright (C) 1995,1997,1999-2002,2004,2006,2008,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -53,8 +53,8 @@ __vasprintf_chk (char **result_ptr, int flags, const char *format,
 #ifdef _IO_MTSAFE_IO
   sf._sbf._f._lock = NULL;
 #endif
-  _IO_no_init ((_IO_FILE *) &sf._sbf, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
+  _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
   _IO_str_init_static_internal (&sf, string, init_string_size, string);
   sf._sbf._f._flags &= ~_IO_USER_BUF;
   sf._s._allocate_buffer = (_IO_alloc_type) malloc;
diff --git a/debug/vsnprintf_chk.c b/debug/vsnprintf_chk.c
index c46937ff6f..8e3d99fa57 100644
--- a/debug/vsnprintf_chk.c
+++ b/debug/vsnprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006
+/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -53,7 +53,7 @@ ___vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
     }
 
   _IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf.f._sbf) = &_IO_strn_jumps;
+  _IO_JUMPS (&sf.f._sbf) = &_IO_strn_jumps;
   s[0] = '\0';
 
   /* For flags > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
@@ -62,7 +62,7 @@ ___vsnprintf_chk (char *s, size_t maxlen, int flags, size_t slen,
     sf.f._sbf._f._flags2 |= _IO_FLAGS2_FORTIFY;
 
   _IO_str_init_static_internal (&sf.f, s, maxlen - 1, s);
-  ret = INTUSE(_IO_vfprintf) ((_IO_FILE *) &sf.f._sbf, format, args);
+  ret = INTUSE(_IO_vfprintf) (&sf.f._sbf._f, format, args);
 
   if (sf.f._sbf._f._IO_buf_base != sf.overflow_buf)
     *sf.f._sbf._f._IO_write_ptr = '\0';
diff --git a/debug/vsprintf_chk.c b/debug/vsprintf_chk.c
index 6538064dce..22cb2c7ad9 100644
--- a/debug/vsprintf_chk.c
+++ b/debug/vsprintf_chk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999-2003, 2004, 2006
+/* Copyright (C) 1994, 1997, 1999-2003, 2004, 2006, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -75,7 +75,7 @@ ___vsprintf_chk (char *s, int flags, size_t slen, const char *format,
     __chk_fail ();
 
   _IO_no_init (&f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &f._sbf) = &_IO_str_chk_jumps;
+  _IO_JUMPS (&f._sbf) = &_IO_str_chk_jumps;
   s[0] = '\0';
   _IO_str_init_static_internal (&f, s, slen - 1, s);
 
@@ -84,7 +84,7 @@ ___vsprintf_chk (char *s, int flags, size_t slen, const char *format,
   if (flags > 0)
     f._sbf._f._flags2 |= _IO_FLAGS2_FORTIFY;
 
-  ret = INTUSE(_IO_vfprintf) ((_IO_FILE *) &f._sbf, format, args);
+  ret = INTUSE(_IO_vfprintf) (&f._sbf._f, format, args);
 
   *f._sbf._f._IO_write_ptr = '\0';
   return ret;
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 0052bc22d4..0b896d9b47 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1655,7 +1655,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 						EI_PAD), 0))
 	{
 	  /* Something is wrong.  */
-	  if (*(Elf32_Word *) &ehdr->e_ident !=
+	  const Elf32_Word *magp = (const void *) ehdr->e_ident;
+	  if (*magp !=
 #if BYTE_ORDER == LITTLE_ENDIAN
 	      ((ELFMAG0 << (EI_MAG0 * 8)) |
 	       (ELFMAG1 << (EI_MAG1 * 8)) |
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 47033f32ef..d9250bcadd 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -1,5 +1,5 @@
 /* Profiling of shared libraries.
-   Copyright (C) 1997-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997-2004, 2006, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
    Based on the BSD mcount implementation.
@@ -178,8 +178,6 @@ _dl_start_profile (void)
   const ElfW(Phdr) *ph;
   ElfW(Addr) mapstart = ~((ElfW(Addr)) 0);
   ElfW(Addr) mapend = 0;
-  struct gmon_hdr gmon_hdr;
-  struct gmon_hist_hdr hist_hdr;
   char *hist, *cp;
   size_t idx;
   size_t tossize;
@@ -251,15 +249,52 @@ _dl_start_profile (void)
 		   + 4 + 4 + fromssize * sizeof (struct here_cg_arc_record));
 
   /* Create the gmon_hdr we expect or write.  */
-  memset (&gmon_hdr, '\0', sizeof (struct gmon_hdr));
+  struct real_gmon_hdr
+  {
+    char cookie[4];
+    int32_t version;
+    char spare[3 * 4];
+  } gmon_hdr;
+  if (sizeof (gmon_hdr) != sizeof (struct gmon_hdr)
+      || (offsetof (struct real_gmon_hdr, cookie)
+	  != offsetof (struct gmon_hdr, cookie))
+      || (offsetof (struct real_gmon_hdr, version)
+	  != offsetof (struct gmon_hdr, version)))
+    abort ();
+
   memcpy (&gmon_hdr.cookie[0], GMON_MAGIC, sizeof (gmon_hdr.cookie));
-  *(int32_t *) gmon_hdr.version = GMON_SHOBJ_VERSION;
+  gmon_hdr.version = GMON_SHOBJ_VERSION;
+  memset (gmon_hdr.spare, '\0', sizeof (gmon_hdr.spare));
 
   /* Create the hist_hdr we expect or write.  */
-  *(char **) hist_hdr.low_pc = (char *) mapstart;
-  *(char **) hist_hdr.high_pc = (char *) mapend;
-  *(int32_t *) hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
-  *(int32_t *) hist_hdr.prof_rate = __profile_frequency ();
+  struct real_gmon_hist_hdr
+  {
+    char *low_pc;
+    char *high_pc;
+    int32_t hist_size;
+    int32_t prof_rate;
+    char dimen[15];
+    char dimen_abbrev;
+  } hist_hdr;
+  if (sizeof (hist_hdr) != sizeof (struct gmon_hist_hdr)
+      || (offsetof (struct real_gmon_hist_hdr, low_pc)
+	  != offsetof (struct gmon_hist_hdr, low_pc))
+      || (offsetof (struct real_gmon_hist_hdr, high_pc)
+	  != offsetof (struct gmon_hist_hdr, high_pc))
+      || (offsetof (struct real_gmon_hist_hdr, hist_size)
+	  != offsetof (struct gmon_hist_hdr, hist_size))
+      || (offsetof (struct real_gmon_hist_hdr, prof_rate)
+	  != offsetof (struct gmon_hist_hdr, prof_rate))
+      || (offsetof (struct real_gmon_hist_hdr, dimen)
+	  != offsetof (struct gmon_hist_hdr, dimen))
+      || (offsetof (struct real_gmon_hist_hdr, dimen_abbrev)
+	  != offsetof (struct gmon_hist_hdr, dimen_abbrev)))
+    abort ();
+
+  hist_hdr.low_pc = (char *) mapstart;
+  hist_hdr.high_pc = (char *) mapend;
+  hist_hdr.hist_size = kcountsize / sizeof (HISTCOUNTER);
+  hist_hdr.prof_rate = __profile_frequency ();
   if (sizeof (hist_hdr.dimen) >= sizeof ("seconds"))
     {
       memcpy (hist_hdr.dimen, "seconds", sizeof ("seconds"));
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 93c8f29d39..0eb7d4e3b9 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -137,7 +137,7 @@ _dl_fixup (
   value = elf_machine_plt_value (l, reloc, value);
 
   if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
-    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (value)) ();
 
   /* Finally, fix up the plt itself.  */
   if (__builtin_expect (GLRO(dl_bind_not), 0))
@@ -225,7 +225,8 @@ _dl_profile_fixup (
 
 	  if (__builtin_expect (ELFW(ST_TYPE) (defsym->st_info)
 				== STT_GNU_IFUNC, 0))
-	    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+	    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
+		     DL_FIXUP_VALUE_ADDR (value)) ();
 	}
       else
 	{
@@ -235,7 +236,8 @@ _dl_profile_fixup (
 
 	  if (__builtin_expect (ELFW(ST_TYPE) (refsym->st_info)
 				== STT_GNU_IFUNC, 0))
-	    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+	    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
+		     DL_FIXUP_VALUE_ADDR (value)) ();
 
 	  result = l;
 	}
diff --git a/elf/sprof.c b/elf/sprof.c
index fd4ffaeaba..96d854fb70 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -195,13 +195,24 @@ struct shobj
 };
 
 
+struct real_gmon_hist_hdr
+{
+  char *low_pc;
+  char *high_pc;
+  int32_t hist_size;
+  int32_t prof_rate;
+  char dimen[15];
+  char dimen_abbrev;
+};
+
+
 struct profdata
 {
   void *addr;
   off_t size;
 
   char *hist;
-  struct gmon_hist_hdr *hist_hdr;
+  struct real_gmon_hist_hdr *hist_hdr;
   uint16_t *kcount;
   uint32_t narcs;		/* Number of arcs in toset.  */
   struct here_cg_arc_record *data;
@@ -740,8 +751,6 @@ load_profdata (const char *name, struct shobj *shobj)
   int fd;
   struct stat st;
   void *addr;
-  struct gmon_hdr gmon_hdr;
-  struct gmon_hist_hdr hist_hdr;
   uint32_t *narcsp;
   size_t fromlimit;
   struct here_cg_arc_record *data;
@@ -828,10 +837,10 @@ load_profdata (const char *name, struct shobj *shobj)
 
   /* Pointer to data after the header.  */
   result->hist = (char *) ((struct gmon_hdr *) addr + 1);
-  result->hist_hdr = (struct gmon_hist_hdr *) ((char *) result->hist
-					       + sizeof (uint32_t));
+  result->hist_hdr = (struct real_gmon_hist_hdr *) ((char *) result->hist
+						    + sizeof (uint32_t));
   result->kcount = (uint16_t *) ((char *) result->hist + sizeof (uint32_t)
-				 + sizeof (struct gmon_hist_hdr));
+				 + sizeof (struct real_gmon_hist_hdr));
 
   /* Compute pointer to array of the arc information.  */
   narcsp = (uint32_t *) ((char *) result->kcount + shobj->kcountsize
@@ -841,18 +850,46 @@ load_profdata (const char *name, struct shobj *shobj)
 						+ sizeof (uint32_t));
 
   /* Create the gmon_hdr we expect or write.  */
-  memset (&gmon_hdr, '\0', sizeof (struct gmon_hdr));
+  struct real_gmon_hdr
+  {
+    char cookie[4];
+    int32_t version;
+    char spare[3 * 4];
+  } gmon_hdr;
+  if (sizeof (gmon_hdr) != sizeof (struct gmon_hdr)
+      || (offsetof (struct real_gmon_hdr, cookie)
+	  != offsetof (struct gmon_hdr, cookie))
+      || (offsetof (struct real_gmon_hdr, version)
+	  != offsetof (struct gmon_hdr, version)))
+    abort ();
+
   memcpy (&gmon_hdr.cookie[0], GMON_MAGIC, sizeof (gmon_hdr.cookie));
-  *(int32_t *) gmon_hdr.version = GMON_SHOBJ_VERSION;
+  gmon_hdr.version = GMON_SHOBJ_VERSION;
+  memset (gmon_hdr.spare, '\0', sizeof (gmon_hdr.spare));
 
   /* Create the hist_hdr we expect or write.  */
-  *(char **) hist_hdr.low_pc = (char *) shobj->lowpc - shobj->map->l_addr;
-  *(char **) hist_hdr.high_pc = (char *) shobj->highpc - shobj->map->l_addr;
+  struct real_gmon_hist_hdr hist_hdr;
+  if (sizeof (hist_hdr) != sizeof (struct gmon_hist_hdr)
+      || (offsetof (struct real_gmon_hist_hdr, low_pc)
+	  != offsetof (struct gmon_hist_hdr, low_pc))
+      || (offsetof (struct real_gmon_hist_hdr, high_pc)
+	  != offsetof (struct gmon_hist_hdr, high_pc))
+      || (offsetof (struct real_gmon_hist_hdr, hist_size)
+	  != offsetof (struct gmon_hist_hdr, hist_size))
+      || (offsetof (struct real_gmon_hist_hdr, prof_rate)
+	  != offsetof (struct gmon_hist_hdr, prof_rate))
+      || (offsetof (struct real_gmon_hist_hdr, dimen)
+	  != offsetof (struct gmon_hist_hdr, dimen))
+      || (offsetof (struct real_gmon_hist_hdr, dimen_abbrev)
+	  != offsetof (struct gmon_hist_hdr, dimen_abbrev)))
+    abort ();
+
+  hist_hdr.low_pc = (char *) shobj->lowpc - shobj->map->l_addr;
+  hist_hdr.high_pc = (char *) shobj->highpc - shobj->map->l_addr;
   if (do_test)
-    printf ("low_pc = %p\nhigh_pc = %p\n",
-	    *(char **) hist_hdr.low_pc, *(char **) hist_hdr.high_pc);
-  *(int32_t *) hist_hdr.hist_size = shobj->kcountsize / sizeof (HISTCOUNTER);
-  *(int32_t *) hist_hdr.prof_rate = __profile_frequency ();
+    printf ("low_pc = %p\nhigh_pc = %p\n", hist_hdr.low_pc, hist_hdr.high_pc);
+  hist_hdr.hist_size = shobj->kcountsize / sizeof (HISTCOUNTER);
+  hist_hdr.prof_rate = __profile_frequency ();
   strncpy (hist_hdr.dimen, "seconds", sizeof (hist_hdr.dimen));
   hist_hdr.dimen_abbrev = 's';
 
@@ -1280,7 +1317,7 @@ generate_flat_profile (struct profdata *profdata)
   size_t n;
   void *data = NULL;
 
-  tick_unit = 1.0 / *(uint32_t *) profdata->hist_hdr->prof_rate;
+  tick_unit = 1.0 / profdata->hist_hdr->prof_rate;
 
   printf ("Flat profile:\n\n"
 	  "Each sample counts as %g %s.\n",
diff --git a/fedora/branch.mk b/fedora/branch.mk
index d2d145a22d..4b9a36165e 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-f8
-fedora-sync-date := 2009-04-24 19:08 UTC
-fedora-sync-tag := fedora-glibc-20090424T1908
+fedora-sync-date := 2009-04-27 14:19 UTC
+fedora-sync-tag := fedora-glibc-20090427T1419
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 6dbcf139e0..0235202969 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -19,7 +19,7 @@
 Summary: The GNU libc libraries
 Name: glibc
 Version: @glibcversion@
-Release: 21
+Release: 22
 # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
 # Things that are linked directly into dynamically linked programs
 # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@@ -1009,6 +1009,11 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Mon Apr 27 2009 Jakub Jelinek <jakub@redhat.com> 2.9.90-22
+- update from trunk
+  - further localedef fixes
+- fix build-locale-archive
+
 * Fri Apr 24 2009 Jakub Jelinek <jakub@redhat.com> 2.9.90-21
 - update from trunk
   - fix localedef
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 8e2eddd0bc..af2ac1c0f6 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -40,6 +40,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stddef.h>
 #include <unistd.h>
 #include <libc-internal.h>
 #include <not-cancel.h>
@@ -180,10 +181,18 @@ write_hist (fd)
      int fd;
 {
   u_char tag = GMON_TAG_TIME_HIST;
-  struct gmon_hist_hdr thdr __attribute__ ((aligned (__alignof__ (char *))));
 
   if (_gmonparam.kcountsize > 0)
     {
+      struct real_gmon_hist_hdr
+      {
+	char *low_pc;
+	char *high_pc;
+	int32_t hist_size;
+	int32_t prof_rate;
+	char dimen[15];
+	char dimen_abbrev;
+      } thdr;
       struct iovec iov[3] =
         {
 	  { &tag, sizeof (tag) },
@@ -191,11 +200,25 @@ write_hist (fd)
 	  { _gmonparam.kcount, _gmonparam.kcountsize }
 	};
 
-      *(char **) thdr.low_pc = (char *) _gmonparam.lowpc;
-      *(char **) thdr.high_pc = (char *) _gmonparam.highpc;
-      *(int32_t *) thdr.hist_size = (_gmonparam.kcountsize
-				     / sizeof (HISTCOUNTER));
-      *(int32_t *) thdr.prof_rate = __profile_frequency ();
+      if (sizeof (thdr) != sizeof (struct gmon_hist_hdr)
+	  || (offsetof (struct real_gmon_hist_hdr, low_pc)
+	      != offsetof (struct gmon_hist_hdr, low_pc))
+	  || (offsetof (struct real_gmon_hist_hdr, high_pc)
+	      != offsetof (struct gmon_hist_hdr, high_pc))
+	  || (offsetof (struct real_gmon_hist_hdr, hist_size)
+	      != offsetof (struct gmon_hist_hdr, hist_size))
+	  || (offsetof (struct real_gmon_hist_hdr, prof_rate)
+	      != offsetof (struct gmon_hist_hdr, prof_rate))
+	  || (offsetof (struct real_gmon_hist_hdr, dimen)
+	      != offsetof (struct gmon_hist_hdr, dimen))
+	  || (offsetof (struct real_gmon_hist_hdr, dimen_abbrev)
+	      != offsetof (struct gmon_hist_hdr, dimen_abbrev)))
+	abort ();
+
+      thdr.low_pc = (char *) _gmonparam.lowpc;
+      thdr.high_pc = (char *) _gmonparam.highpc;
+      thdr.hist_size = _gmonparam.kcountsize / sizeof (HISTCOUNTER);
+      thdr.prof_rate = __profile_frequency ();
       strncpy (thdr.dimen, "seconds", sizeof (thdr.dimen));
       thdr.dimen_abbrev = 's';
 
@@ -318,7 +341,6 @@ write_bb_counts (fd)
 static void
 write_gmon (void)
 {
-    struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int))));
     int fd = -1;
     char *env;
 
@@ -350,9 +372,21 @@ write_gmon (void)
       }
 
     /* write gmon.out header: */
-    memset (&ghdr, '\0', sizeof (struct gmon_hdr));
+    struct real_gmon_hdr
+    {
+      char cookie[4];
+      int32_t version;
+      char spare[3 * 4];
+    } ghdr;
+    if (sizeof (ghdr) != sizeof (struct gmon_hdr)
+	|| (offsetof (struct real_gmon_hdr, cookie)
+	    != offsetof (struct gmon_hdr, cookie))
+	|| (offsetof (struct real_gmon_hdr, version)
+	    != offsetof (struct gmon_hdr, version)))
+      abort ();
     memcpy (&ghdr.cookie[0], GMON_MAGIC, sizeof (ghdr.cookie));
-    *(int32_t *) ghdr.version = GMON_VERSION;
+    ghdr.version = GMON_VERSION;
+    memset (ghdr.spare, '\0', sizeof (ghdr.spare));
     write_not_cancel (fd, &ghdr, sizeof (struct gmon_hdr));
 
     /* write PC histogram: */
diff --git a/include/features.h b/include/features.h
index e064289f7a..a653e4d46b 100644
--- a/include/features.h
+++ b/include/features.h
@@ -230,6 +230,8 @@
 
 #if (_POSIX_C_SOURCE - 0) >= 200112L
 # define __USE_XOPEN2K		1
+# undef __USE_ISOC99
+# define __USE_ISOC99		1
 #endif
 
 #if (_POSIX_C_SOURCE - 0) >= 200809L
diff --git a/inet/inet6_option.c b/inet/inet6_option.c
index b34eb22b7d..aa693cc9e4 100644
--- a/inet/inet6_option.c
+++ b/inet/inet6_option.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -216,7 +216,8 @@ option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy)
     /* Too long.  */
     return NULL;
 
-  ((struct ip6_ext *) CMSG_DATA (cmsg))->ip6e_len = len8b;
+  struct ip6_ext *ie = (void *) CMSG_DATA (cmsg);
+  ie->ip6e_len = len8b;
 
   return result;
 }
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 5dcbd25568..343e0954db 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -112,7 +112,13 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
 {
 	char paddr[INET6_ADDRSTRLEN];
 	struct addrinfo hints, *res, *ai;
-	struct sockaddr_storage from;
+	union
+	{
+	  struct sockaddr sa;
+	  struct sockaddr_storage ss;
+	  struct sockaddr_in sin;
+	  struct sockaddr_in6 sin6;
+	} from;
 	struct pollfd pfd[2];
 	int32_t oldmask;
 	pid_t pid;
@@ -274,14 +280,13 @@ poll: protocol failure in circuit setup\n")) >= 0))
 			(void)__close(s2);
 			goto bad;
 		}
-		s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
-						&len));
-		switch (from.ss_family) {
+		s3 = TEMP_FAILURE_RETRY (accept(s2, &from.sa, &len));
+		switch (from.sa.sa_family) {
 		case AF_INET:
-			rport = ntohs(((struct sockaddr_in *)&from)->sin_port);
+			rport = ntohs(from.sin.sin_port);
 			break;
 		case AF_INET6:
-			rport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port);
+			rport = ntohs(from.sin6.sin6_port);
 			break;
 		default:
 			rport = 0;
@@ -605,13 +610,13 @@ iruserok_af (raddr, superuser, ruser, luser, af)
   memset (&ra, '\0', sizeof(ra));
   switch (af){
   case AF_INET:
-    ((struct sockaddr_in *)&ra)->sin_family = AF_INET;
+    ra.ss_family = AF_INET;
     memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr,
 	    sizeof(struct in_addr));
     ralen = sizeof(struct sockaddr_in);
     break;
   case AF_INET6:
-    ((struct sockaddr_in6 *)&ra)->sin6_family = AF_INET6;
+    ra.ss_family = AF_INET6;
     memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr,
             sizeof(struct in6_addr));
     ralen = sizeof(struct sockaddr_in6);
diff --git a/inet/rexec.c b/inet/rexec.c
index 07ddeeafea..75bb47082b 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -56,7 +56,7 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af)
 	int *fd2p;
 	sa_family_t af;
 {
-	struct sockaddr_storage sa2, from;
+	struct sockaddr_storage from;
 	struct addrinfo hints, *res0;
 	const char *orig_name = name;
 	const char *orig_pass = pass;
@@ -115,6 +115,11 @@ retry:
 	} else {
 		char num[32];
 		int s2;
+		union
+		{
+		  struct sockaddr_storage ss;
+		  struct sockaddr sa;
+		} sa2;
 		socklen_t sa2len;
 
 		s2 = __socket(res0->ai_family, res0->ai_socktype, 0);
@@ -124,17 +129,17 @@ retry:
 		}
 		__listen(s2, 1);
 		sa2len = sizeof (sa2);
-		if (__getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) {
+		if (__getsockname(s2, &sa2.sa, &sa2len) < 0) {
 			perror("getsockname");
 			(void) __close(s2);
 			goto bad;
-		} else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) {
+		} else if (sa2len != SA_LEN(&sa2.sa)) {
 			__set_errno(EINVAL);
 			(void) __close(s2);
 			goto bad;
 		}
 		port = 0;
-		if (!getnameinfo((struct sockaddr *)&sa2, sa2len,
+		if (!getnameinfo(&sa2.sa, sa2len,
 				 NULL, 0, servbuff, sizeof(servbuff),
 				 NI_NUMERICSERV))
 			port = atoi(servbuff);
diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c
index 7fcd0a156e..ab82411097 100644
--- a/libio/iovsprintf.c
+++ b/libio/iovsprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2003, 2006, 2009 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
@@ -38,10 +38,10 @@ __IO_vsprintf (char *string, const char *format, _IO_va_list args)
   sf._sbf._f._lock = NULL;
 #endif
   _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
   _IO_str_init_static_internal (&sf, string, -1, string);
-  ret = INTUSE(_IO_vfprintf) ((_IO_FILE *) &sf._sbf, format, args);
-  _IO_putc_unlocked ('\0', (_IO_FILE *) &sf._sbf);
+  ret = INTUSE(_IO_vfprintf) (&sf._sbf._f, format, args);
+  _IO_putc_unlocked ('\0', &sf._sbf._f);
   return ret;
 }
 INTDEF2(__IO_vsprintf, _IO_vsprintf)
diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c
index 10e4b0a9ac..6f8a826ef6 100644
--- a/libio/iovsscanf.c
+++ b/libio/iovsscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2003, 2006, 2009 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
@@ -40,9 +40,9 @@ _IO_vsscanf (string, format, args)
   sf._sbf._f._lock = NULL;
 #endif
   _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
   _IO_str_init_static_internal (&sf, (char*)string, 0, NULL);
-  ret = INTUSE(_IO_vfscanf) ((_IO_FILE *) &sf._sbf, format, args, NULL);
+  ret = INTUSE(_IO_vfscanf) (&sf._sbf._f, format, args, NULL);
   return ret;
 }
 ldbl_weak_alias (_IO_vsscanf, __vsscanf)
diff --git a/libio/strfile.h b/libio/strfile.h
index 53a36a3db8..21ea9a615b 100644
--- a/libio/strfile.h
+++ b/libio/strfile.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1997,1998,1999,2005,2009 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
@@ -47,7 +47,7 @@ struct _IO_str_fields
 struct _IO_streambuf
 {
   struct _IO_FILE _f;
-  const void *_vtable;
+  const struct _IO_jump_t *vtable;
 };
 
 typedef struct _IO_strfile_
diff --git a/libio/tst-widetext.input b/libio/tst-widetext.input
index f9694dc6d2..bef07cef3d 100644
--- a/libio/tst-widetext.input
+++ b/libio/tst-widetext.input
@@ -1807,47 +1807,6 @@ Free block (U+D7A4-U+D7FF):
 힤힥힦힧힨힩힪힫힬힭힮힯ힰힱힲힳힴힵힶힷힸힹힺힻힼힽힾힿퟀíŸíŸ‚ퟃퟄퟅퟆ퟇퟈퟉퟊ퟋퟌíŸíŸŽíŸíŸíŸ‘ퟒퟓퟔퟕퟖퟗퟘퟙퟚퟛퟜíŸíŸžíŸŸíŸ íŸ¡íŸ¢íŸ£
 ퟤퟥퟦퟧퟨퟩퟪퟫퟬퟭퟮퟯퟰퟱퟲퟳퟴퟵퟶퟷퟸퟹퟺퟻ퟼퟽퟾퟿
 
-High Surrogates (U+D800-U+DB7F):
-
-í €í í ‚í ƒí „í …í †í ‡í ˆí ‰í Ší ‹í Œí í Ží í í ‘í ’í “í ”í •í –í —í ˜í ™í ší ›í œí í ží Ÿí  í ¡í ¢í £í ¤í ¥í ¦í §í ¨í ©í ªí «í ¬í ­í ®í ¯í °í ±í ²í ³í ´í µí ¶í ·í ¸í ¹í ºí »í ¼í ½í ¾í ¿
-í¡€í¡í¡‚í¡ƒí¡„í¡…í¡†í¡‡í¡ˆí¡‰í¡Ší¡‹í¡Œí¡í¡Ží¡í¡í¡‘í¡’í¡“í¡”í¡•í¡–í¡—í¡˜í¡™í¡ší¡›í¡œí¡í¡ží¡Ÿí¡ í¡¡í¡¢í¡£í¡¤í¡¥í¡¦í¡§í¡¨í¡©í¡ªí¡«í¡¬í¡­í¡®í¡¯í¡°í¡±í¡²í¡³í¡´í¡µí¡¶í¡·í¡¸í¡¹í¡ºí¡»í¡¼í¡½í¡¾í¡¿
-í¢€í¢í¢‚í¢ƒí¢„í¢…í¢†í¢‡í¢ˆí¢‰í¢Ší¢‹í¢Œí¢í¢Ží¢í¢í¢‘í¢’í¢“í¢”í¢•í¢–í¢—í¢˜í¢™í¢ší¢›í¢œí¢í¢ží¢Ÿí¢ í¢¡í¢¢í¢£í¢¤í¢¥í¢¦í¢§í¢¨í¢©í¢ªí¢«í¢¬í¢­í¢®í¢¯í¢°í¢±í¢²í¢³í¢´í¢µí¢¶í¢·í¢¸í¢¹í¢ºí¢»í¢¼í¢½í¢¾í¢¿
-í£€í£í£‚í£ƒí£„í£…í£†í£‡í£ˆí£‰í£Ší£‹í£Œí£í£Ží£í£í£‘í£’í£“í£”í£•í£–í£—í£˜í£™í£ší£›í£œí£í£ží£Ÿí£ í£¡í£¢í££í£¤í£¥í£¦í£§í£¨í£©í£ªí£«í£¬í£­í£®í£¯í£°í£±í£²í£³í£´í£µí£¶í£·í£¸í£¹í£ºí£»í£¼í£½í£¾í£¿
-í¤€í¤í¤‚í¤ƒí¤„í¤…í¤†í¤‡í¤ˆí¤‰í¤Ší¤‹í¤Œí¤í¤Ží¤í¤í¤‘í¤’í¤“í¤”í¤•í¤–í¤—í¤˜í¤™í¤ší¤›í¤œí¤í¤ží¤Ÿí¤ í¤¡í¤¢í¤£í¤¤í¤¥í¤¦í¤§í¤¨í¤©í¤ªí¤«í¤¬í¤­í¤®í¤¯í¤°í¤±í¤²í¤³í¤´í¤µí¤¶í¤·í¤¸í¤¹í¤ºí¤»í¤¼í¤½í¤¾í¤¿
-í¥€í¥í¥‚í¥ƒí¥„í¥…í¥†í¥‡í¥ˆí¥‰í¥Ší¥‹í¥Œí¥í¥Ží¥í¥í¥‘í¥’í¥“í¥”í¥•í¥–í¥—í¥˜í¥™í¥ší¥›í¥œí¥í¥ží¥Ÿí¥ í¥¡í¥¢í¥£í¥¤í¥¥í¥¦í¥§í¥¨í¥©í¥ªí¥«í¥¬í¥­í¥®í¥¯í¥°í¥±í¥²í¥³í¥´í¥µí¥¶í¥·í¥¸í¥¹í¥ºí¥»í¥¼í¥½í¥¾í¥¿
-í¦€í¦í¦‚í¦ƒí¦„í¦…í¦†í¦‡í¦ˆí¦‰í¦Ší¦‹í¦Œí¦í¦Ží¦í¦í¦‘í¦’í¦“í¦”í¦•í¦–í¦—í¦˜í¦™í¦ší¦›í¦œí¦í¦ží¦Ÿí¦ í¦¡í¦¢í¦£í¦¤í¦¥í¦¦í¦§í¦¨í¦©í¦ªí¦«í¦¬í¦­í¦®í¦¯í¦°í¦±í¦²í¦³í¦´í¦µí¦¶í¦·í¦¸í¦¹í¦ºí¦»í¦¼í¦½í¦¾í¦¿
-í§€í§í§‚í§ƒí§„í§…í§†í§‡í§ˆí§‰í§Ší§‹í§Œí§í§Ží§í§í§‘í§’í§“í§”í§•í§–í§—í§˜í§™í§ší§›í§œí§í§ží§Ÿí§ í§¡í§¢í§£í§¤í§¥í§¦í§§í§¨í§©í§ªí§«í§¬í§­í§®í§¯í§°í§±í§²í§³í§´í§µí§¶í§·í§¸í§¹í§ºí§»í§¼í§½í§¾í§¿
-í¨€í¨í¨‚í¨ƒí¨„í¨…í¨†í¨‡í¨ˆí¨‰í¨Ší¨‹í¨Œí¨í¨Ží¨í¨í¨‘í¨’í¨“í¨”í¨•í¨–í¨—í¨˜í¨™í¨ší¨›í¨œí¨í¨ží¨Ÿí¨ í¨¡í¨¢í¨£í¨¤í¨¥í¨¦í¨§í¨¨í¨©í¨ªí¨«í¨¬í¨­í¨®í¨¯í¨°í¨±í¨²í¨³í¨´í¨µí¨¶í¨·í¨¸í¨¹í¨ºí¨»í¨¼í¨½í¨¾í¨¿
-í©€í©í©‚í©ƒí©„í©…í©†í©‡í©ˆí©‰í©Ší©‹í©Œí©í©Ží©í©í©‘í©’í©“í©”í©•í©–í©—í©˜í©™í©ší©›í©œí©í©ží©Ÿí© í©¡í©¢í©£í©¤í©¥í©¦í©§í©¨í©©í©ªí©«í©¬í©­í©®í©¯í©°í©±í©²í©³í©´í©µí©¶í©·í©¸í©¹í©ºí©»í©¼í©½í©¾í©¿
-íª€íªíª‚íªƒíª„íª…íª†íª‡íªˆíª‰íªŠíª‹íªŒíªíªŽíªíªíª‘íª’íª“íª”íª•íª–íª—íª˜íª™íªšíª›íªœíªíªžíªŸíª íª¡íª¢íª£íª¤íª¥íª¦íª§íª¨íª©íªªíª«íª¬íª­íª®íª¯íª°íª±íª²íª³íª´íªµíª¶íª·íª¸íª¹íªºíª»íª¼íª½íª¾íª¿
-í«€í«í«‚í«ƒí«„í«…í«†í«‡í«ˆí«‰í«Ší«‹í«Œí«í«Ží«í«í«‘í«’í«“í«”í«•í«–í«—í«˜í«™í«ší«›í«œí«í«ží«Ÿí« í«¡í«¢í«£í«¤í«¥í«¦í«§í«¨í«©í«ªí««í«¬í«­í«®í«¯í«°í«±í«²í«³í«´í«µí«¶í«·í«¸í«¹í«ºí«»í«¼í«½í«¾í«¿
-í¬€í¬í¬‚í¬ƒí¬„í¬…í¬†í¬‡í¬ˆí¬‰í¬Ší¬‹í¬Œí¬í¬Ží¬í¬í¬‘í¬’í¬“í¬”í¬•í¬–í¬—í¬˜í¬™í¬ší¬›í¬œí¬í¬ží¬Ÿí¬ í¬¡í¬¢í¬£í¬¤í¬¥í¬¦í¬§í¬¨í¬©í¬ªí¬«í¬¬í¬­í¬®í¬¯í¬°í¬±í¬²í¬³í¬´í¬µí¬¶í¬·í¬¸í¬¹í¬ºí¬»í¬¼í¬½í¬¾í¬¿
-í­€í­í­‚í­ƒí­„í­…í­†í­‡í­ˆí­‰í­Ší­‹í­Œí­í­Ží­í­í­‘í­’í­“í­”í­•í­–í­—í­˜í­™í­ší­›í­œí­í­ží­Ÿí­ í­¡í­¢í­£í­¤í­¥í­¦í­§í­¨í­©í­ªí­«í­¬í­­í­®í­¯í­°í­±í­²í­³í­´í­µí­¶í­·í­¸í­¹í­ºí­»í­¼í­½í­¾í­¿
-
-High Private Use Surrogates (U+DB80-U+DBFF):
-
-í®€í®í®‚í®ƒí®„í®…í®†í®‡í®ˆí®‰í®Ší®‹í®Œí®í®Ží®í®í®‘í®’í®“í®”í®•í®–í®—í®˜í®™í®ší®›í®œí®í®ží®Ÿí® í®¡í®¢í®£í®¤í®¥í®¦í®§í®¨í®©í®ªí®«í®¬í®­í®®í®¯í®°í®±í®²í®³í®´í®µí®¶í®·í®¸í®¹í®ºí®»í®¼í®½í®¾í®¿
-í¯€í¯í¯‚í¯ƒí¯„í¯…í¯†í¯‡í¯ˆí¯‰í¯Ší¯‹í¯Œí¯í¯Ží¯í¯í¯‘í¯’í¯“í¯”í¯•í¯–í¯—í¯˜í¯™í¯ší¯›í¯œí¯í¯ží¯Ÿí¯ í¯¡í¯¢í¯£í¯¤í¯¥í¯¦í¯§í¯¨í¯©í¯ªí¯«í¯¬í¯­í¯®í¯¯í¯°í¯±í¯²í¯³í¯´í¯µí¯¶í¯·í¯¸í¯¹í¯ºí¯»í¯¼í¯½í¯¾í¯¿
-
-Low Surrogates (U+DC00-U+DFFF):
-
-í°€í°í°‚í°ƒí°„í°…í°†í°‡í°ˆí°‰í°Ší°‹í°Œí°í°Ží°í°í°‘í°’í°“í°”í°•í°–í°—í°˜í°™í°ší°›í°œí°í°ží°Ÿí° í°¡í°¢í°£í°¤í°¥í°¦í°§í°¨í°©í°ªí°«í°¬í°­í°®í°¯í°°í°±í°²í°³í°´í°µí°¶í°·í°¸í°¹í°ºí°»í°¼í°½í°¾í°¿
-í±€í±í±‚í±ƒí±„í±…í±†í±‡í±ˆí±‰í±Ší±‹í±Œí±í±Ží±í±í±‘í±’í±“í±”í±•í±–í±—í±˜í±™í±ší±›í±œí±í±ží±Ÿí± í±¡í±¢í±£í±¤í±¥í±¦í±§í±¨í±©í±ªí±«í±¬í±­í±®í±¯í±°í±±í±²í±³í±´í±µí±¶í±·í±¸í±¹í±ºí±»í±¼í±½í±¾í±¿
-í²€í²í²‚í²ƒí²„í²…í²†í²‡í²ˆí²‰í²Ší²‹í²Œí²í²Ží²í²í²‘í²’í²“í²”í²•í²–í²—í²˜í²™í²ší²›í²œí²í²ží²Ÿí² í²¡í²¢í²£í²¤í²¥í²¦í²§í²¨í²©í²ªí²«í²¬í²­í²®í²¯í²°í²±í²²í²³í²´í²µí²¶í²·í²¸í²¹í²ºí²»í²¼í²½í²¾í²¿
-í³€í³í³‚í³ƒí³„í³…í³†í³‡í³ˆí³‰í³Ší³‹í³Œí³í³Ží³í³í³‘í³’í³“í³”í³•í³–í³—í³˜í³™í³ší³›í³œí³í³ží³Ÿí³ í³¡í³¢í³£í³¤í³¥í³¦í³§í³¨í³©í³ªí³«í³¬í³­í³®í³¯í³°í³±í³²í³³í³´í³µí³¶í³·í³¸í³¹í³ºí³»í³¼í³½í³¾í³¿
-í´€í´í´‚í´ƒí´„í´…í´†í´‡í´ˆí´‰í´Ší´‹í´Œí´í´Ží´í´í´‘í´’í´“í´”í´•í´–í´—í´˜í´™í´ší´›í´œí´í´ží´Ÿí´ í´¡í´¢í´£í´¤í´¥í´¦í´§í´¨í´©í´ªí´«í´¬í´­í´®í´¯í´°í´±í´²í´³í´´í´µí´¶í´·í´¸í´¹í´ºí´»í´¼í´½í´¾í´¿
-íµ€íµíµ‚íµƒíµ„íµ…íµ†íµ‡íµˆíµ‰íµŠíµ‹íµŒíµíµŽíµíµíµ‘íµ’íµ“íµ”íµ•íµ–íµ—íµ˜íµ™íµšíµ›íµœíµíµžíµŸíµ íµ¡íµ¢íµ£íµ¤íµ¥íµ¦íµ§íµ¨íµ©íµªíµ«íµ¬íµ­íµ®íµ¯íµ°íµ±íµ²íµ³íµ´íµµíµ¶íµ·íµ¸íµ¹íµºíµ»íµ¼íµ½íµ¾íµ¿
-í¶€í¶í¶‚í¶ƒí¶„í¶…í¶†í¶‡í¶ˆí¶‰í¶Ší¶‹í¶Œí¶í¶Ží¶í¶í¶‘í¶’í¶“í¶”í¶•í¶–í¶—í¶˜í¶™í¶ší¶›í¶œí¶í¶ží¶Ÿí¶ í¶¡í¶¢í¶£í¶¤í¶¥í¶¦í¶§í¶¨í¶©í¶ªí¶«í¶¬í¶­í¶®í¶¯í¶°í¶±í¶²í¶³í¶´í¶µí¶¶í¶·í¶¸í¶¹í¶ºí¶»í¶¼í¶½í¶¾í¶¿
-í·€í·í·‚í·ƒí·„í·…í·†í·‡í·ˆí·‰í·Ší·‹í·Œí·í·Ží·í·í·‘í·’í·“í·”í·•í·–í·—í·˜í·™í·ší·›í·œí·í·ží·Ÿí· í·¡í·¢í·£í·¤í·¥í·¦í·§í·¨í·©í·ªí·«í·¬í·­í·®í·¯í·°í·±í·²í·³í·´í·µí·¶í··í·¸í·¹í·ºí·»í·¼í·½í·¾í·¿
-í¸€í¸í¸‚í¸ƒí¸„í¸…í¸†í¸‡í¸ˆí¸‰í¸Ší¸‹í¸Œí¸í¸Ží¸í¸í¸‘í¸’í¸“í¸”í¸•í¸–í¸—í¸˜í¸™í¸ší¸›í¸œí¸í¸ží¸Ÿí¸ í¸¡í¸¢í¸£í¸¤í¸¥í¸¦í¸§í¸¨í¸©í¸ªí¸«í¸¬í¸­í¸®í¸¯í¸°í¸±í¸²í¸³í¸´í¸µí¸¶í¸·í¸¸í¸¹í¸ºí¸»í¸¼í¸½í¸¾í¸¿
-í¹€í¹í¹‚í¹ƒí¹„í¹…í¹†í¹‡í¹ˆí¹‰í¹Ší¹‹í¹Œí¹í¹Ží¹í¹í¹‘í¹’í¹“í¹”í¹•í¹–í¹—í¹˜í¹™í¹ší¹›í¹œí¹í¹ží¹Ÿí¹ í¹¡í¹¢í¹£í¹¤í¹¥í¹¦í¹§í¹¨í¹©í¹ªí¹«í¹¬í¹­í¹®í¹¯í¹°í¹±í¹²í¹³í¹´í¹µí¹¶í¹·í¹¸í¹¹í¹ºí¹»í¹¼í¹½í¹¾í¹¿
-íº€íºíº‚íºƒíº„íº…íº†íº‡íºˆíº‰íºŠíº‹íºŒíºíºŽíºíºíº‘íº’íº“íº”íº•íº–íº—íº˜íº™íºšíº›íºœíºíºžíºŸíº íº¡íº¢íº£íº¤íº¥íº¦íº§íº¨íº©íºªíº«íº¬íº­íº®íº¯íº°íº±íº²íº³íº´íºµíº¶íº·íº¸íº¹íººíº»íº¼íº½íº¾íº¿
-í»€í»í»‚í»ƒí»„í»…í»†í»‡í»ˆí»‰í»Ší»‹í»Œí»í»Ží»í»í»‘í»’í»“í»”í»•í»–í»—í»˜í»™í»ší»›í»œí»í»ží»Ÿí» í»¡í»¢í»£í»¤í»¥í»¦í»§í»¨í»©í»ªí»«í»¬í»­í»®í»¯í»°í»±í»²í»³í»´í»µí»¶í»·í»¸í»¹í»ºí»»í»¼í»½í»¾í»¿
-í¼€í¼í¼‚í¼ƒí¼„í¼…í¼†í¼‡í¼ˆí¼‰í¼Ší¼‹í¼Œí¼í¼Ží¼í¼í¼‘í¼’í¼“í¼”í¼•í¼–í¼—í¼˜í¼™í¼ší¼›í¼œí¼í¼ží¼Ÿí¼ í¼¡í¼¢í¼£í¼¤í¼¥í¼¦í¼§í¼¨í¼©í¼ªí¼«í¼¬í¼­í¼®í¼¯í¼°í¼±í¼²í¼³í¼´í¼µí¼¶í¼·í¼¸í¼¹í¼ºí¼»í¼¼í¼½í¼¾í¼¿
-í½€í½í½‚í½ƒí½„í½…í½†í½‡í½ˆí½‰í½Ší½‹í½Œí½í½Ží½í½í½‘í½’í½“í½”í½•í½–í½—í½˜í½™í½ší½›í½œí½í½ží½Ÿí½ í½¡í½¢í½£í½¤í½¥í½¦í½§í½¨í½©í½ªí½«í½¬í½­í½®í½¯í½°í½±í½²í½³í½´í½µí½¶í½·í½¸í½¹í½ºí½»í½¼í½½í½¾í½¿
-í¾€í¾í¾‚í¾ƒí¾„í¾…í¾†í¾‡í¾ˆí¾‰í¾Ší¾‹í¾Œí¾í¾Ží¾í¾í¾‘í¾’í¾“í¾”í¾•í¾–í¾—í¾˜í¾™í¾ší¾›í¾œí¾í¾ží¾Ÿí¾ í¾¡í¾¢í¾£í¾¤í¾¥í¾¦í¾§í¾¨í¾©í¾ªí¾«í¾¬í¾­í¾®í¾¯í¾°í¾±í¾²í¾³í¾´í¾µí¾¶í¾·í¾¸í¾¹í¾ºí¾»í¾¼í¾½í¾¾í¾¿
-í¿€í¿í¿‚í¿ƒí¿„í¿…í¿†í¿‡í¿ˆí¿‰í¿Ší¿‹í¿Œí¿í¿Ží¿í¿í¿‘í¿’í¿“í¿”í¿•í¿–í¿—í¿˜í¿™í¿ší¿›í¿œí¿í¿ží¿Ÿí¿ í¿¡í¿¢í¿£í¿¤í¿¥í¿¦í¿§í¿¨í¿©í¿ªí¿«í¿¬í¿­í¿®í¿¯í¿°í¿±í¿²í¿³í¿´í¿µí¿¶í¿·í¿¸í¿¹í¿ºí¿»í¿¼í¿½í¿¾í¿¿
-
 Private Use (U+E000-U+F8FF):
 
 î€î€‚î€î€Žî€î€î€‘î€î€žî€Ÿî€ î€¡î€¢î€£î€¤î€¥î€¦î€§î€¨î€©î€ªî€«î€¬î€­î€®î€¯î€°î€±î€²î€³î€´î€µî€¶î€·î€¸î€¹î€ºî€»î€¼î€½î€¾î€¿
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index 2fdb9f6ed2..7e15eb044a 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1997,1999-2002,2004,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1999-2002,2004,2006,2009
+   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
@@ -54,8 +55,8 @@ _IO_vasprintf (result_ptr, format, args)
 #ifdef _IO_MTSAFE_IO
   sf._sbf._f._lock = NULL;
 #endif
-  _IO_no_init ((_IO_FILE *) &sf._sbf, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
+  _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
   _IO_str_init_static_internal (&sf, string, init_string_size, string);
   sf._sbf._f._flags &= ~_IO_USER_BUF;
   sf._s._allocate_buffer = (_IO_alloc_type) malloc;
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 289160e540..a05eb5455c 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994,1997,1999-2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1997,1999-2004,2006,2009 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
@@ -114,10 +114,10 @@ _IO_vsnprintf (string, maxlen, format, args)
     }
 
   _IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf.f._sbf) = &_IO_strn_jumps;
+  _IO_JUMPS (&sf.f._sbf) = &_IO_strn_jumps;
   string[0] = '\0';
   _IO_str_init_static_internal (&sf.f, string, maxlen - 1, string);
-  ret = INTUSE(_IO_vfprintf) ((_IO_FILE *) &sf.f._sbf, format, args);
+  ret = INTUSE(_IO_vfprintf) (&sf.f._sbf._f, format, args);
 
   if (sf.f._sbf._f._IO_buf_base != sf.overflow_buf)
     *sf.f._sbf._f._IO_write_ptr = '\0';
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index e2ccda01b7..a58505852d 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -134,8 +134,8 @@ create_archive (const char *archivefname, struct locarhandle *ah)
   size_t reserved = RESERVE_MMAP_SIZE;
   int xflags = 0;
   if (total < reserved
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_ANON, -1, 0))
-	  != MAP_FAILED))
+      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+		       -1, 0)) != MAP_FAILED))
     xflags = MAP_FIXED;
   else
     {
@@ -259,10 +259,16 @@ file_data_available_p (struct locarhandle *ah, uint32_t offset, uint32_t size)
   if (st.st_size > ah->reserved)
     return false;
 
-  void *p = mremap (ah->addr, ah->mmaped, st.st_size,
-		    MREMAP_FIXED | MREMAP_MAYMOVE, ah->addr);
+  const size_t pagesz = getpagesize ();
+  size_t start = ah->mmaped & ~(pagesz - 1);
+  void *p = mmap64 (ah->addr + start, st.st_size - start,
+		    PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
+		    ah->fd, start);
   if (p == MAP_FAILED)
-    return false;
+    {
+      ah->mmaped = start;
+      return false;
+    }
 
   ah->mmaped = st.st_size;
   return true;
@@ -312,14 +318,15 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
     error (EXIT_FAILURE, errno, _("cannot map locale archive file"));
 
   if (st.st_size < ah->reserved)
-    ah->addr = mremap (ah->addr, ah->mmaped, st.st_size,
-		       MREMAP_MAYMOVE | MREMAP_FIXED, ah->addr);
+    ah->addr = mmap64 (ah->addr, st.st_size, PROT_READ | PROT_WRITE,
+		       MAP_SHARED | MAP_FIXED, ah->fd, 0);
   else
     {
       munmap (ah->addr, ah->reserved);
       ah->addr = mmap64 (NULL, st.st_size, PROT_READ | PROT_WRITE,
 			 MAP_SHARED, ah->fd, 0);
       ah->reserved = st.st_size;
+      head = ah->addr;
     }
   if (ah->addr == MAP_FAILED)
     goto enomap;
@@ -384,8 +391,22 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
       error (EXIT_FAILURE, errval, _("cannot resize archive file"));
     }
 
+  /* To prepare for enlargements of the mmaped area reserve some
+     address space.  */
+  size_t reserved = RESERVE_MMAP_SIZE;
+  int xflags = 0;
+  if (total < reserved
+      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+		       -1, 0)) != MAP_FAILED))
+    xflags = MAP_FIXED;
+  else
+    {
+      p = NULL;
+      reserved = total;
+    }
+
   /* Map the header and all the administration data structures.  */
-  p = mmap64 (NULL, total, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
   if (p == MAP_FAILED)
     {
       int errval = errno;
@@ -404,7 +425,7 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
   new_ah.mmaped = total;
   new_ah.addr = p;
   new_ah.fd = fd;
-  new_ah.reserved = total;
+  new_ah.reserved = reserved;
 
   /* Walk through the hash name hash table to find out what data is
      still referenced and transfer it into the new file.  */
@@ -593,8 +614,8 @@ open_archive (struct locarhandle *ah, bool readonly)
   int xflags = 0;
   void *p;
   if (st.st_size < reserved
-      && ((p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_ANON, -1, 0))
-	  != MAP_FAILED))
+      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+		       -1, 0)) != MAP_FAILED))
     xflags = MAP_FIXED;
   else
     {
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index c13533b4ff..332918f0e7 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,34 @@
+2009-03-08  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* locales/cs.CZ: Change week[2] to 19971130, change first_weekday and
+	first_workday to 2.
+	* locales/da_DK: Likewise.
+	* locales/de_DE: Likewise.
+	* locales/fr_FR: Likewise.
+	* locales/fur_IT: Likewise.
+	* locales/fy_DE: Likewise.
+	* locales/ht_HT: Likewise.
+	* locales/hu_HU: Likewise.
+	* locales/li_BE: Likewise.
+	* locales/li_NL: Likewise.
+	* locales/mk_MK: Likewise.
+	* locales/nb_NO: Likewise.
+	* locales/nds_DE: Likewise.
+	* locales/nds_NL: Likewise.
+	* locales/nn_NO: Likewise.
+	* locales/pl_PL: Likewise.
+	* locales/sc_IT: Likewise.
+	* locales/sk_SK: Likewise.
+	* locales/uk_UA: Likewise.
+
+	* locales/csb_PL: Change week[2] to 19971130.
+	* locales/en_GB: Likewise.
+	* locales/et_EE: Likewise.
+
+	* locales/sr_ME: Set week to 7;19971130;4.
+	* locales/sr_RS: Likewise.
+	* locales/sr_RS@latin: Likewise.
+
 2009-04-22  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #9963]
diff --git a/localedata/locales/cs_CZ b/localedata/locales/cs_CZ
index 640c8f836d..2f25e9a8f6 100644
--- a/localedata/locales/cs_CZ
+++ b/localedata/locales/cs_CZ
@@ -2438,9 +2438,9 @@ abmon		"<U006C><U0065><U0064>";/
 %		"<U004E><U006F><U0076>";/
 %		"<U0044><U0065><U0063>"
 
-week		7;19971201;4
-first_weekday	1
-first_workday	1
+week		7;19971130;4
+first_weekday	2
+first_workday	2
 
 d_t_fmt		"<U0025><U0061><U00A0><U0025><U002D><U0064><U002E><U00A0><U0025><U0042><U00A0><U0025><U0059><U002C><U00A0><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U00A0><U0025><U005A>"
 
diff --git a/localedata/locales/csb_PL b/localedata/locales/csb_PL
index 663fd6cf8d..93c9ae2eb7 100644
--- a/localedata/locales/csb_PL
+++ b/localedata/locales/csb_PL
@@ -184,7 +184,7 @@ t_fmt_ampm ""
 date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week    7;19971201;4
+week    7;19971130;4
 first_weekday 2
 first_workday 2
 END LC_TIME
diff --git a/localedata/locales/da_DK b/localedata/locales/da_DK
index 2c8a41a963..c4b451db9c 100644
--- a/localedata/locales/da_DK
+++ b/localedata/locales/da_DK
@@ -209,9 +209,9 @@ t_fmt_ampm  ""
 date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week    7;19971201;4
-first_weekday 1
-first_workday 1
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_MESSAGES
diff --git a/localedata/locales/de_DE b/localedata/locales/de_DE
index b040923ead..eac517a578 100644
--- a/localedata/locales/de_DE
+++ b/localedata/locales/de_DE
@@ -155,9 +155,9 @@ date_fmt	"<U0025><U0061><U0020><U0025><U002D><U0064><U002E><U0020>/
 <U0025><U0062><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
 <U0020><U0025><U005A><U0020><U0025><U0059>"
 
-week    7;19971201;4
-first_weekday 1
-first_workday 1
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_MESSAGES
diff --git a/localedata/locales/en_GB b/localedata/locales/en_GB
index cefa08b6c4..32a4e6cbae 100644
--- a/localedata/locales/en_GB
+++ b/localedata/locales/en_GB
@@ -121,7 +121,7 @@ t_fmt_ampm  "<U0025><U006C><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U00
 date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week    7;19971201;4
+week    7;19971130;4
 first_weekday 2
 first_workday 2
 END LC_TIME
diff --git a/localedata/locales/et_EE b/localedata/locales/et_EE
index e4bfcd5570..efec335e05 100644
--- a/localedata/locales/et_EE
+++ b/localedata/locales/et_EE
@@ -2196,7 +2196,7 @@ t_fmt_ampm    ""
 date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week    7;19971201;4
+week    7;19971130;4
 first_weekday 1
 first_workday 1
 END LC_TIME
diff --git a/localedata/locales/fr_FR b/localedata/locales/fr_FR
index ffa6513e6a..dd54bcf973 100644
--- a/localedata/locales/fr_FR
+++ b/localedata/locales/fr_FR
@@ -141,9 +141,9 @@ date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
 
-week    7;19971201;4
-first_weekday 1
-first_workday 1
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/fur_IT b/localedata/locales/fur_IT
index 35da38ca9d..4dab671792 100644
--- a/localedata/locales/fur_IT
+++ b/localedata/locales/fur_IT
@@ -110,9 +110,9 @@ t_fmt_ampm ""
 date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week			7;19971201;4
-first_weekday		1
-first_workday		1
+week			7;19971130;4
+first_weekday		2
+first_workday		2
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/fy_DE b/localedata/locales/fy_DE
index dc4757f63d..588f3e268e 100644
--- a/localedata/locales/fy_DE
+++ b/localedata/locales/fy_DE
@@ -127,7 +127,7 @@ d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
diff --git a/localedata/locales/ht_HT b/localedata/locales/ht_HT
index 37ba0a56b7..8ec865d1ce 100644
--- a/localedata/locales/ht_HT
+++ b/localedata/locales/ht_HT
@@ -139,9 +139,9 @@ date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0045>/
 <U0020><U0025><U0068><U003A><U0025><U006D><U003A><U0025><U0073><U0020>/
 <U0025><U005A><U0020><U0025><U0079>"
 
-week    7;19971201;4
-first_weekday 1
-first_workday 1
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/hu_HU b/localedata/locales/hu_HU
index 6948df4bf5..8fce6e40a7 100644
--- a/localedata/locales/hu_HU
+++ b/localedata/locales/hu_HU
@@ -520,9 +520,9 @@ am_pm   "";""
 t_fmt_ampm "<U0025><U0048><U002E><U0025><U004D><U002E><U0025><U0053>"
 date_fmt "<U0025><U0059><U002E><U0020><U0025><U0062><U002E><U0020><U0025><U0065><U002E><U002C>/
 <U0020><U0025><U0041><U002C><U0020><U0025><U0048><U002E><U0025><U004D><U002E><U0025><U0053><U0020><U0025><U005A>"
-week     7;19971201;4
-first_weekday	1
-first_workday	1
+week     7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/li_BE b/localedata/locales/li_BE
index eea6bdbab8..7896092a75 100644
--- a/localedata/locales/li_BE
+++ b/localedata/locales/li_BE
@@ -126,7 +126,7 @@ d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
diff --git a/localedata/locales/li_NL b/localedata/locales/li_NL
index 21c5044904..d0a710a7a0 100644
--- a/localedata/locales/li_NL
+++ b/localedata/locales/li_NL
@@ -127,7 +127,7 @@ d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
diff --git a/localedata/locales/mk_MK b/localedata/locales/mk_MK
index 3157b4940d..8c137a6502 100644
--- a/localedata/locales/mk_MK
+++ b/localedata/locales/mk_MK
@@ -85,9 +85,9 @@ t_fmt_ampm ""
 date_fmt "<U0025><U0061><U002C><U0020><U0025><U0064><U0020><U0025><U0062>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week    7;19971201;4
-first_weekday 1 % Monday
-first_workday 1 % Monday
+week    7;19971130;4
+first_weekday 2 % Monday
+first_workday 2 % Monday
 END LC_TIME
 
 LC_MONETARY
diff --git a/localedata/locales/nb_NO b/localedata/locales/nb_NO
index 2604676739..e4916438c6 100644
--- a/localedata/locales/nb_NO
+++ b/localedata/locales/nb_NO
@@ -201,9 +201,9 @@ date_fmt       "<U0025><U0061><U0020><U0025><U0064><U002E><U0020><U0025>/
 <U0062><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
 <U0020><U0025><U007A><U0020><U0025><U0059>"
 
-week    7;19971201;4
-first_weekday 1
-first_workday 1
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_MESSAGES
diff --git a/localedata/locales/nds_DE b/localedata/locales/nds_DE
index 5c37f317b5..02c1b1a451 100644
--- a/localedata/locales/nds_DE
+++ b/localedata/locales/nds_DE
@@ -125,7 +125,7 @@ d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
diff --git a/localedata/locales/nds_NL b/localedata/locales/nds_NL
index 51ac58329d..38579472df 100644
--- a/localedata/locales/nds_NL
+++ b/localedata/locales/nds_NL
@@ -124,7 +124,7 @@ d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
diff --git a/localedata/locales/nn_NO b/localedata/locales/nn_NO
index ea223398bf..50950673c5 100644
--- a/localedata/locales/nn_NO
+++ b/localedata/locales/nn_NO
@@ -128,9 +128,9 @@ date_fmt       "<U0025><U0061><U0020><U0025><U0064><U002E><U0020><U0025>/
 <U0062><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
 <U0020><U0025><U007A><U0020><U0025><U0059>"
 
-week    7;19971201;4
-first_weekday 1
-first_workday 1
+week    7;19971130;4
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 
diff --git a/localedata/locales/pl_PL b/localedata/locales/pl_PL
index 37f9e5c5cd..1bce8f5b30 100644
--- a/localedata/locales/pl_PL
+++ b/localedata/locales/pl_PL
@@ -2196,9 +2196,9 @@ t_fmt_ampm ""
 date_fmt "<U0025><U0061><U002C><U0020>/
 <U0025><U002D><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U002C><U0020>/
 <U0025><U0054><U0020><U0025><U005A>"
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/sc_IT b/localedata/locales/sc_IT
index 0309d56f63..f0b99d292d 100644
--- a/localedata/locales/sc_IT
+++ b/localedata/locales/sc_IT
@@ -110,9 +110,9 @@ t_fmt_ampm ""
 date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
-week	7;19971201;4
-first_weekday	1
-first_workday	1
+week	7;19971130;4
+first_weekday	2
+first_workday	2
 END LC_TIME
 
 LC_PAPER
diff --git a/localedata/locales/sk_SK b/localedata/locales/sk_SK
index 6a458582a7..0b737a0b1f 100644
--- a/localedata/locales/sk_SK
+++ b/localedata/locales/sk_SK
@@ -183,9 +183,9 @@ date_fmt       "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
 
-week		7;19971201;4
-first_weekday	1
-first_workday	1
+week		7;19971130;4
+first_weekday	2
+first_workday	2
 
 END LC_TIME
 
diff --git a/localedata/locales/sr_ME b/localedata/locales/sr_ME
index ed12002e54..231efb111e 100644
--- a/localedata/locales/sr_ME
+++ b/localedata/locales/sr_ME
@@ -120,7 +120,7 @@ t_fmt_ampm "<U0025><U0054>"
 date_fmt  "<U0025><U0061><U002c><U0020><U0025><U0065><U002E><U0020>/
 <U0025><U0062><U0020><U0025><U0059><U002E><U0020><U0020><U0025><U0048>/
 <U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U000A>"
-% week    7;19971201;4
+week    7;19971130;4
 first_weekday 2
 first_workday 2
 END LC_TIME
diff --git a/localedata/locales/sr_RS b/localedata/locales/sr_RS
index 90d54aa2e7..3028e35707 100644
--- a/localedata/locales/sr_RS
+++ b/localedata/locales/sr_RS
@@ -301,7 +301,7 @@ t_fmt_ampm "<U0025><U0054>"
 date_fmt  "<U0025><U0061><U002C><U0020><U0025><U0065><U002E><U0020>/
 <U0025><U0062><U0020><U0025><U0059><U002E><U0020><U0020><U0025><U0048>/
 <U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U000A>"
-% week    7;19971201;4
+week    7;19971130;4
 first_weekday 2
 first_workday 2
 END LC_TIME
diff --git a/localedata/locales/sr_RS@latin b/localedata/locales/sr_RS@latin
index 207f515180..6bc402a85f 100644
--- a/localedata/locales/sr_RS@latin
+++ b/localedata/locales/sr_RS@latin
@@ -121,7 +121,7 @@ t_fmt_ampm "<U0025><U0054>"
 date_fmt  "<U0025><U0061><U002c><U0020><U0025><U0065><U002E><U0020>/
 <U0025><U0062><U0020><U0025><U0059><U002E><U0020><U0020><U0025><U0048>/
 <U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U000A>"
-% week    7;19971201;4
+week    7;19971130;4
 first_weekday 2
 first_workday 2
 END LC_TIME
diff --git a/localedata/locales/uk_UA b/localedata/locales/uk_UA
index 80f1f7b6b1..b5f5381317 100644
--- a/localedata/locales/uk_UA
+++ b/localedata/locales/uk_UA
@@ -901,7 +901,9 @@ LC_TIME
 %
 % ISO 8601 conforming applications should use the values 7, 19971201 (a
 % Monday), and 4 (Thursday), respectively.
-week 7;19971201;4
+% week 7;19971201;4
+% But see BUG below.
+week 7;19971130;4
 
 % A list of abbreviated weekday names. (%a)
 %
@@ -1015,10 +1017,10 @@ am_pm     "";""
 
 % Define the first day of the week to be displayed in a calendar.
 % This weekday is relative to the date defined in the <week> keyword.
-first_weekday 1
+first_weekday 2
 
 % Define the first workday relative to the <week> keyword
-first_workday 1
+first_workday 2
 
 % Zymovyj CHas (winter time) or z.ch. (or nothing)
 % Litnij CHas (summer time) or l.ch.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 6d9a3ec6cb..8c5727ca27 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1997.
 
@@ -1993,9 +1993,15 @@ cos_test (void)
 
   TEST_f_f (cos, 0, 1);
   TEST_f_f (cos, minus_zero, 1);
+  errno = 0;
   TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for cos(+inf) == EDOM", errno, EDOM, 0, 0, 0);
+  errno = 0;
   TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for cos(-inf) == EDOM", errno, EDOM, 0, 0, 0);
+  errno = 0;
   TEST_f_f (cos, nan_value, nan_value);
+  check_int ("errno for cos(NaN) unchanged", errno, 0, 0, 0, 0);
 
   TEST_f_f (cos, M_PI_6l * 2.0, 0.5);
   TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
@@ -2877,11 +2883,17 @@ fmod_test (void)
   TEST_ff_f (fmod, minus_zero, 3, minus_zero);
 
   /* fmod (+inf, y) == NaN plus invalid exception.  */
+  errno = 0;
   TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for fmod(Inf,3) unchanged", errno, EDOM, 0, 0, 0);
   /* fmod (-inf, y) == NaN plus invalid exception.  */
+  errno = 0;
   TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for fmod(-Inf,3) unchanged", errno, EDOM, 0, 0, 0);
   /* fmod (x, +0) == NaN plus invalid exception.  */
+  errno = 0;
   TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for fmod(3,0) unchanged", errno, EDOM, 0, 0, 0);
   /* fmod (x, -0) == NaN plus invalid exception.  */
   TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
 
@@ -3241,7 +3253,9 @@ lgamma_test (void)
   TEST_f_f (lgamma, nan_value, nan_value);
 
   /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0.  */
+  errno = 0;
   TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for lgamma(-integer) == ERANGE", errno, ERANGE, 0, 0, 0);
   TEST_f_f (lgamma, minus_infty, plus_infty);
 
   TEST_f_f1 (lgamma, 1, 0, 1);
@@ -4728,15 +4742,31 @@ pow_test (void)
   TEST_ff_f (pow, -10.1L, 1.1L, nan_value, INVALID_EXCEPTION);
   TEST_ff_f (pow, -10.1L, -1.1L, nan_value, INVALID_EXCEPTION);
 
+  errno = 0;
   TEST_ff_f (pow, 0, -1, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
+  errno = 0;
   TEST_ff_f (pow, 0, -11, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
+  errno = 0;
   TEST_ff_f (pow, minus_zero, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
-  TEST_ff_f (pow, minus_zero, -11, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
+  errno = 0;
+  TEST_ff_f (pow, minus_zero, -11L, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(-0,-odd) == ERANGE", errno, ERANGE, 0, 0, 0);
 
+  errno = 0;
   TEST_ff_f (pow, 0, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
+  errno = 0;
   TEST_ff_f (pow, 0, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
+  errno = 0;
   TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(-0,-even) == ERANGE", errno, ERANGE, 0, 0, 0);
+  errno = 0;
   TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+  check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0);
 
   TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
   TEST_ff_f (pow, 10, -0x1p72L, 0);
@@ -4749,11 +4779,9 @@ pow_test (void)
   TEST_ff_f (pow, minus_zero, 1, minus_zero);
   TEST_ff_f (pow, minus_zero, 11, minus_zero);
 
-
   TEST_ff_f (pow, 0, 2, 0);
   TEST_ff_f (pow, 0, 11.1L, 0);
 
-
   TEST_ff_f (pow, minus_zero, 2, 0);
   TEST_ff_f (pow, minus_zero, 11.1L, 0);
   TEST_ff_f (pow, 0, plus_infty, 0);
@@ -5495,9 +5523,15 @@ sin_test (void)
 
   TEST_f_f (sin, 0, 0);
   TEST_f_f (sin, minus_zero, minus_zero);
+  errno = 0;
   TEST_f_f (sin, plus_infty, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for sin(+inf) == EDOM", errno, EDOM, 0, 0, 0);
+  errno = 0;
   TEST_f_f (sin, minus_infty, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for sin(-inf) == EDOM", errno, EDOM, 0, 0, 0);
+  errno = 0;
   TEST_f_f (sin, nan_value, nan_value);
+  check_int ("errno for sin(NaN) unchanged", errno, 0, 0, 0, 0);
 
   TEST_f_f (sin, M_PI_6l, 0.5);
   TEST_f_f (sin, -M_PI_6l, -0.5);
@@ -5619,9 +5653,15 @@ tan_test (void)
 
   TEST_f_f (tan, 0, 0);
   TEST_f_f (tan, minus_zero, minus_zero);
+  errno = 0;
   TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for tan(Inf) == EDOM", errno, EDOM, 0, 0, 0);
+  errno = 0;
   TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
+  check_int ("errno for tan(-Inf) == EDOM", errno, EDOM, 0, 0, 0);
+  errno = 0;
   TEST_f_f (tan, nan_value, nan_value);
+  check_int ("errno for tan(NaN) == 0", errno, 0, 0, 0, 0);
 
   TEST_f_f (tan, M_PI_4l, 1);
   TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
diff --git a/math/w_fmod.c b/math/w_fmod.c
index 43a1d8ef5c..ca01cf2ac5 100644
--- a/math/w_fmod.c
+++ b/math/w_fmod.c
@@ -35,8 +35,9 @@ static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
 	double z;
 	z = __ieee754_fmod(x,y);
 	if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
-	if(y==0.0) {
-	        return __kernel_standard(x,y,27); /* fmod(x,0) */
+	if(__isinf(x)||y==0.0) {
+		/* fmod(+-Inf,y) or fmod(x,0) */
+	        return __kernel_standard(x,y,27);
 	} else
 	    return z;
 #endif
diff --git a/math/w_fmodf.c b/math/w_fmodf.c
index 2bd133f2d7..e2e869a3cc 100644
--- a/math/w_fmodf.c
+++ b/math/w_fmodf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -17,7 +17,7 @@
 static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
 #endif
 
-/* 
+/*
  * wrapper fmodf(x,y)
  */
 
@@ -38,8 +38,8 @@ static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
 	float z;
 	z = __ieee754_fmodf(x,y);
 	if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
-	if(y==(float)0.0) {
-		/* fmodf(x,0) */
+	if(__isinff(x)||y==(float)0.0) {
+		/* fmodf(+-Inf,y) or fmodf(x,0) */
 	        return (float)__kernel_standard((double)x,(double)y,127);
 	} else
 	    return z;
diff --git a/math/w_fmodl.c b/math/w_fmodl.c
index 7b9a297cfd..c39b2852f6 100644
--- a/math/w_fmodl.c
+++ b/math/w_fmodl.c
@@ -39,8 +39,9 @@ static char rcsid[] = "$NetBSD: $";
 	long double z;
 	z = __ieee754_fmodl(x,y);
 	if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
-	if(y==0.0) {
-	        return __kernel_standard(x,y,227); /* fmod(x,0) */
+	if(__isinfl(x)||y==0.0) {
+		/* fmodl(+-Inf,y) or fmodl(x,0) */
+	        return __kernel_standard(x,y,227);
 	} else
 	    return z;
 #endif
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 6015f40737..0a928a91b9 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* sem_open.c (sem_open): Rewrite initialization of initsem to
+	avoid warnings.
+
+	* sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
+	Avoid warning by using may_alias attribute on ptrhack.
+
 2009-04-22  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #10090]
diff --git a/nptl/sem_open.c b/nptl/sem_open.c
index e58dde9472..4e603491c0 100644
--- a/nptl/sem_open.c
+++ b/nptl/sem_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -302,15 +302,18 @@ sem_open (const char *name, int oflag, ...)
 	}
 
       /* Create the initial file content.  */
-      sem_t initsem;
+      union
+      {
+	sem_t initsem;
+	struct new_sem newsem;
+      } sem;
 
-      struct new_sem *iinitsem = (struct new_sem *) &initsem;
-      iinitsem->value = value;
-      iinitsem->private = 0;
-      iinitsem->nwaiters = 0;
+      sem.newsem.value = value;
+      sem.newsem.private = 0;
+      sem.newsem.nwaiters = 0;
 
       /* Initialize the remaining bytes as well.  */
-      memset ((char *) &initsem + sizeof (struct new_sem), '\0',
+      memset ((char *) &sem.initsem + sizeof (struct new_sem), '\0',
 	      sizeof (sem_t) - sizeof (struct new_sem));
 
       tmpfname = (char *) alloca (mountpoint.dirlen + 6 + 1);
@@ -349,7 +352,7 @@ sem_open (const char *name, int oflag, ...)
 	  break;
 	}
 
-      if (TEMP_FAILURE_RETRY (__libc_write (fd, &initsem, sizeof (sem_t)))
+      if (TEMP_FAILURE_RETRY (__libc_write (fd, &sem.initsem, sizeof (sem_t)))
 	  == sizeof (sem_t)
 	  /* Map the sem_t structure from the file.  */
 	  && (result = (sem_t *) mmap (NULL, sizeof (sem_t),
diff --git a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
index 4b614bd1a6..8924c4f450 100644
--- a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
+++ b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2005,2006,2007,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -56,10 +56,10 @@ __libc_pthread_init (ptr, reclaim, functions)
   union ptrhack
   {
     struct pthread_functions pf;
-    void *parr[1];
-  } const *src;
-  union ptrhack *dest;
 # define NPTRS (sizeof (struct pthread_functions) / sizeof (void *))
+    void *parr[NPTRS];
+  } __attribute__ ((may_alias)) const *src;
+  union ptrhack *dest;
 
   src = (const void *) functions;
   dest = (void *) &__libc_pthread_functions;
diff --git a/nscd/connections.c b/nscd/connections.c
index 234e289f00..ca73393f40 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1023,7 +1023,8 @@ send_ro_fd (struct database_dyn *db, char *key, int fd)
   cmsg->cmsg_type = SCM_RIGHTS;
   cmsg->cmsg_len = CMSG_LEN (sizeof (int));
 
-  *(int *) CMSG_DATA (cmsg) = db->ro_fd;
+  int *ip = (int *) CMSG_DATA (cmsg);
+  *ip = db->ro_fd;
 
   msg.msg_controllen = cmsg->cmsg_len;
 
@@ -1719,6 +1720,7 @@ handle_request: request received (Version = %d)"), req.version);
       /* One more thread available.  */
       ++nready;
     }
+  /* NOTREACHED */
 }
 
 
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 7db5d09845..cd3fa24196 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -318,7 +318,7 @@ get_mapping (request_type type, const char *key,
 
   /* This access is well-aligned since BUF is correctly aligned for an
      int and CMSG_DATA preserves this alignment.  */
-  *(int *) CMSG_DATA (cmsg) = -1;
+  memset (CMSG_DATA (cmsg), '\xff', sizeof (int));
 
   msg.msg_controllen = cmsg->cmsg_len;
 
@@ -335,7 +335,8 @@ get_mapping (request_type type, const char *key,
 			    != CMSG_LEN (sizeof (int))), 0))
     goto out_close2;
 
-  mapfd = *(int *) CMSG_DATA (cmsg);
+  int *ip = (void *) CMSG_DATA (cmsg);
+  mapfd = *ip;
 
   if (__builtin_expect (n != keylen && n != keylen + sizeof (mapsize), 0))
     goto out_close;
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index c0b661feb3..da94ca9838 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2001-2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -300,8 +300,11 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
 
   found = __tsearch (&fct_name, &ni->known, &known_compare);
   if (*found != &fct_name)
-    /* The search found an existing structure in the tree.  */
-    result = ((known_function *) *found)->fct_ptr;
+    {
+      /* The search found an existing structure in the tree.  */
+      result = ((known_function *) *found)->fct_ptr;
+      PTR_DEMANGLE (result);
+    }
   else
     {
       /* This name was not known before.  Now we have a node in the tree
@@ -424,6 +427,7 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
 	  /* Remember function pointer for later calls.  Even if null, we
 	     record it so a second try needn't search the library again.  */
 	  known->fct_ptr = result;
+	  PTR_MANGLE (known->fct_ptr);
 	}
     }
 
diff --git a/posix/bits/posix1_lim.h b/posix/bits/posix1_lim.h
index 71c58f7605..a0eb4329cb 100644
--- a/posix/bits/posix1_lim.h
+++ b/posix/bits/posix1_lim.h
@@ -87,9 +87,11 @@
 # define _POSIX_OPEN_MAX	16
 #endif
 
+#if !defined __USE_XOPEN2K || defined __USE_GNU
 /* Number of descriptors that a process may examine with `pselect' or
    `select'.  */
-#define	_POSIX_FD_SETSIZE	_POSIX_OPEN_MAX
+# define _POSIX_FD_SETSIZE	_POSIX_OPEN_MAX
+#endif
 
 /* Number of bytes in a pathname.  */
 #define	_POSIX_PATH_MAX		256
@@ -135,15 +137,17 @@
 /* Maximum length of a timezone name (element of `tzname').  */
 #define	_POSIX_TZNAME_MAX	6
 
+#if !defined __USE_XOPEN2K || defined __USE_GNU
 /* Maximum number of connections that can be queued on a socket.  */
-#define	_POSIX_QLIMIT		1
+# define _POSIX_QLIMIT		1
 
 /* Maximum number of bytes that can be buffered on a socket for send
    or receive.  */
-#define	_POSIX_HIWAT		_POSIX_PIPE_BUF
+# define _POSIX_HIWAT		_POSIX_PIPE_BUF
 
 /* Maximum number of elements in an `iovec' array.  */
-#define	_POSIX_UIO_MAXIOV	16
+# define _POSIX_UIO_MAXIOV	16
+#endif
 
 /* Maximum clock resolution in nanoseconds.  */
 #define _POSIX_CLOCKRES_MIN	20000000
diff --git a/stdio-common/isoc99_vsscanf.c b/stdio-common/isoc99_vsscanf.c
index f10919c79a..b11cf603d3 100644
--- a/stdio-common/isoc99_vsscanf.c
+++ b/stdio-common/isoc99_vsscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2003, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1997-2003,2006,2007,2009 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
@@ -38,10 +38,10 @@ __isoc99_vsscanf (const char *string, const char *format, _IO_va_list args)
   sf._sbf._f._lock = NULL;
 #endif
   _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
-  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
   _IO_str_init_static_internal (&sf, (char*)string, 0, NULL);
   sf._sbf._f._flags2 |= _IO_FLAGS2_SCANF_STD;
-  ret = INTUSE(_IO_vfscanf) ((_IO_FILE *) &sf._sbf, format, args, NULL);
+  ret = INTUSE(_IO_vfscanf) (&sf._sbf._f, format, args, NULL);
   return ret;
 }
 libc_hidden_def (__isoc99_vsscanf)
diff --git a/stdio-common/stdio_lim.h.in b/stdio-common/stdio_lim.h.in
index bb496c59de..a827255790 100644
--- a/stdio-common/stdio_lim.h.in
+++ b/stdio-common/stdio_lim.h.in
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1998, 1999, 2009 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
@@ -27,7 +27,9 @@
 
 # ifdef __USE_POSIX
 #  define L_ctermid @L_ctermid@
-#  define L_cuserid @L_cuserid@
+#  if !defined __USE_XOPEN2K || defined __USE_GNU
+#   define L_cuserid @L_cuserid@
+#  endif
 # endif
 #endif
 
diff --git a/stdlib/strfmon_l.c b/stdlib/strfmon_l.c
index 8e63d459e3..eb7a17801a 100644
--- a/stdlib/strfmon_l.c
+++ b/stdlib/strfmon_l.c
@@ -90,9 +90,6 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
 {
   struct locale_data *current = loc->__locales[LC_MONETARY];
   _IO_strfile f;
-#ifdef _IO_MTSAFE_IO
-  _IO_lock_t lock;
-#endif
   struct printf_info info;
   char *dest;			/* Pointer so copy the output.  */
   const char *fmt;		/* Pointer that walks through format.  */
@@ -517,11 +514,11 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
 
       /* Print the number.  */
 #ifdef _IO_MTSAFE_IO
-      f._sbf._f._lock = &lock;
+      f._sbf._f._lock = NULL;
 #endif
-      INTUSE(_IO_init) ((_IO_FILE *) &f, 0);
-      _IO_JUMPS ((struct _IO_FILE_plus *) &f) = &_IO_str_jumps;
-      INTUSE(_IO_str_init_static) ((_IO_strfile *) &f, dest,
+      INTUSE(_IO_init) (&f._sbf._f, 0);
+      _IO_JUMPS (&f._sbf) = &_IO_str_jumps;
+      INTUSE(_IO_str_init_static) (&f, dest,
 				   (s + maxsize) - dest, dest);
       /* We clear the last available byte so we can find out whether
 	 the numeric representation is too long.  */
@@ -537,7 +534,7 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
       info.extra = 1;		/* This means use values from LC_MONETARY.  */
 
       ptr = &fpnum;
-      done = __printf_fp ((FILE *) &f, &info, &ptr);
+      done = __printf_fp (&f._sbf._f, &info, &ptr);
       if (done < 0)
 	return -1;
 
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index 09a8f9bb3b..9ddfa3fa66 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -1,5 +1,5 @@
 /* Convert string representing a number to float value, using given locale.
-   Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008
+   Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -232,6 +232,7 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
 # define DENORM_EXP (MIN_EXP - 2)
 #endif
       exponent = DENORM_EXP;
+      __set_errno (ERANGE);
     }
 
   if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c
index 628e40ca39..c30eb1ee12 100644
--- a/stdlib/tst-strtod.c
+++ b/stdlib/tst-strtod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,96,97,98,99,2000,2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1996-2001,2003,2009 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
@@ -61,10 +61,10 @@ static const struct ltest tests[] =
     { "0x00.0014p19", 160.0, '\0', 0 },
     { "0x1p-1023",
       1.11253692925360069154511635866620203210960799023116591527666e-308,
-      '\0', 0 },
+      '\0', ERANGE },
     { "0x0.8p-1022",
       1.11253692925360069154511635866620203210960799023116591527666e-308,
-      '\0', 0 },
+      '\0', ERANGE },
 #if __GNUC_PREREQ(2,96)
     /* For older GCC release HUGE_VAL is not a constant.  */
     { "Inf", HUGE_VAL, '\0', 0 },
diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c
index 44ea03efb7..74d90c8051 100644
--- a/sunrpc/clnt_raw.c
+++ b/sunrpc/clnt_raw.c
@@ -57,7 +57,11 @@ struct clntraw_private_s
     CLIENT client_object;
     XDR xdr_stream;
     char _raw_buf[UDPMSGSIZE];
-    char mashl_callmsg[MCALL_MSG_SIZE];
+    union
+    {
+      char msg[MCALL_MSG_SIZE];
+      u_long rm_xid;
+    } mashl_callmsg;
     u_int mcnt;
   };
 #ifdef _RPC_THREAD_SAFE_
@@ -111,7 +115,8 @@ clntraw_create (u_long prog, u_long vers)
   call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
   call_msg.rm_call.cb_prog = prog;
   call_msg.rm_call.cb_vers = vers;
-  INTUSE(xdrmem_create) (xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
+  INTUSE(xdrmem_create) (xdrs, clp->mashl_callmsg.msg, MCALL_MSG_SIZE,
+			 XDR_ENCODE);
   if (!INTUSE(xdr_callhdr) (xdrs, &call_msg))
     {
       perror (_ ("clnt_raw.c: fatal header serialization error"));
@@ -156,8 +161,11 @@ call_again:
    */
   xdrs->x_op = XDR_ENCODE;
   XDR_SETPOS (xdrs, 0);
-  ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++;
-  if ((!XDR_PUTBYTES (xdrs, clp->mashl_callmsg, clp->mcnt)) ||
+  /* Just checking the union definition to access rm_xid is correct.  */
+  if (offsetof (struct rpc_msg, rm_xid) != 0)
+    abort ();
+  clp->mashl_callmsg.rm_xid++;
+  if ((!XDR_PUTBYTES (xdrs, clp->mashl_callmsg.msg, clp->mcnt)) ||
       (!XDR_PUTLONG (xdrs, (long *) &proc)) ||
       (!AUTH_MARSHALL (h->cl_auth, xdrs)) ||
       (!(*xargs) (xdrs, argsp)))
diff --git a/sysdeps/i386/fpu/s_cos.S b/sysdeps/i386/fpu/s_cos.S
index ac8b1459d9..d341d008c5 100644
--- a/sysdeps/i386/fpu/s_cos.S
+++ b/sysdeps/i386/fpu/s_cos.S
@@ -1,15 +1,24 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  * Public domain.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: s_cos.S,v 1.5 1995/05/08 23:54:00 jtc Exp $")
 
 ENTRY(__cos)
 	fldl	4(%esp)
-	fcos
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fcos
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -25,5 +34,21 @@ ENTRY(__cos)
 	fstp	%st(1)
 	fcos
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__cos)
 weak_alias (__cos, cos)
diff --git a/sysdeps/i386/fpu/s_cosf.S b/sysdeps/i386/fpu/s_cosf.S
index 21f87aa874..578967ad3c 100644
--- a/sysdeps/i386/fpu/s_cosf.S
+++ b/sysdeps/i386/fpu/s_cosf.S
@@ -1,15 +1,24 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  * Public domain.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $")
 
 ENTRY(__cosf)
 	flds	4(%esp)
-	fcos
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fcos
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -25,5 +34,21 @@ ENTRY(__cosf)
 	fstp	%st(1)
 	fcos
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__cosf)
 weak_alias (__cosf, cosf)
diff --git a/sysdeps/i386/fpu/s_cosl.S b/sysdeps/i386/fpu/s_cosl.S
index 61c9010c99..27dd74f21b 100644
--- a/sysdeps/i386/fpu/s_cosl.S
+++ b/sysdeps/i386/fpu/s_cosl.S
@@ -3,15 +3,22 @@
  * Public domain.
  *
  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
-RCSID("$NetBSD: $")
-
 ENTRY(__cosl)
 	fldt	4(%esp)
-	fcos
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fcos
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -27,5 +34,21 @@ ENTRY(__cosl)
 	fstp	%st(1)
 	fcos
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__cosl)
 weak_alias (__cosl, cosl)
diff --git a/sysdeps/i386/fpu/s_sin.S b/sysdeps/i386/fpu/s_sin.S
index eb22d7e98b..6b913992dc 100644
--- a/sysdeps/i386/fpu/s_sin.S
+++ b/sysdeps/i386/fpu/s_sin.S
@@ -1,15 +1,24 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  * Public domain.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $")
 
 ENTRY(__sin)
 	fldl	4(%esp)
-	fsin
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fsin
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -25,5 +34,21 @@ ENTRY(__sin)
 	fstp	%st(1)
 	fsin
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__sin)
 weak_alias (__sin, sin)
diff --git a/sysdeps/i386/fpu/s_sinf.S b/sysdeps/i386/fpu/s_sinf.S
index 5ca45f52e2..67621f70f2 100644
--- a/sysdeps/i386/fpu/s_sinf.S
+++ b/sysdeps/i386/fpu/s_sinf.S
@@ -1,15 +1,24 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  * Public domain.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: s_sinf.S,v 1.3 1995/05/09 00:27:53 jtc Exp $")
 
 ENTRY(__sinf)
 	flds	4(%esp)
-	fsin
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fsin
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -25,5 +34,21 @@ ENTRY(__sinf)
 	fstp	%st(1)
 	fsin
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__sinf)
 weak_alias (__sinf, sinf)
diff --git a/sysdeps/i386/fpu/s_sinl.S b/sysdeps/i386/fpu/s_sinl.S
index 3e215de5e1..68c4f99668 100644
--- a/sysdeps/i386/fpu/s_sinl.S
+++ b/sysdeps/i386/fpu/s_sinl.S
@@ -3,15 +3,22 @@
  * Public domain.
  *
  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
-RCSID("$NetBSD: $")
-
 ENTRY(__sinl)
 	fldt	4(%esp)
-	fsin
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fsin
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -27,5 +34,21 @@ ENTRY(__sinl)
 	fstp	%st(1)
 	fsin
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__sinl)
 weak_alias (__sinl, sinl)
diff --git a/sysdeps/i386/fpu/s_tan.S b/sysdeps/i386/fpu/s_tan.S
index 7b3547af4c..b35bb835de 100644
--- a/sysdeps/i386/fpu/s_tan.S
+++ b/sysdeps/i386/fpu/s_tan.S
@@ -1,15 +1,24 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  * Public domain.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: s_tan.S,v 1.5 1995/05/09 00:30:00 jtc Exp $")
 
 ENTRY(__tan)
 	fldl	4(%esp)
-	fptan
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fptan
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -26,5 +35,21 @@ ENTRY(__tan)
 	fptan
 	fstp	%st(0)
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__tan)
 weak_alias (__tan, tan)
diff --git a/sysdeps/i386/fpu/s_tanf.S b/sysdeps/i386/fpu/s_tanf.S
index 355dff9c8d..74bc22fceb 100644
--- a/sysdeps/i386/fpu/s_tanf.S
+++ b/sysdeps/i386/fpu/s_tanf.S
@@ -1,15 +1,24 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  * Public domain.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $")
 
 ENTRY(__tanf)
 	flds	4(%esp)
-	fptan
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fptan
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -26,5 +35,21 @@ ENTRY(__tanf)
 	fptan
 	fstp	%st(0)
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__tanf)
 weak_alias (__tanf, tanf)
diff --git a/sysdeps/i386/fpu/s_tanl.S b/sysdeps/i386/fpu/s_tanl.S
index f2bdd6a605..151b77113f 100644
--- a/sysdeps/i386/fpu/s_tanl.S
+++ b/sysdeps/i386/fpu/s_tanl.S
@@ -3,15 +3,22 @@
  * Public domain.
  *
  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
-RCSID("$NetBSD: $")
-
 ENTRY(__tanl)
 	fldt	4(%esp)
-	fptan
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fptan
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -28,5 +35,21 @@ ENTRY(__tanl)
 	fptan
 	fstp	%st(0)
 	ret
+3:
+#ifdef PIC
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+#else
+	call	__errno_location@PLT
+	movl	$EDOM, (%eax)
+#endif
+	jmp	4b
 END (__tanl)
 weak_alias (__tanl, tanl)
diff --git a/sysdeps/ieee754/dbl-64/s_expm1.c b/sysdeps/ieee754/dbl-64/s_expm1.c
index bfd15b2e31..324354336e 100644
--- a/sysdeps/ieee754/dbl-64/s_expm1.c
+++ b/sysdeps/ieee754/dbl-64/s_expm1.c
@@ -112,6 +112,7 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $";
  * to produce the hexadecimal values shown.
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 #define one Q[0]
@@ -159,7 +160,10 @@ Q[]  =  {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */
 		         return x+x; 	 /* NaN */
 		    else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
 	        }
-	        if(x > o_threshold) return huge*huge; /* overflow */
+	        if(x > o_threshold) {
+		  __set_errno (ERANGE);
+		  return huge*huge; /* overflow */
+		}
 	    }
 	    if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */
 		if(x+tiny<0.0)		/* raise inexact */
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 86e1a6d121..b40776f5e2 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2009 Free Software Foundation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -48,6 +48,7 @@
 /****************************************************************************/
 
 
+#include <errno.h>
 #include "endian.h"
 #include "mydefs.h"
 #include "usncs.h"
@@ -329,7 +330,11 @@ double __sin(double x){
 	}    /*   else  if (k <  0x7ff00000 )    */
 
 /*--------------------- |x| > 2^1024 ----------------------------------*/
-	else return x / x;
+	else {
+	  if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
+	    __set_errno (EDOM);
+	  return x / x;
+	}
 	return 0;         /* unreachable */
 }
 
@@ -572,7 +577,11 @@ double __cos(double x)
 
 
 
-  else return x / x; /* |x| > 2^1024 */
+  else {
+    if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
+      __set_errno (EDOM);
+    return x / x; /* |x| > 2^1024 */
+  }
   return 0;
 
 }
diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c
index cf8d4d0267..4e26d90ae1 100644
--- a/sysdeps/ieee754/dbl-64/s_tan.c
+++ b/sysdeps/ieee754/dbl-64/s_tan.c
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2009 Free Software Foundation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -33,6 +33,8 @@
 /* round to nearest mode of IEEE 754 standard.                       */
 /*                                                                   */
 /*********************************************************************/
+
+#include <errno.h>
 #include "endian.h"
 #include "dla.h"
 #include "mpa.h"
@@ -61,7 +63,11 @@ double tan(double x) {
 
   /* x=+-INF, x=NaN */
   num.d = x;  ux = num.i[HIGH_HALF];
-  if ((ux&0x7ff00000)==0x7ff00000) return x-x;
+  if ((ux&0x7ff00000)==0x7ff00000) {
+    if ((ux&0x7fffffff)==0x7ff00000)
+      __set_errno (EDOM);
+    return x-x;
+  }
 
   w=(x<ZERO) ? -x : x;
 
@@ -108,7 +114,8 @@ double tan(double x) {
     fi = xfg[i][1].d;   gi = xfg[i][2].d;   t2 = pz*(gi+fi)/(gi-pz);
     if ((y=fi+(t2-fi*u3.d))==fi+(t2+fi*u3.d))  return (s*y);
     t3 = (t2<ZERO) ? -t2 : t2;
-    if ((y=fi+(t2-(t4=fi*ua3.d+t3*ub3.d)))==fi+(t2+t4))  return (s*y);
+    t4 = fi*ua3.d+t3*ub3.d;
+    if ((y=fi+(t2-t4))==fi+(t2+t4))  return (s*y);
 
     /* Second stage */
     ffi = xfg[i][3].d;
@@ -216,13 +223,15 @@ double tan(double x) {
       t2 = pz*(fi+gi)/(fi+pz);
       if ((y=gi-(t2-gi*u10.d))==gi-(t2+gi*u10.d))  return (-sy*y);
       t3 = (t2<ZERO) ? -t2 : t2;
-      if ((y=gi-(t2-(t4=gi*ua10.d+t3*ub10.d)))==gi-(t2+t4))  return (-sy*y); }
+      t4 = gi*ua10.d+t3*ub10.d;
+      if ((y=gi-(t2-t4))==gi-(t2+t4))  return (-sy*y); }
     else   {
       /* tan */
       t2 = pz*(gi+fi)/(gi-pz);
       if ((y=fi+(t2-fi*u9.d))==fi+(t2+fi*u9.d))  return (sy*y);
       t3 = (t2<ZERO) ? -t2 : t2;
-      if ((y=fi+(t2-(t4=fi*ua9.d+t3*ub9.d)))==fi+(t2+t4))  return (sy*y); }
+      t4 = fi*ua9.d+t3*ub9.d;
+      if ((y=fi+(t2-t4))==fi+(t2+t4))  return (sy*y); }
 
     /* Second stage */
     ffi = xfg[i][3].d;
@@ -327,13 +336,15 @@ double tan(double x) {
       t2 = pz*(fi+gi)/(fi+pz);
       if ((y=gi-(t2-gi*u18.d))==gi-(t2+gi*u18.d))  return (-sy*y);
       t3 = (t2<ZERO) ? -t2 : t2;
-      if ((y=gi-(t2-(t4=gi*ua18.d+t3*ub18.d)))==gi-(t2+t4))  return (-sy*y); }
+      t4 = gi*ua18.d+t3*ub18.d;
+      if ((y=gi-(t2-t4))==gi-(t2+t4))  return (-sy*y); }
     else   {
       /* tan */
       t2 = pz*(gi+fi)/(gi-pz);
       if ((y=fi+(t2-fi*u17.d))==fi+(t2+fi*u17.d))  return (sy*y);
       t3 = (t2<ZERO) ? -t2 : t2;
-      if ((y=fi+(t2-(t4=fi*ua17.d+t3*ub17.d)))==fi+(t2+t4))  return (sy*y); }
+      t4 = fi*ua17.d+t3*ub17.d;
+      if ((y=fi+(t2-t4))==fi+(t2+t4))  return (sy*y); }
 
     /* Second stage */
     ffi = xfg[i][3].d;
@@ -431,13 +442,15 @@ double tan(double x) {
     t2 = pz*(fi+gi)/(fi+pz);
     if ((y=gi-(t2-gi*u26.d))==gi-(t2+gi*u26.d))  return (-sy*y);
     t3 = (t2<ZERO) ? -t2 : t2;
-    if ((y=gi-(t2-(t4=gi*ua26.d+t3*ub26.d)))==gi-(t2+t4))  return (-sy*y); }
+    t4 = gi*ua26.d+t3*ub26.d;
+    if ((y=gi-(t2-t4))==gi-(t2+t4))  return (-sy*y); }
   else   {
     /* tan */
     t2 = pz*(gi+fi)/(gi-pz);
     if ((y=fi+(t2-fi*u25.d))==fi+(t2+fi*u25.d))  return (sy*y);
     t3 = (t2<ZERO) ? -t2 : t2;
-    if ((y=fi+(t2-(t4=fi*ua25.d+t3*ub25.d)))==fi+(t2+t4))  return (sy*y); }
+    t4 = fi*ua25.d+t3*ub25.d;
+    if ((y=fi+(t2-t4))==fi+(t2+t4))  return (sy*y); }
 
   /* Second stage */
   ffi = xfg[i][3].d;
diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
index 86c59d440c..4f9f239f6f 100644
--- a/sysdeps/ieee754/flt-32/s_cosf.c
+++ b/sysdeps/ieee754/flt-32/s_cosf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -17,6 +17,7 @@
 static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
 #endif
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -43,7 +44,11 @@ static float one=1.0;
 	if(ix <= 0x3f490fd8) return __kernel_cosf(x,z);
 
     /* cos(Inf or NaN) is NaN */
-	else if (ix>=0x7f800000) return x-x;
+	else if (ix>=0x7f800000) {
+	  if (ix == 0x7f800000)
+	    __set_errno (EDOM);
+	  return x-x;
+	}
 
     /* argument reduction needed */
 	else {
diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c
index 1f032be25f..3f4536b906 100644
--- a/sysdeps/ieee754/flt-32/s_expm1f.c
+++ b/sysdeps/ieee754/flt-32/s_expm1f.c
@@ -17,6 +17,7 @@
 static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $";
 #endif
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -63,7 +64,10 @@ Q5  =  -2.0109921195e-07; /* 0xb457edbb */
 		    return x+x; 	 /* NaN */
 		if(hx==0x7f800000)
 		    return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
-	        if(x > o_threshold) return huge*huge; /* overflow */
+	        if(x > o_threshold) {
+		  __set_errno (ERANGE);
+		  return huge*huge; /* overflow */
+		}
 	    }
 	    if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */
 		if(x+tiny<(float)0.0)	/* raise inexact */
diff --git a/sysdeps/ieee754/flt-32/s_sinf.c b/sysdeps/ieee754/flt-32/s_sinf.c
index 76a7c21fcb..673e379f0c 100644
--- a/sysdeps/ieee754/flt-32/s_sinf.c
+++ b/sysdeps/ieee754/flt-32/s_sinf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -17,6 +17,7 @@
 static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $";
 #endif
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -37,7 +38,11 @@ static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $";
 	if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0);
 
     /* sin(Inf or NaN) is NaN */
-	else if (ix>=0x7f800000) return x-x;
+	else if (ix>=0x7f800000) {
+	  if (ix == 0x7f800000)
+	    __set_errno (EDOM);
+	  return x-x;
+	}
 
     /* argument reduction needed */
 	else {
diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c
index e8f6016c32..4a852cb1f4 100644
--- a/sysdeps/ieee754/flt-32/s_tanf.c
+++ b/sysdeps/ieee754/flt-32/s_tanf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -17,6 +17,7 @@
 static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
 #endif
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -37,7 +38,11 @@ static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
 	if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1);
 
     /* tan(Inf or NaN) is NaN */
-	else if (ix>=0x7f800000) return x-x;		/* NaN */
+	else if (ix>=0x7f800000) {
+	  if (ix==0x7f800000)
+	    __set_errno (EDOM);
+	  return x-x;		/* NaN */
+	}
 
     /* argument reduction needed */
 	else {
diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index d8fa2a4493..ede5157454 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -383,7 +383,7 @@ static double zero = 0.0;	/* used as const */
                 else
                   exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
-		  __set_errno (EDOM);
+		  __set_errno (ERANGE);
 		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("lgamma: SING error\n", 19);
@@ -528,7 +528,7 @@ static double zero = 0.0;	/* used as const */
 		else
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
-		  __set_errno (EDOM);
+		  __set_errno (ERANGE);
 		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
@@ -547,7 +547,7 @@ static double zero = 0.0;	/* used as const */
 		else
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
-		  __set_errno (EDOM);
+		  __set_errno (ERANGE);
 		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
@@ -692,7 +692,7 @@ static double zero = 0.0;	/* used as const */
 						   ? "atanhf" : "atanhl");
 		exc.retval = x/zero;	/* sign(x)*inf */
                 if (_LIB_VERSION == _POSIX_)
-                  __set_errno (EDOM);
+                  __set_errno (ERANGE);
                 else if (!matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: SING error\n", 18);
@@ -990,7 +990,7 @@ static double zero = 0.0;	/* used as const */
 		  __set_errno (ERANGE);
 		}
 		break;
-		
+
 		/* #### Last used is 50/150/250 ### */
 	}
 	return exc.retval;
diff --git a/sysdeps/ieee754/ldbl-96/s_cosl.c b/sysdeps/ieee754/ldbl-96/s_cosl.c
index 9765f7fd4e..e33abc9afd 100644
--- a/sysdeps/ieee754/ldbl-96/s_cosl.c
+++ b/sysdeps/ieee754/ldbl-96/s_cosl.c
@@ -49,6 +49,7 @@ static char rcsid[] = "$NetBSD: $";
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -71,7 +72,11 @@ static char rcsid[] = "$NetBSD: $";
 	  return __kernel_cosl(x,z);
 
     /* cos(Inf or NaN) is NaN */
-	else if (se==0x7fff) return x-x;
+	else if (se==0x7fff) {
+	  if ((i0 | i1) == 0)
+	    __set_errno (EDOM);
+	  return x-x;
+	}
 
     /* argument reduction needed */
 	else {
diff --git a/sysdeps/ieee754/ldbl-96/s_sinl.c b/sysdeps/ieee754/ldbl-96/s_sinl.c
index 4fd48805b4..b939bd6a99 100644
--- a/sysdeps/ieee754/ldbl-96/s_sinl.c
+++ b/sysdeps/ieee754/ldbl-96/s_sinl.c
@@ -49,6 +49,7 @@ static char rcsid[] = "$NetBSD: $";
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -71,7 +72,11 @@ static char rcsid[] = "$NetBSD: $";
 	  return __kernel_sinl(x,z,0);
 
     /* sin(Inf or NaN) is NaN */
-	else if (se==0x7fff) return x-x;
+	else if (se==0x7fff) {
+	  if ((i0 | i1) == 0)
+	    __set_errno (EDOM);
+	  return x-x;
+	}
 
     /* argument reduction needed */
 	else {
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 9fcfd47829..430166a578 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -32,7 +32,7 @@
 #ifdef SHARED
 /* This is the function used in the dynamic linker to print the fatal error
    message.  */
-static inline void
+static void
 __attribute__ ((__noreturn__))
 dl_fatal (const char *str)
 {
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index bff4a3ff74..9425084a25 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -27,8 +27,10 @@
 #include <bp-checks.h>
 #include <kernel-features.h>
 
+#ifndef __ASSUME_COMPLETE_READV_WRITEV
 static ssize_t __atomic_readv_replacement (int, __const struct iovec *,
 					   int) internal_function;
+#endif
 
 
 /* Not all versions of the kernel support the large number of records.  */
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 55e915d34d..8552856cdb 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -27,8 +27,10 @@
 #include <bp-checks.h>
 #include <kernel-features.h>
 
+#ifndef __ASSUME_COMPLETE_READV_WRITEV
 static ssize_t __atomic_writev_replacement (int, const struct iovec *,
 					    int) internal_function;
+#endif
 
 
 /* Not all versions of the kernel support the large number of records.  */
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 8c67b5b5f9..4444ae0a71 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -403,7 +403,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 
 	      fmt = "\
 %s: Symbol `%s' causes overflow in R_X86_64_32 relocation\n";
+#  ifndef RESOLVE_CONFLICT_FIND_MAP
 	    print_err:
+#  endif
 	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
 
 	      _dl_error_printf (fmt,
diff --git a/sysdeps/x86_64/fpu/s_cosl.S b/sysdeps/x86_64/fpu/s_cosl.S
index 6636fb5ec6..6921cda567 100644
--- a/sysdeps/x86_64/fpu/s_cosl.S
+++ b/sysdeps/x86_64/fpu/s_cosl.S
@@ -4,15 +4,22 @@
  *
  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
  * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
-RCSID("$NetBSD: $")
-
 ENTRY(__cosl)
 	fldt	8(%rsp)
-	fcos
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fcos
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -28,5 +35,8 @@ ENTRY(__cosl)
 	fstp	%st(1)
 	fcos
 	ret
+3:	call	__errno_location@PLT
+	movl	$EDOM, (%rax)
+	jmp	4b
 END (__cosl)
 weak_alias (__cosl, cosl)
diff --git a/sysdeps/x86_64/fpu/s_expm1l.S b/sysdeps/x86_64/fpu/s_expm1l.S
index 05a1bfcce1..c0b93e94a9 100644
--- a/sysdeps/x86_64/fpu/s_expm1l.S
+++ b/sysdeps/x86_64/fpu/s_expm1l.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996, 1997, 2001, 2002, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,2001,2002,2008,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -51,7 +51,7 @@ ENTRY(__expm1l)
 	movzwl	8+8(%rsp), %eax	// load sign bit and 15-bit exponent
 	xorb	$0x80, %ah	// invert sign bit (now 1 is "positive")
 	cmpl	$0xc006, %eax	// is num positive and exp >= 6 (number is >= 128.0)?
-	jae     __ieee754_expl	// (if num is denormal, it is at least >= 64.0)
+	jae     __expl		// (if num is denormal, it is at least >= 64.0)
 
 	fldt	8(%rsp)		// x
 	fxam			// Is NaN or +-Inf?
@@ -76,7 +76,7 @@ ENTRY(__expm1l)
 	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)-1
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/x86_64/fpu/s_sinl.S b/sysdeps/x86_64/fpu/s_sinl.S
index 181f112f4f..79fc4af95b 100644
--- a/sysdeps/x86_64/fpu/s_sinl.S
+++ b/sysdeps/x86_64/fpu/s_sinl.S
@@ -4,13 +4,22 @@
  *
  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
  * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 ENTRY(__sinl)
 	fldt	8(%rsp)
-	fsin
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fsin
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -26,5 +35,8 @@ ENTRY(__sinl)
 	fstp	%st(1)
 	fsin
 	ret
+3:	call	__errno_location@PLT
+	movl	$EDOM, (%rax)
+	jmp	4b
 END (__sinl)
 weak_alias (__sinl, sinl)
diff --git a/sysdeps/x86_64/fpu/s_tanl.S b/sysdeps/x86_64/fpu/s_tanl.S
index 674e908acc..6427e3f6f0 100644
--- a/sysdeps/x86_64/fpu/s_tanl.S
+++ b/sysdeps/x86_64/fpu/s_tanl.S
@@ -4,15 +4,24 @@
  *
  * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
  * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ * Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
  */
 
+#define __need_Emath
+#include <bits/errno.h>
 #include <machine/asm.h>
 
 RCSID("$NetBSD: $")
 
 ENTRY(__tanl)
 	fldt	8(%rsp)
-	fptan
+	fxam
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	3f
+4:	fptan
 	fnstsw	%ax
 	testl	$0x400,%eax
 	jnz	1f
@@ -29,5 +38,8 @@ ENTRY(__tanl)
 	fptan
 	fstp	%st(0)
 	ret
+3:	call	__errno_location@PLT
+	movl	$EDOM, (%rax)
+	jmp	4b
 END (__tanl)
 weak_alias (__tanl, tanl)