about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-16 22:17:36 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-16 22:17:36 +0100
commita0f3faf34e6b2f024ef86d84ad80c124c33b941a (patch)
tree11eed0d9ee2e444dde60899e8d290ca722bab1c3
parent389143d808be38fe4e0def83946c5ab2fd7c5376 (diff)
parentcef0bcefc6544513fec9dec49686932ef15f1734 (diff)
downloadnixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.tar
nixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.tar.gz
nixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.tar.bz2
nixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.tar.lz
nixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.tar.xz
nixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.tar.zst
nixlib-a0f3faf34e6b2f024ef86d84ad80c124c33b941a.zip
Merge remote-tracking branch 'origin/glibc-2.20' into staging
-rw-r--r--pkgs/development/compilers/gcc/4.8/bug-61801.patch15
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix2
-rw-r--r--pkgs/development/libraries/aterm/2.5.nix2
-rw-r--r--pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch170
-rw-r--r--pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch206
-rw-r--r--pkgs/development/libraries/glibc/2.19/fix-math.patch336
-rw-r--r--pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch12
-rw-r--r--pkgs/development/libraries/glibc/builder.sh (renamed from pkgs/development/libraries/glibc/2.19/builder.sh)4
-rw-r--r--pkgs/development/libraries/glibc/common.nix (renamed from pkgs/development/libraries/glibc/2.19/common.nix)19
-rw-r--r--pkgs/development/libraries/glibc/default.nix (renamed from pkgs/development/libraries/glibc/2.19/default.nix)2
-rw-r--r--pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch (renamed from pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-cache.patch)0
-rw-r--r--pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch (renamed from pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-preload.patch)10
-rw-r--r--pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch (renamed from pkgs/development/libraries/glibc/2.19/fix_path_attribute_in_getconf.patch)0
-rw-r--r--pkgs/development/libraries/glibc/glibc-crypt-blowfish.patch (renamed from pkgs/development/libraries/glibc/2.19/glibc-crypt-blowfish.patch)0
-rw-r--r--pkgs/development/libraries/glibc/glibc-remove-datetime-from-nscd.patch (renamed from pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch)2
-rw-r--r--pkgs/development/libraries/glibc/info.nix (renamed from pkgs/development/libraries/glibc/2.19/info.nix)0
-rw-r--r--pkgs/development/libraries/glibc/locales-builder.sh (renamed from pkgs/development/libraries/glibc/2.19/locales-builder.sh)0
-rw-r--r--pkgs/development/libraries/glibc/locales.nix (renamed from pkgs/development/libraries/glibc/2.19/locales.nix)4
-rw-r--r--pkgs/development/libraries/glibc/multi.nix (renamed from pkgs/development/libraries/glibc/2.19/multi.nix)0
-rw-r--r--pkgs/development/libraries/glibc/nix-locale-archive.patch (renamed from pkgs/development/libraries/glibc/2.19/nix-locale-archive.patch)0
-rw-r--r--pkgs/development/libraries/glibc/rpcgen-path.patch (renamed from pkgs/development/libraries/glibc/2.19/rpcgen-path.patch)0
-rw-r--r--pkgs/os-specific/linux/busybox/busybox-in-store.patch16
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix53
-rw-r--r--pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch12
-rw-r--r--pkgs/os-specific/linux/e3cfsprogs/default.nix12
-rw-r--r--pkgs/os-specific/linux/kernel-headers/3.12.nix (renamed from pkgs/os-specific/linux/kernel-headers/3.7.nix)6
-rw-r--r--pkgs/os-specific/linux/module-init-tools/default.nix4
-rw-r--r--pkgs/os-specific/linux/uclibc/default.nix16
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix10
-rw-r--r--pkgs/stdenv/adapters.nix57
-rw-r--r--pkgs/stdenv/linux/bootstrap/i686.nix41
-rw-r--r--pkgs/stdenv/linux/bootstrap/x86_64.nix9
-rw-r--r--pkgs/stdenv/linux/default.nix11
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix169
-rw-r--r--pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh55
-rw-r--r--pkgs/tools/compression/bzip2/default.nix2
-rw-r--r--pkgs/tools/filesystems/squashfs/default.nix2
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix2
-rw-r--r--pkgs/tools/misc/grub/glibc-2.20.patch29
-rw-r--r--pkgs/tools/networking/curl/7.15.nix1
-rw-r--r--pkgs/tools/networking/curl/default.nix17
-rw-r--r--pkgs/top-level/all-packages.nix16
42 files changed, 235 insertions, 1089 deletions
diff --git a/pkgs/development/compilers/gcc/4.8/bug-61801.patch b/pkgs/development/compilers/gcc/4.8/bug-61801.patch
new file mode 100644
index 000000000000..3d87e007813b
--- /dev/null
+++ b/pkgs/development/compilers/gcc/4.8/bug-61801.patch
@@ -0,0 +1,15 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=212740
+
+--- a/gcc/sched-deps.c	2014/07/17 07:48:49	212739
++++ b/gcc/sched-deps.c	2014/07/17 07:49:44	212740
+@@ -2744,7 +2744,8 @@
+ 	   Consider for instance a volatile asm that changes the fpu rounding
+ 	   mode.  An insn should not be moved across this even if it only uses
+ 	   pseudo-regs because it might give an incorrectly rounded result.  */
+-	if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
++	if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x))
++	    && !DEBUG_INSN_P (insn))
+ 	  reg_pending_barrier = TRUE_BARRIER;
+ 
+ 	/* For all ASM_OPERANDS, we must traverse the vector of input operands.
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index c240acb5e897..6547d9b12b6c 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -61,7 +61,7 @@ let version = "4.8.3";
 
     enableParallelBuilding = true;
 
-    patches = []
+    patches = [ ./bug-61801.patch ]
       ++ optional enableParallelBuilding ./parallel-bconfig.patch
       ++ optional (cross != null) ./libstdc++-target.patch
       ++ optional noSysDirs ./no-sys-dirs.patch
diff --git a/pkgs/development/libraries/aterm/2.5.nix b/pkgs/development/libraries/aterm/2.5.nix
index 10a22e00f650..ef53a76d20ba 100644
--- a/pkgs/development/libraries/aterm/2.5.nix
+++ b/pkgs/development/libraries/aterm/2.5.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation {
 
   dontDisableStatic = true;
 
+  NIX_CFLAGS_COMPILE = "-D__USE_BSD";
+
   meta = {
     homepage = http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ATerm;
     license = "LGPL";
diff --git a/pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch b/pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch
deleted file mode 100644
index a4f983de8f6c..000000000000
--- a/pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-Picked from upstream commits, but excluding changes to news and tests:
-d183645616b0533 and 4e8f95a0df7c2
-Also see https://sourceware.org/bugzilla/show_bug.cgi?id=17137
-
-diff --git a/locale/setlocale.c b/locale/setlocale.c
-index 9458468..6455b8b 100644
---- a/locale/setlocale.c
-+++ b/locale/setlocale.c
-@@ -272,6 +272,8 @@ setlocale (int category, const char *locale)
- 	 of entries of the form `CATEGORY=VALUE'.  */
-       const char *newnames[__LC_LAST];
-       struct __locale_data *newdata[__LC_LAST];
-+      /* Copy of the locale argument, for in-place splitting.  */
-+      char *locale_copy = NULL;
- 
-       /* Set all name pointers to the argument name.  */
-       for (category = 0; category < __LC_LAST; ++category)
-@@ -281,7 +283,13 @@ setlocale (int category, const char *locale)
-       if (__glibc_unlikely (strchr (locale, ';') != NULL))
- 	{
- 	  /* This is a composite name.  Make a copy and split it up.  */
--	  char *np = strdupa (locale);
-+	  locale_copy = strdup (locale);
-+	  if (__glibc_unlikely (locale_copy == NULL))
-+	    {
-+	      __libc_rwlock_unlock (__libc_setlocale_lock);
-+	      return NULL;
-+	    }
-+	  char *np = locale_copy;
- 	  char *cp;
- 	  int cnt;
- 
-@@ -299,6 +307,7 @@ setlocale (int category, const char *locale)
- 		{
- 		error_return:
- 		  __libc_rwlock_unlock (__libc_setlocale_lock);
-+		  free (locale_copy);
- 
- 		  /* Bogus category name.  */
- 		  ERROR_RETURN;
-@@ -391,8 +400,9 @@ setlocale (int category, const char *locale)
-       /* Critical section left.  */
-       __libc_rwlock_unlock (__libc_setlocale_lock);
- 
--      /* Free the resources (the locale path variable).  */
-+      /* Free the resources.  */
-       free (locale_path);
-+      free (locale_copy);
- 
-       return composite;
-     }
-diff --git a/locale/findlocale.c b/locale/findlocale.c
-index bbaf708..22e8b53 100644
---- a/locale/findlocale.c
-+++ b/locale/findlocale.c
-@@ -17,6 +17,7 @@
-    <http://www.gnu.org/licenses/>.  */
- 
- #include <assert.h>
-+#include <errno.h>
- #include <locale.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -57,6 +58,45 @@ struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
- 
- const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
- 
-+/* Checks if the name is actually present, that is, not NULL and not
-+   empty.  */
-+static inline int
-+name_present (const char *name)
-+{
-+  return name != NULL && name[0] != '\0';
-+}
-+
-+/* Checks that the locale name neither extremely long, nor contains a
-+   ".." path component (to prevent directory traversal).  */
-+static inline int
-+valid_locale_name (const char *name)
-+{
-+  /* Not set.  */
-+  size_t namelen = strlen (name);
-+  /* Name too long.  The limit is arbitrary and prevents stack overflow
-+     issues later.  */
-+  if (__glibc_unlikely (namelen > 255))
-+    return 0;
-+  /* Directory traversal attempt.  */
-+  static const char slashdot[4] = {'/', '.', '.', '/'};
-+  if (__glibc_unlikely (memmem (name, namelen,
-+				slashdot, sizeof (slashdot)) != NULL))
-+    return 0;
-+  if (namelen == 2 && __glibc_unlikely (name[0] == '.' && name [1] == '.'))
-+    return 0;
-+  if (namelen >= 3
-+      && __glibc_unlikely (((name[0] == '.'
-+			     && name[1] == '.'
-+			     && name[2] == '/')
-+			    || (name[namelen - 3] == '/'
-+				&& name[namelen - 2] == '.'
-+				&& name[namelen - 1] == '.'))))
-+    return 0;
-+  /* If there is a slash in the name, it must start with one.  */
-+  if (__glibc_unlikely (memchr (name, '/', namelen) != NULL) && name[0] != '/')
-+    return 0;
-+  return 1;
-+}
- 
- struct __locale_data *
- internal_function
-@@ -65,7 +105,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
- {
-   int mask;
-   /* Name of the locale for this category.  */
--  char *loc_name;
-+  char *loc_name = (char *) *name;
-   const char *language;
-   const char *modifier;
-   const char *territory;
-@@ -73,31 +113,39 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
-   const char *normalized_codeset;
-   struct loaded_l10nfile *locale_file;
- 
--  if ((*name)[0] == '\0')
-+  if (loc_name[0] == '\0')
-     {
-       /* The user decides which locale to use by setting environment
- 	 variables.  */
--      *name = getenv ("LC_ALL");
--      if (*name == NULL || (*name)[0] == '\0')
--	*name = getenv (_nl_category_names.str
-+      loc_name = getenv ("LC_ALL");
-+      if (!name_present (loc_name))
-+	loc_name = getenv (_nl_category_names.str
- 			+ _nl_category_name_idxs[category]);
--      if (*name == NULL || (*name)[0] == '\0')
--	*name = getenv ("LANG");
-+      if (!name_present (loc_name))
-+	loc_name = getenv ("LANG");
-+      if (!name_present (loc_name))
-+	loc_name = (char *) _nl_C_name;
-     }
- 
--  if (*name == NULL || (*name)[0] == '\0'
--      || (__builtin_expect (__libc_enable_secure, 0)
--	  && strchr (*name, '/') != NULL))
--    *name = (char *) _nl_C_name;
-+  /* We used to fall back to the C locale if the name contains a slash
-+     character '/', but we now check for directory traversal in
-+     valid_locale_name, so this is no longer necessary.  */
- 
--  if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
--      || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
-+  if (__builtin_expect (strcmp (loc_name, _nl_C_name), 1) == 0
-+      || __builtin_expect (strcmp (loc_name, _nl_POSIX_name), 1) == 0)
-     {
-       /* We need not load anything.  The needed data is contained in
- 	 the library itself.  */
-       *name = (char *) _nl_C_name;
-       return _nl_C[category];
-     }
-+  else if (!valid_locale_name (loc_name))
-+    {
-+      __set_errno (EINVAL);
-+      return NULL;
-+    }
-+
-+  *name = loc_name;
- 
-   /* We really have to load some data.  First we try the archive,
-      but only if there was no LOCPATH environment variable specified.  */
diff --git a/pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch b/pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch
deleted file mode 100644
index cbae03425eb9..000000000000
--- a/pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-http://anonscm.debian.org/viewvc/pkg-glibc/glibc-package/trunk/debian/patches/any/cvs-CVE-2014-5119.diff?revision=6248&view=co
-
-commit a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8
-Author: Florian Weimer <fweimer@redhat.com>
-Date:   Tue Aug 26 19:38:59 2014 +0200
-
-    __gconv_translit_find: Disable function [BZ #17187]
-    
-    This functionality has never worked correctly, and the implementation
-    contained a security vulnerability (CVE-2014-5119).
-
-2014-08-26  Florian Weimer  <fweimer@redhat.com>
-
-	[BZ #17187]
-	* iconv/gconv_trans.c (struct known_trans, search_tree, lock,
-	trans_compare, open_translit, __gconv_translit_find):
-	Remove module loading code.
-
---- a/iconv/gconv_trans.c
-+++ b/iconv/gconv_trans.c
-@@ -238,181 +238,12 @@ __gconv_transliterate (struct __gconv_step *step,
-   return __GCONV_ILLEGAL_INPUT;
- }
- 
--
--/* Structure to represent results of found (or not) transliteration
--   modules.  */
--struct known_trans
--{
--  /* This structure must remain the first member.  */
--  struct trans_struct info;
--
--  char *fname;
--  void *handle;
--  int open_count;
--};
--
--
--/* Tree with results of previous calls to __gconv_translit_find.  */
--static void *search_tree;
--
--/* We modify global data.   */
--__libc_lock_define_initialized (static, lock);
--
--
--/* Compare two transliteration entries.  */
--static int
--trans_compare (const void *p1, const void *p2)
--{
--  const struct known_trans *s1 = (const struct known_trans *) p1;
--  const struct known_trans *s2 = (const struct known_trans *) p2;
--
--  return strcmp (s1->info.name, s2->info.name);
--}
--
--
--/* Open (maybe reopen) the module named in the struct.  Get the function
--   and data structure pointers we need.  */
--static int
--open_translit (struct known_trans *trans)
--{
--  __gconv_trans_query_fct queryfct;
--
--  trans->handle = __libc_dlopen (trans->fname);
--  if (trans->handle == NULL)
--    /* Not available.  */
--    return 1;
--
--  /* Find the required symbol.  */
--  queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
--  if (queryfct == NULL)
--    {
--      /* We cannot live with that.  */
--    close_and_out:
--      __libc_dlclose (trans->handle);
--      trans->handle = NULL;
--      return 1;
--    }
--
--  /* Get the context.  */
--  if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
--      != 0)
--    goto close_and_out;
--
--  /* Of course we also have to have the actual function.  */
--  trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
--  if (trans->info.trans_fct == NULL)
--    goto close_and_out;
--
--  /* Now the optional functions.  */
--  trans->info.trans_init_fct =
--    __libc_dlsym (trans->handle, "gconv_trans_init");
--  trans->info.trans_context_fct =
--    __libc_dlsym (trans->handle, "gconv_trans_context");
--  trans->info.trans_end_fct =
--    __libc_dlsym (trans->handle, "gconv_trans_end");
--
--  trans->open_count = 1;
--
--  return 0;
--}
--
--
- int
- internal_function
- __gconv_translit_find (struct trans_struct *trans)
- {
--  struct known_trans **found;
--  const struct path_elem *runp;
--  int res = 1;
--
--  /* We have to have a name.  */
--  assert (trans->name != NULL);
--
--  /* Acquire the lock.  */
--  __libc_lock_lock (lock);
--
--  /* See whether we know this module already.  */
--  found = __tfind (trans, &search_tree, trans_compare);
--  if (found != NULL)
--    {
--      /* Is this module available?  */
--      if ((*found)->handle != NULL)
--	{
--	  /* Maybe we have to reopen the file.  */
--	  if ((*found)->handle != (void *) -1)
--	    /* The object is not unloaded.  */
--	    res = 0;
--	  else if (open_translit (*found) == 0)
--	    {
--	      /* Copy the data.  */
--	      *trans = (*found)->info;
--	      (*found)->open_count++;
--	      res = 0;
--	    }
--	}
--    }
--  else
--    {
--      size_t name_len = strlen (trans->name) + 1;
--      int need_so = 0;
--      struct known_trans *newp;
--
--      /* We have to continue looking for the module.  */
--      if (__gconv_path_elem == NULL)
--	__gconv_get_path ();
--
--      /* See whether we have to append .so.  */
--      if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
--	need_so = 1;
--
--      /* Create a new entry.  */
--      newp = (struct known_trans *) malloc (sizeof (struct known_trans)
--					    + (__gconv_max_path_elem_len
--					       + name_len + 3)
--					    + name_len);
--      if (newp != NULL)
--	{
--	  char *cp;
--
--	  /* Clear the struct.  */
--	  memset (newp, '\0', sizeof (struct known_trans));
--
--	  /* Store a copy of the module name.  */
--	  newp->info.name = cp = (char *) (newp + 1);
--	  cp = __mempcpy (cp, trans->name, name_len);
--
--	  newp->fname = cp;
--
--	  /* Search in all the directories.  */
--	  for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
--	    {
--	      cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
--			      trans->name, name_len);
--	      if (need_so)
--		memcpy (cp, ".so", sizeof (".so"));
--
--	      if (open_translit (newp) == 0)
--		{
--		  /* We found a module.  */
--		  res = 0;
--		  break;
--		}
--	    }
--
--	  if (res)
--	    newp->fname = NULL;
--
--	  /* In any case we'll add the entry to our search tree.  */
--	  if (__tsearch (newp, &search_tree, trans_compare) == NULL)
--	    {
--	      /* Yickes, this should not happen.  Unload the object.  */
--	      res = 1;
--	      /* XXX unload here.  */
--	    }
--	}
--    }
--
--  __libc_lock_unlock (lock);
--
--  return res;
-+  /* Transliteration module loading has been removed because it never
-+     worked as intended and suffered from a security vulnerability.
-+     Consequently, this function always fails.  */
-+  return 1;
- }
diff --git a/pkgs/development/libraries/glibc/2.19/fix-math.patch b/pkgs/development/libraries/glibc/2.19/fix-math.patch
deleted file mode 100644
index 516f53954ddd..000000000000
--- a/pkgs/development/libraries/glibc/2.19/fix-math.patch
+++ /dev/null
@@ -1,336 +0,0 @@
-From: Siddhesh Poyarekar <siddhesh@redhat.com>
-Date: Thu, 27 Feb 2014 15:42:09 +0000 (+0530)
-Subject: Fix sign of input to bsloww1 (BZ #16623)
-X-Git-Url: http://repo.or.cz/w/glibc.git/commitdiff_plain/1cadc85813d736f7682fa2eeadae639ab6b66c65
-
-Fix sign of input to bsloww1 (BZ #16623)
-
-In 84ba214c, I removed some redundant sign computations and in the
-process, I incorrectly got rid of a temporary variable, thus passing
-the absolute value of the input to bsloww1.  This caused #16623.
-
-This fix undoes the incorrect change.
-
-[nix]: drop docs update (wouldn't apply)
----
-
-diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
-index ac5348f..fafe96f 100644
---- a/math/auto-libm-test-in
-+++ b/math/auto-libm-test-in
-@@ -594,6 +594,7 @@ cos 0x1.0000010b239a9p0
- cos 0x1.00000162a932bp0
- cos 0x1.000002d452a10p0
- cos 0x1.000005bc7d86dp0
-+cos 0x1.200145a975ce6p32
- cos 1
- cos 2
- cos 3
-@@ -1748,6 +1749,7 @@ sin 7
- sin 8
- sin 9
- sin 10
-+sin 0x1.2001469775ce6p32
- 
- sincos 0
- sincos -0
-diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
-index 8f79359..59c08a7 100644
---- a/math/auto-libm-test-out
-+++ b/math/auto-libm-test-out
-@@ -74446,6 +74446,75 @@ cos 0x1.000005bc7d86dp0
- = cos tonearest ldbl-128ibm 0x1.000005bc7d86dp+0L : 0x8.a513ba9f703d3ffffffcb92354p-4L : inexact-ok
- = cos towardzero ldbl-128ibm 0x1.000005bc7d86dp+0L : 0x8.a513ba9f703d3ffffffcb92354p-4L : inexact-ok
- = cos upward ldbl-128ibm 0x1.000005bc7d86dp+0L : 0x8.a513ba9f703d3ffffffcb92358p-4L : inexact-ok
-+cos 0x1.200145a975ce6p32
-+= cos downward flt-32 0x1.200146p+32f : -0xf.74fbep-4f : inexact-ok
-+= cos tonearest flt-32 0x1.200146p+32f : -0xf.74fbdp-4f : inexact-ok
-+= cos towardzero flt-32 0x1.200146p+32f : -0xf.74fbdp-4f : inexact-ok
-+= cos upward flt-32 0x1.200146p+32f : -0xf.74fbdp-4f : inexact-ok
-+= cos downward dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe5p-4 : inexact-ok
-+= cos tonearest dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe5p-4 : inexact-ok
-+= cos towardzero dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe48p-4 : inexact-ok
-+= cos upward dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe48p-4 : inexact-ok
-+= cos downward ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0dp-4L : inexact-ok
-+= cos tonearest ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos towardzero ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos upward ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos downward ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0dp-4L : inexact-ok
-+= cos tonearest ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos towardzero ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos upward ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos downward ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59e8p-4L : inexact-ok
-+= cos tonearest ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59e8p-4L : inexact-ok
-+= cos towardzero ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59ep-4L : inexact-ok
-+= cos upward ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59ep-4L : inexact-ok
-+= cos downward ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef5cp-4L : inexact-ok
-+= cos tonearest ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef58p-4L : inexact-ok
-+= cos towardzero ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef58p-4L : inexact-ok
-+= cos upward ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef58p-4L : inexact-ok
-+= cos downward flt-32 0x1.200144p+32f : 0xf.bc96cp-4f : inexact-ok
-+= cos tonearest flt-32 0x1.200144p+32f : 0xf.bc96dp-4f : inexact-ok
-+= cos towardzero flt-32 0x1.200144p+32f : 0xf.bc96cp-4f : inexact-ok
-+= cos upward flt-32 0x1.200144p+32f : 0xf.bc96dp-4f : inexact-ok
-+= cos downward dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658a8p-4 : inexact-ok
-+= cos tonearest dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658a8p-4 : inexact-ok
-+= cos towardzero dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658a8p-4 : inexact-ok
-+= cos upward dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658bp-4 : inexact-ok
-+= cos downward ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos tonearest ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos towardzero ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos upward ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos downward ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos tonearest ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos towardzero ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos upward ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos downward ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fbp-4L : inexact-ok
-+= cos tonearest ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fbp-4L : inexact-ok
-+= cos towardzero ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fbp-4L : inexact-ok
-+= cos upward ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fb8p-4L : inexact-ok
-+= cos downward ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8cp-4L : inexact-ok
-+= cos tonearest ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a9p-4L : inexact-ok
-+= cos towardzero ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8cp-4L : inexact-ok
-+= cos upward ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a9p-4L : inexact-ok
-+= cos downward dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffdp-4 : inexact-ok
-+= cos tonearest dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffccp-4 : inexact-ok
-+= cos towardzero dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffccp-4 : inexact-ok
-+= cos upward dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffccp-4 : inexact-ok
-+= cos downward ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe8p-4L : inexact-ok
-+= cos tonearest ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos towardzero ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos upward ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos downward ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe8p-4L : inexact-ok
-+= cos tonearest ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos towardzero ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos upward ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos downward ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e8p-4L : inexact-ok
-+= cos tonearest ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e4p-4L : inexact-ok
-+= cos towardzero ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e4p-4L : inexact-ok
-+= cos upward ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e4p-4L : inexact-ok
-+= cos downward ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726842p-4L : inexact-ok
-+= cos tonearest ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd72684p-4L : inexact-ok
-+= cos towardzero ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd72684p-4L : inexact-ok
-+= cos upward ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd72684p-4L : inexact-ok
- cos 1
- = cos downward flt-32 0x1p+0f : 0x8.a514p-4f : inexact-ok
- = cos tonearest flt-32 0x1p+0f : 0x8.a514p-4f : inexact-ok
-@@ -157744,6 +157813,75 @@ sin 10
- = sin tonearest ldbl-128ibm 0xap+0L : -0x8.b44f7af9a7a92ce7fb22be025p-4L : inexact-ok
- = sin towardzero ldbl-128ibm 0xap+0L : -0x8.b44f7af9a7a92ce7fb22be024cp-4L : inexact-ok
- = sin upward ldbl-128ibm 0xap+0L : -0x8.b44f7af9a7a92ce7fb22be024cp-4L : inexact-ok
-+sin 0x1.2001469775ce6p32
-+= sin downward flt-32 0x1.200148p+32f : -0x5.595d8p-4f : inexact-ok
-+= sin tonearest flt-32 0x1.200148p+32f : -0x5.595d8p-4f : inexact-ok
-+= sin towardzero flt-32 0x1.200148p+32f : -0x5.595d78p-4f : inexact-ok
-+= sin upward flt-32 0x1.200148p+32f : -0x5.595d78p-4f : inexact-ok
-+= sin downward dbl-64 0x1.200148p+32 : -0x5.595d7e536fe38p-4 : inexact-ok
-+= sin tonearest dbl-64 0x1.200148p+32 : -0x5.595d7e536fe34p-4 : inexact-ok
-+= sin towardzero dbl-64 0x1.200148p+32 : -0x5.595d7e536fe34p-4 : inexact-ok
-+= sin upward dbl-64 0x1.200148p+32 : -0x5.595d7e536fe34p-4 : inexact-ok
-+= sin downward ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35eep-4L : inexact-ok
-+= sin tonearest ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin towardzero ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin upward ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin downward ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35eep-4L : inexact-ok
-+= sin tonearest ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin towardzero ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin upward ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin downward ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d944p-4L : inexact-ok
-+= sin tonearest ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d94p-4L : inexact-ok
-+= sin towardzero ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d94p-4L : inexact-ok
-+= sin upward ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d94p-4L : inexact-ok
-+= sin downward ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9dap-4L : inexact-ok
-+= sin tonearest ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9dap-4L : inexact-ok
-+= sin towardzero ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d8p-4L : inexact-ok
-+= sin upward ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d8p-4L : inexact-ok
-+= sin downward flt-32 0x1.200146p+32f : 0x4.220ffp-4f : inexact-ok
-+= sin tonearest flt-32 0x1.200146p+32f : 0x4.220ffp-4f : inexact-ok
-+= sin towardzero flt-32 0x1.200146p+32f : 0x4.220ffp-4f : inexact-ok
-+= sin upward flt-32 0x1.200146p+32f : 0x4.220ff8p-4f : inexact-ok
-+= sin downward dbl-64 0x1.200146p+32 : 0x4.220ff25f5cfp-4 : inexact-ok
-+= sin tonearest dbl-64 0x1.200146p+32 : 0x4.220ff25f5cf04p-4 : inexact-ok
-+= sin towardzero dbl-64 0x1.200146p+32 : 0x4.220ff25f5cfp-4 : inexact-ok
-+= sin upward dbl-64 0x1.200146p+32 : 0x4.220ff25f5cf04p-4 : inexact-ok
-+= sin downward ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin tonearest ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin towardzero ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin upward ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin downward ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin tonearest ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin towardzero ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin upward ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin downward ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ccp-4L : inexact-ok
-+= sin tonearest ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ccp-4L : inexact-ok
-+= sin towardzero ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ccp-4L : inexact-ok
-+= sin upward ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cc4p-4L : inexact-ok
-+= sin downward ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cp-4L : inexact-ok
-+= sin tonearest ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cp-4L : inexact-ok
-+= sin towardzero ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cp-4L : inexact-ok
-+= sin upward ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ep-4L : inexact-ok
-+= sin downward dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019fcp-4 : inexact-ok
-+= sin tonearest dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019f8p-4 : inexact-ok
-+= sin towardzero dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019f8p-4 : inexact-ok
-+= sin upward dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019f8p-4 : inexact-ok
-+= sin downward ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f6p-4L : inexact-ok
-+= sin tonearest ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin towardzero ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin upward ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin downward ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f6p-4L : inexact-ok
-+= sin tonearest ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin towardzero ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin upward ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin downward ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca70604p-4L : inexact-ok
-+= sin tonearest ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin towardzero ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin upward ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin downward ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca708p-4L : inexact-ok
-+= sin tonearest ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin towardzero ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin upward ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
- sincos 0
- = sincos downward flt-32 0x0p+0f : 0x0p+0f 0x1p+0f : inexact-ok
- = sincos tonearest flt-32 0x0p+0f : 0x0p+0f 0x1p+0f : inexact-ok
-diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
-index 6105e9f..50109b8 100644
---- a/sysdeps/ieee754/dbl-64/s_sin.c
-+++ b/sysdeps/ieee754/dbl-64/s_sin.c
-@@ -447,19 +447,21 @@ __sin (double x)
- 	    }
- 	  else
- 	    {
-+	      double t;
- 	      if (a > 0)
- 		{
- 		  m = 1;
-+		  t = a;
- 		  db = da;
- 		}
- 	      else
- 		{
- 		  m = 0;
--		  a = -a;
-+		  t = -a;
- 		  db = -da;
- 		}
--	      u.x = big + a;
--	      y = a - (u.x - big);
-+	      u.x = big + t;
-+	      y = t - (u.x - big);
- 	      res = do_sin (u, y, db, &cor);
- 	      cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- 	      retval = ((res == res + cor) ? ((m) ? res : -res)
-@@ -671,19 +673,21 @@ __cos (double x)
- 	    }
- 	  else
- 	    {
-+	      double t;
- 	      if (a > 0)
- 		{
- 		  m = 1;
-+		  t = a;
- 		  db = da;
- 		}
- 	      else
- 		{
- 		  m = 0;
--		  a = -a;
-+		  t = -a;
- 		  db = -da;
- 		}
--	      u.x = big + a;
--	      y = a - (u.x - big);
-+	      u.x = big + t;
-+	      y = t - (u.x - big);
- 	      res = do_sin (u, y, db, &cor);
- 	      cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- 	      retval = ((res == res + cor) ? ((m) ? res : -res)
-diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
-index f3980f8..544f1c7 100644
---- a/sysdeps/x86_64/fpu/libm-test-ulps
-+++ b/sysdeps/x86_64/fpu/libm-test-ulps
-@@ -10900,6 +10900,14 @@ idouble: 1
- Test "cos_downward (0x1.0c152382d7365p+0)":
- double: 1
- idouble: 1
-+Test "cos_downward (0x1.200145a975ce6p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
-+Test "cos_downward (0x1.200146p+32)":
-+ildouble: 1
-+ldouble: 1
- Test "cos_downward (0x1.921fb4p+0)":
- ildouble: 1
- ldouble: 1
-@@ -11126,6 +11134,9 @@ idouble: 1
- Test "cos_towardzero (0x1.0c152382d7365p+0)":
- double: 1
- idouble: 1
-+Test "cos_towardzero (0x1.200146p+32)":
-+double: 1
-+idouble: 1
- Test "cos_towardzero (0x1.921fb4p+0)":
- ildouble: 1
- ldouble: 1
-@@ -11258,6 +11269,17 @@ idouble: 1
- Test "cos_upward (0x1.0c1524p+0)":
- double: 1
- idouble: 1
-+Test "cos_upward (0x1.200144p+32)":
-+double: 1
-+idouble: 1
-+Test "cos_upward (0x1.200145a975ce6p+32)":
-+ildouble: 1
-+ldouble: 1
-+Test "cos_upward (0x1.200146p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
- Test "cos_upward (0x1.921fb4p+0)":
- double: 1
- idouble: 1
-@@ -15155,6 +15177,19 @@ double: 1
- idouble: 1
- ildouble: 1
- ldouble: 1
-+Test "sin_downward (0x1.2001469775ce6p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
-+Test "sin_downward (0x1.200146p+32)":
-+double: 1
-+idouble: 1
-+Test "sin_downward (0x1.200148p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
- Test "sin_downward (0x1.921fb54442d18468p+0)":
- ildouble: 1
- ldouble: 1
-@@ -15383,6 +15418,9 @@ double: 1
- idouble: 1
- ildouble: 1
- ldouble: 1
-+Test "sin_towardzero (0x1.200146p+32)":
-+double: 1
-+idouble: 1
- Test "sin_towardzero (0x1.921fb54442d18468p+0)":
- ildouble: 1
- ldouble: 1
-@@ -15532,6 +15570,12 @@ ldouble: 1
- Test "sin_upward (-0x8.60a92p-4)":
- ildouble: 1
- ldouble: 1
-+Test "sin_upward (0x1.2001469775ce6p+32)":
-+ildouble: 1
-+ldouble: 1
-+Test "sin_upward (0x1.200148p+32)":
-+ildouble: 1
-+ldouble: 1
- Test "sin_upward (0x1.921fb4p+0)":
- double: 1
- idouble: 1
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch b/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch
deleted file mode 100644
index 5d0b1a51762e..000000000000
--- a/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ur glibc-2.17.orig/csu/Makefile glibc-2.17/csu/Makefile
---- glibc-2.17.orig/csu/Makefile	2012-12-25 04:02:13.000000000 +0100
-+++ glibc-2.17/csu/Makefile	2013-08-19 16:01:57.132378550 +0200
-@@ -172,7 +172,7 @@
- 		     os=Linux; \
- 		   fi; \
- 		   printf '"Compiled on a %s %s system on %s.\\n"\n' \
--			  "$$os" "$$version" "`date +%Y-%m-%d`";; \
-+			  "$$os" "$$version";; \
- 	   *) ;; \
- 	 esac; \
- 	 files="$(all-Banner-files)";				\
diff --git a/pkgs/development/libraries/glibc/2.19/builder.sh b/pkgs/development/libraries/glibc/builder.sh
index 3b077cbb3fd5..2836063e3bf4 100644
--- a/pkgs/development/libraries/glibc/2.19/builder.sh
+++ b/pkgs/development/libraries/glibc/builder.sh
@@ -46,10 +46,6 @@ postInstall() {
         ln -s lib $out/lib64
     fi
 
-    # This file, that should not remain in the glibc derivation,
-    # may have not been created during the preInstall
-    rm -f $out/lib/libgcc_s.so.1
-
     # Get rid of more unnecessary stuff.
     rm -rf $out/var $out/sbin/sln
 }
diff --git a/pkgs/development/libraries/glibc/2.19/common.nix b/pkgs/development/libraries/glibc/common.nix
index 23efc01a3975..da1d4f08fa2f 100644
--- a/pkgs/development/libraries/glibc/2.19/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -13,7 +13,7 @@ cross:
 
 let
 
-  version = "2.19";
+  version = "2.20";
 
 in
 
@@ -56,14 +56,6 @@ stdenv.mkDerivation ({
          "/bin:/usr/bin", which is inappropriate on NixOS machines. This
          patch extends the search path by "/run/current-system/sw/bin". */
       ./fix_path_attribute_in_getconf.patch
-
-      ./fix-math.patch
-
-      ./cve-2014-0475.patch
-      ./cve-2014-5119.patch
-
-      /* Remove references to the compilation date.  */
-      ./glibc-remove-date-from-compilation-banner.patch
     ];
 
   postPatch =
@@ -77,8 +69,11 @@ stdenv.mkDerivation ({
     + ''
       echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
     ''
-    # Replace the date and time in nscd by $out.
-    #  It is used as a protocol compatibility check.
+    # Replace the date and time in nscd by a prefix of $out.
+    # It is used as a protocol compatibility check.
+    # Note: the size of the struct changes, but using only a part
+    # would break hash-rewriting. When receiving stats it does check
+    # that the struct sizes match and can't cause overflow or something.
     + ''
       cat ${./glibc-remove-datetime-from-nscd.patch} \
         | sed "s,@out@,$out," | patch -p1
@@ -155,7 +150,7 @@ stdenv.mkDerivation ({
     }
     else fetchurl {
       url = "mirror://gnu/glibc/glibc-${version}.tar.gz";
-      sha256 = "15n7x9mmzhd7w6s5hd9srx0h23b32gwb306x98k9ss940yvnvb8q";
+      sha256 = "1g6ysvk15arpi7c1f1fpx5slgfr2k3dqd5xr0yvijajp1m0xxq9p";
     };
 
   # Remove absolute paths from `configure' & co.; build out-of-tree.
diff --git a/pkgs/development/libraries/glibc/2.19/default.nix b/pkgs/development/libraries/glibc/default.nix
index 52a94bd0a0d5..1abba35af088 100644
--- a/pkgs/development/libraries/glibc/2.19/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -35,7 +35,7 @@ in
     preInstall = ''
       if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
           mkdir -p $out/lib
-          ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
+          cp ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
       fi
     '';
 
diff --git a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-cache.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
index 95f537733204..95f537733204 100644
--- a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-cache.patch
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
diff --git a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-preload.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch
index fabb6c3ec5e1..894e2a11cf87 100644
--- a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-preload.patch
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch
@@ -1,12 +1,12 @@
-diff -rupN a/elf/rtld.c b/elf/rtld.c
---- a/elf/rtld.c	2013-08-11 00:52:55.000000001 +0200
-+++ b/elf/rtld.c	2014-02-18 13:56:19.000000001 +0100
-@@ -1639,7 +1639,7 @@ ERROR: ld.so: object '%s' cannot be load
+diff -ru glibc-2.20-orig/elf/rtld.c glibc-2.20/elf/rtld.c
+--- glibc-2.20-orig/elf/rtld.c	2014-09-07 10:09:09.000000000 +0200
++++ glibc-2.20/elf/rtld.c	2014-10-27 11:32:25.203043157 +0100
+@@ -1513,7 +1513,7 @@
       open().  So we do this first.  If it succeeds we do almost twice
       the work but this does not matter, since it is not for production
       use.  */
 -  static const char preload_file[] = "/etc/ld.so.preload";
 +  static const char preload_file[] = "/etc/ld-nix.so.preload";
-   if (__builtin_expect (__access (preload_file, R_OK) == 0, 0))
+   if (__glibc_unlikely (__access (preload_file, R_OK) == 0))
      {
        /* Read the contents of the file.  */
diff --git a/pkgs/development/libraries/glibc/2.19/fix_path_attribute_in_getconf.patch b/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
index 714e49db5607..714e49db5607 100644
--- a/pkgs/development/libraries/glibc/2.19/fix_path_attribute_in_getconf.patch
+++ b/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-crypt-blowfish.patch b/pkgs/development/libraries/glibc/glibc-crypt-blowfish.patch
index a0a8acdab63d..a0a8acdab63d 100644
--- a/pkgs/development/libraries/glibc/2.19/glibc-crypt-blowfish.patch
+++ b/pkgs/development/libraries/glibc/glibc-crypt-blowfish.patch
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch b/pkgs/development/libraries/glibc/glibc-remove-datetime-from-nscd.patch
index 0a5456ea5c42..db010e62366b 100644
--- a/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch
+++ b/pkgs/development/libraries/glibc/glibc-remove-datetime-from-nscd.patch
@@ -5,7 +5,7 @@
  
  /* We use this to make sure the receiver is the same.  */
 -static const char compilation[21] = __DATE__ " " __TIME__;
-+static const char compilation[21] = "@out@";
++static const char compilation[] = "@out@";
  
  /* Statistic data for one database.  */
  struct dbstat
diff --git a/pkgs/development/libraries/glibc/2.19/info.nix b/pkgs/development/libraries/glibc/info.nix
index e4cdb42dd689..e4cdb42dd689 100644
--- a/pkgs/development/libraries/glibc/2.19/info.nix
+++ b/pkgs/development/libraries/glibc/info.nix
diff --git a/pkgs/development/libraries/glibc/2.19/locales-builder.sh b/pkgs/development/libraries/glibc/locales-builder.sh
index d732e208fa22..d732e208fa22 100644
--- a/pkgs/development/libraries/glibc/2.19/locales-builder.sh
+++ b/pkgs/development/libraries/glibc/locales-builder.sh
diff --git a/pkgs/development/libraries/glibc/2.19/locales.nix b/pkgs/development/libraries/glibc/locales.nix
index 9f9fb86a396d..1dd15832f5b6 100644
--- a/pkgs/development/libraries/glibc/2.19/locales.nix
+++ b/pkgs/development/libraries/glibc/locales.nix
@@ -28,8 +28,8 @@ build null {
       mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
 
       # Hack to allow building of the locales (needed since glibc-2.12)
-      sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
-          /library-path/d ../glibc-2*/localedata/Makefile
+      sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
+
       ${if allLocales then "" else
           "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
 
diff --git a/pkgs/development/libraries/glibc/2.19/multi.nix b/pkgs/development/libraries/glibc/multi.nix
index ad4a34152b65..ad4a34152b65 100644
--- a/pkgs/development/libraries/glibc/2.19/multi.nix
+++ b/pkgs/development/libraries/glibc/multi.nix
diff --git a/pkgs/development/libraries/glibc/2.19/nix-locale-archive.patch b/pkgs/development/libraries/glibc/nix-locale-archive.patch
index 88c8adef9226..88c8adef9226 100644
--- a/pkgs/development/libraries/glibc/2.19/nix-locale-archive.patch
+++ b/pkgs/development/libraries/glibc/nix-locale-archive.patch
diff --git a/pkgs/development/libraries/glibc/2.19/rpcgen-path.patch b/pkgs/development/libraries/glibc/rpcgen-path.patch
index 3349449d9163..3349449d9163 100644
--- a/pkgs/development/libraries/glibc/2.19/rpcgen-path.patch
+++ b/pkgs/development/libraries/glibc/rpcgen-path.patch
diff --git a/pkgs/os-specific/linux/busybox/busybox-in-store.patch b/pkgs/os-specific/linux/busybox/busybox-in-store.patch
new file mode 100644
index 000000000000..ea245a49259b
--- /dev/null
+++ b/pkgs/os-specific/linux/busybox/busybox-in-store.patch
@@ -0,0 +1,16 @@
+Allow BusyBox to be invoked as "<something>-busybox". This is
+necessary when it's run from the Nix store as <hash>-busybox during
+stdenv bootstrap.
+
+diff -ru -x '*~' busybox-1.22.1-orig/libbb/appletlib.c busybox-1.22.1/libbb/appletlib.c
+--- busybox-1.22.1-orig/libbb/appletlib.c	2014-01-09 19:15:44.000000000 +0100
++++ busybox-1.22.1/libbb/appletlib.c	2014-10-29 09:53:01.232052068 +0100
+@@ -764,7 +764,7 @@
+ 	int applet = find_applet_by_name(name);
+ 	if (applet >= 0)
+ 		run_applet_no_and_exit(applet, argv);
+-	if (strncmp(name, "busybox", 7) == 0)
++	if (strstr(name, "busybox") != 0)
+ 		exit(busybox_main(argv));
+ }
+ 
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index 34eb19380d4a..47f9fb9a5a40 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, enableStatic ? false, extraConfig ? ""}:
+{ lib, stdenv, uclibc, fetchurl, enableStatic ? false, enableMinimal ? false, useUclibc ? false, extraConfig ? "" }:
 
 let
   configParser = ''
@@ -7,14 +7,7 @@ let
             NAME=`echo "$LINE" | cut -d \  -f 1`
             OPTION=`echo "$LINE" | cut -d \  -f 2`
 
-            if test -z "$NAME"; then
-                continue
-            fi
-
-            if test "$NAME" == "CLEAR"; then
-                echo "parseconfig: CLEAR"
-                echo > .config
-            fi
+            if ! [[ "$NAME" =~ ^CONFIG_ ]]; then continue; fi
 
             echo "parseconfig: removing $NAME"
             sed -i /$NAME'\(=\| \)'/d .config
@@ -25,19 +18,6 @@ let
     }
   '';
 
-  nixConfig = ''
-    CONFIG_PREFIX "$out"
-    CONFIG_INSTALL_NO_USR y
-
-    # Use the external mount.cifs program.
-    CONFIG_FEATURE_MOUNT_CIFS n
-    CONFIG_FEATURE_MOUNT_HELPERS y
-  '';
-
-  staticConfig = stdenv.lib.optionalString enableStatic ''
-    CONFIG_STATIC y
-  '';
-
 in
 
 stdenv.mkDerivation rec {
@@ -48,17 +28,34 @@ stdenv.mkDerivation rec {
     sha256 = "12v7nri79v8gns3inmz4k24q7pcnwi00hybs0wddfkcy1afh42xf";
   };
 
+  patches = [ ./busybox-in-store.patch ];
+
   configurePhase = ''
     export KCONFIG_NOTIMESTAMP=1
-    make defconfig
+    make ${if enableMinimal then "allnoconfig" else "defconfig"}
+
     ${configParser}
+
     cat << EOF | parseconfig
-    ${staticConfig}
-    ${nixConfig}
+
+    CONFIG_PREFIX "$out"
+    CONFIG_INSTALL_NO_USR y
+
+    ${lib.optionalString enableStatic ''
+      CONFIG_STATIC y
+    ''}
+
+    # Use the external mount.cifs program.
+    CONFIG_FEATURE_MOUNT_CIFS n
+    CONFIG_FEATURE_MOUNT_HELPERS y
+
     ${extraConfig}
     $extraCrossConfig
     EOF
+
     make oldconfig
+  '' + lib.optionalString useUclibc ''
+    makeFlagsArray+=("CC=gcc -isystem ${uclibc}/include -B${uclibc}/lib -L${uclibc}/lib")
   '';
 
   crossAttrs = {
@@ -75,8 +72,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Tiny versions of common UNIX utilities in a single small executable";
     homepage = http://busybox.net/;
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.viric ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch b/pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch
deleted file mode 100644
index 8163a86e3cdb..000000000000
--- a/pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/include/libbb.h b/include/libbb.h
-index f12800f..e7806c2 100644
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -40,6 +40,7 @@
- #include <sys/poll.h>
- #include <sys/ioctl.h>
- #include <sys/mman.h>
-+#include <sys/resource.h>
- #include <sys/socket.h>
- #include <sys/stat.h>
- #include <sys/time.h>
diff --git a/pkgs/os-specific/linux/e3cfsprogs/default.nix b/pkgs/os-specific/linux/e3cfsprogs/default.nix
index 89d5ad5158ce..ef25d59a9df5 100644
--- a/pkgs/os-specific/linux/e3cfsprogs/default.nix
+++ b/pkgs/os-specific/linux/e3cfsprogs/default.nix
@@ -11,20 +11,10 @@ stdenv.mkDerivation {
     sha256 = "8dd3de546aeb1ae42fb05409aeb724a145fe9aa1dbe1115441c2297c9d48cf31";
   };
 
-  configureFlags =
-    if stdenv ? isDietLibC
-    then ""
-    else "--enable-dynamic-e2fsck --enable-elf-shlibs";
+  configureFlags ="--enable-dynamic-e2fsck --enable-elf-shlibs";
   buildInputs = [gettext];
   preInstall = "installFlagsArray=('LN=ln -s')";
   postInstall = "make install-libs";
-
-  NIX_CFLAGS_COMPILE =
-    if stdenv ? isDietLibC then
-      "-UHAVE_SYS_PRCTL_H " +
-      (if stdenv.system == "x86_64-linux" then "-DHAVE_LSEEK64_PROTOTYPE=1 -Dstat64=stat" else "")
-    else "";
 }
 
-
 #note that ext3cow requires the ext3cow kernel patch !!!!
diff --git a/pkgs/os-specific/linux/kernel-headers/3.7.nix b/pkgs/os-specific/linux/kernel-headers/3.12.nix
index 9bf189c40eda..2fd34c68edc6 100644
--- a/pkgs/os-specific/linux/kernel-headers/3.7.nix
+++ b/pkgs/os-specific/linux/kernel-headers/3.12.nix
@@ -4,7 +4,7 @@ assert cross == null -> stdenv.isLinux;
 
 let
 
-  version = "3.12.6";
+  version = "3.12.32";
 
   kernelHeadersBaseConfig =
     if cross == null
@@ -17,8 +17,8 @@ stdenv.mkDerivation {
   name = "linux-headers-${version}";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.bz2";
-    sha256 = "1qh6f1az0flfrbkdjx1i9r7yf31ad0gxigax91nd33z2jmd6h4df";
+    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
+    sha256 = "1hzws2bf267hfk81ywqcxspkyi1lg56x63izdc0pv1338xcfas53";
   };
 
   targetConfig = if cross != null then cross.config else null;
diff --git a/pkgs/os-specific/linux/module-init-tools/default.nix b/pkgs/os-specific/linux/module-init-tools/default.nix
index 4877a2c77946..1302d7b1fef0 100644
--- a/pkgs/os-specific/linux/module-init-tools/default.nix
+++ b/pkgs/os-specific/linux/module-init-tools/default.nix
@@ -26,10 +26,6 @@ stdenv.mkDerivation {
 
   postInstall = "rm $out/sbin/insmod.static"; # don't need it
 
-  # We don't want bash (and therefore glibc) in the closure of the
-  # output, since we want to put this in a initrd.
-  dontPatchShebangs = stdenv ? isDietLibC;
-
   meta = {
     homepage = http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/;
     description = "Tools for loading and managing Linux kernel modules";
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix
index a0df3d526f59..169733112054 100644
--- a/pkgs/os-specific/linux/uclibc/default.nix
+++ b/pkgs/os-specific/linux/uclibc/default.nix
@@ -16,11 +16,6 @@ let
                 continue
             fi
 
-            if test "$NAME" == "CLEAR"; then
-                echo "parseconfig: CLEAR"
-                echo > .config
-            fi
-
             echo "parseconfig: removing $NAME"
             sed -i /^$NAME=/d .config
 
@@ -51,13 +46,14 @@ let
   '';
 
 in
+
 stdenv.mkDerivation {
-  name = "uclibc-0.9.33.2" + stdenv.lib.optionalString (cross != null)
+  name = "uclibc-0.9.34-pre-20141029" + stdenv.lib.optionalString (cross != null)
     ("-" + cross.config);
 
   src = fetchurl {
-    url = http://www.uclibc.org/downloads/uClibc-0.9.33.2.tar.bz2;
-    sha256 = "0qhngsbzj2s6nz92b1s2p0dmvwk8xiqpy58j7ljzw186grvjr3cq";
+    url = http://www.uclibc.org/downloads/snapshots/uClibc-20141029.tar.bz2;
+    sha256 = "018r3bhw1jyyihmm5xxq1psl3r5yx02a57p8qxvay3vvzxn2cvzm";
   };
 
   # 'ftw' needed to build acl, a coreutils dependency
@@ -80,6 +76,8 @@ stdenv.mkDerivation {
 
   buildInputs = stdenv.lib.optional (gccCross != null) gccCross;
 
+  enableParallelBuilding = true;
+
   installPhase = ''
     mkdir -p $out
     make PREFIX=$out VERBOSE=1 install ${crossMakeFlag}
@@ -92,7 +90,7 @@ stdenv.mkDerivation {
     # Derivations may check for the existance of this attribute, to know what to link to.
     inherit libiconv;
   };
-  
+
   meta = {
     homepage = http://www.uclibc.org/;
     description = "A small implementation of the C library";
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index a29d184e48c6..2fa9a7fddc5d 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -194,6 +194,11 @@ in
       "--with-xorg-conf-dir=$(out)/share/X11/xorg.conf.d"
       "--with-udev-rules-dir=$(out)/lib/udev/rules.d"
     ];
+    patches = [( args.fetchpatch {
+      url = "http://cgit.freedesktop.org/xorg/driver/xf86-input-vmmouse/patch/"
+        + "?id=1cbbc03c4b37d57760c57bd2e0b0f89d744a5795";
+      sha256 = "1qkhwj2yal0cz15lv9557d10ylvxlq05ibq43pm2rrvqdg3mb6h4";
+    })];
   };
 
   xf86videoati = attrs: attrs // {
@@ -209,6 +214,11 @@ in
 
   xf86videovmware = attrs: attrs // {
     buildInputs =  attrs.buildInputs ++ [ args.mesa_drivers ]; # for libxatracker
+    patches = [( args.fetchpatch {
+      url = "http://cgit.freedesktop.org/xorg/driver/xf86-video-vmware/patch/"
+        + "?id=4664412d7a5266d2b392957406b34abc5db95e48";
+      sha256 = "1gix83f1is91iq1zd66nj4k72jm24jjjd9s9l0bzpzhgc8smqdk2";
+    })];
   };
 
   xf86videoqxl = attrs: attrs // {
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index cf95a5edfadf..3917f63563aa 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -29,63 +29,6 @@ rec {
   overrideSetup = stdenv: setupScript: stdenv.override { inherit setupScript; };
 
 
-  # Return a modified stdenv that uses dietlibc to create small
-  # statically linked binaries.
-  useDietLibC = stdenv: stdenv //
-    { mkDerivation = args: stdenv.mkDerivation (args // {
-        NIX_CFLAGS_LINK = "-static";
-
-        # libcompat.a contains some commonly used functions.
-        NIX_LDFLAGS = "-lcompat";
-
-        # These are added *after* the command-line flags, so we'll
-        # always optimise for size.
-        NIX_CFLAGS_COMPILE =
-          args.NIX_CFLAGS_COMPILE or ""
-          + " -Os -s -D_BSD_SOURCE=1";
-
-        configureFlags =
-          args.configureFlags or ""
-          + " --disable-shared"; # brrr...
-
-        NIX_GCC = import ../build-support/gcc-wrapper {
-          inherit stdenv;
-          libc = pkgs.dietlibc;
-          inherit (stdenv.gcc) gcc binutils nativeTools nativePrefix;
-          nativeLibc = false;
-        };
-      });
-      isDietLibC = true;
-    };
-
-
-  # Return a modified stdenv that uses klibc to create small
-  # statically linked binaries.
-  useKlibc = stdenv: klibc: stdenv //
-    { mkDerivation = args: stdenv.mkDerivation (args // {
-        NIX_CFLAGS_LINK = "-static";
-
-        # These are added *after* the command-line flags, so we'll
-        # always optimise for size.
-        NIX_CFLAGS_COMPILE =
-          args.NIX_CFLAGS_COMPILE or "" + " -Os -s";
-
-        configureFlags =
-          args.configureFlags or "" + " --disable-shared"; # brrr...
-
-        NIX_GCC = pkgs.runCommand "klibc-wrapper" {} ''
-          mkdir -p $out/bin
-          ln -s ${klibc}/bin/klcc $out/bin/gcc
-          ln -s ${klibc}/bin/klcc $out/bin/cc
-          mkdir -p $out/nix-support
-          echo 'PATH=$PATH:${stdenv.gcc.binutils}/bin' > $out/nix-support/setup-hook
-        '';
-      });
-      isKlibc = true;
-      isStatic = true;
-    };
-
-
   # Return a modified stdenv that tries to build statically linked
   # binaries.
   makeStaticBinaries = stdenv: stdenv //
diff --git a/pkgs/stdenv/linux/bootstrap/i686.nix b/pkgs/stdenv/linux/bootstrap/i686.nix
index 7b6b3ee80344..88bd984bab96 100644
--- a/pkgs/stdenv/linux/bootstrap/i686.nix
+++ b/pkgs/stdenv/linux/bootstrap/i686.nix
@@ -1,39 +1,12 @@
-let
-
-  fetch = { file, sha256 }: import <nix/fetchurl.nix> {
-    url = "http://tarballs.nixos.org/stdenv-linux/i686/r24519/${file}";
-    inherit sha256;
+{
+  busybox = import <nix/fetchurl.nix> {
+    url = http://tarballs.nixos.org/stdenv-linux/i686/73b75f6157db79fc899154a497823e82e409e76d/busybox;
+    sha256 = "159208615405938d9830634f15d38adf5a9c33643926845c44499dbe6dd62042";
     executable = true;
   };
 
-in {
-  sh = fetch {
-    file = "sh";
-    sha256 = "1l6sdhyqjlh4m5gj3pfpi8aisp1m012lpwxfcc4v1x8g429mflmy";
-  };
-
-  bzip2 = fetch {
-    file = "bzip2";
-    sha256 = "1p5nkrdn52jm6rsx8x3wwjpsh83f2qsjl1qckkgnkplwhj23zjp7";
-  };
-
-  mkdir = fetch {
-    file = "mkdir";
-    sha256 = "02ff7i9ph9ahiapsg2v9c3pwr7sl73sk4n7ic112ljkrgwkail33";
-  };
-
-  cpio = fetch {
-    file = "cpio";
-    sha256 = "046if3aqqramyhrn2yxrjf4bfkl8x1bcqxhvi7ml9nrv9smx8irg";
-  };
-
-  curl = fetch {
-    file = "curl.bz2";
-    sha256 = "1v0yfb4gcdyqpl2fxlxjh337r28c23iqm7vwck4p4643xd55di7q";
-  };
-
-  bootstrapTools = {
-    url = http://tarballs.nixos.org/stdenv-linux/i686/r24519/bootstrap-tools.cpio.bz2;
-    sha256 = "0imypaxy6piwbk8ff2y1nr7yk49pqmdgdbv6g8miq1zs5yfip6ij";
+  bootstrapTools = import <nix/fetchurl.nix> {
+    url = http://tarballs.nixos.org/stdenv-linux/i686/73b75f6157db79fc899154a497823e82e409e76d/bootstrap-tools.tar.xz;
+    sha256 = "68c430b84dbeac0bd1bea4cdd3159dce44a76445e07860caed1972b4608c42ca";
   };
 }
diff --git a/pkgs/stdenv/linux/bootstrap/x86_64.nix b/pkgs/stdenv/linux/bootstrap/x86_64.nix
index 71961e6961e6..96822f57e504 100644
--- a/pkgs/stdenv/linux/bootstrap/x86_64.nix
+++ b/pkgs/stdenv/linux/bootstrap/x86_64.nix
@@ -1,10 +1,9 @@
-# Use the static tools for i686-linux.  They work on x86_64-linux
-# machines as well.
+# Use busybox for i686-linux since it works on x86_64-linux as well.
 (import ./i686.nix) //
 
 {
-  bootstrapTools = {
-    url = http://tarballs.nixos.org/stdenv-linux/x86_64/r23302/bootstrap-tools.cpio.bz2;
-    sha256 = "0w89kqhx47yl0jifp2vffp073pyrqha5f312kp971smi4h41drna";
+  bootstrapTools = import <nix/fetchurl.nix> {
+    url = http://tarballs.nixos.org/stdenv-linux/x86_64/73b75f6157db79fc899154a497823e82e409e76d/bootstrap-tools.tar.xz;
+    sha256 = "e29d47a5dc9f1ff10c3fbaacbd03a3cca0c784299df09fcdd9e25797ec6414ad";
   };
 }
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 76849c2c61ab..cbbddc718969 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -40,20 +40,15 @@ rec {
   bootstrapTools = derivation {
     name = "bootstrap-tools";
 
-    builder = bootstrapFiles.sh;
+    builder = bootstrapFiles.busybox;
 
     args =
       if system == "armv5tel-linux" || system == "armv6l-linux"
         || system == "armv7l-linux"
       then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
-      else [ ./scripts/unpack-bootstrap-tools.sh ];
+      else [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];
 
-    # FIXME: get rid of curl.
-    inherit (bootstrapFiles) bzip2 mkdir curl cpio;
-
-    tarball = import <nix/fetchurl.nix> {
-      inherit (bootstrapFiles.bootstrapTools) url sha256;
-    };
+    tarball = bootstrapFiles.bootstrapTools;
 
     inherit system;
 
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 9116b2225690..e202f691fa8d 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -1,4 +1,4 @@
-{system ? builtins.currentSystem}:
+{ system ? builtins.currentSystem }:
 
 with import ../../top-level/all-packages.nix {inherit system;};
 
@@ -6,84 +6,32 @@ rec {
 
 
   # We want coreutils without ACL support.
-  coreutils_ = coreutils.override (args: {
+  coreutilsMinimal = coreutils.override (args: {
     aclSupport = false;
   });
 
-  # bzip2 wants utime.h, a header 'legacy' in uclibc
-  uclibcForBzip2 = uclibc.override {
-    extraConfig = ''
-        UCLIBC_SUSV3_LEGACY y
-        UCLIBC_SUSV4_LEGACY y
-    '';
-  };
-
-  gccLinkStatic = wrapGCCWith (import ../../build-support/gcc-wrapper) uclibcForBzip2
-    stdenv.gcc.gcc;
-  stdenvLinkStatic = overrideGCC stdenv gccLinkStatic;
-
-  curlStatic = import ../../tools/networking/curl {
-    stdenv = stdenvLinkStatic;
-    inherit fetchurl;
+  curlMinimal = curl.override {
     zlibSupport = false;
     sslSupport = false;
-    linkStatic = true;
+    scpSupport = false;
   };
 
-
-  bzip2Static = import ../../tools/compression/bzip2 {
-    stdenv = stdenvLinkStatic;
-    inherit fetchurl;
-    linkStatic = true;
-  };
-
-  #gccNoShared = wrapGCC ( gcc.gcc.override { enableShared = false; } );
-
-  busyboxStaticSh = busybox.override {
+  busyboxMinimal = busybox.override {
+    useUclibc = true;
+    enableStatic = true;
+    enableMinimal = true;
     extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
-
       CONFIG_ASH y
-      CONFIG_BASH_COMPAT y
-      CONFIG_ASH_ALIAS y
-      CONFIG_ASH_GETOPTS y
-      CONFIG_ASH_CMDCMD y
-      CONFIG_ASH_JOB_CONTROL y
       CONFIG_ASH_BUILTIN_ECHO y
-      CONFIG_ASH_BUILTIN_PRINTF y
       CONFIG_ASH_BUILTIN_TEST y
-    '';
-  };
-
-  busyboxStaticLn = busybox.override {
-    extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
-      CONFIG_LN y
-    '';
-  };
-
-  busyboxStaticMkdir = busybox.override {
-    extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
+      CONFIG_ASH_OPTIMIZE_FOR_SIZE y
       CONFIG_MKDIR y
+      CONFIG_TAR y
+      CONFIG_UNXZ y
     '';
   };
 
-  busyboxStaticCpio = busybox.override {
-    extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
-      CONFIG_CPIO y
-      # (shlevy) Are these necessary?
-      CONFIG_FEATURE_CPIO_O y
-      CONFIG_FEATURE_CPIO_P y
-    '';
-  };
-
-  build = 
+  build =
 
     stdenv.mkDerivation {
       name = "build";
@@ -91,7 +39,7 @@ rec {
       buildInputs = [nukeReferences cpio];
 
       buildCommand = ''
-	set -x
+        set -x
         mkdir -p $out/bin $out/lib $out/libexec
 
         # Copy what we need of Glibc.
@@ -105,26 +53,26 @@ rec {
         cp -d ${glibc}/lib/libnsl*.so* $out/lib
         cp -d ${glibc}/lib/libutil*.so* $out/lib
         cp -d ${glibc}/lib/crt?.o $out/lib
-        
+
         cp -rL ${glibc}/include $out
         chmod -R u+w $out/include
-        
+
         # Hopefully we won't need these.
         rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
         find $out/include -name .install -exec rm {} \;
         find $out/include -name ..install.cmd -exec rm {} \;
         mv $out/include $out/include-glibc
-        
+
         # Copy coreutils, bash, etc.
-        cp ${coreutils_}/bin/* $out/bin
+        cp ${coreutilsMinimal}/bin/* $out/bin
         (cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
-        
+
         cp ${bash}/bin/bash $out/bin
         cp ${findutils}/bin/find $out/bin
         cp ${findutils}/bin/xargs $out/bin
         cp -d ${diffutils}/bin/* $out/bin
         cp -d ${gnused}/bin/* $out/bin
-        cp -d ${gnugrep}/bin/* $out/bin
+        cp -d ${gnugrep}/bin/grep $out/bin
         cp ${gawk}/bin/gawk $out/bin
         cp -d ${gawk}/bin/awk $out/bin
         cp ${gnutar}/bin/tar $out/bin
@@ -133,9 +81,11 @@ rec {
         cp -d ${gnumake}/bin/* $out/bin
         cp -d ${patch}/bin/* $out/bin
         cp ${patchelf}/bin/* $out/bin
+        cp ${curlMinimal}/bin/curl $out/bin
+        cp -d ${curlMinimal}/lib/libcurl* $out/lib
 
         cp -d ${gnugrep.pcre}/lib/libpcre*.so* $out/lib # needed by grep
-        
+
         # Copy what we need of GCC.
         cp -d ${gcc.gcc}/bin/gcc $out/bin
         cp -d ${gcc.gcc}/bin/cpp $out/bin
@@ -151,6 +101,8 @@ rec {
         rm -rf $out/lib/gcc/*/*/plugin
         #rm -f $out/lib/gcc/*/*/*.a
         cp -rd ${gcc.gcc}/libexec/* $out/libexec
+        chmod -R u+w $out/libexec
+        rm -rf $out/libexec/gcc/*/*/plugin
         mkdir $out/include
         cp -rd ${gcc.gcc}/include/c++ $out/include
         chmod -R u+w $out/include
@@ -159,19 +111,18 @@ rec {
 
         cp -d ${gmpxx}/lib/libgmp*.so* $out/lib
         cp -d ${mpfr}/lib/libmpfr*.so* $out/lib
-        cp -d ${ppl}/lib/libppl*.so* $out/lib
-        cp -d ${cloogppl}/lib/libcloog*.so* $out/lib
         cp -d ${mpc}/lib/libmpc*.so* $out/lib
         cp -d ${zlib}/lib/libz.so* $out/lib
         cp -d ${libelf}/lib/libelf.so* $out/lib
-        
+
         # Copy binutils.
         for i in as ld ar ranlib nm strip readelf objdump; do
           cp ${binutils}/bin/$i $out/bin
         done
+        cp -d ${binutils}/lib/lib*.so* $out/lib
 
         chmod -R u+w $out
-        
+
         # Strip executables even further.
         for i in $out/bin/* $out/libexec/gcc/*/*/*; do
             if test -x $i -a ! -L $i; then
@@ -189,19 +140,10 @@ rec {
         mv $out/.pack $out/pack
 
         mkdir $out/on-server
-        (cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
-
-        mkdir $out/in-nixpkgs
-        cp ${busyboxStaticSh}/bin/busybox $out/in-nixpkgs/sh
-        cp ${busyboxStaticCpio}/bin/busybox $out/in-nixpkgs/cpio
-        cp ${busyboxStaticMkdir}/bin/busybox $out/in-nixpkgs/mkdir
-        cp ${busyboxStaticLn}/bin/busybox $out/in-nixpkgs/ln
-        cp ${curlStatic}/bin/curl $out/in-nixpkgs
-        cp ${bzip2Static}/bin/bzip2 $out/in-nixpkgs
-        chmod u+w $out/in-nixpkgs/*
-        strip $out/in-nixpkgs/*
-        nuke-refs $out/in-nixpkgs/*
-        bzip2 $out/in-nixpkgs/curl
+        tar cvfJ $out/on-server/bootstrap-tools.tar.xz -C $out/pack .
+        cp ${busyboxMinimal}/bin/busybox $out/on-server
+        chmod u+w $out/on-server/busybox
+        nuke-refs $out/on-server/busybox
       ''; # */
 
       # The result should not contain any references (store paths) so
@@ -210,22 +152,33 @@ rec {
       allowedReferences = [];
     };
 
-  
+
   unpack =
-    
-    stdenv.mkDerivation {
+
+    derivation {
       name = "unpack";
+      inherit system;
+      builder = "${build}/on-server/busybox";
+      args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
 
       buildCommand = ''
-        ${build}/in-nixpkgs/mkdir $out
-        ${build}/in-nixpkgs/bzip2 -d < ${build}/on-server/bootstrap-tools.cpio.bz2 | (cd $out && ${build}/in-nixpkgs/cpio -v -i)
+        export PATH=${build}/on-server:$out/bin
+
+        busybox mkdir $out
+        < ${build}/on-server/bootstrap-tools.tar.xz busybox unxz | busybox tar x -C $out
 
         for i in $out/bin/* $out/libexec/gcc/*/*/*; do
-            echo patching $i
-            if ! test -L $i; then
-                LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
-                    $out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath $i
-            fi
+            if [ -L "$i" ]; then continue; fi
+            if [ -z "''${i##*/liblto*}" ]; then continue; fi
+            echo patching "$i"
+            LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
+                $out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath "$i"
+        done
+
+        for i in $out/lib/libpcre*; do
+            if [ -L "$i" ]; then continue; fi
+            echo patching "$i"
+            $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
         done
 
         # Fix the libc linker script.
@@ -241,11 +194,12 @@ rec {
 
   test =
 
-    stdenv.mkDerivation {
+    derivation {
       name = "test";
+      inherit system;
+      builder = "${build}/on-server/busybox";
+      args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
 
-      realBuilder = "${unpack}/bin/bash";
-      
       buildCommand = ''
         export PATH=${unpack}/bin
         ls -l
@@ -259,23 +213,22 @@ rec {
         awk --version
         grep --version
         gcc --version
-
-        ${build}/in-nixpkgs/sh -c 'echo Hello World'
+        curl --version
 
         ldlinux=$(echo ${unpack}/lib/ld-linux*.so.2)
 
         export CPP="cpp -idirafter ${unpack}/include-glibc -B${unpack}"
         export CC="gcc -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
         export CXX="g++ -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
-        
+
         echo '#include <stdio.h>' >> foo.c
         echo '#include <limits.h>' >> foo.c
-        echo 'int main() { printf("Hello World\n"); return 0; }' >> foo.c
+        echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
         $CC -o $out/bin/foo foo.c
         $out/bin/foo
 
         echo '#include <iostream>' >> bar.cc
-        echo 'int main() { std::cout << "Hello World\n"; }' >> bar.cc
+        echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
         $CXX -v -o $out/bin/bar bar.cc
         $out/bin/bar
 
@@ -286,5 +239,5 @@ rec {
         make install
       ''; # */
     };
-    
+
 }
diff --git a/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
index 422dc6dd5fef..52953c9b88da 100644
--- a/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
+++ b/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
@@ -1,9 +1,7 @@
-set -e
-
 # Unpack the bootstrap tools tarball.
 echo Unpacking the bootstrap tools...
-$mkdir $out
-$bzip2 -d < $tarball | (cd $out && $cpio -i)
+$builder mkdir $out
+< $tarball $builder unxz | $builder tar x -C $out
 
 # Set the ELF interpreter / RPATH in the bootstrap binaries.
 echo Patching the bootstrap tools...
@@ -21,32 +19,17 @@ fi
 LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
 
 for i in $out/bin/* $out/libexec/gcc/*/*/*; do
-    echo patching $i
-    if ! test -L $i; then
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-    fi
-done
-for i in $out/lib/librt* ; do
-    echo patching $i
-    if ! test -L $i; then
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-    fi
+    if [ -L "$i" ]; then continue; fi
+    if [ -z "${i##*/liblto*}" ]; then continue; fi
+    echo patching "$i"
+    LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
+        $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
 done
 
-for i in $out/lib/libgmp* $out/lib/libppl* $out/lib/libcloog* $out/lib/libmpc* $out/lib/libpcre* $out/lib/libstdc++*.so.*[0-9]; do
-    echo trying to patch $i
-    if test -f $i -a ! -L $i; then
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-rpath $out/lib --force-rpath $i
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-rpath $out/lib --force-rpath $i
-    fi
+for i in $out/lib/libpcre*; do
+    if [ -L "$i" ]; then continue; fi
+    echo patching "$i"
+    $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
 done
 
 # Fix the libc linker script.
@@ -60,13 +43,21 @@ mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so
 ln -s bash $out/bin/sh
 ln -s bzip2 $out/bin/bunzip2
 
-# Mimic the gunzip script as in gzip installations
+# Provide a gunzip script.
 cat > $out/bin/gunzip <<EOF
 #!$out/bin/sh
 exec $out/bin/gzip -d "\$@"
 EOF
 chmod +x $out/bin/gunzip
 
-# fetchurl needs curl.
-bzip2 -d < $curl > $out/bin/curl
-chmod +x $out/bin/curl
+# Provide fgrep/egrep.
+echo "#! $out/bin/sh" > $out/bin/egrep
+echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
+echo "#! $out/bin/sh" > $out/bin/fgrep
+echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
+
+# Provide xz (actually only xz -d will work).
+echo "#! $out/bin/sh" > $out/bin/xz
+echo "exec $builder unxz \"\$@\"" >> $out/bin/xz
+
+chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/xz
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index 256f574c2e0c..74da91431a43 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   };
 
   sharedLibrary =
-    !stdenv.isDarwin && !(stdenv ? isDietLibC) && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;
+    !stdenv.isDarwin && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;
 
   patchPhase = stdenv.lib.optionalString stdenv.isDarwin "substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";
 
diff --git a/pkgs/tools/filesystems/squashfs/default.nix b/pkgs/tools/filesystems/squashfs/default.nix
index a016627b7a47..5e1700af0178 100644
--- a/pkgs/tools/filesystems/squashfs/default.nix
+++ b/pkgs/tools/filesystems/squashfs/default.nix
@@ -12,8 +12,6 @@ stdenv.mkDerivation rec {
   buildInputs = [ zlib xz ];
 
   preBuild = "cd squashfs-tools";
-  
-  NIX_LDFLAGS = "-lgcc_s"; # for pthread_cancel
 
   installFlags = "INSTALL_DIR=\${out}/bin";
 
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index e5471a6c404c..1dbdfff7448d 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
            -e "s|/usr/src/unifont.bdf|$PWD/unifont.bdf|g"
     '';
 
-  patches = [ ./fix-bash-completion.patch ];
+  patches = [ ./fix-bash-completion.patch ./glibc-2.20.patch ];
 
   configureFlags = optional zfsSupport "--enable-libzfs"
     ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
diff --git a/pkgs/tools/misc/grub/glibc-2.20.patch b/pkgs/tools/misc/grub/glibc-2.20.patch
new file mode 100644
index 000000000000..6bb4f677541b
--- /dev/null
+++ b/pkgs/tools/misc/grub/glibc-2.20.patch
@@ -0,0 +1,29 @@
+* grub-core/kern/emu/hostfs.c: squahes below warning
+  warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use 
+_DEFAULT_SOURCE"
+
+Signed-off-by: Khem Raj <address@hidden>
+
+Upstream-Status: Submitted
+---
+ grub-core/kern/emu/hostfs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c
+index 7e725f6..823116d 100644
+--- a/grub-core/kern/emu/hostfs.c
++++ b/grub-core/kern/emu/hostfs.c
+@@ -19,7 +19,11 @@
+ 
+ #include <config-util.h>
+ 
++/* Legacy feature macro.*/
+ #define _BSD_SOURCE
++/* New feature macro that provides everything _BSD_SOURCE and
++ *    _SVID_SOURCE provided and possibly more.  */
++#define _DEFAULT_SOURCE
+ #include <grub/fs.h>
+ #include <grub/file.h>
+ #include <grub/disk.h>
+-- 
+2.1.0
diff --git a/pkgs/tools/networking/curl/7.15.nix b/pkgs/tools/networking/curl/7.15.nix
index 0a87eaa944cd..47ac790e2adb 100644
--- a/pkgs/tools/networking/curl/7.15.nix
+++ b/pkgs/tools/networking/curl/7.15.nix
@@ -43,7 +43,6 @@ stdenv.mkDerivation rec {
 
   dontDisableStatic = linkStatic;
 
-  CFLAGS = if stdenv ? isDietLibC then "-DHAVE_INET_NTOA_R_2_ARGS=1" else "";
   LDFLAGS = if linkStatic then "-static" else "";
   CXX = "g++";
   CXXCPP = "g++ -E";
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index 85b935ebd767..b4ea6f99376d 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -4,7 +4,6 @@
 , scpSupport ? false, libssh2 ? null
 , gssSupport ? false, gss ? null
 , c-aresSupport ? false, c-ares ? null
-, linkStatic ? false
 }:
 
 assert zlibSupport -> zlib != null;
@@ -41,30 +40,18 @@ stdenv.mkDerivation rec {
       ( if scpSupport then "--with-libssh2=${libssh2}" else "--without-libssh2" )
     ]
     ++ stdenv.lib.optional c-aresSupport "--enable-ares=${c-ares}"
-    ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}"
-    ++ stdenv.lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]
-  ;
+    ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}";
 
-  dontDisableStatic = linkStatic;
-
-  CFLAGS = if stdenv ? isDietLibC then "-DHAVE_INET_NTOA_R_2_ARGS=1" else "";
-  LDFLAGS = if linkStatic then "-static" else "";
   CXX = "g++";
   CXXCPP = "g++ -E";
 
-  # libtool hack to get a static binary. Notice that to 'configure' I passed
-  # other LDFLAGS, because it doesn't use libtool for linking in the tests.
-  makeFlags = if linkStatic then "LDFLAGS=-all-static" else "";
-
   crossAttrs = {
     # We should refer to the cross built openssl
     # For the 'urandom', maybe it should be a cross-system option
     configureFlags = [
         ( if sslSupport then "--with-ssl=${openssl.crossDrv}" else "--without-ssl" )
         "--with-random /dev/urandom"
-      ]
-      ++ stdenv.lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]
-    ;
+      ];
   };
 
   passthru = {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0d9e13b7ead0..84380054211b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5178,7 +5178,7 @@ let
   glfw2 = callPackage ../development/libraries/glfw/2.x.nix { };
   glfw3 = callPackage ../development/libraries/glfw/3.x.nix { };
 
-  glibc = callPackage ../development/libraries/glibc/2.19 {
+  glibc = callPackage ../development/libraries/glibc {
     kernelHeaders = linuxHeaders;
     installLocales = config.glibc.locales or false;
     machHeaders = null;
@@ -5186,13 +5186,13 @@ let
     gccCross = null;
   };
 
-  glibc_memusage = callPackage ../development/libraries/glibc/2.19 {
+  glibc_memusage = callPackage ../development/libraries/glibc {
     kernelHeaders = linuxHeaders;
     installLocales = false;
     withGd = true;
   };
 
-  glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.19)
+  glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc)
     (let crossGNU = crossSystem != null && crossSystem.config == "i586-pc-gnu";
      in {
        inherit stdenv fetchurl;
@@ -5220,11 +5220,11 @@ let
     installLocales = config.glibc.locales or false;
   };
 
-  glibcLocales = callPackage ../development/libraries/glibc/2.19/locales.nix { };
+  glibcLocales = callPackage ../development/libraries/glibc/locales.nix { };
 
-  glibcInfo = callPackage ../development/libraries/glibc/2.19/info.nix { };
+  glibcInfo = callPackage ../development/libraries/glibc/info.nix { };
 
-  glibc_multi = callPackage ../development/libraries/glibc/2.19/multi.nix {
+  glibc_multi = callPackage ../development/libraries/glibc/multi.nix {
     inherit glibc;
     glibc32 = (import ./all-packages.nix {system = "i686-linux";}).glibc;
   };
@@ -8073,7 +8073,7 @@ let
 
   # -- Linux kernel expressions ------------------------------------------------
 
-  linuxHeaders = linuxHeaders_3_7;
+  linuxHeaders = linuxHeaders_3_12;
 
   linuxHeaders24Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.4.nix {
     inherit stdenv fetchurl perl;
@@ -8085,7 +8085,7 @@ let
     cross = assert crossSystem != null; crossSystem;
   });
 
-  linuxHeaders_3_7 = callPackage ../os-specific/linux/kernel-headers/3.7.nix { };
+  linuxHeaders_3_12 = callPackage ../os-specific/linux/kernel-headers/3.12.nix { };
 
   linuxHeaders_3_14 = callPackage ../os-specific/linux/kernel-headers/3.14.nix { };