diff --git a/_constraints b/_constraints
deleted file mode 100644
index 03d38d4..0000000
--- a/_constraints
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- glibc-testsuite
-
-
-
- 1500
-
-
- xen
-
-
diff --git a/abort-no-flush.patch b/abort-no-flush.patch
deleted file mode 100644
index a32b6fe..0000000
--- a/abort-no-flush.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-Don't close or flush stdio streams on abort
-
- [BZ #15436]
- * stdlib/abort.c (abort): Don't call fflush and __fcloseall.
-
-Index: glibc-2.19/stdlib/abort.c
-===================================================================
---- glibc-2.19.orig/stdlib/abort.c
-+++ glibc-2.19/stdlib/abort.c
-@@ -30,9 +30,6 @@
- # define ABORT_INSTRUCTION
- #endif
-
--#include
--#define fflush(s) _IO_flush_all_lockp (0)
--
- /* Exported variable to locate abort message in core files etc. */
- struct abort_msg_s *__abort_msg __attribute__ ((nocommon));
- libc_hidden_def (__abort_msg)
-@@ -66,16 +63,8 @@ abort (void)
- __sigprocmask (SIG_UNBLOCK, &sigs, 0);
- }
-
-- /* Flush all streams. We cannot close them now because the user
-- might have registered a handler for SIGABRT. */
-- if (stage == 1)
-- {
-- ++stage;
-- fflush (NULL);
-- }
--
- /* Send signal which possibly calls a user handler. */
-- if (stage == 2)
-+ if (stage == 1)
- {
- /* This stage is special: we must allow repeated calls of
- `abort' when a user defined handler for SIGABRT is installed.
-@@ -93,7 +82,7 @@ abort (void)
- }
-
- /* There was a handler installed. Now remove it. */
-- if (stage == 3)
-+ if (stage == 2)
- {
- ++stage;
- memset (&act, '\0', sizeof (struct sigaction));
-@@ -103,30 +92,22 @@ abort (void)
- __sigaction (SIGABRT, &act, NULL);
- }
-
-- /* Now close the streams which also flushes the output the user
-- defined handler might has produced. */
-- if (stage == 4)
-- {
-- ++stage;
-- __fcloseall ();
-- }
--
- /* Try again. */
-- if (stage == 5)
-+ if (stage == 3)
- {
- ++stage;
- raise (SIGABRT);
- }
-
- /* Now try to abort using the system specific command. */
-- if (stage == 6)
-+ if (stage == 4)
- {
- ++stage;
- ABORT_INSTRUCTION;
- }
-
- /* If we can't signal ourselves and the abort instruction failed, exit. */
-- if (stage == 7)
-+ if (stage == 5)
- {
- ++stage;
- _exit (127);
diff --git a/add-locales.patch b/add-locales.patch
deleted file mode 100644
index 7a18cd1..0000000
--- a/add-locales.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Index: glibc-2.25/localedata/SUPPORTED
-===================================================================
---- glibc-2.25.orig/localedata/SUPPORTED
-+++ glibc-2.25/localedata/SUPPORTED
-@@ -129,6 +129,7 @@ en_CA.UTF-8/UTF-8 \
- en_CA/ISO-8859-1 \
- en_DK.UTF-8/UTF-8 \
- en_DK/ISO-8859-1 \
-+en_GB.ISO-8859-15/ISO-8859-15 \
- en_GB.UTF-8/UTF-8 \
- en_GB/ISO-8859-1 \
- en_HK.UTF-8/UTF-8 \
-@@ -145,6 +146,7 @@ en_PH.UTF-8/UTF-8 \
- en_PH/ISO-8859-1 \
- en_SG.UTF-8/UTF-8 \
- en_SG/ISO-8859-1 \
-+en_US.ISO-8859-15/ISO-8859-15 \
- en_US.UTF-8/UTF-8 \
- en_US/ISO-8859-1 \
- en_ZA.UTF-8/UTF-8 \
-@@ -269,6 +271,8 @@ it_IT/ISO-8859-1 \
- it_IT@euro/ISO-8859-15 \
- iu_CA/UTF-8 \
- ja_JP.EUC-JP/EUC-JP \
-+ja_JP.SHIFT_JISX0213/SHIFT_JISX0213 \
-+ja_JP.SJIS/SHIFT_JIS \
- ja_JP.UTF-8/UTF-8 \
- ka_GE.UTF-8/UTF-8 \
- ka_GE/GEORGIAN-PS \
diff --git a/baselibs.conf b/baselibs.conf
index 0af8f27..f37d7ce 100644
--- a/baselibs.conf
+++ b/baselibs.conf
@@ -6,19 +6,12 @@ glibc
targettype ia32 +/etc/ld.so.conf
targettype ia32 "/lib/ld-linux.so.2 -> /lib/ld-linux.so.2"
prereq -glibc-x86
- +/usr/lib/getconf/[^g]
- +/usr/sbin/iconvconfig -> /usr/sbin/iconvconfig-
glibc-locale
arch i586 block!
+/usr/lib(64)?/gconv/gconv-modules
targettype x86 -/usr/lib(64)?/gconv/gconv-modules
glibc-devel
- requires "glibc- = %version"
arch i586 block!
- +^/usr/include/gnu/lib-names-.*\.h$
+^/usr/include/gnu/stubs-.*\.h$
-glibc-devel-static
- arch i586 block!
glibc-profile
arch i586 block!
-glibc-utils
diff --git a/bindresvport.blacklist b/bindresvport.blacklist
index 8b285bd..ae64c70 100644
--- a/bindresvport.blacklist
+++ b/bindresvport.blacklist
@@ -4,10 +4,8 @@
# called by RPC services. This mostly solves the problem, that a
# RPC service uses a well known port of another service.
#
-623 # ASF, used by IPMI on some cards
631 # cups
636 # ldaps
-664 # Secure ASF, used by IPMI on some cards
774 # rpasswd
921 # lwresd
993 # imaps
diff --git a/check-build.sh b/check-build.sh
new file mode 100644
index 0000000..cc01226
--- /dev/null
+++ b/check-build.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Copyright (c) 2003, 2004 SuSE Linux AG, Germany. All rights reserved.
+#
+# Authors: Thorsten Kukuk
+#
+# this script use the following variable(s):
+#
+# - $BUILD_BASENAME
+#
+
+if [ `nice` -gt '9' ] ; then
+ echo "Don't modify nice for building glibc!"
+ exit 1
+fi
+
+# get kernel version
+OFS="$IFS" ; IFS=".-" ; version=(`uname -r`) ; IFS="$OIFS"
+if test ${version[0]} -lt 2 -o ${version[1]} -lt 6 -o ${version[2]} -lt 11 ; then
+ echo "FATAL: kernel too old, need kernel >= 2.6.11 for this package" 1>&2
+ exit 1
+fi
+
+
+exit 0
+
diff --git a/crypt_blowfish-1.0.diff b/crypt_blowfish-1.0.diff
new file mode 100644
index 0000000..32e5be7
--- /dev/null
+++ b/crypt_blowfish-1.0.diff
@@ -0,0 +1,1330 @@
+diff -ruN crypt-/crypt_blowfish.c crypt/crypt_blowfish.c
+--- crypt-/crypt_blowfish.c 1970-01-01 01:00:00.000000000 +0100
++++ crypt/crypt_blowfish.c 2006-09-20 20:56:59.000000000 +0200
+@@ -0,0 +1,743 @@
++/*
++ * This code comes from John the Ripper password cracker, with reentrant
++ * and crypt(3) interfaces added, but optimizations specific to password
++ * cracking removed.
++ *
++ * Written by Solar Designer in 1998-2002 and
++ * placed in the public domain.
++ *
++ * There's absolutely no warranty.
++ *
++ * It is my intent that you should be able to use this on your system,
++ * as a part of a software package, or anywhere else to improve security,
++ * ensure compatibility, or for any other purpose. I would appreciate
++ * it if you give credit where it is due and keep your modifications in
++ * the public domain as well, but I don't require that in order to let
++ * you place this code and any modifications you make under a license
++ * of your choice.
++ *
++ * This implementation is compatible with OpenBSD bcrypt.c (version 2a)
++ * by Niels Provos , and uses some of his
++ * ideas. The password hashing algorithm was designed by David Mazieres
++ * .
++ *
++ * There's a paper on the algorithm that explains its design decisions:
++ *
++ * http://www.usenix.org/events/usenix99/provos.html
++ *
++ * Some of the tricks in BF_ROUND might be inspired by Eric Young's
++ * Blowfish library (I can't be sure if I would think of something if I
++ * hadn't seen his code).
++ */
++
++#include
++
++#include
++#ifndef __set_errno
++#define __set_errno(val) errno = (val)
++#endif
++
++#undef __CONST
++#ifdef __GNUC__
++#define __CONST __const
++#else
++#define __CONST
++#endif
++
++#ifdef __i386__
++#define BF_ASM 1
++#define BF_SCALE 1
++#elif defined(__alpha__) || defined(__hppa__)
++#define BF_ASM 0
++#define BF_SCALE 1
++#else
++#define BF_ASM 0
++#define BF_SCALE 0
++#endif
++
++typedef unsigned int BF_word;
++
++/* Number of Blowfish rounds, this is also hardcoded into a few places */
++#define BF_N 16
++
++typedef BF_word BF_key[BF_N + 2];
++
++typedef struct {
++ BF_word S[4][0x100];
++ BF_key P;
++} BF_ctx;
++
++/*
++ * Magic IV for 64 Blowfish encryptions that we do at the end.
++ * The string is "OrpheanBeholderScryDoubt" on big-endian.
++ */
++static BF_word BF_magic_w[6] = {
++ 0x4F727068, 0x65616E42, 0x65686F6C,
++ 0x64657253, 0x63727944, 0x6F756274
++};
++
++/*
++ * P-box and S-box tables initialized with digits of Pi.
++ */
++static BF_ctx BF_init_state = {
++ {
++ {
++ 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
++ 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
++ 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
++ 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
++ 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
++ 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
++ 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
++ 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
++ 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
++ 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
++ 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
++ 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
++ 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
++ 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
++ 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
++ 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
++ 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
++ 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
++ 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
++ 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
++ 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
++ 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
++ 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
++ 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
++ 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
++ 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
++ 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
++ 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
++ 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
++ 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
++ 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
++ 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
++ 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
++ 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
++ 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
++ 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
++ 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
++ 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
++ 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
++ 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
++ 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
++ 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
++ 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
++ 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
++ 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
++ 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
++ 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
++ 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
++ 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
++ 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
++ 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
++ 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
++ 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
++ 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
++ 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
++ 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
++ 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
++ 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
++ 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
++ 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
++ 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
++ 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
++ 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
++ 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a
++ }, {
++ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
++ 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
++ 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
++ 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
++ 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
++ 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
++ 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
++ 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
++ 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
++ 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
++ 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
++ 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
++ 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
++ 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
++ 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
++ 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
++ 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
++ 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
++ 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
++ 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
++ 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
++ 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
++ 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
++ 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
++ 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
++ 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
++ 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
++ 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
++ 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
++ 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
++ 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
++ 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
++ 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
++ 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
++ 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
++ 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
++ 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
++ 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
++ 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
++ 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
++ 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
++ 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
++ 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
++ 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
++ 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
++ 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
++ 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
++ 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
++ 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
++ 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
++ 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
++ 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
++ 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
++ 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
++ 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
++ 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
++ 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
++ 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
++ 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
++ 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
++ 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
++ 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
++ 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
++ 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7
++ }, {
++ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
++ 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
++ 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
++ 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
++ 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
++ 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
++ 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
++ 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
++ 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
++ 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
++ 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
++ 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
++ 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
++ 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
++ 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
++ 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
++ 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
++ 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
++ 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
++ 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
++ 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
++ 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
++ 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
++ 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
++ 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
++ 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
++ 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
++ 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
++ 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
++ 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
++ 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
++ 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
++ 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
++ 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
++ 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
++ 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
++ 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
++ 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
++ 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
++ 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
++ 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
++ 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
++ 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
++ 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
++ 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
++ 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
++ 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
++ 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
++ 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
++ 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
++ 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
++ 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
++ 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
++ 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
++ 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
++ 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
++ 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
++ 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
++ 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
++ 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
++ 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
++ 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
++ 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
++ 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0
++ }, {
++ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
++ 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
++ 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
++ 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
++ 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
++ 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
++ 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
++ 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
++ 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
++ 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
++ 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
++ 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
++ 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
++ 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
++ 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
++ 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
++ 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
++ 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
++ 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
++ 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
++ 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
++ 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
++ 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
++ 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
++ 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
++ 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
++ 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
++ 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
++ 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
++ 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
++ 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
++ 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
++ 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
++ 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
++ 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
++ 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
++ 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
++ 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
++ 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
++ 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
++ 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
++ 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
++ 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
++ 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
++ 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
++ 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
++ 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
++ 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
++ 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
++ 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
++ 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
++ 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
++ 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
++ 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
++ 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
++ 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
++ 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
++ 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
++ 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
++ 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
++ 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
++ 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
++ 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
++ 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6
++ }
++ }, {
++ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
++ 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
++ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
++ 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
++ 0x9216d5d9, 0x8979fb1b
++ }
++};
++
++static unsigned char BF_itoa64[64 + 1] =
++ "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
++
++static unsigned char BF_atoi64[0x60] = {
++ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1,
++ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64, 64, 64,
++ 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
++ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 64, 64, 64, 64, 64,
++ 64, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
++ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 64, 64, 64, 64, 64
++};
++
++/*
++ * This may be optimized out if built with function inlining and no BF_ASM.
++ */
++static void clean(void *data, int size)
++{
++#if BF_ASM
++ extern void _BF_clean(void *data);
++#endif
++ memset(data, 0, size);
++#if BF_ASM
++ _BF_clean(data);
++#endif
++}
++
++#define BF_safe_atoi64(dst, src) \
++{ \
++ tmp = (unsigned char)(src); \
++ if ((unsigned int)(tmp -= 0x20) >= 0x60) return -1; \
++ tmp = BF_atoi64[tmp]; \
++ if (tmp > 63) return -1; \
++ (dst) = tmp; \
++}
++
++static int BF_decode(BF_word *dst, __CONST char *src, int size)
++{
++ unsigned char *dptr = (unsigned char *)dst;
++ unsigned char *end = dptr + size;
++ unsigned char *sptr = (unsigned char *)src;
++ unsigned int tmp, c1, c2, c3, c4;
++
++ do {
++ BF_safe_atoi64(c1, *sptr++);
++ BF_safe_atoi64(c2, *sptr++);
++ *dptr++ = (c1 << 2) | ((c2 & 0x30) >> 4);
++ if (dptr >= end) break;
++
++ BF_safe_atoi64(c3, *sptr++);
++ *dptr++ = ((c2 & 0x0F) << 4) | ((c3 & 0x3C) >> 2);
++ if (dptr >= end) break;
++
++ BF_safe_atoi64(c4, *sptr++);
++ *dptr++ = ((c3 & 0x03) << 6) | c4;
++ } while (dptr < end);
++
++ return 0;
++}
++
++static void BF_encode(char *dst, __CONST BF_word *src, int size)
++{
++ unsigned char *sptr = (unsigned char *)src;
++ unsigned char *end = sptr + size;
++ unsigned char *dptr = (unsigned char *)dst;
++ unsigned int c1, c2;
++
++ do {
++ c1 = *sptr++;
++ *dptr++ = BF_itoa64[c1 >> 2];
++ c1 = (c1 & 0x03) << 4;
++ if (sptr >= end) {
++ *dptr++ = BF_itoa64[c1];
++ break;
++ }
++
++ c2 = *sptr++;
++ c1 |= c2 >> 4;
++ *dptr++ = BF_itoa64[c1];
++ c1 = (c2 & 0x0f) << 2;
++ if (sptr >= end) {
++ *dptr++ = BF_itoa64[c1];
++ break;
++ }
++
++ c2 = *sptr++;
++ c1 |= c2 >> 6;
++ *dptr++ = BF_itoa64[c1];
++ *dptr++ = BF_itoa64[c2 & 0x3f];
++ } while (sptr < end);
++}
++
++static void BF_swap(BF_word *x, int count)
++{
++ static int endianness_check = 1;
++ char *is_little_endian = (char *)&endianness_check;
++ BF_word tmp;
++
++ if (*is_little_endian)
++ do {
++ tmp = *x;
++ tmp = (tmp << 16) | (tmp >> 16);
++ *x++ = ((tmp & 0x00FF00FF) << 8) | ((tmp >> 8) & 0x00FF00FF);
++ } while (--count);
++}
++
++#if BF_SCALE
++/* Architectures which can shift addresses left by 2 bits with no extra cost */
++#define BF_ROUND(L, R, N) \
++ tmp1 = L & 0xFF; \
++ tmp2 = L >> 8; \
++ tmp2 &= 0xFF; \
++ tmp3 = L >> 16; \
++ tmp3 &= 0xFF; \
++ tmp4 = L >> 24; \
++ tmp1 = data.ctx.S[3][tmp1]; \
++ tmp2 = data.ctx.S[2][tmp2]; \
++ tmp3 = data.ctx.S[1][tmp3]; \
++ tmp3 += data.ctx.S[0][tmp4]; \
++ tmp3 ^= tmp2; \
++ R ^= data.ctx.P[N + 1]; \
++ tmp3 += tmp1; \
++ R ^= tmp3;
++#else
++/* Architectures with no complicated addressing modes supported */
++#define BF_INDEX(S, i) \
++ (*((BF_word *)(((unsigned char *)S) + (i))))
++#define BF_ROUND(L, R, N) \
++ tmp1 = L & 0xFF; \
++ tmp1 <<= 2; \
++ tmp2 = L >> 6; \
++ tmp2 &= 0x3FC; \
++ tmp3 = L >> 14; \
++ tmp3 &= 0x3FC; \
++ tmp4 = L >> 22; \
++ tmp4 &= 0x3FC; \
++ tmp1 = BF_INDEX(data.ctx.S[3], tmp1); \
++ tmp2 = BF_INDEX(data.ctx.S[2], tmp2); \
++ tmp3 = BF_INDEX(data.ctx.S[1], tmp3); \
++ tmp3 += BF_INDEX(data.ctx.S[0], tmp4); \
++ tmp3 ^= tmp2; \
++ R ^= data.ctx.P[N + 1]; \
++ tmp3 += tmp1; \
++ R ^= tmp3;
++#endif
++
++/*
++ * Encrypt one block, BF_N is hardcoded here.
++ */
++#define BF_ENCRYPT \
++ L ^= data.ctx.P[0]; \
++ BF_ROUND(L, R, 0); \
++ BF_ROUND(R, L, 1); \
++ BF_ROUND(L, R, 2); \
++ BF_ROUND(R, L, 3); \
++ BF_ROUND(L, R, 4); \
++ BF_ROUND(R, L, 5); \
++ BF_ROUND(L, R, 6); \
++ BF_ROUND(R, L, 7); \
++ BF_ROUND(L, R, 8); \
++ BF_ROUND(R, L, 9); \
++ BF_ROUND(L, R, 10); \
++ BF_ROUND(R, L, 11); \
++ BF_ROUND(L, R, 12); \
++ BF_ROUND(R, L, 13); \
++ BF_ROUND(L, R, 14); \
++ BF_ROUND(R, L, 15); \
++ tmp4 = R; \
++ R = L; \
++ L = tmp4 ^ data.ctx.P[BF_N + 1];
++
++#if BF_ASM
++#define BF_body() \
++ _BF_body_r(&data.ctx);
++#else
++#define BF_body() \
++ L = R = 0; \
++ ptr = data.ctx.P; \
++ do { \
++ ptr += 2; \
++ BF_ENCRYPT; \
++ *(ptr - 2) = L; \
++ *(ptr - 1) = R; \
++ } while (ptr < &data.ctx.P[BF_N + 2]); \
++\
++ ptr = data.ctx.S[0]; \
++ do { \
++ ptr += 2; \
++ BF_ENCRYPT; \
++ *(ptr - 2) = L; \
++ *(ptr - 1) = R; \
++ } while (ptr < &data.ctx.S[3][0xFF]);
++#endif
++
++static void BF_set_key(__CONST char *key, BF_key expanded, BF_key initial)
++{
++ __CONST char *ptr = key;
++ int i, j;
++ BF_word tmp;
++
++ for (i = 0; i < BF_N + 2; i++) {
++ tmp = 0;
++ for (j = 0; j < 4; j++) {
++ tmp <<= 8;
++ tmp |= *ptr;
++
++ if (!*ptr) ptr = key; else ptr++;
++ }
++
++ expanded[i] = tmp;
++ initial[i] = BF_init_state.P[i] ^ tmp;
++ }
++}
++
++char *_crypt_blowfish_rn(__CONST char *key, __CONST char *setting,
++ char *output, int size)
++{
++#if BF_ASM
++ extern void _BF_body_r(BF_ctx *ctx);
++#endif
++ struct {
++ BF_ctx ctx;
++ BF_key expanded_key;
++ union {
++ BF_word salt[4];
++ BF_word output[6];
++ } binary;
++ } data;
++ BF_word L, R;
++ BF_word tmp1, tmp2, tmp3, tmp4;
++ BF_word *ptr;
++ BF_word count;
++ int i;
++
++ if (size < 7 + 22 + 31 + 1) {
++ __set_errno(ERANGE);
++ return NULL;
++ }
++
++ if (setting[0] != '$' ||
++ setting[1] != '2' ||
++ setting[2] != 'a' ||
++ setting[3] != '$' ||
++ setting[4] < '0' || setting[4] > '3' ||
++ setting[5] < '0' || setting[5] > '9' ||
++ setting[6] != '$') {
++ __set_errno(EINVAL);
++ return NULL;
++ }
++
++ count = (BF_word)1 << ((setting[4] - '0') * 10 + (setting[5] - '0'));
++ if (count < 16 || BF_decode(data.binary.salt, &setting[7], 16)) {
++ clean(data.binary.salt, sizeof(data.binary.salt));
++ __set_errno(EINVAL);
++ return NULL;
++ }
++ BF_swap(data.binary.salt, 4);
++
++ BF_set_key(key, data.expanded_key, data.ctx.P);
++
++ memcpy(data.ctx.S, BF_init_state.S, sizeof(data.ctx.S));
++
++ L = R = 0;
++ for (i = 0; i < BF_N + 2; i += 2) {
++ L ^= data.binary.salt[i & 2];
++ R ^= data.binary.salt[(i & 2) + 1];
++ BF_ENCRYPT;
++ data.ctx.P[i] = L;
++ data.ctx.P[i + 1] = R;
++ }
++
++ ptr = data.ctx.S[0];
++ do {
++ ptr += 4;
++ L ^= data.binary.salt[(BF_N + 2) & 3];
++ R ^= data.binary.salt[(BF_N + 3) & 3];
++ BF_ENCRYPT;
++ *(ptr - 4) = L;
++ *(ptr - 3) = R;
++
++ L ^= data.binary.salt[(BF_N + 4) & 3];
++ R ^= data.binary.salt[(BF_N + 5) & 3];
++ BF_ENCRYPT;
++ *(ptr - 2) = L;
++ *(ptr - 1) = R;
++ } while (ptr < &data.ctx.S[3][0xFF]);
++
++ do {
++ data.ctx.P[0] ^= data.expanded_key[0];
++ data.ctx.P[1] ^= data.expanded_key[1];
++ data.ctx.P[2] ^= data.expanded_key[2];
++ data.ctx.P[3] ^= data.expanded_key[3];
++ data.ctx.P[4] ^= data.expanded_key[4];
++ data.ctx.P[5] ^= data.expanded_key[5];
++ data.ctx.P[6] ^= data.expanded_key[6];
++ data.ctx.P[7] ^= data.expanded_key[7];
++ data.ctx.P[8] ^= data.expanded_key[8];
++ data.ctx.P[9] ^= data.expanded_key[9];
++ data.ctx.P[10] ^= data.expanded_key[10];
++ data.ctx.P[11] ^= data.expanded_key[11];
++ data.ctx.P[12] ^= data.expanded_key[12];
++ data.ctx.P[13] ^= data.expanded_key[13];
++ data.ctx.P[14] ^= data.expanded_key[14];
++ data.ctx.P[15] ^= data.expanded_key[15];
++ data.ctx.P[16] ^= data.expanded_key[16];
++ data.ctx.P[17] ^= data.expanded_key[17];
++
++ BF_body();
++
++ tmp1 = data.binary.salt[0];
++ tmp2 = data.binary.salt[1];
++ tmp3 = data.binary.salt[2];
++ tmp4 = data.binary.salt[3];
++ data.ctx.P[0] ^= tmp1;
++ data.ctx.P[1] ^= tmp2;
++ data.ctx.P[2] ^= tmp3;
++ data.ctx.P[3] ^= tmp4;
++ data.ctx.P[4] ^= tmp1;
++ data.ctx.P[5] ^= tmp2;
++ data.ctx.P[6] ^= tmp3;
++ data.ctx.P[7] ^= tmp4;
++ data.ctx.P[8] ^= tmp1;
++ data.ctx.P[9] ^= tmp2;
++ data.ctx.P[10] ^= tmp3;
++ data.ctx.P[11] ^= tmp4;
++ data.ctx.P[12] ^= tmp1;
++ data.ctx.P[13] ^= tmp2;
++ data.ctx.P[14] ^= tmp3;
++ data.ctx.P[15] ^= tmp4;
++ data.ctx.P[16] ^= tmp1;
++ data.ctx.P[17] ^= tmp2;
++
++ BF_body();
++ } while (--count);
++
++ for (i = 0; i < 6; i += 2) {
++ L = BF_magic_w[i];
++ R = BF_magic_w[i + 1];
++
++ count = 64;
++ do {
++ BF_ENCRYPT;
++ } while (--count);
++
++ data.binary.output[i] = L;
++ data.binary.output[i + 1] = R;
++ }
++
++ memcpy(output, setting, 7 + 22 - 1);
++ output[7 + 22 - 1] = BF_itoa64[(int)
++ BF_atoi64[(int)setting[7 + 22 - 1] - 0x20] & 0x30];
++
++/* This has to be bug-compatible with the original implementation, so
++ * only encode 23 of the 24 bytes. :-) */
++ BF_swap(data.binary.output, 6);
++ BF_encode(&output[7 + 22], data.binary.output, 23);
++ output[7 + 22 + 31] = '\0';
++
++/* Overwrite the most obvious sensitive data we have on the stack. Note
++ * that this does not guarantee there's no sensitive data left on the
++ * stack and/or in registers; I'm not aware of portable code that does. */
++ clean(&data, sizeof(data));
++
++ return output;
++}
++
++char *_crypt_gensalt_blowfish_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size)
++{
++ if (size < 16 || output_size < 7 + 22 + 1 ||
++ (count && (count < 4 || count > 31))) {
++ if (output_size > 0) output[0] = '\0';
++ __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
++ return NULL;
++ }
++
++ if (!count) count = 5;
++
++ output[0] = '$';
++ output[1] = '2';
++ output[2] = 'a';
++ output[3] = '$';
++ output[4] = '0' + count / 10;
++ output[5] = '0' + count % 10;
++ output[6] = '$';
++
++ BF_encode(&output[7], (BF_word *)input, 16);
++ output[7 + 22] = '\0';
++
++ return output;
++}
+diff -ruN crypt-/crypt_gensalt.c crypt/crypt_gensalt.c
+--- crypt-/crypt_gensalt.c 1970-01-01 01:00:00.000000000 +0100
++++ crypt/crypt_gensalt.c 2006-09-20 20:56:59.000000000 +0200
+@@ -0,0 +1,111 @@
++/*
++ * Written by Solar Designer and placed in the public domain.
++ * See crypt_blowfish.c for more information.
++ *
++ * This file contains salt generation functions for the traditional and
++ * other common crypt(3) algorithms, except for bcrypt which is defined
++ * entirely in crypt_blowfish.c.
++ */
++
++#include
++
++#include
++#ifndef __set_errno
++#define __set_errno(val) errno = (val)
++#endif
++
++#undef __CONST
++#ifdef __GNUC__
++#define __CONST __const
++#else
++#define __CONST
++#endif
++
++unsigned char _crypt_itoa64[64 + 1] =
++ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
++
++char *_crypt_gensalt_traditional_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size)
++{
++ if (size < 2 || output_size < 2 + 1 || (count && count != 25)) {
++ if (output_size > 0) output[0] = '\0';
++ __set_errno((output_size < 2 + 1) ? ERANGE : EINVAL);
++ return NULL;
++ }
++
++ output[0] = _crypt_itoa64[(unsigned int)input[0] & 0x3f];
++ output[1] = _crypt_itoa64[(unsigned int)input[1] & 0x3f];
++ output[2] = '\0';
++
++ return output;
++}
++
++char *_crypt_gensalt_extended_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size)
++{
++ unsigned long value;
++
++/* Even iteration counts make it easier to detect weak DES keys from a look
++ * at the hash, so they should be avoided */
++ if (size < 3 || output_size < 1 + 4 + 4 + 1 ||
++ (count && (count > 0xffffff || !(count & 1)))) {
++ if (output_size > 0) output[0] = '\0';
++ __set_errno((output_size < 1 + 4 + 4 + 1) ? ERANGE : EINVAL);
++ return NULL;
++ }
++
++ if (!count) count = 725;
++
++ output[0] = '_';
++ output[1] = _crypt_itoa64[count & 0x3f];
++ output[2] = _crypt_itoa64[(count >> 6) & 0x3f];
++ output[3] = _crypt_itoa64[(count >> 12) & 0x3f];
++ output[4] = _crypt_itoa64[(count >> 18) & 0x3f];
++ value = (unsigned long)(unsigned char)input[0] |
++ ((unsigned long)(unsigned char)input[1] << 8) |
++ ((unsigned long)(unsigned char)input[2] << 16);
++ output[5] = _crypt_itoa64[value & 0x3f];
++ output[6] = _crypt_itoa64[(value >> 6) & 0x3f];
++ output[7] = _crypt_itoa64[(value >> 12) & 0x3f];
++ output[8] = _crypt_itoa64[(value >> 18) & 0x3f];
++ output[9] = '\0';
++
++ return output;
++}
++
++char *_crypt_gensalt_md5_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size)
++{
++ unsigned long value;
++
++ if (size < 3 || output_size < 3 + 4 + 1 || (count && count != 1000)) {
++ if (output_size > 0) output[0] = '\0';
++ __set_errno((output_size < 3 + 4 + 1) ? ERANGE : EINVAL);
++ return NULL;
++ }
++
++ output[0] = '$';
++ output[1] = '1';
++ output[2] = '$';
++ value = (unsigned long)(unsigned char)input[0] |
++ ((unsigned long)(unsigned char)input[1] << 8) |
++ ((unsigned long)(unsigned char)input[2] << 16);
++ output[3] = _crypt_itoa64[value & 0x3f];
++ output[4] = _crypt_itoa64[(value >> 6) & 0x3f];
++ output[5] = _crypt_itoa64[(value >> 12) & 0x3f];
++ output[6] = _crypt_itoa64[(value >> 18) & 0x3f];
++ output[7] = '\0';
++
++ if (size >= 6 && output_size >= 3 + 4 + 4 + 1) {
++ value = (unsigned long)(unsigned char)input[3] |
++ ((unsigned long)(unsigned char)input[4] << 8) |
++ ((unsigned long)(unsigned char)input[5] << 16);
++ output[7] = _crypt_itoa64[value & 0x3f];
++ output[8] = _crypt_itoa64[(value >> 6) & 0x3f];
++ output[9] = _crypt_itoa64[(value >> 12) & 0x3f];
++ output[10] = _crypt_itoa64[(value >> 18) & 0x3f];
++ output[11] = '\0';
++ }
++
++ return output;
++}
+diff -ruN crypt-/ow-crypt.h crypt/ow-crypt.h
+--- crypt-/ow-crypt.h 1970-01-01 01:00:00.000000000 +0100
++++ crypt/ow-crypt.h 2006-09-20 20:56:59.000000000 +0200
+@@ -0,0 +1,34 @@
++/*
++ * Written by Solar Designer and placed in the public domain.
++ * See crypt_blowfish.c for more information.
++ */
++
++#ifndef _OW_CRYPT_H
++#define _OW_CRYPT_H
++
++#undef __CONST
++#ifdef __GNUC__
++#define __CONST __const
++#else
++#define __CONST
++#endif
++
++#ifndef __SKIP_GNU
++extern char *crypt(__CONST char *key, __CONST char *setting);
++extern char *crypt_r(__CONST char *key, __CONST char *setting, void *data);
++#endif
++
++#ifndef __SKIP_OW
++extern char *crypt_rn(__CONST char *key, __CONST char *setting,
++ void *data, int size);
++extern char *crypt_ra(__CONST char *key, __CONST char *setting,
++ void **data, int *size);
++extern char *crypt_gensalt(__CONST char *prefix, unsigned long count,
++ __CONST char *input, int size);
++extern char *crypt_gensalt_rn(__CONST char *prefix, unsigned long count,
++ __CONST char *input, int size, char *output, int output_size);
++extern char *crypt_gensalt_ra(__CONST char *prefix, unsigned long count,
++ __CONST char *input, int size);
++#endif
++
++#endif
+diff -ruN crypt-/wrapper.c crypt/wrapper.c
+--- crypt-/wrapper.c 1970-01-01 01:00:00.000000000 +0100
++++ crypt/wrapper.c 2006-09-20 20:56:59.000000000 +0200
+@@ -0,0 +1,426 @@
++/*
++ * Written by Solar Designer and placed in the public domain.
++ * See crypt_blowfish.c for more information.
++ */
++
++#include
++#include
++
++#include
++#ifndef __set_errno
++#define __set_errno(val) errno = (val)
++#endif
++
++#ifdef TEST
++#include
++#include
++#include
++#include
++#include
++#ifdef TEST_THREADS
++#include
++#endif
++#endif
++
++#define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1)
++#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
++
++#if defined(__GLIBC__) && defined(_LIBC)
++#define __SKIP_GNU
++#endif
++#include "ow-crypt.h"
++
++extern char *_crypt_blowfish_rn(__CONST char *key, __CONST char *setting,
++ char *output, int size);
++extern char *_crypt_gensalt_blowfish_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size);
++
++extern unsigned char _crypt_itoa64[];
++extern char *_crypt_gensalt_traditional_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size);
++extern char *_crypt_gensalt_extended_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size);
++extern char *_crypt_gensalt_md5_rn(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size);
++
++#if defined(__GLIBC__) && defined(_LIBC)
++/* crypt.h from glibc-crypt-2.1 will define struct crypt_data for us */
++#include "crypt.h"
++extern char *__md5_crypt_r(const char *key, const char *salt,
++ char *buffer, int buflen);
++/* crypt-entry.c needs to be patched to define __des_crypt_r rather than
++ * __crypt_r, and not define crypt_r and crypt at all */
++extern char *__des_crypt_r(const char *key, const char *salt,
++ struct crypt_data *data);
++extern struct crypt_data _ufc_foobar;
++#endif
++
++static int _crypt_data_alloc(void **data, int *size, int need)
++{
++ void *updated;
++
++ if (*data && *size >= need) return 0;
++
++ updated = realloc(*data, need);
++
++ if (!updated) {
++#ifndef __GLIBC__
++ /* realloc(3) on glibc sets errno, so we don't need to bother */
++ __set_errno(ENOMEM);
++#endif
++ return -1;
++ }
++
++#if defined(__GLIBC__) && defined(_LIBC)
++ if (need >= sizeof(struct crypt_data))
++ ((struct crypt_data *)updated)->initialized = 0;
++#endif
++
++ *data = updated;
++ *size = need;
++
++ return 0;
++}
++
++static char *_crypt_retval_magic(char *retval, __CONST char *setting,
++ char *output)
++{
++ if (retval) return retval;
++
++ output[0] = '*';
++ output[1] = '0';
++ output[2] = '\0';
++
++ if (setting[0] == '*' && setting[1] == '0')
++ output[1] = '1';
++
++ return output;
++}
++
++#if defined(__GLIBC__) && defined(_LIBC)
++/*
++ * Applications may re-use the same instance of struct crypt_data without
++ * resetting the initialized field in order to let crypt_r() skip some of
++ * its initialization code. Thus, it is important that our multiple hashing
++ * algorithms either don't conflict with each other in their use of the
++ * data area or reset the initialized field themselves whenever required.
++ * Currently, the hashing algorithms simply have no conflicts: the first
++ * field of struct crypt_data is the 128-byte large DES key schedule which
++ * __des_crypt_r() calculates each time it is called while the two other
++ * hashing algorithms use less than 128 bytes of the data area.
++ */
++
++char *__crypt_rn(__const char *key, __const char *setting,
++ void *data, int size)
++{
++ if (setting[0] == '$' && setting[1] == '2')
++ return _crypt_blowfish_rn(key, setting, (char *)data, size);
++ if (setting[0] == '$' && setting[1] == '1')
++ return __md5_crypt_r(key, setting, (char *)data, size);
++ if (setting[0] == '$' || setting[0] == '_') {
++ __set_errno(EINVAL);
++ return NULL;
++ }
++ if (size >= sizeof(struct crypt_data))
++ return __des_crypt_r(key, setting, (struct crypt_data *)data);
++ __set_errno(ERANGE);
++ return NULL;
++}
++
++char *__crypt_ra(__const char *key, __const char *setting,
++ void **data, int *size)
++{
++ if (setting[0] == '$' && setting[1] == '2') {
++ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
++ return NULL;
++ return _crypt_blowfish_rn(key, setting, (char *)*data, *size);
++ }
++ if (setting[0] == '$' && setting[1] == '1') {
++ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
++ return NULL;
++ return __md5_crypt_r(key, setting, (char *)*data, *size);
++ }
++ if (setting[0] == '$' || setting[0] == '_') {
++ __set_errno(EINVAL);
++ return NULL;
++ }
++ if (_crypt_data_alloc(data, size, sizeof(struct crypt_data)))
++ return NULL;
++ return __des_crypt_r(key, setting, (struct crypt_data *)*data);
++}
++
++char *__crypt_r(__const char *key, __const char *setting,
++ struct crypt_data *data)
++{
++ return _crypt_retval_magic(
++ __crypt_rn(key, setting, data, sizeof(*data)),
++ setting, (char *)data);
++}
++
++char *__crypt(__const char *key, __const char *setting)
++{
++ return _crypt_retval_magic(
++ __crypt_rn(key, setting, &_ufc_foobar, sizeof(_ufc_foobar)),
++ setting, (char *)&_ufc_foobar);
++}
++#else
++char *crypt_rn(__CONST char *key, __CONST char *setting, void *data, int size)
++{
++ return _crypt_blowfish_rn(key, setting, (char *)data, size);
++}
++
++char *crypt_ra(__CONST char *key, __CONST char *setting,
++ void **data, int *size)
++{
++ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
++ return NULL;
++ return _crypt_blowfish_rn(key, setting, (char *)*data, *size);
++}
++
++char *crypt_r(__CONST char *key, __CONST char *setting, void *data)
++{
++ return _crypt_retval_magic(
++ crypt_rn(key, setting, data, CRYPT_OUTPUT_SIZE),
++ setting, (char *)data);
++}
++
++char *crypt(__CONST char *key, __CONST char *setting)
++{
++ static char output[CRYPT_OUTPUT_SIZE];
++
++ return _crypt_retval_magic(
++ crypt_rn(key, setting, output, sizeof(output)),
++ setting, output);
++}
++
++#define __crypt_gensalt_rn crypt_gensalt_rn
++#define __crypt_gensalt_ra crypt_gensalt_ra
++#define __crypt_gensalt crypt_gensalt
++#endif
++
++char *__crypt_gensalt_rn(__CONST char *prefix, unsigned long count,
++ __CONST char *input, int size, char *output, int output_size)
++{
++ char *(*use)(unsigned long count,
++ __CONST char *input, int size, char *output, int output_size);
++
++ /* This may be supported on some platforms in the future */
++ if (!input) {
++ __set_errno(EINVAL);
++ return NULL;
++ }
++
++ if (!strncmp(prefix, "$2a$", 4))
++ use = _crypt_gensalt_blowfish_rn;
++ else
++ if (!strncmp(prefix, "$1$", 3))
++ use = _crypt_gensalt_md5_rn;
++ else
++ if (prefix[0] == '_')
++ use = _crypt_gensalt_extended_rn;
++ else
++ if (!prefix[0] ||
++ (prefix[0] && prefix[1] &&
++ memchr(_crypt_itoa64, prefix[0], 64) &&
++ memchr(_crypt_itoa64, prefix[1], 64)))
++ use = _crypt_gensalt_traditional_rn;
++ else {
++ __set_errno(EINVAL);
++ return NULL;
++ }
++
++ return use(count, input, size, output, output_size);
++}
++
++char *__crypt_gensalt_ra(__CONST char *prefix, unsigned long count,
++ __CONST char *input, int size)
++{
++ char output[CRYPT_GENSALT_OUTPUT_SIZE];
++ char *retval;
++
++ retval = __crypt_gensalt_rn(prefix, count,
++ input, size, output, sizeof(output));
++
++ if (retval) {
++ retval = strdup(retval);
++#ifndef __GLIBC__
++ /* strdup(3) on glibc sets errno, so we don't need to bother */
++ if (!retval)
++ __set_errno(ENOMEM);
++#endif
++ }
++
++ return retval;
++}
++
++char *__crypt_gensalt(__CONST char *prefix, unsigned long count,
++ __CONST char *input, int size)
++{
++ static char output[CRYPT_GENSALT_OUTPUT_SIZE];
++
++ return __crypt_gensalt_rn(prefix, count,
++ input, size, output, sizeof(output));
++}
++
++#if defined(__GLIBC__) && defined(_LIBC)
++weak_alias(__crypt_rn, crypt_rn)
++weak_alias(__crypt_ra, crypt_ra)
++weak_alias(__crypt_r, crypt_r)
++weak_alias(__crypt, crypt)
++weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn)
++weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra)
++weak_alias(__crypt_gensalt, crypt_gensalt)
++#endif
++
++#ifdef TEST
++static struct {
++ char *hash;
++ char *pw;
++} tests[] = {
++ {"$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW",
++ "U*U"},
++ {"$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK",
++ "U*U*"},
++ {"$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a",
++ "U*U*U"},
++ {"$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy",
++ ""},
++ {"$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui",
++ "0123456789abcdefghijklmnopqrstuvwxyz"
++ "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"},
++ {NULL, NULL}
++};
++
++#define which tests[0]
++
++static volatile sig_atomic_t running;
++
++static void handle_timer(int signum)
++{
++ running = 0;
++}
++
++static void *run(void *arg)
++{
++ unsigned long count = 0;
++ int i = 0;
++ void *data = NULL;
++ int size = 0x12345678;
++
++ do {
++ if (strcmp(crypt_ra(tests[i].pw, tests[i].hash, &data, &size),
++ tests[i].hash)) {
++ printf("%d: FAILED (crypt_ra/%d/%lu)\n",
++ (char *)arg - (char *)0, i, count);
++ free(data);
++ return NULL;
++ }
++ if (!tests[++i].hash) i = 0;
++ count++;
++ } while (running);
++
++ free(data);
++ return count + (char *)0;
++}
++
++int main(void)
++{
++ struct itimerval it;
++ struct tms buf;
++ clock_t start_real, start_virtual, end_real, end_virtual;
++ unsigned long count;
++ void *data;
++ int size;
++ char *setting1, *setting2;
++ int i;
++#ifdef TEST_THREADS
++ pthread_t t[TEST_THREADS];
++ void *t_retval;
++#endif
++
++ for (i = 0; tests[i].hash; i++)
++ if (strcmp(crypt(tests[i].pw, tests[i].hash), tests[i].hash)) {
++ printf("FAILED (crypt/%d)\n", i);
++ return 1;
++ }
++
++ data = NULL;
++ size = 0x12345678;
++ for (i = 0; tests[i].hash; i++)
++ if (strcmp(crypt_ra(tests[i].pw, tests[i].hash, &data, &size),
++ tests[i].hash)) {
++ printf("FAILED (crypt_ra/%d)\n", i);
++ return 1;
++ }
++
++ setting1 = crypt_gensalt(which.hash, 12, data, size);
++ if (!setting1 || strncmp(setting1, "$2a$12$", 7)) {
++ puts("FAILED (crypt_gensalt)\n");
++ return 1;
++ }
++
++ setting2 = crypt_gensalt_ra(setting1, 12, data, size);
++ if (strcmp(setting1, setting2)) {
++ puts("FAILED (crypt_gensalt_ra/1)\n");
++ return 1;
++ }
++
++ (*(char *)data)++;
++ setting1 = crypt_gensalt_ra(setting2, 12, data, size);
++ if (!strcmp(setting1, setting2)) {
++ puts("FAILED (crypt_gensalt_ra/2)\n");
++ return 1;
++ }
++
++ free(setting1);
++ free(setting2);
++ free(data);
++
++ running = 1;
++ signal(SIGALRM, handle_timer);
++
++ memset(&it, 0, sizeof(it));
++ it.it_value.tv_sec = 5;
++ setitimer(ITIMER_REAL, &it, NULL);
++
++ start_real = times(&buf);
++ start_virtual = buf.tms_utime + buf.tms_stime;
++
++ count = (char *)run((char *)0) - (char *)0;
++
++ end_real = times(&buf);
++ end_virtual = buf.tms_utime + buf.tms_stime;
++ if (end_virtual == start_virtual) end_virtual++;
++
++ printf("%.1f c/s real, %.1f c/s virtual\n",
++ (float)count * CLK_TCK / (end_real - start_real),
++ (float)count * CLK_TCK / (end_virtual - start_virtual));
++
++#ifdef TEST_THREADS
++ running = 1;
++ it.it_value.tv_sec = 60;
++ setitimer(ITIMER_REAL, &it, NULL);
++ start_real = times(&buf);
++
++ for (i = 0; i < TEST_THREADS; i++)
++ if (pthread_create(&t[i], NULL, run, i + (char *)0)) {
++ perror("pthread_create");
++ return 1;
++ }
++
++ for (i = 0; i < TEST_THREADS; i++) {
++ if (pthread_join(t[i], &t_retval)) {
++ perror("pthread_join");
++ continue;
++ }
++ if (!t_retval) continue;
++ count = (char *)t_retval - (char *)0;
++ end_real = times(&buf);
++ printf("%d: %.1f c/s real\n", i,
++ (float)count * CLK_TCK / (end_real - start_real));
++ }
++#endif
++
++ return 0;
++}
++#endif
diff --git a/crypt_blowfish-1.2-hack_around_arm.diff b/crypt_blowfish-1.2-hack_around_arm.diff
deleted file mode 100644
index 3beb8ea..0000000
--- a/crypt_blowfish-1.2-hack_around_arm.diff
+++ /dev/null
@@ -1,9 +0,0 @@
---- x86.S
-+++ x86.S
-@@ -199,5 +199,5 @@
- #endif
-
- #if defined(__ELF__) && defined(__linux__)
--.section .note.GNU-stack,"",@progbits
-+.section .note.GNU-stack,"",%progbits
- #endif
diff --git a/crypt_blowfish-1.2-sha.diff b/crypt_blowfish-1.2-sha.diff
deleted file mode 100644
index d7a5ce9..0000000
--- a/crypt_blowfish-1.2-sha.diff
+++ /dev/null
@@ -1,174 +0,0 @@
-From 1c581a8364ab18a6938f3153d7bea793d06a4652 Mon Sep 17 00:00:00 2001
-From: Ludwig Nussel
-Date: Thu, 25 Aug 2011 14:00:38 +0200
-Subject: [PATCH crypt_blowfish] support for sha256 and sha512
-
----
- crypt.3 | 14 +++++++++++++
- crypt_gensalt.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
- wrapper.c | 23 +++++++++++++++++++++
- 3 files changed, 95 insertions(+), 0 deletions(-)
-
-Index: crypt_blowfish-1.3/crypt.3
-===================================================================
---- crypt_blowfish-1.3.orig/crypt.3
-+++ crypt_blowfish-1.3/crypt.3
-@@ -399,6 +399,20 @@ too low for the currently available hard
- .hash "$1$" "\e$1\e$[^$]{1,8}\e$[./0-9A-Za-z]{22}" unlimited 8 "" 128 "6 to 48" 1000
- .PP
- .ti -2
-+.B SHA256 based
-+.br
-+This is Ulrich Drepper's SHA256-based password hashing method originally
-+developed for Linux.
-+.hash "$5$" "\e$5\e$(rounds=[0-9]{1,9}\e$)?([./0-9A-Za-z]{1,16})?\e$[./0-9A-Za-z]{43}" unlimited 8 "" 256 "0 to 96" "1000 to 999999999 (default 5000)"
-+.PP
-+.ti -2
-+.B SHA512 based
-+.br
-+This is Ulrich Drepper's SHA512-based password hashing method originally
-+developed for Linux.
-+.hash "$6$" "\e$6\e$(rounds=[0-9]{1,9}\e$)?([./0-9A-Za-z]{1,16})?\e$[./0-9A-Za-z]{86}" unlimited 8 "" 512 "0 to 96" "1000 to 999999999 (default 5000)"
-+.PP
-+.ti -2
- .BR "OpenBSD-style Blowfish-based" " (" bcrypt )
- .br
- .B bcrypt
-Index: crypt_blowfish-1.3/crypt_gensalt.c
-===================================================================
---- crypt_blowfish-1.3.orig/crypt_gensalt.c
-+++ crypt_blowfish-1.3/crypt_gensalt.c
-@@ -19,6 +19,7 @@
- */
-
- #include
-+#include
-
- #include
- #ifndef __set_errno
-@@ -122,3 +123,60 @@ char *_crypt_gensalt_md5_rn(const char *
-
- return output;
- }
-+
-+#define SHA2_SALT_LEN_MAX 16
-+#define SHA2_ROUNDS_MIN 1000
-+#define SHA2_ROUNDS_MAX 999999999
-+char *_crypt_gensalt_sha2_rn (const char *prefix, unsigned long count,
-+ const char *input, int size, char *output, int output_size)
-+
-+{
-+ char *o = output;
-+ const char *i = input;
-+ unsigned needed = 3 + MIN(size/3*4, SHA2_SALT_LEN_MAX) + 1;
-+
-+ if (size < 3 || output_size < needed)
-+ goto error;
-+
-+ size = MIN(size, SHA2_SALT_LEN_MAX/4*3);
-+
-+ o[0] = prefix[0];
-+ o[1] = prefix[1];
-+ o[2] = prefix[2];
-+ o += 3;
-+
-+ if (count) {
-+ count = MAX(SHA2_ROUNDS_MIN, MIN(count, SHA2_ROUNDS_MAX));
-+ int n = snprintf (o, output_size-3, "rounds=%ld$", count);
-+ if (n < 0 || n >= output_size-3)
-+ goto error;
-+ needed += n;
-+ o += n;
-+ }
-+
-+ if (output_size < needed)
-+ goto error;
-+
-+ while (size >= 3) {
-+ unsigned long value =
-+ (unsigned long)(unsigned char)i[0] |
-+ ((unsigned long)(unsigned char)i[1] << 8) |
-+ ((unsigned long)(unsigned char)i[2] << 16);
-+ o[0] = _crypt_itoa64[value & 0x3f];
-+ o[1] = _crypt_itoa64[(value >> 6) & 0x3f];
-+ o[2] = _crypt_itoa64[(value >> 12) & 0x3f];
-+ o[3] = _crypt_itoa64[(value >> 18) & 0x3f];
-+ size -= 3;
-+ i += 3;
-+ o += 3;
-+ }
-+ o[0] = '\0';
-+
-+ return output;
-+
-+error:
-+ if (output_size > 0)
-+ output[0] = '\0';
-+ errno = ENOMEM;
-+ return NULL;
-+}
-Index: crypt_blowfish-1.3/crypt_gensalt.h
-===================================================================
---- crypt_blowfish-1.3.orig/crypt_gensalt.h
-+++ crypt_blowfish-1.3/crypt_gensalt.h
-@@ -26,5 +26,7 @@ extern char *_crypt_gensalt_extended_rn(
- const char *input, int size, char *output, int output_size);
- extern char *_crypt_gensalt_md5_rn(const char *prefix, unsigned long count,
- const char *input, int size, char *output, int output_size);
-+extern char *_crypt_gensalt_sha2_rn(const char *prefix, unsigned long count,
-+ const char *input, int size, char *output, int output_size);
-
- #endif
-Index: crypt_blowfish-1.3/wrapper.c
-===================================================================
---- crypt_blowfish-1.3.orig/wrapper.c
-+++ crypt_blowfish-1.3/wrapper.c
-@@ -50,6 +50,10 @@
- #include "crypt.h"
- extern char *__md5_crypt_r(const char *key, const char *salt,
- char *buffer, int buflen);
-+extern char *__sha256_crypt_r (const char *key, const char *salt,
-+ char *buffer, int buflen);
-+extern char *__sha512_crypt_r (const char *key, const char *salt,
-+ char *buffer, int buflen);
- /* crypt-entry.c needs to be patched to define __des_crypt_r rather than
- * __crypt_r, and not define crypt_r and crypt at all */
- extern char *__des_crypt_r(const char *key, const char *salt,
-@@ -112,6 +116,10 @@ static char *_crypt_retval_magic(char *r
- char *__crypt_rn(__const char *key, __const char *setting,
- void *data, int size)
- {
-+ if (setting[0] == '$' && setting[1] == '6')
-+ return __sha512_crypt_r(key, setting, (char *)data, size);
-+ if (setting[0] == '$' && setting[1] == '5')
-+ return __sha256_crypt_r(key, setting, (char *)data, size);
- if (setting[0] == '$' && setting[1] == '2')
- return _crypt_blowfish_rn(key, setting, (char *)data, size);
- if (setting[0] == '$' && setting[1] == '1')
-@@ -129,6 +137,16 @@ char *__crypt_rn(__const char *key, __co
- char *__crypt_ra(__const char *key, __const char *setting,
- void **data, int *size)
- {
-+ if (setting[0] == '$' && setting[1] == '6') {
-+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
-+ return NULL;
-+ return __sha512_crypt_r(key, setting, (char *)*data, *size);
-+ }
-+ if (setting[0] == '$' && setting[1] == '5') {
-+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
-+ return NULL;
-+ return __sha256_crypt_r(key, setting, (char *)*data, *size);
-+ }
- if (setting[0] == '$' && setting[1] == '2') {
- if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
- return NULL;
-@@ -210,6 +228,9 @@ char *__crypt_gensalt_rn(const char *pre
- return NULL;
- }
-
-+ if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3))
-+ use = _crypt_gensalt_sha2_rn;
-+ else
- if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) ||
- !strncmp(prefix, "$2y$", 4))
- use = _crypt_gensalt_blowfish_rn;
diff --git a/crypt_blowfish-1.3.tar.gz b/crypt_blowfish-1.3.tar.gz
deleted file mode 100644
index fcb0aed..0000000
--- a/crypt_blowfish-1.3.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:83fa01fca6996fe8d882b7f8e9ba0305a5664936100b01481ea3c6a8ce8d72fd
-size 30310
diff --git a/crypt_blowfish-const.patch b/crypt_blowfish-const.patch
deleted file mode 100644
index 0d4a8d0..0000000
--- a/crypt_blowfish-const.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-Index: crypt_blowfish-1.2/crypt_blowfish.c
-===================================================================
---- crypt_blowfish-1.2.orig/crypt_blowfish.c
-+++ crypt_blowfish-1.2/crypt_blowfish.c
-@@ -81,7 +81,7 @@ typedef struct {
- * Magic IV for 64 Blowfish encryptions that we do at the end.
- * The string is "OrpheanBeholderScryDoubt" on big-endian.
- */
--static BF_word BF_magic_w[6] = {
-+static const BF_word BF_magic_w[6] = {
- 0x4F727068, 0x65616E42, 0x65686F6C,
- 0x64657253, 0x63727944, 0x6F756274
- };
-@@ -89,7 +89,7 @@ static BF_word BF_magic_w[6] = {
- /*
- * P-box and S-box tables initialized with digits of Pi.
- */
--static BF_ctx BF_init_state = {
-+static const BF_ctx BF_init_state = {
- {
- {
- 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
-@@ -361,10 +361,10 @@ static BF_ctx BF_init_state = {
- }
- };
-
--static unsigned char BF_itoa64[64 + 1] =
-+static const unsigned char BF_itoa64[64 + 1] =
- "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
--static unsigned char BF_atoi64[0x60] = {
-+static const unsigned char BF_atoi64[0x60] = {
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64, 64, 64,
- 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
-@@ -440,8 +440,8 @@ static void BF_encode(char *dst, const B
-
- static void BF_swap(BF_word *x, int count)
- {
-- static int endianness_check = 1;
-- char *is_little_endian = (char *)&endianness_check;
-+ static const int endianness_check = 1;
-+ const char *is_little_endian = (const char *)&endianness_check;
- BF_word tmp;
-
- if (*is_little_endian)
diff --git a/crypt_blowfish-gensalt.patch b/crypt_blowfish-gensalt.patch
deleted file mode 100644
index 9d1dd87..0000000
--- a/crypt_blowfish-gensalt.patch
+++ /dev/null
@@ -1,373 +0,0 @@
-Index: crypt_blowfish-1.3/crypt_blowfish.c
-===================================================================
---- crypt_blowfish-1.3.orig/crypt_blowfish.c
-+++ crypt_blowfish-1.3/crypt_blowfish.c
-@@ -877,31 +877,3 @@ char *_crypt_blowfish_rn(const char *key
- __set_errno(EINVAL); /* pretend we don't support this hash type */
- return NULL;
- }
--
--char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count,
-- const char *input, int size, char *output, int output_size)
--{
-- if (size < 16 || output_size < 7 + 22 + 1 ||
-- (count && (count < 4 || count > 31)) ||
-- prefix[0] != '$' || prefix[1] != '2' ||
-- (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) {
-- if (output_size > 0) output[0] = '\0';
-- __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
-- return NULL;
-- }
--
-- if (!count) count = 5;
--
-- output[0] = '$';
-- output[1] = '2';
-- output[2] = prefix[2];
-- output[3] = '$';
-- output[4] = '0' + count / 10;
-- output[5] = '0' + count % 10;
-- output[6] = '$';
--
-- BF_encode(&output[7], (const BF_word *)input, 16);
-- output[7 + 22] = '\0';
--
-- return output;
--}
-Index: crypt_blowfish-1.3/crypt_blowfish.h
-===================================================================
---- crypt_blowfish-1.3.orig/crypt_blowfish.h
-+++ crypt_blowfish-1.3/crypt_blowfish.h
-@@ -20,8 +20,5 @@
- extern int _crypt_output_magic(const char *setting, char *output, int size);
- extern char *_crypt_blowfish_rn(const char *key, const char *setting,
- char *output, int size);
--extern char *_crypt_gensalt_blowfish_rn(const char *prefix,
-- unsigned long count,
-- const char *input, int size, char *output, int output_size);
-
- #endif
-Index: crypt_blowfish-1.3/crypt_gensalt.c
-===================================================================
---- crypt_blowfish-1.3.orig/crypt_gensalt.c
-+++ crypt_blowfish-1.3/crypt_gensalt.c
-@@ -20,6 +20,7 @@
-
- #include
- #include
-+#include
-
- #include
- #ifndef __set_errno
-@@ -180,3 +181,69 @@ error:
- errno = ENOMEM;
- return NULL;
- }
-+
-+
-+typedef unsigned int BF_word;
-+
-+static const unsigned char BF_itoa64[64 + 1] =
-+ "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-+
-+static void BF_encode(char *dst, const BF_word *src, int size)
-+{
-+ const unsigned char *sptr = (const unsigned char *)src;
-+ const unsigned char *end = sptr + size;
-+ unsigned char *dptr = (unsigned char *)dst;
-+ unsigned int c1, c2;
-+
-+ do {
-+ c1 = *sptr++;
-+ *dptr++ = BF_itoa64[c1 >> 2];
-+ c1 = (c1 & 0x03) << 4;
-+ if (sptr >= end) {
-+ *dptr++ = BF_itoa64[c1];
-+ break;
-+ }
-+
-+ c2 = *sptr++;
-+ c1 |= c2 >> 4;
-+ *dptr++ = BF_itoa64[c1];
-+ c1 = (c2 & 0x0f) << 2;
-+ if (sptr >= end) {
-+ *dptr++ = BF_itoa64[c1];
-+ break;
-+ }
-+
-+ c2 = *sptr++;
-+ c1 |= c2 >> 6;
-+ *dptr++ = BF_itoa64[c1];
-+ *dptr++ = BF_itoa64[c2 & 0x3f];
-+ } while (sptr < end);
-+}
-+
-+char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count,
-+ const char *input, int size, char *output, int output_size)
-+{
-+ if (size < 16 || output_size < 7 + 22 + 1 ||
-+ (count && (count < 4 || count > 31)) ||
-+ prefix[0] != '$' || prefix[1] != '2' ||
-+ (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) {
-+ if (output_size > 0) output[0] = '\0';
-+ __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
-+ return NULL;
-+ }
-+
-+ if (!count) count = 5;
-+
-+ output[0] = '$';
-+ output[1] = '2';
-+ output[2] = prefix[2];
-+ output[3] = '$';
-+ output[4] = '0' + count / 10;
-+ output[5] = '0' + count % 10;
-+ output[6] = '$';
-+
-+ BF_encode(&output[7], (const BF_word *)input, 16);
-+ output[7 + 22] = '\0';
-+
-+ return output;
-+}
-Index: crypt_blowfish-1.3/crypt_gensalt.h
-===================================================================
---- crypt_blowfish-1.3.orig/crypt_gensalt.h
-+++ crypt_blowfish-1.3/crypt_gensalt.h
-@@ -28,5 +28,8 @@ extern char *_crypt_gensalt_md5_rn(const
- const char *input, int size, char *output, int output_size);
- extern char *_crypt_gensalt_sha2_rn(const char *prefix, unsigned long count,
- const char *input, int size, char *output, int output_size);
-+extern char *_crypt_gensalt_blowfish_rn(const char *prefix,
-+ unsigned long count,
-+ const char *input, int size, char *output, int output_size);
-
- #endif
-Index: crypt_blowfish-1.3/wrapper-gensalt.c
-===================================================================
---- /dev/null
-+++ crypt_blowfish-1.3/wrapper-gensalt.c
-@@ -0,0 +1,114 @@
-+/*
-+ * Written by Solar Designer in 2000-2011.
-+ * No copyright is claimed, and the software is hereby placed in the public
-+ * domain. In case this attempt to disclaim copyright and place the software
-+ * in the public domain is deemed null and void, then the software is
-+ * Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
-+ * general public under the following terms:
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted.
-+ *
-+ * There's ABSOLUTELY NO WARRANTY, express or implied.
-+ *
-+ * See crypt_blowfish.c for more information.
-+ */
-+
-+#include
-+#include
-+
-+#include
-+#ifndef __set_errno
-+#define __set_errno(val) errno = (val)
-+#endif
-+
-+#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
-+
-+#if defined(__GLIBC__) && defined(_LIBC)
-+#define __SKIP_GNU
-+#endif
-+#include "ow-crypt.h"
-+
-+#include "crypt_gensalt.h"
-+
-+#if !(defined(__GLIBC__) && defined(_LIBC))
-+#define __crypt_gensalt_rn crypt_gensalt_rn
-+#define __crypt_gensalt_ra crypt_gensalt_ra
-+#define __crypt_gensalt crypt_gensalt
-+#endif
-+
-+char *__crypt_gensalt_rn(const char *prefix, unsigned long count,
-+ const char *input, int size, char *output, int output_size)
-+{
-+ char *(*use)(const char *_prefix, unsigned long _count,
-+ const char *_input, int _size,
-+ char *_output, int _output_size);
-+
-+ /* This may be supported on some platforms in the future */
-+ if (!input) {
-+ __set_errno(EINVAL);
-+ return NULL;
-+ }
-+
-+ if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3))
-+ use = _crypt_gensalt_sha2_rn;
-+ else
-+ if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) ||
-+ !strncmp(prefix, "$2y$", 4))
-+ use = _crypt_gensalt_blowfish_rn;
-+ else
-+ if (!strncmp(prefix, "$1$", 3))
-+ use = _crypt_gensalt_md5_rn;
-+ else
-+ if (prefix[0] == '_')
-+ use = _crypt_gensalt_extended_rn;
-+ else
-+ if (!prefix[0] ||
-+ (prefix[0] && prefix[1] &&
-+ memchr(_crypt_itoa64, prefix[0], 64) &&
-+ memchr(_crypt_itoa64, prefix[1], 64)))
-+ use = _crypt_gensalt_traditional_rn;
-+ else {
-+ __set_errno(EINVAL);
-+ return NULL;
-+ }
-+
-+ return use(prefix, count, input, size, output, output_size);
-+}
-+
-+char *__crypt_gensalt_ra(const char *prefix, unsigned long count,
-+ const char *input, int size)
-+{
-+ char output[CRYPT_GENSALT_OUTPUT_SIZE];
-+ char *retval;
-+
-+ retval = __crypt_gensalt_rn(prefix, count,
-+ input, size, output, sizeof(output));
-+
-+ if (retval) {
-+ retval = strdup(retval);
-+#ifndef __GLIBC__
-+ /* strdup(3) on glibc sets errno, so we don't need to bother */
-+ if (!retval)
-+ __set_errno(ENOMEM);
-+#endif
-+ }
-+
-+ return retval;
-+}
-+
-+char *__crypt_gensalt(const char *prefix, unsigned long count,
-+ const char *input, int size)
-+{
-+ static char output[CRYPT_GENSALT_OUTPUT_SIZE];
-+
-+ return __crypt_gensalt_rn(prefix, count,
-+ input, size, output, sizeof(output));
-+}
-+
-+#if defined(__GLIBC__) && defined(_LIBC)
-+weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn)
-+weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra)
-+weak_alias(__crypt_gensalt, crypt_gensalt)
-+#endif
-+
-Index: crypt_blowfish-1.3/wrapper.c
-===================================================================
---- crypt_blowfish-1.3.orig/wrapper.c
-+++ crypt_blowfish-1.3/wrapper.c
-@@ -35,7 +35,6 @@
- #endif
-
- #define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1)
--#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
-
- #if defined(__GLIBC__) && defined(_LIBC)
- #define __SKIP_GNU
-@@ -43,7 +42,6 @@
- #include "ow-crypt.h"
-
- #include "crypt_blowfish.h"
--#include "crypt_gensalt.h"
-
- #if defined(__GLIBC__) && defined(_LIBC)
- /* crypt.h from glibc-crypt-2.1 will define struct crypt_data for us */
-@@ -209,89 +207,11 @@ char *crypt(const char *key, const char
- crypt_rn(key, setting, output, sizeof(output)),
- setting, output, sizeof(output));
- }
--
--#define __crypt_gensalt_rn crypt_gensalt_rn
--#define __crypt_gensalt_ra crypt_gensalt_ra
--#define __crypt_gensalt crypt_gensalt
--#endif
--
--char *__crypt_gensalt_rn(const char *prefix, unsigned long count,
-- const char *input, int size, char *output, int output_size)
--{
-- char *(*use)(const char *_prefix, unsigned long _count,
-- const char *_input, int _size,
-- char *_output, int _output_size);
--
-- /* This may be supported on some platforms in the future */
-- if (!input) {
-- __set_errno(EINVAL);
-- return NULL;
-- }
--
-- if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3))
-- use = _crypt_gensalt_sha2_rn;
-- else
-- if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) ||
-- !strncmp(prefix, "$2y$", 4))
-- use = _crypt_gensalt_blowfish_rn;
-- else
-- if (!strncmp(prefix, "$1$", 3))
-- use = _crypt_gensalt_md5_rn;
-- else
-- if (prefix[0] == '_')
-- use = _crypt_gensalt_extended_rn;
-- else
-- if (!prefix[0] ||
-- (prefix[0] && prefix[1] &&
-- memchr(_crypt_itoa64, prefix[0], 64) &&
-- memchr(_crypt_itoa64, prefix[1], 64)))
-- use = _crypt_gensalt_traditional_rn;
-- else {
-- __set_errno(EINVAL);
-- return NULL;
-- }
--
-- return use(prefix, count, input, size, output, output_size);
--}
--
--char *__crypt_gensalt_ra(const char *prefix, unsigned long count,
-- const char *input, int size)
--{
-- char output[CRYPT_GENSALT_OUTPUT_SIZE];
-- char *retval;
--
-- retval = __crypt_gensalt_rn(prefix, count,
-- input, size, output, sizeof(output));
--
-- if (retval) {
-- retval = strdup(retval);
--#ifndef __GLIBC__
-- /* strdup(3) on glibc sets errno, so we don't need to bother */
-- if (!retval)
-- __set_errno(ENOMEM);
- #endif
-- }
--
-- return retval;
--}
--
--char *__crypt_gensalt(const char *prefix, unsigned long count,
-- const char *input, int size)
--{
-- static char output[CRYPT_GENSALT_OUTPUT_SIZE];
--
-- return __crypt_gensalt_rn(prefix, count,
-- input, size, output, sizeof(output));
--}
-
- #if defined(__GLIBC__) && defined(_LIBC)
--weak_alias(__crypt_rn, crypt_rn)
--weak_alias(__crypt_ra, crypt_ra)
- weak_alias(__crypt_r, crypt_r)
- weak_alias(__crypt, crypt)
--weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn)
--weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra)
--weak_alias(__crypt_gensalt, crypt_gensalt)
- weak_alias(crypt, fcrypt)
- #endif
-
diff --git a/crypt_blowfish-glibc-2.3.diff b/crypt_blowfish-glibc-2.3.diff
new file mode 100644
index 0000000..a8abbcd
--- /dev/null
+++ b/crypt_blowfish-glibc-2.3.diff
@@ -0,0 +1,106 @@
+--- crypt/crypt-entry.c 2001-07-06 09:37:47.000000000 +0200
++++ crypt/crypt-entry.c 2003-10-01 11:23:27.000000000 +0200
+@@ -70,7 +70,7 @@
+ */
+
+ char *
+-__crypt_r (key, salt, data)
++__des_crypt_r (key, salt, data)
+ const char *key;
+ const char *salt;
+ struct crypt_data * __restrict data;
+@@ -115,6 +115,7 @@
+ _ufc_output_conversion_r (res[0], res[1], salt, data);
+ return data->crypt_3_buf;
+ }
++#if 0
+ weak_alias (__crypt_r, crypt_r)
+
+ char *
+@@ -147,3 +148,4 @@
+ return crypt (key, salt);
+ }
+ #endif
++#endif
+--- crypt/crypt-private.h 2001-07-06 09:37:47.000000000 +0200
++++ crypt/crypt-private.h 2003-10-01 11:23:27.000000000 +0200
+@@ -55,6 +55,8 @@
+ /* crypt-entry.c */
+ extern char *__crypt_r (__const char *__key, __const char *__salt,
+ struct crypt_data * __restrict __data);
++extern char *__des_crypt_r (__const char *__key, __const char *__salt,
++ struct crypt_data * __restrict __data);
+ extern char *fcrypt (__const char *key, __const char *salt);
+
+ #endif /* crypt-private.h */
+--- crypt/Makefile~ 2007-11-06 05:27:13.635014000 +0100
++++ crypt/Makefile 2007-11-06 05:27:27.500142000 +0100
+@@ -27,7 +27,8 @@
+ extra-libs-others := $(extra-libs)
+
+ libcrypt-routines := crypt-entry md5-crypt md5 sha256-crypt sha256 \
+- sha512-crypt sha512 crypt crypt_util
++ sha512-crypt sha512 crypt crypt_util \
++ crypt_blowfish crypt_gensalt wrapper
+
+ tests := cert md5test md5c-test sha256test sha256c-test sha512test sha512c-test
+
+--- crypt/ow-crypt.h 2001-05-01 13:14:31.000000000 +0200
++++ crypt/ow-crypt.h 2003-10-01 11:23:27.000000000 +0200
+@@ -13,12 +13,6 @@
+ #define __CONST
+ #endif
+
+-#ifndef __SKIP_GNU
+-extern char *crypt(__CONST char *key, __CONST char *setting);
+-extern char *crypt_r(__CONST char *key, __CONST char *setting, void *data);
+-#endif
+-
+-#ifndef __SKIP_OW
+ extern char *crypt_rn(__CONST char *key, __CONST char *setting,
+ void *data, int size);
+ extern char *crypt_ra(__CONST char *key, __CONST char *setting,
+@@ -29,6 +23,5 @@
+ __CONST char *input, int size, char *output, int output_size);
+ extern char *crypt_gensalt_ra(__CONST char *prefix, unsigned long count,
+ __CONST char *input, int size);
+-#endif
+
+ #endif
+--- crypt/wrapper.c 2002-11-08 01:26:31.000000000 +0100
++++ crypt/wrapper.c 2003-10-01 11:59:03.000000000 +0200
+@@ -45,12 +45,11 @@
+ #if defined(__GLIBC__) && defined(_LIBC)
+ /* crypt.h from glibc-crypt-2.1 will define struct crypt_data for us */
+ #include "crypt.h"
++#include "ufc-crypt.h"
++#include "crypt-private.h"
++
+ extern char *__md5_crypt_r(const char *key, const char *salt,
+ char *buffer, int buflen);
+-/* crypt-entry.c needs to be patched to define __des_crypt_r rather than
+- * __crypt_r, and not define crypt_r and crypt at all */
+-extern char *__des_crypt_r(const char *key, const char *salt,
+- struct crypt_data *data);
+ extern struct crypt_data _ufc_foobar;
+ #endif
+
+@@ -266,6 +264,7 @@
+ weak_alias(__crypt_ra, crypt_ra)
+ weak_alias(__crypt_r, crypt_r)
+ weak_alias(__crypt, crypt)
++weak_alias(__crypt, fcrypt)
+ weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn)
+ weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra)
+ weak_alias(__crypt_gensalt, crypt_gensalt)
+--- crypt/crypt_blowfish.c
++++ crypt/crypt_blowfish.c 2005/04/28 10:59:24
+@@ -45,7 +45,7 @@
+ #endif
+
+ #ifdef __i386__
+-#define BF_ASM 1
++#define BF_ASM 0
+ #define BF_SCALE 1
+ #elif defined(__alpha__) || defined(__hppa__)
+ #define BF_ASM 0
diff --git a/ctype_b.c b/ctype_b.c
new file mode 100644
index 0000000..91a5b50
--- /dev/null
+++ b/ctype_b.c
@@ -0,0 +1,196 @@
+/*
+ * ctype_b.c
+ *
+ * This file has been added to compensate buggy object files
+ * using __ctype_b, __ctype_tolower and __ctype_toupper.
+ *
+ * This file only allows the linking of this buggy object files,
+ * there is no gurantee, that it will work correct. Linking of
+ * object files is only possible with the same glibc as they are
+ * compiled with.
+ *
+ * Compile this file with -fPIC and add it to the link stage of
+ * your application.
+ *
+ */
+
+#include
+
+#define CTYPE_EXTERN_INLINE /* Define real functions for accessors. */
+#include
+
+static const char _nl_C_LC_CTYPE_class[768] =
+ /* 0x80 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x86 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x8c */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x92 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x98 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x9e */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xa4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xaa */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xb0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xb6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xbc */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xc2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xc8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xce */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xd4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xda */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xe0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xe6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xec */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xf2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xf8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xfe */ "\000\000" "\000\000" "\002\000" "\002\000" "\002\000" "\002\000"
+ /* 0x04 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\003\040"
+ /* 0x0a */ "\002\040" "\002\040" "\002\040" "\002\040" "\002\000" "\002\000"
+ /* 0x10 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+ /* 0x16 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
+ /* 0x1c */ "\002\000" "\002\000" "\002\000" "\002\000" "\001\140" "\004\300"
+ /* 0x22 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
+ /* 0x28 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
+ /* 0x2e */ "\004\300" "\004\300" "\010\330" "\010\330" "\010\330" "\010\330"
+ /* 0x34 */ "\010\330" "\010\330" "\010\330" "\010\330" "\010\330" "\010\330"
+ /* 0x3a */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
+ /* 0x40 */ "\004\300" "\010\325" "\010\325" "\010\325" "\010\325" "\010\325"
+ /* 0x46 */ "\010\325" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
+ /* 0x4c */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
+ /* 0x52 */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
+ /* 0x58 */ "\010\305" "\010\305" "\010\305" "\004\300" "\004\300" "\004\300"
+ /* 0x5e */ "\004\300" "\004\300" "\004\300" "\010\326" "\010\326" "\010\326"
+ /* 0x64 */ "\010\326" "\010\326" "\010\326" "\010\306" "\010\306" "\010\306"
+ /* 0x6a */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
+ /* 0x70 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
+ /* 0x76 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\004\300"
+ /* 0x7c */ "\004\300" "\004\300" "\004\300" "\002\000" "\000\000" "\000\000"
+ /* 0x82 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x88 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x8e */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x94 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0x9a */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xa0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xa6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xac */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xb2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xb8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xbe */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xc4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xca */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xd0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xd6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xdc */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xe2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xe8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xee */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xf4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+ /* 0xfa */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
+;
+
+static const uint32_t _nl_C_LC_CTYPE_toupper[384] =
+{
+ /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xffffffff,
+ /* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ /* 0x08 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ /* 0x10 */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ /* 0x18 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ /* 0x20 */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ /* 0x28 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ /* 0x30 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ /* 0x38 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ /* 0x40 */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ /* 0x48 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ /* 0x50 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ /* 0x58 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ /* 0x60 */ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ /* 0x68 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ /* 0x70 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ /* 0x78 */ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+static const uint32_t _nl_C_LC_CTYPE_tolower[384] =
+{
+ /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xffffffff,
+ /* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ /* 0x08 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ /* 0x10 */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ /* 0x18 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ /* 0x20 */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ /* 0x28 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ /* 0x30 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ /* 0x38 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ /* 0x40 */ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ /* 0x48 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ /* 0x50 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ /* 0x58 */ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ /* 0x60 */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ /* 0x68 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ /* 0x70 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ /* 0x78 */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o)
+const unsigned short int *__ctype_b = b (unsigned short int, class, 128);
+const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128);
+const __int32_t *__ctype_toupper = b (__int32_t, toupper, 128);
diff --git a/dl-runtime-resolve-opt-avx512f.patch b/dl-runtime-resolve-opt-avx512f.patch
deleted file mode 100644
index d3bc303..0000000
--- a/dl-runtime-resolve-opt-avx512f.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-2017-08-06 H.J. Lu
-
- [BZ #21871]
- * sysdeps/x86/cpu-features.c (init_cpu_features): Set
- bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
-
-Index: glibc-2.26/sysdeps/x86/cpu-features.c
-===================================================================
---- glibc-2.26.orig/sysdeps/x86/cpu-features.c
-+++ glibc-2.26/sysdeps/x86/cpu-features.c
-@@ -244,10 +244,13 @@ init_cpu_features (struct cpu_features *
- |= bit_arch_Prefer_No_AVX512;
-
- /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow.
-- If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */
-+ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt.
-+ Use _dl_runtime_resolve_opt only with AVX512F since it is
-+ slower than _dl_runtime_resolve_slow with AVX. */
- cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow]
- |= bit_arch_Use_dl_runtime_resolve_slow;
-- if (cpu_features->max_cpuid >= 0xd)
-+ if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
-+ && cpu_features->max_cpuid >= 0xd)
- {
- unsigned int eax;
-
diff --git a/eh-frame-zero-terminator.patch b/eh-frame-zero-terminator.patch
deleted file mode 100644
index 28a4c16..0000000
--- a/eh-frame-zero-terminator.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-2017-08-31 H.J. Lu
-
- [BZ #22051]
- * Makerules (build-module-helper-objlist): Filter out
- $(elf-objpfx)sofini.os.
- (build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
- needed.
-
-Index: glibc-2.26/Makerules
-===================================================================
---- glibc-2.26.orig/Makerules
-+++ glibc-2.26/Makerules
-@@ -686,14 +686,17 @@ $(build-module-helper) -o $@ $(shlib-lds
- $(call after-link,$@)
- endef
-
-+# sofini.os must be placed last since it terminates .eh_frame section.
- build-module-helper-objlist = \
- $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
- $(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
-+ $(elf-objpfx)sofini.os \
- $(link-libc-deps),$^))
-
- build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
- build-shlib-objlist = $(build-module-helper-objlist) \
-- $(LDLIBS-$(@F:lib%.so=%).so)
-+ $(LDLIBS-$(@F:lib%.so=%).so) \
-+ $(filter $(elf-objpfx)sofini.os,$^)
-
- # Don't try to use -lc when making libc.so itself.
- # Also omits crti.o and crtn.o, which we do not want
diff --git a/fix-locking-in-_IO_cleanup.patch b/fix-locking-in-_IO_cleanup.patch
deleted file mode 100644
index b3f591b..0000000
--- a/fix-locking-in-_IO_cleanup.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-Always do locking when accessing streams
-
- [BZ #15142]
- * libio/genops.c (_IO_list_all_stamp): Delete. All uses removed.
- (_IO_flush_all_all_lockp): Delete.
- (_IO_flush_all): Replace with body of _IO_flush_all_all_lockp.
- Always do locking.
- (_IO_unbuffer_all): Always do locking.
- (_IO_cleanup): Call _IO_flush_all instead of _IO_flush_all_lockp.
- * libio/libioP.h (_IO_flush_all_all_lockp): Remove declaration.
-
-diff --git a/libio/genops.c b/libio/genops.c
-index e0ce8cc..9def1d4 100644
---- a/libio/genops.c
-+++ b/libio/genops.c
-@@ -38,10 +38,6 @@
- static _IO_lock_t list_all_lock = _IO_lock_initializer;
- #endif
-
--/* Used to signal modifications to the list of FILE decriptors. */
--static int _IO_list_all_stamp;
--
--
- static _IO_FILE *run_fp;
-
- #ifdef _IO_MTSAFE_IO
-@@ -70,16 +66,12 @@ _IO_un_link (fp)
- if (_IO_list_all == NULL)
- ;
- else if (fp == _IO_list_all)
-- {
-- _IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
-- ++_IO_list_all_stamp;
-- }
-+ _IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
- else
- for (f = &_IO_list_all->file._chain; *f; f = &(*f)->_chain)
- if (*f == (_IO_FILE *) fp)
- {
- *f = fp->file._chain;
-- ++_IO_list_all_stamp;
- break;
- }
- fp->file._flags &= ~_IO_LINKED;
-@@ -108,7 +100,6 @@ _IO_link_in (fp)
- #endif
- fp->file._chain = (_IO_FILE *) _IO_list_all;
- _IO_list_all = fp;
-- ++_IO_list_all_stamp;
- #ifdef _IO_MTSAFE_IO
- _IO_funlockfile ((_IO_FILE *) fp);
- run_fp = NULL;
-@@ -818,25 +809,20 @@ _IO_get_column (fp)
-
-
- int
--_IO_flush_all_lockp (int do_lock)
-+_IO_flush_all (void)
- {
- int result = 0;
- struct _IO_FILE *fp;
-- int last_stamp;
-
- #ifdef _IO_MTSAFE_IO
-- __libc_cleanup_region_start (do_lock, flush_cleanup, NULL);
-- if (do_lock)
-- _IO_lock_lock (list_all_lock);
-+ _IO_cleanup_region_start_noarg (flush_cleanup);
-+ _IO_lock_lock (list_all_lock);
- #endif
-
-- last_stamp = _IO_list_all_stamp;
-- fp = (_IO_FILE *) _IO_list_all;
-- while (fp != NULL)
-+ for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
- {
- run_fp = fp;
-- if (do_lock)
-- _IO_flockfile (fp);
-+ _IO_flockfile (fp);
-
- if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
- #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-@@ -848,52 +834,30 @@ _IO_flush_all_lockp (int do_lock)
- && _IO_OVERFLOW (fp, EOF) == EOF)
- result = EOF;
-
-- if (do_lock)
-- _IO_funlockfile (fp);
-+ _IO_funlockfile (fp);
- run_fp = NULL;
--
-- if (last_stamp != _IO_list_all_stamp)
-- {
-- /* Something was added to the list. Start all over again. */
-- fp = (_IO_FILE *) _IO_list_all;
-- last_stamp = _IO_list_all_stamp;
-- }
-- else
-- fp = fp->_chain;
- }
-
- #ifdef _IO_MTSAFE_IO
-- if (do_lock)
-- _IO_lock_unlock (list_all_lock);
-- __libc_cleanup_region_end (0);
-+ _IO_lock_unlock (list_all_lock);
-+ _IO_cleanup_region_end (0);
- #endif
-
- return result;
- }
--
--
--int
--_IO_flush_all (void)
--{
-- /* We want locking. */
-- return _IO_flush_all_lockp (1);
--}
- libc_hidden_def (_IO_flush_all)
-
- void
- _IO_flush_all_linebuffered (void)
- {
- struct _IO_FILE *fp;
-- int last_stamp;
-
- #ifdef _IO_MTSAFE_IO
- _IO_cleanup_region_start_noarg (flush_cleanup);
- _IO_lock_lock (list_all_lock);
- #endif
-
-- last_stamp = _IO_list_all_stamp;
-- fp = (_IO_FILE *) _IO_list_all;
-- while (fp != NULL)
-+ for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
- {
- run_fp = fp;
- _IO_flockfile (fp);
-@@ -903,15 +867,6 @@ _IO_flush_all_linebuffered (void)
-
- _IO_funlockfile (fp);
- run_fp = NULL;
--
-- if (last_stamp != _IO_list_all_stamp)
-- {
-- /* Something was added to the list. Start all over again. */
-- fp = (_IO_FILE *) _IO_list_all;
-- last_stamp = _IO_list_all_stamp;
-- }
-- else
-- fp = fp->_chain;
- }
-
- #ifdef _IO_MTSAFE_IO
-@@ -947,6 +902,12 @@ static void
- _IO_unbuffer_all (void)
- {
- struct _IO_FILE *fp;
-+
-+#ifdef _IO_MTSAFE_IO
-+ _IO_cleanup_region_start_noarg (flush_cleanup);
-+ _IO_lock_lock (list_all_lock);
-+#endif
-+
- for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
- {
- if (! (fp->_flags & _IO_UNBUFFERED)
-@@ -956,15 +917,8 @@ _IO_unbuffer_write (void)
- && fp->_mode != 0)
- {
- #ifdef _IO_MTSAFE_IO
-- int cnt;
--#define MAXTRIES 2
-- for (cnt = 0; cnt < MAXTRIES; ++cnt)
-- if (fp->_lock == NULL || _IO_lock_trylock (*fp->_lock) == 0)
-- break;
-- else
-- /* Give the other thread time to finish up its use of the
-- stream. */
-- __sched_yield ();
-+ run_fp = fp;
-+ _IO_flockfile (fp);
- #endif
-
- if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
-@@ -980,8 +934,8 @@ _IO_unbuffer_write (void)
- _IO_wsetb (fp, NULL, NULL, 0);
-
- #ifdef _IO_MTSAFE_IO
-- if (cnt < MAXTRIES && fp->_lock != NULL)
-- _IO_lock_unlock (*fp->_lock);
-+ _IO_funlockfile (fp);
-+ run_fp = NULL;
- #endif
- }
-
-@@ -989,6 +943,11 @@ _IO_unbuffer_write (void)
- used. */
- fp->_mode = -1;
- }
-+
-+#ifdef _IO_MTSAFE_IO
-+ _IO_lock_unlock (list_all_lock);
-+ _IO_cleanup_region_end (0);
-+#endif
- }
-
-
-@@ -1008,9 +967,7 @@ libc_freeres_fn (buffer_free)
- int
- _IO_cleanup (void)
- {
-- /* We do *not* want locking. Some threads might use streams but
-- that is their problem, we flush them underneath them. */
-- int result = _IO_flush_all_lockp (0);
-+ int result = _IO_flush_all ();
-
- /* We currently don't have a reliable mechanism for making sure that
- C++ static destructors are executed in the correct order.
-diff --git a/libio/libioP.h b/libio/libioP.h
-index 8a7b85b..3e3a724 100644
---- a/libio/libioP.h
-+++ b/libio/libioP.h
-@@ -488,7 +488,6 @@ extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t);
- extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t);
- extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t);
- libc_hidden_proto (_IO_wdo_write)
--extern int _IO_flush_all_lockp (int);
- extern int _IO_flush_all (void);
- libc_hidden_proto (_IO_flush_all)
- extern int _IO_cleanup (void);
---
-1.9.1
-
diff --git a/fnmatch-collating-elements.patch b/fnmatch-collating-elements.patch
deleted file mode 100644
index f660b31..0000000
--- a/fnmatch-collating-elements.patch
+++ /dev/null
@@ -1,467 +0,0 @@
-Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
-
- [BZ #16976]
- [BZ #17396]
- * posix/fnmatch_loop.c (internal_fnmatch, internal_fnwmatch): When
- looking up collating elements match against (wide) character
- sequence instead of name. Correct alignment adjustment.
- * posix/fnmatch.c: Don't include "../locale/elem-hash.h".
- * posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5.
- * posix/tst-fnmatch4.c: New file.
- * posix/tst-fnmatch5.c: New file.
-
-Index: glibc-2.22/posix/Makefile
-===================================================================
---- glibc-2.22.orig/posix/Makefile
-+++ glibc-2.22/posix/Makefile
-@@ -87,6 +87,7 @@ tests := tstgetopt testfnm runtests run
- bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
- tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \
- tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \
-+ tst-fnmatch4 tst-fnmatch5 \
- tst-posix_spawn-fd tst-posix_spawn-setsid \
- tst-posix_fadvise tst-posix_fadvise64 \
- tst-sysconf-empty-chroot
-Index: glibc-2.22/posix/fnmatch.c
-===================================================================
---- glibc-2.22.orig/posix/fnmatch.c
-+++ glibc-2.22/posix/fnmatch.c
-@@ -53,7 +53,6 @@
- we support a correct implementation only in glibc. */
- #ifdef _LIBC
- # include "../locale/localeinfo.h"
--# include "../locale/elem-hash.h"
- # include "../locale/coll-lookup.h"
- # include
-
-Index: glibc-2.22/posix/fnmatch_loop.c
-===================================================================
---- glibc-2.22.orig/posix/fnmatch_loop.c
-+++ glibc-2.22/posix/fnmatch_loop.c
-@@ -503,26 +503,12 @@ FCT (pattern, string, string_end, no_lea
- {
- int32_t table_size;
- const int32_t *symb_table;
--# if WIDE_CHAR_VERSION
-- char str[c1];
-- unsigned int strcnt;
--# else
--# define str (startp + 1)
--# endif
- const unsigned char *extra;
- int32_t idx;
- int32_t elem;
-- int32_t second;
-- int32_t hash;
--
- # if WIDE_CHAR_VERSION
-- /* We have to convert the name to a single-byte
-- string. This is possible since the names
-- consist of ASCII characters and the internal
-- representation is UCS4. */
-- for (strcnt = 0; strcnt < c1; ++strcnt)
-- str[strcnt] = startp[1 + strcnt];
--#endif
-+ int32_t *wextra;
-+# endif
-
- table_size =
- _NL_CURRENT_WORD (LC_COLLATE,
-@@ -534,71 +520,55 @@ FCT (pattern, string, string_end, no_lea
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_EXTRAMB);
-
-- /* Locate the character in the hashing table. */
-- hash = elem_hash (str, c1);
--
-- idx = 0;
-- elem = hash % table_size;
-- if (symb_table[2 * elem] != 0)
-- {
-- second = hash % (table_size - 2) + 1;
--
-- do
-- {
-- /* First compare the hashing value. */
-- if (symb_table[2 * elem] == hash
-- && (c1
-- == extra[symb_table[2 * elem + 1]])
-- && memcmp (str,
-- &extra[symb_table[2 * elem
-- + 1]
-- + 1], c1) == 0)
-- {
-- /* Yep, this is the entry. */
-- idx = symb_table[2 * elem + 1];
-- idx += 1 + extra[idx];
-- break;
-- }
--
-- /* Next entry. */
-- elem += second;
-- }
-- while (symb_table[2 * elem] != 0);
-- }
-+ for (elem = 0; elem < table_size; elem++)
-+ if (symb_table[2 * elem] != 0)
-+ {
-+ idx = symb_table[2 * elem + 1];
-+ /* Skip the name of collating element. */
-+ idx += 1 + extra[idx];
-+# if WIDE_CHAR_VERSION
-+ /* Skip the byte sequence of the
-+ collating element. */
-+ idx += 1 + extra[idx];
-+ /* Adjust for the alignment. */
-+ idx = (idx + 3) & ~3;
-+
-+ wextra = (int32_t *) &extra[idx + 4];
-+
-+ if (/* Compare the length of the sequence. */
-+ c1 == wextra[0]
-+ /* Compare the wide char sequence. */
-+ && memcmp (startp + 1, &wextra[1],
-+ c1 * sizeof (UCHAR)) == 0)
-+ /* Yep, this is the entry. */
-+ break;
-+# else
-+ if (/* Compare the length of the sequence. */
-+ c1 == extra[idx]
-+ /* Compare the byte sequence. */
-+ && memcmp (startp + 1,
-+ &extra[idx + 1], c1) == 0)
-+ /* Yep, this is the entry. */
-+ break;
-+# endif
-+ }
-
-- if (symb_table[2 * elem] != 0)
-+ if (elem < table_size)
- {
- /* Compare the byte sequence but only if
- this is not part of a range. */
--# if WIDE_CHAR_VERSION
-- int32_t *wextra;
-+ if (! is_range
-
-- idx += 1 + extra[idx];
-- /* Adjust for the alignment. */
-- idx = (idx + 3) & ~3;
--
-- wextra = (int32_t *) &extra[idx + 4];
--# endif
--
-- if (! is_range)
-- {
- # if WIDE_CHAR_VERSION
-- for (c1 = 0;
-- (int32_t) c1 < wextra[idx];
-- ++c1)
-- if (n[c1] != wextra[1 + c1])
-- break;
--
-- if ((int32_t) c1 == wextra[idx])
-- goto matched;
-+ && memcmp (n, &wextra[1],
-+ c1 * sizeof (UCHAR)) == 0
- # else
-- for (c1 = 0; c1 < extra[idx]; ++c1)
-- if (n[c1] != extra[1 + c1])
-- break;
--
-- if (c1 == extra[idx])
-- goto matched;
-+ && memcmp (n, &extra[idx + 1], c1) == 0
- # endif
-+ )
-+ {
-+ n += c1 - 1;
-+ goto matched;
- }
-
- /* Get the collation sequence value. */
-@@ -606,9 +576,9 @@ FCT (pattern, string, string_end, no_lea
- # if WIDE_CHAR_VERSION
- cold = wextra[1 + wextra[idx]];
- # else
-- /* Adjust for the alignment. */
- idx += 1 + extra[idx];
-- idx = (idx + 3) & ~4;
-+ /* Adjust for the alignment. */
-+ idx = (idx + 3) & ~3;
- cold = *((int32_t *) &extra[idx]);
- # endif
-
-@@ -618,10 +588,10 @@ FCT (pattern, string, string_end, no_lea
- {
- /* No valid character. Match it as a
- single byte. */
-- if (!is_range && *n == str[0])
-+ if (!is_range && *n == startp[1])
- goto matched;
-
-- cold = str[0];
-+ cold = startp[1];
- c = *p++;
- }
- else
-@@ -629,7 +599,6 @@ FCT (pattern, string, string_end, no_lea
- }
- }
- else
--# undef str
- #endif
- {
- c = FOLD (c);
-@@ -721,25 +690,11 @@ FCT (pattern, string, string_end, no_lea
- {
- int32_t table_size;
- const int32_t *symb_table;
--# if WIDE_CHAR_VERSION
-- char str[c1];
-- unsigned int strcnt;
--# else
--# define str (startp + 1)
--# endif
- const unsigned char *extra;
- int32_t idx;
- int32_t elem;
-- int32_t second;
-- int32_t hash;
--
- # if WIDE_CHAR_VERSION
-- /* We have to convert the name to a single-byte
-- string. This is possible since the names
-- consist of ASCII characters and the internal
-- representation is UCS4. */
-- for (strcnt = 0; strcnt < c1; ++strcnt)
-- str[strcnt] = startp[1 + strcnt];
-+ int32_t *wextra;
- # endif
-
- table_size =
-@@ -752,51 +707,44 @@ FCT (pattern, string, string_end, no_lea
- _NL_CURRENT (LC_COLLATE,
- _NL_COLLATE_SYMB_EXTRAMB);
-
-- /* Locate the character in the hashing
-- table. */
-- hash = elem_hash (str, c1);
--
-- idx = 0;
-- elem = hash % table_size;
-- if (symb_table[2 * elem] != 0)
-- {
-- second = hash % (table_size - 2) + 1;
--
-- do
-- {
-- /* First compare the hashing value. */
-- if (symb_table[2 * elem] == hash
-- && (c1
-- == extra[symb_table[2 * elem + 1]])
-- && memcmp (str,
-- &extra[symb_table[2 * elem + 1]
-- + 1], c1) == 0)
-- {
-- /* Yep, this is the entry. */
-- idx = symb_table[2 * elem + 1];
-- idx += 1 + extra[idx];
-- break;
-- }
--
-- /* Next entry. */
-- elem += second;
-- }
-- while (symb_table[2 * elem] != 0);
-- }
--
-- if (symb_table[2 * elem] != 0)
-- {
-- /* Compare the byte sequence but only if
-- this is not part of a range. */
-+ for (elem = 0; elem < table_size; elem++)
-+ if (symb_table[2 * elem] != 0)
-+ {
-+ idx = symb_table[2 * elem + 1];
-+ /* Skip the name of collating
-+ element. */
-+ idx += 1 + extra[idx];
- # if WIDE_CHAR_VERSION
-- int32_t *wextra;
--
-- idx += 1 + extra[idx];
-- /* Adjust for the alignment. */
-- idx = (idx + 3) & ~4;
--
-- wextra = (int32_t *) &extra[idx + 4];
-+ /* Skip the byte sequence of the
-+ collating element. */
-+ idx += 1 + extra[idx];
-+ /* Adjust for the alignment. */
-+ idx = (idx + 3) & ~3;
-+
-+ wextra = (int32_t *) &extra[idx + 4];
-+
-+ if (/* Compare the length of the
-+ sequence. */
-+ c1 == wextra[0]
-+ /* Compare the wide char sequence. */
-+ && memcmp (startp + 1, &wextra[1],
-+ c1 * sizeof (int32_t)) == 0)
-+ /* Yep, this is the entry. */
-+ break;
-+# else
-+ if (/* Compare the length of the
-+ sequence. */
-+ c1 == extra[idx]
-+ /* Compare the byte sequence. */
-+ && memcmp (startp + 1,
-+ &extra[idx + 1], c1) == 0)
-+ /* Yep, this is the entry. */
-+ break;
- # endif
-+ }
-+
-+ if (elem < table_size)
-+ {
- /* Get the collation sequence value. */
- is_seqval = 1;
- # if WIDE_CHAR_VERSION
-@@ -804,19 +752,18 @@ FCT (pattern, string, string_end, no_lea
- # else
- /* Adjust for the alignment. */
- idx += 1 + extra[idx];
-- idx = (idx + 3) & ~4;
-+ idx = (idx + 3) & ~3;
- cend = *((int32_t *) &extra[idx]);
- # endif
- }
-- else if (symb_table[2 * elem] != 0 && c1 == 1)
-+ else if (c1 == 1)
- {
-- cend = str[0];
-+ cend = startp[1];
- c = *p++;
- }
- else
- return FNM_NOMATCH;
- }
--# undef str
- }
- else
- {
-Index: glibc-2.22/posix/tst-fnmatch4.c
-===================================================================
---- /dev/null
-+++ glibc-2.22/posix/tst-fnmatch4.c
-@@ -0,0 +1,51 @@
-+/* Test for fnmatch handling of collating elements
-+ Copyright (C) 2015 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ . */
-+
-+#include
-+#include
-+#include
-+
-+static int
-+do_test_locale (const char *locale)
-+{
-+ const char *pattern = "[[.ll.]]";
-+
-+ if (setlocale (LC_ALL, locale) == NULL)
-+ {
-+ printf ("could not set locale %s\n", locale);
-+ return 1;
-+ }
-+
-+ if (fnmatch (pattern, "ll", 0) != 0)
-+ {
-+ printf ("%s didn't match in locale %s\n", pattern, locale);
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int
-+do_test (void)
-+{
-+ return (do_test_locale ("es_US.ISO-8859-1")
-+ || do_test_locale ("es_US.UTF-8"));
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-Index: glibc-2.22/posix/tst-fnmatch5.c
-===================================================================
---- /dev/null
-+++ glibc-2.22/posix/tst-fnmatch5.c
-@@ -0,0 +1,53 @@
-+/* Test for fnmatch handling of collating elements
-+ Copyright (C) 2015 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ . */
-+
-+#include
-+#include
-+#include
-+#include
-+
-+#define LENGTH 20000000
-+
-+char pattern[LENGTH + 7];
-+
-+static int
-+do_test (void)
-+{
-+ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL)
-+ {
-+ puts ("could not set locale");
-+ return 1;
-+ }
-+ pattern[0] = '[';
-+ pattern[1] = '[';
-+ pattern[2] = '.';
-+ memset (pattern + 3, 'a', LENGTH);
-+ pattern[LENGTH + 3] = '.';
-+ pattern[LENGTH + 4] = ']';
-+ pattern[LENGTH + 5] = ']';
-+ int ret = fnmatch (pattern, "a", 0);
-+ if (ret == 0)
-+ {
-+ puts ("fnmatch returned 0 for invalid pattern");
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
diff --git a/getaddrinfo-ipv6-sanity.diff b/getaddrinfo-ipv6-sanity.diff
new file mode 100644
index 0000000..5b5ad8b
--- /dev/null
+++ b/getaddrinfo-ipv6-sanity.diff
@@ -0,0 +1,33 @@
+References: bnc#361697
+
+Index: sysdeps/posix/getaddrinfo.c
+===================================================================
+--- sysdeps/posix/getaddrinfo.c.orig
++++ sysdeps/posix/getaddrinfo.c
+@@ -269,7 +269,7 @@ extern service_user *__nss_hosts_databas
+ static int
+ gaih_inet (const char *name, const struct gaih_service *service,
+ const struct addrinfo *req, struct addrinfo **pai,
+- unsigned int *naddrs)
++ unsigned int *naddrs, bool usable_ipv6)
+ {
+ const struct gaih_typeproto *tp = gaih_inet_typeproto;
+ struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
+@@ -762,7 +762,7 @@ gaih_inet (const char *name, const struc
+ if (fct != NULL)
+ {
+ if (req->ai_family == AF_INET6
+- || req->ai_family == AF_UNSPEC)
++ || (req->ai_family == AF_UNSPEC && usable_ipv6))
+ {
+ gethosts (AF_INET6, struct in6_addr);
+ no_inet6_data = no_data;
+@@ -2151,7 +2151,7 @@ getaddrinfo (const char *name, const cha
+ if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
+ || hints->ai_family == AF_INET6)
+ {
+- last_i = gaih_inet (name, pservice, hints, end, &naddrs);
++ last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
+ if (last_i != 0)
+ {
+ freeaddrinfo (p);
diff --git a/glibc-2.10-dns-fixpack.diff b/glibc-2.10-dns-fixpack.diff
new file mode 100644
index 0000000..88318d6
--- /dev/null
+++ b/glibc-2.10-dns-fixpack.diff
@@ -0,0 +1,169 @@
+2008-11-26 Ulrich Drepper
+
+ * sysdeps/posix/getaddrinfo.c (getaddrinfo): Only restrict search
+ to IPv4 or IPv6 if an interface has been found.
+
+--- sysdeps/posix/getaddrinfo.c 30 Jul 2008 19:14:22 -0000 1.136
++++ sysdeps/posix/getaddrinfo.c 3 Dec 2008 07:04:10 -0000 1.139
+@@ -2108,7 +2110,7 @@ getaddrinfo (const char *name, const cha
+ {
+ /* If we haven't seen both IPv4 and IPv6 interfaces we can
+ narrow down the search. */
+- if (! seen_ipv4 || ! seen_ipv6)
++ if ((! seen_ipv4 || ! seen_ipv6) && (seen_ipv4 || seen_ipv6))
+ {
+ local_hints = *hints;
+ local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6;
+
+
+2008-12-02 Ulrich Drepper
+
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): In case we use
+ gethostbyname4_r, we don't have a separate IPv6 status, so copy
+ the no_data variable.
+
+--- sysdeps/posix/getaddrinfo.c 30 Jul 2008 19:14:22 -0000 1.136
++++ sysdeps/posix/getaddrinfo.c 3 Dec 2008 07:04:10 -0000 1.139
+@@ -733,6 +733,8 @@ gaih_inet (const char *name, const struc
+ tmpbuflen, 2 * tmpbuflen);
+ }
+
++ no_inet6_data = no_data;
++
+ if (status == NSS_STATUS_SUCCESS)
+ {
+ if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
+
+
+2008-12-02 Ulrich Drepper
+
+ * resolv/res_init.c (__res_vinit): Initialize nscount to zero.
+
+ * resolv/res_init.c (__res_vinit): Fill in IPv4 name server
+ information at the correct index.
+
+2008-12-07 Ulrich Drepper
+
+ * resolv/res_init.c (__res_vinit): Always assign to statp->nscount
+ after reading name server list.
+
+--- resolv/res_init.c 7 Apr 2008 17:20:25 -0000 1.47
++++ resolv/res_init.c 8 Dec 2008 03:59:05 -0000 1.50
+@@ -183,7 +183,7 @@ __res_vinit(res_state statp, int preinit
+ #endif
+ statp->nsaddr.sin_family = AF_INET;
+ statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
+- statp->nscount = 1;
++ statp->nscount = 0;
+ statp->ndots = 1;
+ statp->pfcode = 0;
+ statp->_vcsock = -1;
+@@ -314,9 +314,9 @@ __res_vinit(res_state statp, int preinit
+ cp++;
+ if ((*cp != '\0') && (*cp != '\n')
+ && __inet_aton(cp, &a)) {
+- statp->nsaddr_list[nserv].sin_addr = a;
+- statp->nsaddr_list[nserv].sin_family = AF_INET;
+- statp->nsaddr_list[nserv].sin_port =
++ statp->nsaddr_list[nservall].sin_addr = a;
++ statp->nsaddr_list[nservall].sin_family = AF_INET;
++ statp->nsaddr_list[nservall].sin_port =
+ htons(NAMESERVER_PORT);
+ nserv++;
+ #ifdef _LIBC
+@@ -420,8 +420,7 @@ __res_vinit(res_state statp, int preinit
+ continue;
+ }
+ }
+- if (nserv > 1)
+- statp->nscount = nserv;
++ statp->nscount = nserv;
+ #ifdef _LIBC
+ if (nservall - nserv > 0) {
+ statp->_u._ext.nscount6 = nservall - nserv;
+
+
+2008-12-02 Ulrich Drepper
+
+ * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Recognize
+ ESRCH return value.
+ (_nss_dns_gethostbyname4_r): Likewise.
+
+--- resolv/nss_dns/dns-host.c 12 Nov 2008 07:52:20 -0000 1.54
++++ resolv/nss_dns/dns-host.c 3 Dec 2008 07:09:26 -0000 1.55
+@@ -198,8 +198,14 @@ _nss_dns_gethostbyname3_r (const char *n
+ 1024, &host_buffer.ptr, NULL, NULL, NULL);
+ if (n < 0)
+ {
+- status = (errno == ECONNREFUSED
+- ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
++ if (errno == ESRCH)
++ {
++ status = NSS_STATUS_TRYAGAIN;
++ h_errno = TRY_AGAIN;
++ }
++ else
++ status = (errno == ECONNREFUSED
++ ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
+ *h_errnop = h_errno;
+ if (h_errno == TRY_AGAIN)
+ *errnop = EAGAIN;
+@@ -304,8 +310,14 @@ _nss_dns_gethostbyname4_r (const char *n
+ &ans2p, &nans2p, &resplen2);
+ if (n < 0)
+ {
+- status = (errno == ECONNREFUSED
+- ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
++ if (errno == ESRCH)
++ {
++ status = NSS_STATUS_TRYAGAIN;
++ h_errno = TRY_AGAIN;
++ }
++ else
++ status = (errno == ECONNREFUSED
++ ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
+ *herrnop = h_errno;
+ if (h_errno == TRY_AGAIN)
+ *errnop = EAGAIN;
+
+
+2008-12-29 Ulrich Drepper
+
+ * resolv/res_init.c (__res_vinit): Count all servers in statp->nscount.
+
+diff -u -r1.50 -r1.51
+--- resolv/res_init.c 2008/12/08 03:59:05 1.50
++++ resolv/res_init.c 2008/12/29 19:53:31 1.51
+@@ -420,7 +420,7 @@
+ continue;
+ }
+ }
+- statp->nscount = nserv;
++ statp->nscount = nservall;
+ #ifdef _LIBC
+ if (nservall - nserv > 0) {
+ statp->_u._ext.nscount6 = nservall - nserv;
+
+
+2009-01-16 Petr Baudis
+
+ * resolv/res_libc (__res_maybe_init): Call __res_vinit()
+ even if we currently have zero nscount.
+
+diff --git a/resolv/res_libc.c b/resolv/res_libc.c
+index 8af57f7..810fbc8 100644
+--- resolv/res_libc.c
++++ resolv/res_libc.c
+@@ -96,10 +96,9 @@ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+- if (resp->nscount > 0) {
++ if (resp->nscount > 0)
+ __res_iclose (resp, true);
+- return __res_vinit (resp, 1);
+- }
++ return __res_vinit (resp, 1);
+ }
+ return 0;
+ } else if (preinit) {
diff --git a/glibc-2.10-dns-no-gethostbyname4.diff b/glibc-2.10-dns-no-gethostbyname4.diff
new file mode 100644
index 0000000..30f37a6
--- /dev/null
+++ b/glibc-2.10-dns-no-gethostbyname4.diff
@@ -0,0 +1,26 @@
+The gethostbyname4() lookup method is problematic since it fires out both
+the A and AAAA DNS queries in parallel and over the same socket. This
+should work in theory, but it turns out that many cheap DSL modems and
+similar devices have buggy DNS servers - if the AAAA query arrives too
+quickly after the A query, the server will generate only a single reply
+with the A query id but returning an error for the AAAA query; we get
+stuck waiting for the second reply.
+
+For gethostbyname4() users affected, disabling IPv6 in the system might
+work around the issue, unfortunately it only helps with applications
+using AI_ADDRCONFIG (e.g. Firefox); some (notably e.g. Pidgin) neglect
+to do that.
+
+Real fix should be using separate ports for the A and AAAA queries.
+
+--- resolv/Versions 2008-08-02 10:26:09.000000000 +0200
++++ resolv/Versions 2008-12-08 12:51:53.000000000 +0100
+@@ -102,7 +102,7 @@ libnss_dns {
+ _nss_dns_gethostbyname_r; _nss_dns_getnetbyaddr_r;
+ _nss_dns_getnetbyname_r; _nss_dns_getcanonname_r;
+ _nss_dns_gethostbyaddr2_r;
+- _nss_dns_gethostbyname4_r;
++# _nss_dns_gethostbyname4_r;
+ }
+ }
+
diff --git a/glibc-2.10-locale-tuesday.diff b/glibc-2.10-locale-tuesday.diff
new file mode 100644
index 0000000..4795094
--- /dev/null
+++ b/glibc-2.10-locale-tuesday.diff
@@ -0,0 +1,26 @@
+diff --git a/localedata/locales/csb_PL b/localedata/locales/csb_PL
+index 663fd6c..93c9ae2 100644
+--- localedata/locales/csb_PL
++++ localedata/locales/csb_PL
+@@ -184,7 +184,7 @@ t_fmt_ampm ""
+ date_fmt "/
+ /
+ "
+-week 7;19971201;4
++week 7;19971130;4
+ first_weekday 2
+ first_workday 2
+ END LC_TIME
+diff --git a/localedata/locales/en_GB b/localedata/locales/en_GB
+index fe58f1f..6a81d6d 100644
+--- localedata/locales/en_GB
++++ localedata/locales/en_GB
+@@ -121,7 +121,7 @@ t_fmt_ampm ""
+ date_fmt "/
+ /
+ "
+-week 7;19971201;4
++week 7;19971130;4
+ first_weekday 2
+ first_workday 2
+ END LC_TIME
diff --git a/glibc-2.10-nis-hosts.diff b/glibc-2.10-nis-hosts.diff
new file mode 100644
index 0000000..b421637
--- /dev/null
+++ b/glibc-2.10-nis-hosts.diff
@@ -0,0 +1,84 @@
+===================================================================
+RCS file: /cvs/glibc/libc/nis/nss_nis/nis-hosts.c,v
+retrieving revision 1.29
+retrieving revision 1.31
+diff -u -r1.29 -r1.31
+--- nis/nss_nis/nis-hosts.c 2008/05/10 23:23:25 1.29
++++ nis/nss_nis/nis-hosts.c 2008/12/07 17:06:43 1.31
+@@ -485,24 +485,6 @@
+ return retval;
+ }
+
+- struct parser_data data;
+- struct hostent host;
+- int parse_res = parse_line (result, &host, &data, buflen, errnop, AF_UNSPEC,
+- 0);
+- if (__builtin_expect (parse_res < 1, 0))
+- {
+- if (parse_res == -1)
+- {
+- *herrnop = NETDB_INTERNAL;
+- return NSS_STATUS_TRYAGAIN;
+- }
+- else
+- {
+- *herrnop = HOST_NOT_FOUND;
+- return NSS_STATUS_NOTFOUND;
+- }
+- }
+-
+ if (*pat == NULL)
+ {
+ uintptr_t pad = (-(uintptr_t) buffer
+@@ -524,16 +506,47 @@
+ buflen -= sizeof (struct gaih_addrtuple);
+ }
+
+- (*pat)->next = NULL;
+- size_t h_name_len = strlen (host.h_name);
+- if (h_name_len >= buflen)
++ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
++ buffer += pad;
++
++ struct parser_data *data = (void *) buffer;
++
++ if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+ goto erange;
+- (*pat)->name = memcpy (buffer, host.h_name, h_name_len + 1);
++ buflen -= pad;
++
++ struct hostent host;
++ int parse_res = parse_line (result, &host, data, buflen, errnop, AF_UNSPEC,
++ 0);
++ if (__builtin_expect (parse_res < 1, 0))
++ {
++ if (parse_res == -1)
++ {
++ *herrnop = NETDB_INTERNAL;
++ return NSS_STATUS_TRYAGAIN;
++ }
++ else
++ {
++ *herrnop = HOST_NOT_FOUND;
++ return NSS_STATUS_NOTFOUND;
++ }
++ }
++
++ (*pat)->next = NULL;
+ (*pat)->family = host.h_addrtype;
+ memcpy ((*pat)->addr, host.h_addr_list[0], host.h_length);
+ (*pat)->scopeid = 0;
+ assert (host.h_addr_list[1] == NULL);
+
++ /* Undo the alignment for parser_data. */
++ buffer -= pad;
++ buflen += pad;
++
++ size_t h_name_len = strlen (host.h_name) + 1;
++ if (h_name_len >= buflen)
++ goto erange;
++ (*pat)->name = memcpy (buffer, host.h_name, h_name_len);
++
+ free (result);
+
+ return NSS_STATUS_SUCCESS;
diff --git a/glibc-2.10-nscd-gc-dataofs.diff b/glibc-2.10-nscd-gc-dataofs.diff
new file mode 100644
index 0000000..6ac0b70
--- /dev/null
+++ b/glibc-2.10-nscd-gc-dataofs.diff
@@ -0,0 +1,15 @@
+http://sourceware.org/bugzilla/show_bug.cgi?id=9741
+
+diff --git a/nscd/mem.c b/nscd/mem.c
+index e821729..1f7215e 100644
+--- nscd/mem.c
++++ nscd/mem.c
+@@ -163,7 +163,7 @@ gc (struct database_dyn *db)
+ else
+ {
+ he = xmalloc (memory_needed);
+- he_data = &he[db->head->nentries * sizeof (struct hashentry *)];
++ he_data = &he[db->head->nentries];
+ he_use_malloc = true;
+ }
+
diff --git a/glibc-2.10-nscd-meminflight.diff b/glibc-2.10-nscd-meminflight.diff
new file mode 100644
index 0000000..b224e62
--- /dev/null
+++ b/glibc-2.10-nscd-meminflight.diff
@@ -0,0 +1,86 @@
+--- nscd/mem.c~ 2008-11-23 12:59:15.000000000 +0100
++++ nscd/mem.c 2008-11-23 13:52:01.000000000 +0100
+@@ -392,6 +392,7 @@
+ moves = moves->next = new_move;
+ }
+
++ ref_t off_alloc_start = off_alloc;
+ /* The following loop will prepare to move this much data. */
+ off_free += off_allocend - off_alloc;
+
+@@ -410,23 +411,60 @@
+ else
+ {
+- assert (next_data < &he_data[db->head->nentries]);
+- assert ((*next_data)->packet == off_alloc);
+
+- struct datahead *dh = (struct datahead *) (db->data + off_alloc);
+- do
+- {
+- assert ((*next_data)->key >= (*next_data)->packet);
+- assert ((*next_data)->key + (*next_data)->len
+- <= (*next_data)->packet + dh->allocsize);
+-
+- (*next_data)->packet -= disp;
+- (*next_data)->key -= disp;
+- ++next_data;
++ if (next_data < &he_data[db->head->nentries] && (*next_data)->packet == off_alloc)
++ {
++ struct datahead *dh = (struct datahead *) (db->data + off_alloc);
++ do
++ {
++ assert ((*next_data)->key >= (*next_data)->packet);
++ assert ((*next_data)->key + (*next_data)->len
++ <= (*next_data)->packet + dh->allocsize);
++
++ (*next_data)->packet -= disp;
++ (*next_data)->key -= disp;
++ ++next_data;
++ }
++ while (next_data < &he_data[db->head->nentries]
++ && (*next_data)->packet == off_alloc);
++
++ off_alloc += (dh->allocsize + BLOCK_ALIGN_M1) & ~BLOCK_ALIGN_M1;
+ }
+- while (next_data < &he_data[db->head->nentries]
+- && (*next_data)->packet == off_alloc);
++ else
++ {
++ /* This is not yet a hashed element but an in-flight
++ * mempool allocation. We cannot displace it, so we
++ * reset the shake-down at this point; typically,
++ * the in-flight allocations will be at the top of
++ * the pool, thus nothing will be above it and we will
++ * shake it down in the next gc run. In theory, we can
++ * grow the pool indefinitely if we always hit gc at
++ * the point we have an in-flight allocation, but
++ * that does not seem to be a realistic scenario. */
++ nscd_ssize_t blocklen = 0;
++ struct mem_in_flight *mrunp = mem_in_flight_list;
++
++ /* See the first mem_in_flight_list loop above
++ * for correctness considerations. */
++ /* Typically, we have only tiny number of in_flight
++ * records so we don't need to bother pre-sorting
++ * the list. */
++ while (!blocklen && mrunp != NULL)
++ {
++ for (enum in_flight idx = IDX_result_data;
++ idx < IDX_last && mrunp->block[idx].dbidx == db - dbs; ++idx)
++ if (mrunp->block[idx].blockoff == off_alloc)
++ blocklen = mrunp->block[idx].blocklen;
++
++ mrunp = mrunp->next;
++ }
++ assert(blocklen > 0);
++
++ moves->size = off_alloc - off_alloc_start;
++ off_free = off_allocend;
++ disp = 0;
+
+- off_alloc += (dh->allocsize + BLOCK_ALIGN_M1) & ~BLOCK_ALIGN_M1;
++ off_alloc += blocklen;
++ }
+ }
+ }
+ assert (off_alloc == off_allocend);
diff --git a/glibc-2.10-nscd-nostack.diff b/glibc-2.10-nscd-nostack.diff
new file mode 100644
index 0000000..27fb9aa
--- /dev/null
+++ b/glibc-2.10-nscd-nostack.diff
@@ -0,0 +1,16 @@
+--- nscd/nscd.h~ 2009-01-21 02:14:55.875774000 +0100
++++ nscd/nscd.h 2009-01-21 02:15:58.519066000 +0100
+@@ -60,7 +60,12 @@
+
+ /* Maximum size of stack frames we allow the thread to use. We use
+ 80% of the thread stack size. */
+-#define MAX_STACK_USE ((8 * NSCD_THREAD_STACKSIZE) / 10)
++// #define MAX_STACK_USE ((8 * NSCD_THREAD_STACKSIZE) / 10)
++/* alloca() calls use extra space on stack that we cannot reliably
++ account for, the optimization effect is not that big and they are
++ prone to hard-to-debug crashes. In short, they are much more trouble
++ than they are worth. */
++#define MAX_STACK_USE 0
+
+
+ /* Structure describing dynamic part of one database. */
diff --git a/glibc-2.10-nscd-prunerace.diff b/glibc-2.10-nscd-prunerace.diff
new file mode 100644
index 0000000..6df9c79
--- /dev/null
+++ b/glibc-2.10-nscd-prunerace.diff
@@ -0,0 +1,88 @@
+diff --git a/nscd/connections.c b/nscd/connections.c
+index e3a6738..597e1a7 100644
+--- nscd/connections.c
++++ nscd/connections.c
+@@ -109,6 +109,7 @@ struct database_dyn dbs[lastdb] =
+ [pwddb] = {
+ .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .prune_lock = PTHREAD_MUTEX_INITIALIZER,
++ .prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
+ .enabled = 0,
+ .check_file = 1,
+ .persistent = 0,
+@@ -129,6 +130,7 @@ struct database_dyn dbs[lastdb] =
+ [grpdb] = {
+ .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .prune_lock = PTHREAD_MUTEX_INITIALIZER,
++ .prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
+ .enabled = 0,
+ .check_file = 1,
+ .persistent = 0,
+@@ -149,6 +151,7 @@ struct database_dyn dbs[lastdb] =
+ [hstdb] = {
+ .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .prune_lock = PTHREAD_MUTEX_INITIALIZER,
++ .prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
+ .enabled = 0,
+ .check_file = 1,
+ .persistent = 0,
+@@ -169,6 +172,7 @@ struct database_dyn dbs[lastdb] =
+ [servdb] = {
+ .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .prune_lock = PTHREAD_MUTEX_INITIALIZER,
++ .prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
+ .enabled = 0,
+ .check_file = 1,
+ .persistent = 0,
+@@ -975,9 +979,9 @@ invalidate_cache (char *key, int fd)
+
+ if (dbs[number].enabled)
+ {
+- pthread_mutex_lock (&dbs[number].prune_lock);
++ pthread_mutex_lock (&dbs[number].prune_run_lock);
+ prune_cache (&dbs[number], LONG_MAX, fd);
+- pthread_mutex_unlock (&dbs[number].prune_lock);
++ pthread_mutex_unlock (&dbs[number].prune_run_lock);
+ }
+ else
+ {
+@@ -1492,6 +1496,7 @@ nscd_run_prune (void *p)
+ dbs[my_number].wakeup_time = now + CACHE_PRUNE_INTERVAL + my_number;
+
+ pthread_mutex_t *prune_lock = &dbs[my_number].prune_lock;
++ pthread_mutex_t *prune_run_lock = &dbs[my_number].prune_run_lock;
+ pthread_cond_t *prune_cond = &dbs[my_number].prune_cond;
+
+ pthread_mutex_lock (prune_lock);
+@@ -1523,7 +1528,10 @@ nscd_run_prune (void *p)
+ time_t prune_now = dbs[my_number].clear_cache ? LONG_MAX : now;
+ dbs[my_number].clear_cache = 0;
+
++ /* prune_cache() must be run with prune_lock off since
++ cache_add() needs to take the lock. */
+ pthread_mutex_unlock (prune_lock);
++ pthread_mutex_lock (prune_run_lock);
+
+ next_wait = prune_cache (&dbs[my_number], prune_now, -1);
+
+@@ -1538,6 +1546,7 @@ nscd_run_prune (void *p)
+ dbs[my_number].head->timestamp = now;
+ }
+
++ pthread_mutex_unlock (prune_run_lock);
+ pthread_mutex_lock (prune_lock);
+
+ /* Make it known when we will wake up again. */
+diff --git a/nscd/nscd.h b/nscd/nscd.h
+index 5c77dd3..a828f3e 100644
+--- nscd/nscd.h
++++ nscd/nscd.h
+@@ -68,7 +68,7 @@ struct database_dyn
+ {
+ pthread_rwlock_t lock;
+ pthread_cond_t prune_cond;
+- pthread_mutex_t prune_lock;
++ pthread_mutex_t prune_lock, prune_run_lock;
+ time_t wakeup_time;
+
+ int enabled;
diff --git a/glibc-2.10-ppc32-setcontext-fp.diff b/glibc-2.10-ppc32-setcontext-fp.diff
new file mode 100644
index 0000000..cbadcff
--- /dev/null
+++ b/glibc-2.10-ppc32-setcontext-fp.diff
@@ -0,0 +1,29 @@
+20090108 Ryan S. Arnold
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+ (__CONTEXT_FUNC_NAME): Fix mtfsf to use fp31 instead of fp0.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+ (__CONTEXT_FUNC_NAME): Fix mtfsf to use fp31 instead of fp0.
+
+--- sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S 2009-01-08 10:01:44.000000000 -0600
++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S 2009-01-08 16:54:10.000000000 -0600
+@@ -202,7 +202,7 @@
+ lfd fp0,_UC_FREGS+(0*8)(r31)
+ # ifdef _ARCH_PWR6
+ /* Use the extended four-operand version of the mtfsf insn. */
+- mtfsf 0xff,fp0,1,0
++ mtfsf 0xff,fp31,1,0
+ # else
+ /* Availability of DFP indicates a 64-bit FPSCR. */
+ andi. r6,r7,PPC_FEATURE_HAS_DFP
+--- sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S 2009-01-08 10:01:44.000000000 -0600
++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S 2009-01-08 16:54:17.000000000 -0600
+@@ -428,7 +428,7 @@
+ lfd fp0,_UC_FREGS+(0*8)(r31)
+ # ifdef _ARCH_PWR6
+ /* Use the extended four-operand version of the mtfsf insn. */
+- mtfsf 0xff,fp0,1,0
++ mtfsf 0xff,fp31,1,0
+ # else
+ /* Availability of DFP indicates a 64-bit FPSCR. */
+ andi. r6,r7,PPC_FEATURE_HAS_DFP
diff --git a/glibc-2.10-unsetenv.diff b/glibc-2.10-unsetenv.diff
new file mode 100644
index 0000000..bede175
--- /dev/null
+++ b/glibc-2.10-unsetenv.diff
@@ -0,0 +1,69 @@
+2008-12-01 Ulrich Drepper
+
+ * stdlib/setenv.c (unsetenv): Don't search environment if it does
+ not exist.
+ * stdlib/Makefile (tests): Add tst-unsetenv1.
+ * stdlib/tst-unsetenv1.c: New file.
+
+--- stdlib/Makefile 8 Mar 2008 21:31:19 -0000 1.122
++++ stdlib/Makefile 2 Dec 2008 02:27:21 -0000 1.123
+@@ -69,7 +69,7 @@ tests := tst-strtol tst-strtod testmb t
+ test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
+ tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
+ tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
+- tst-makecontext2 tst-strtod6
++ tst-makecontext2 tst-strtod6 tst-unsetenv1
+
+ include ../Makeconfig
+
+--- stdlib/setenv.c 14 Dec 2005 10:44:05 -0000 1.1
++++ stdlib/setenv.c 2 Dec 2008 01:39:44 -0000 1.2
+@@ -292,19 +292,20 @@ unsetenv (name)
+ LOCK;
+
+ ep = __environ;
+- while (*ep != NULL)
+- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+- {
+- /* Found it. Remove this pointer by moving later ones back. */
+- char **dp = ep;
+-
+- do
+- dp[0] = dp[1];
+- while (*dp++);
+- /* Continue the loop in case NAME appears again. */
+- }
+- else
+- ++ep;
++ if (ep != NULL)
++ while (*ep != NULL)
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
+
+ UNLOCK;
+
+--- stdlib/tst-unsetenv1.c 1 Jan 1970 00:00:00 -0000
++++ stdlib/tst-unsetenv1.c 2 Dec 2008 02:27:12 -0000 1.1
+@@ -0,0 +1,12 @@
++#include
++
++static int
++do_test (void)
++{
++ clearenv ();
++ unsetenv ("FOO");
++ return 0;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
diff --git a/glibc-2.14-crypt.diff b/glibc-2.14-crypt.diff
deleted file mode 100644
index 5afebd2..0000000
--- a/glibc-2.14-crypt.diff
+++ /dev/null
@@ -1,98 +0,0 @@
-Index: glibc-2.25/crypt/Makefile
-===================================================================
---- glibc-2.25.orig/crypt/Makefile
-+++ glibc-2.25/crypt/Makefile
-@@ -23,14 +23,18 @@ subdir := crypt
- include ../Makeconfig
-
- headers := crypt.h
-+headers += gnu-crypt.h ow-crypt.h
-
--extra-libs := libcrypt
-+extra-libs := libcrypt libowcrypt
- extra-libs-others := $(extra-libs)
-
- libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
- crypt_util
-
--tests := cert md5c-test sha256c-test sha512c-test badsalttest
-+libcrypt-routines += crypt_blowfish x86 wrapper
-+libowcrypt-routines := crypt_gensalt wrapper-gensalt
-+
-+tests := cert md5c-test sha256c-test sha512c-test
-
- ifeq ($(crypt-in-libc),yes)
- routines += $(libcrypt-routines)
-Index: glibc-2.25/crypt/Versions
-===================================================================
---- glibc-2.25.orig/crypt/Versions
-+++ glibc-2.25/crypt/Versions
-@@ -3,3 +3,8 @@ libcrypt {
- crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
- }
- }
-+libowcrypt {
-+ OW_CRYPT_1.0 {
-+ crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra;
-+ }
-+}
-Index: glibc-2.25/crypt/crypt-entry.c
-===================================================================
---- glibc-2.25.orig/crypt/crypt-entry.c
-+++ glibc-2.25/crypt/crypt-entry.c
-@@ -71,7 +71,7 @@ extern struct crypt_data _ufc_foobar;
- */
-
- char *
--__crypt_r (const char *key, const char *salt,
-+__des_crypt_r (const char *key, const char *salt,
- struct crypt_data * __restrict data)
- {
- ufc_long res[4];
-@@ -152,6 +152,7 @@ __crypt_r (const char *key, const char *
-
- return data->crypt_3_buf;
- }
-+#if 0
- weak_alias (__crypt_r, crypt_r)
-
- char *
-@@ -190,3 +191,4 @@ __fcrypt (const char *key, const char *s
- return crypt (key, salt);
- }
- #endif
-+#endif
-Index: glibc-2.25/crypt/crypt-private.h
-===================================================================
---- glibc-2.25.orig/crypt/crypt-private.h
-+++ glibc-2.25/crypt/crypt-private.h
-@@ -65,7 +65,7 @@ extern void __encrypt_r (char * __restri
- struct crypt_data * __restrict __data);
-
- /* crypt-entry.c */
--extern char *__crypt_r (const char *__key, const char *__salt,
-+extern char *__des_crypt_r (const char *__key, const char *__salt,
- struct crypt_data * __restrict __data);
- extern char *fcrypt (const char *key, const char *salt);
-
-Index: glibc-2.25/shlib-versions
-===================================================================
---- glibc-2.25.orig/shlib-versions
-+++ glibc-2.25/shlib-versions
-@@ -58,6 +58,7 @@ libnsl=1
-
- # This defines the shared library version numbers we will install.
- libcrypt=1
-+libowcrypt=1
-
- # The gross patch for programs assuming broken locale implementations.
- libBrokenLocale=1
-Index: glibc-2.25/sysdeps/unix/sysv/linux/libowcrypt.abilist
-===================================================================
---- /dev/null
-+++ glibc-2.25/sysdeps/unix/sysv/linux/libowcrypt.abilist
-@@ -0,0 +1,4 @@
-+OW_CRYPT_1.0 OW_CRYPT_1.0 A
-+OW_CRYPT_1.0 crypt_gensalt F
-+OW_CRYPT_1.0 crypt_gensalt_ra F
-+OW_CRYPT_1.0 crypt_gensalt_rn F
diff --git a/glibc-2.2-sunrpc.diff b/glibc-2.2-sunrpc.diff
new file mode 100644
index 0000000..523f0b4
--- /dev/null
+++ b/glibc-2.2-sunrpc.diff
@@ -0,0 +1,76 @@
+diff -urN glibc-2.2.4/sunrpc/clnt_udp.c glibc-2.2.4.new/sunrpc/clnt_udp.c
+--- sunrpc/clnt_udp.c Tue Aug 24 11:34:36 2004
++++ sunrpc/clnt_udp.c Tue Aug 24 11:35:19 2004
+@@ -272,6 +272,7 @@
+ XDR *xdrs;
+ int outlen = 0;
+ int inlen;
++ int pollresult;
+ socklen_t fromlen;
+ struct pollfd fd;
+ int milliseconds = (cu->cu_wait.tv_sec * 1000) +
+@@ -342,37 +343,36 @@
+ anyup = 0;
+ for (;;)
+ {
+- switch (__poll (&fd, 1, milliseconds))
++ switch (pollresult = __poll (&fd, 1, milliseconds))
+ {
+-
+ case 0:
+- if (anyup == 0)
+- {
+- anyup = is_network_up (cu->cu_sock);
+- if (!anyup)
+- return (cu->cu_error.re_status = RPC_CANTRECV);
+- }
+-
+- time_waited.tv_sec += cu->cu_wait.tv_sec;
+- time_waited.tv_usec += cu->cu_wait.tv_usec;
+- while (time_waited.tv_usec >= 1000000)
+- {
+- time_waited.tv_sec++;
+- time_waited.tv_usec -= 1000000;
+- }
+- if ((time_waited.tv_sec < timeout.tv_sec) ||
+- ((time_waited.tv_sec == timeout.tv_sec) &&
+- (time_waited.tv_usec < timeout.tv_usec)))
+- goto send_again;
+- return (cu->cu_error.re_status = RPC_TIMEDOUT);
+-
+- /*
+- * buggy in other cases because time_waited is not being
+- * updated.
+- */
+ case -1:
+- if (errno == EINTR)
+- continue;
++ if (pollresult == 0 || errno == EINTR) {
++ if (anyup == 0)
++ {
++ anyup = is_network_up (cu->cu_sock);
++ if (!anyup)
++ return (cu->cu_error.re_status = RPC_CANTRECV);
++ }
++
++ time_waited.tv_sec += cu->cu_wait.tv_sec;
++ time_waited.tv_usec += cu->cu_wait.tv_usec;
++ while (time_waited.tv_usec >= 1000000)
++ {
++ time_waited.tv_sec++;
++ time_waited.tv_usec -= 1000000;
++ }
++ if ((time_waited.tv_sec < timeout.tv_sec) ||
++ ((time_waited.tv_sec == timeout.tv_sec) &&
++ (time_waited.tv_usec < timeout.tv_usec)))
++ if (pollresult == 0)
++ goto send_again;
++ else
++ continue;
++ return (cu->cu_error.re_status = RPC_TIMEDOUT);
++ }
++
++ /* errno != EINTR */
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
+ }
diff --git a/glibc-2.26.tar.xz b/glibc-2.26.tar.xz
deleted file mode 100644
index 3a2b030..0000000
--- a/glibc-2.26.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd
-size 14682748
diff --git a/glibc-2.26.tar.xz.sig b/glibc-2.26.tar.xz.sig
deleted file mode 100644
index 21adc1c..0000000
--- a/glibc-2.26.tar.xz.sig
+++ /dev/null
@@ -1,10 +0,0 @@
------BEGIN PGP SIGNATURE-----
-
-iQEcBAABAgAGBQJZgduLAAoJEHnEPfvxzyGHDesH/itf17ZUWSWNIRp2cC0RK1et
-jtR7ufFMpSHfMFJQXkli162s+iFMAxuOus52rma/h3PP8BXVbEKB7M3N0dvqPbmC
-AIC6YtAYU/I4M3V+6T1pi4ras19i2VgNY+iag0xw5o0ah4yZmZwB5eFR2xIz10ZD
-SGffJyCD/8EFwn/SPx38JS55ENwGj5PT1m2TsEnlLeHg7sCH7ksb5Pqq/ZEwIw0v
-E56a4hSliDUhurc0gUQmFxm/FhFSdTzns0vShfgou4D2tNSYaUjrf/17ebj0ehUF
-XkNH5jvwHoxiKzEVnD7dS9NLbvOPAG4AlFnWejgqvX0JB/M5TknOcmJYpzZYiGE=
-=XObH
------END PGP SIGNATURE-----
diff --git a/glibc-2.3-SuSE.diff b/glibc-2.3-SuSE.diff
new file mode 100644
index 0000000..01107dc
--- /dev/null
+++ b/glibc-2.3-SuSE.diff
@@ -0,0 +1,37 @@
+--- io/Makefile
++++ io/Makefile 2003/02/24 12:15:52
+@@ -56,7 +56,7 @@
+
+ others := pwd
+ test-srcs := ftwtest
+-tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
++tests := test-utime test-stat test-stat2 tst-getcwd \
+ tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
+ tst-openat tst-unlinkat tst-fstatat tst-futimesat \
+ distribute := ftwtest-sh
+--- libio/stdio.h 23 Apr 2003 10:13:22 -0000 1.1.1.14
++++ libio/stdio.h 23 Apr 2003 10:27:07 -0000 1.10
+@@ -142,10 +142,12 @@ typedef _G_fpos64_t fpos64_t;
+ extern struct _IO_FILE *stdin; /* Standard input stream. */
+ extern struct _IO_FILE *stdout; /* Standard output stream. */
+ extern struct _IO_FILE *stderr; /* Standard error output stream. */
++#ifdef __STDC__
+ /* C89/C99 say they're macros. Make them happy. */
+ #define stdin stdin
+ #define stdout stdout
+ #define stderr stderr
++#endif
+
+ __BEGIN_NAMESPACE_STD
+ /* Remove file FILENAME. */
+--- stdio-common/Makefile
++++ stdio-common/Makefile 2005/12/05 11:13:59
+@@ -48,7 +48,7 @@
+ temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
+ xbug errnobug \
+ bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
+- tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
++ tfformat tiformat tllformat tst-printfsz tst-wc-printf \
+ scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
+ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
+ tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
diff --git a/glibc-2.3-regcomp.diff b/glibc-2.3-regcomp.diff
new file mode 100644
index 0000000..eaa62e2
--- /dev/null
+++ b/glibc-2.3-regcomp.diff
@@ -0,0 +1,11 @@
+--- posix/regcomp.c 2003-11-26 08:54:28.000000000 +0100
++++ posix/regcomp.c 2003-11-27 11:41:00.000000000 +0100
+@@ -2191,6 +2191,8 @@
+ else if (syntax & RE_CONTEXT_INDEP_OPS)
+ {
+ fetch_token (token, regexp, syntax);
++ if (token->type == OP_CLOSE_SUBEXP || token->type == OP_ALT)
++ return NULL;
+ return parse_expression (regexp, preg, token, syntax, nest, err);
+ }
+ /* else fall through */
diff --git a/glibc-2.3.1.localedef.diff b/glibc-2.3.1.localedef.diff
new file mode 100644
index 0000000..a4dca05
--- /dev/null
+++ b/glibc-2.3.1.localedef.diff
@@ -0,0 +1,68 @@
+-------------------------------------------------------------------
+Mon Oct 21 17:20:04 CEST 2002 - schwab@suse.de
+
+- Fix alignment in locale-archive.
+
+--- locale/programs/locarchive.c 2002-10-18 11:14:16.000000000 +0200
++++ locale/programs/locarchive.c 2002-10-21 13:28:27.000000000 +0200
+@@ -72,6 +72,9 @@ static const char *locnames[] =
+ #define INITIAL_NUM_SUMS 2000
+
+
++#define ALIGN(offset, alignment) \
++ (((offset) + (alignment) - 1) & -(alignment))
++
+ static void
+ create_archive (const char *archivefname, struct locarhandle *ah)
+ {
+@@ -90,8 +93,9 @@ create_archive (const char *archivefname
+
+ /* Create the initial content of the archive. */
+ head.magic = AR_MAGIC;
+ head.serial = 0;
+- head.namehash_offset = sizeof (struct locarhead);
++ head.namehash_offset = ALIGN (sizeof (struct locarhead),
++ __alignof__ (struct namehashent));
+ head.namehash_used = 0;
+ head.namehash_size = next_prime (INITIAL_NUM_NAMES);
+
+@@ -99,12 +103,15 @@ create_archive (const char *archivefname
+ head.string_used = 0;
+ head.string_size = INITIAL_SIZE_STRINGS;
+
+- head.locrectab_offset = head.string_offset + head.string_size;
++ head.locrectab_offset = ALIGN (head.string_offset + head.string_size,
++ __alignof__ (struct locrecent));
+ head.locrectab_used = 0;
+ head.locrectab_size = INITIAL_NUM_LOCREC;
+
+- head.sumhash_offset = (head.locrectab_offset
+- + head.locrectab_size * sizeof (struct locrecent));
++ head.sumhash_offset = ALIGN (head.locrectab_offset
++ + (head.locrectab_size
++ * sizeof (struct locrecent)),
++ __alignof__ (struct sumhashent));
+ head.sumhash_used = 0;
+ head.sumhash_size = next_prime (INITIAL_NUM_SUMS);
+
+@@ -274,13 +281,16 @@ enlarge_archive (struct locarhandle *ah,
+ * sizeof (struct namehashent)));
+ newhead.string_size = MAX (2 * newhead.string_used, newhead.string_size);
+
+- newhead.locrectab_offset = newhead.string_offset + newhead.string_size;
++ newhead.locrectab_offset = ALIGN (newhead.string_offset
++ + newhead.string_size,
++ __alignof__ (struct locrecent));
+ newhead.locrectab_size = MAX (2 * newhead.locrectab_used,
+ newhead.locrectab_size);
+
+- newhead.sumhash_offset = (newhead.locrectab_offset
+- + (newhead.locrectab_size
+- * sizeof (struct locrecent)));
++ newhead.sumhash_offset = ALIGN (newhead.locrectab_offset
++ + (newhead.locrectab_size
++ * sizeof (struct locrecent)),
++ __alignof__ (struct sumhashent));
+ newhead.sumhash_size = MAX (next_prime (2 * newhead.sumhash_used),
+ newhead.sumhash_size);
+
diff --git a/glibc-2.3.2-revert_tcsetattr.diff b/glibc-2.3.2-revert_tcsetattr.diff
new file mode 100644
index 0000000..f660306
--- /dev/null
+++ b/glibc-2.3.2-revert_tcsetattr.diff
@@ -0,0 +1,53 @@
+Index: sysdeps/unix/sysv/linux/tcsetattr.c
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/tcsetattr.c,v
+retrieving revision 1.14
+retrieving revision 1.13
+diff -u -r1.14 -r1.13
+--- sysdeps/unix/sysv/linux/tcsetattr.c 21 Feb 2003 00:09:04 -0000 1.14
++++ sysdeps/unix/sysv/linux/tcsetattr.c 17 Feb 2003 19:48:44 -0000 1.13
+@@ -56,6 +56,7 @@
+ {
+ struct __kernel_termios k_termios;
+ unsigned long int cmd;
++ int retval;
+
+ switch (optional_actions)
+ {
+@@ -87,6 +88,35 @@
+ memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
+ __KERNEL_NCCS * sizeof (cc_t));
+
+- return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
++ retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
++
++ if (retval == 0 && cmd == TCSETS)
++ {
++ /* The Linux kernel has a bug which silently ignore the invalid
++ c_cflag on pty. We have to check it here. */
++ int save = errno;
++ retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
++ if (retval)
++ {
++ /* We cannot verify if the setting is ok. We don't return
++ an error (?). */
++ __set_errno (save);
++ retval = 0;
++ }
++ else if ((termios_p->c_cflag & (PARENB | CREAD))
++ != (k_termios.c_cflag & (PARENB | CREAD))
++ || ((termios_p->c_cflag & CSIZE)
++ && ((termios_p->c_cflag & CSIZE)
++ != (k_termios.c_cflag & CSIZE))))
++ {
++ /* It looks like the Linux kernel silently changed the
++ PARENB/CREAD/CSIZE bits in c_cflag. Report it as an
++ error. */
++ __set_errno (EINVAL);
++ retval = -1;
++ }
++ }
++
++ return retval;
+ }
+ libc_hidden_def (tcsetattr)
diff --git a/glibc-2.3.2.no_archive.diff b/glibc-2.3.2.no_archive.diff
index ed68c3b..52f4e69 100644
--- a/glibc-2.3.2.no_archive.diff
+++ b/glibc-2.3.2.no_archive.diff
@@ -1,12 +1,11 @@
+-------------------------------------------------------------------
Wed Jun 4 14:29:07 CEST 2003 - kukuk@suse.de
- Make --no-archive default for localedef
-Index: glibc-2.18.90/locale/programs/localedef.c
-===================================================================
---- glibc-2.18.90.orig/locale/programs/localedef.c
-+++ glibc-2.18.90/locale/programs/localedef.c
-@@ -81,7 +81,7 @@ const char *alias_file;
+--- locale/programs/localedef.c
++++ locale/programs/localedef.c 2003/06/04 11:03:28
+@@ -83,7 +83,7 @@
static struct localedef_t *locales;
/* If true don't add locale data to archive. */
@@ -15,15 +14,15 @@ Index: glibc-2.18.90/locale/programs/localedef.c
/* If true add named locales to archive. */
static bool add_to_archive;
-@@ -112,6 +112,7 @@ void (*argp_program_version_hook) (FILE
+@@ -114,6 +114,7 @@
#define OPT_REPLACE 307
#define OPT_DELETE_FROM_ARCHIVE 308
#define OPT_LIST_ARCHIVE 309
+#define OPT_ARCHIVE 310
- #define OPT_LITTLE_ENDIAN 400
- #define OPT_BIG_ENDIAN 401
-@@ -136,6 +137,8 @@ static const struct argp_option options[
+ /* Definitions of arguments for argp functions. */
+ static const struct argp_option options[] =
+@@ -135,6 +136,8 @@
N_("Suppress warnings and information messages") },
{ "verbose", 'v', NULL, 0, N_("Print more messages") },
{ NULL, 0, NULL, 0, N_("Archive control:") },
@@ -32,7 +31,7 @@ Index: glibc-2.18.90/locale/programs/localedef.c
{ "no-archive", OPT_NO_ARCHIVE, NULL, 0,
N_("Don't add new data to archive") },
{ "add-to-archive", OPT_ADD_TO_ARCHIVE, NULL, 0,
-@@ -317,6 +320,9 @@ parse_opt (int key, char *arg, struct ar
+@@ -315,6 +318,9 @@
case OPT_PREFIX:
output_prefix = arg;
break;
diff --git a/glibc-2.3.3-amd64-s_ceil.diff b/glibc-2.3.3-amd64-s_ceil.diff
new file mode 100644
index 0000000..36f8b0d
--- /dev/null
+++ b/glibc-2.3.3-amd64-s_ceil.diff
@@ -0,0 +1,38 @@
+
+This fixes ceil (x) for -1.0 < x < 0.
+
+--- sysdeps/x86_64/fpu/s_ceil.c 2003-11-26 15:25:50.000000000 +0100
++++ sysdeps/x86_64/fpu/s_ceil.c 2003-11-27 13:57:35.000000000 +0100
+@@ -34,7 +34,11 @@
+ /* x is +zero or -zero; return the same zero */
+ return x;
+ else if (xneg) /* x < 0.0 */
+- return 0.0;
++ {
++ /* Return zero with the sign of x */
++ PUT_BITS_DP64(SIGNBIT_DP64, x);
++ return x;
++ }
+ else
+ return 1.0;
+ }
+--- sysdeps/x86_64/fpu/s_ceilf.c 2003-11-26 15:25:50.000000000 +0100
++++ sysdeps/x86_64/fpu/s_ceilf.c 2003-11-27 13:57:35.000000000 +0100
+@@ -34,7 +34,11 @@
+ /* x is +zero or -zero; return the same zero */
+ return x;
+ else if (xneg) /* x < 0.0 */
+- return 0.0F;
++ {
++ /* Return zero with the sign of x */
++ PUT_BITS_SP32(SIGNBIT_SP32, x);
++ return x;
++ }
+ else
+ return 1.0F;
+ }
+
+--
+ Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
+ SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
+ GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
diff --git a/glibc-2.3.3-amd64-string.diff b/glibc-2.3.3-amd64-string.diff
new file mode 100644
index 0000000..03b513b
--- /dev/null
+++ b/glibc-2.3.3-amd64-string.diff
@@ -0,0 +1,2744 @@
+============================================================
+Index: sysdeps/x86_64/strlen.S
+===================================================================
+--- sysdeps/x86_64/strlen.S.orig
++++ sysdeps/x86_64/strlen.S
+@@ -1,139 +1,405 @@
+-/* strlen(str) -- determine the length of the string STR.
+- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+- Based on i486 version contributed by Ulrich Drepper .
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
+- License as published by the Free Software Foundation; either
+- version 2.1 of the License, or (at your option) any later version.
+-
+- The GNU C Library is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, write to the Free
+- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+- 02111-1307 USA. */
+-
+-#include
+-#include "asm-syntax.h"
+-#include "bp-sym.h"
+-#include "bp-asm.h"
+-
+-
+- .text
+-ENTRY (strlen)
+- movq %rdi, %rcx /* Duplicate source pointer. */
+- andl $7, %ecx /* mask alignment bits */
+- movq %rdi, %rax /* duplicate destination. */
+- jz 1f /* aligned => start loop */
+-
+- neg %ecx /* We need to align to 8 bytes. */
+- addl $8,%ecx
+- /* Search the first bytes directly. */
+-0: cmpb $0x0,(%rax) /* is byte NUL? */
+- je 2f /* yes => return */
+- incq %rax /* increment pointer */
+- decl %ecx
+- jnz 0b
+-
+-1: movq $0xfefefefefefefeff,%r8 /* Save magic. */
+-
+- .p2align 4 /* Align loop. */
+-4: /* Main Loop is unrolled 4 times. */
+- /* First unroll. */
+- movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+- addq $8,%rax /* adjust pointer for next word */
+- movq %r8, %rdx /* magic value */
+- addq %rcx, %rdx /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rcx, %rdx /* (word+magic)^word */
+- orq %r8, %rdx /* set all non-carry bits */
+- incq %rdx /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+- jnz 3f /* found NUL => return pointer */
+-
+- /* Second unroll. */
+- movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+- addq $8,%rax /* adjust pointer for next word */
+- movq %r8, %rdx /* magic value */
+- addq %rcx, %rdx /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rcx, %rdx /* (word+magic)^word */
+- orq %r8, %rdx /* set all non-carry bits */
+- incq %rdx /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+- jnz 3f /* found NUL => return pointer */
+-
+- /* Third unroll. */
+- movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+- addq $8,%rax /* adjust pointer for next word */
+- movq %r8, %rdx /* magic value */
+- addq %rcx, %rdx /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rcx, %rdx /* (word+magic)^word */
+- orq %r8, %rdx /* set all non-carry bits */
+- incq %rdx /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+- jnz 3f /* found NUL => return pointer */
+-
+- /* Fourth unroll. */
+- movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+- addq $8,%rax /* adjust pointer for next word */
+- movq %r8, %rdx /* magic value */
+- addq %rcx, %rdx /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rcx, %rdx /* (word+magic)^word */
+- orq %r8, %rdx /* set all non-carry bits */
+- incq %rdx /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+- jz 4b /* no NUL found => continue loop */
+-
+- .p2align 4 /* Align, it's a jump target. */
+-3: subq $8,%rax /* correct pointer increment. */
+-
+- testb %cl, %cl /* is first byte NUL? */
+- jz 2f /* yes => return */
+- incq %rax /* increment pointer */
+-
+- testb %ch, %ch /* is second byte NUL? */
+- jz 2f /* yes => return */
+- incq %rax /* increment pointer */
+-
+- testl $0x00ff0000, %ecx /* is third byte NUL? */
+- jz 2f /* yes => return pointer */
+- incq %rax /* increment pointer */
+-
+- testl $0xff000000, %ecx /* is fourth byte NUL? */
+- jz 2f /* yes => return pointer */
+- incq %rax /* increment pointer */
+-
+- shrq $32, %rcx /* look at other half. */
+-
+- testb %cl, %cl /* is first byte NUL? */
+- jz 2f /* yes => return */
+- incq %rax /* increment pointer */
+-
+- testb %ch, %ch /* is second byte NUL? */
+- jz 2f /* yes => return */
+- incq %rax /* increment pointer */
+-
+- testl $0xff0000, %ecx /* is third byte NUL? */
+- jz 2f /* yes => return pointer */
+- incq %rax /* increment pointer */
+-2:
+- subq %rdi, %rax /* compute difference to string start */
+- ret
++# $Header: /K8_Projects/Glibc/amd64strlen.S 3 10/06/03 11:00 Emenezes $
++
++# (c) 2002 Advanced Micro Devices, Inc.
++# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
++# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
++# LICENSE FOUND IN THE "README" FILE THAT IS
++# INCLUDED WITH THIS FILE
++
++#include "sysdep.h"
++#include
++
++#ifdef PIC
++ .globl _rtld_local_ro
++ .hidden _rtld_local_ro
++ .set _rtld_local_ro,_rtld_global_ro
++#endif
++ .text
++
++ENTRY (strlen) # (const char *s)
++
++ mov %rdi, %rsi
++ neg %rdi
++
++L(strlenaligntry):
++ mov %rsi , %r8
++ and $7, %r8d
++ jz L(strlenalignafter)
++
++L(strlenalign): # 8-byte align
++ sub $8, %r8
++
++ .p2align 4
++
++L(strlenalignloop):
++ cmpb $0, (%rsi)
++ je L(exit)
++
++ inc %rsi
++ inc %r8
++ jnz L(strlenalignloop)
++
++ .p2align 4
++
++L(strlenalignafter):
++
++L(strlen56try):
++
++L(strlen56): # 56-byte
++ mov (%rsi), %rax
++ mov $0xfefefefefefefeff, %rcx
++
++L(strlen56loop):
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ jnc L(strlentail)
++
++ xor %rax, %r8
++ or %rcx, %r8
++ inc %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++L(strlen56after):
++
++L(strlen32): # 32-byte
++# mov $0xfefefefefefefeff, %rcx
++# mov (%rsi), %rax
++
++#ifdef PIC
++ mov _rtld_local_ro@GOTPCREL(%rip), %r8
++ mov RTLD_GLOBAL_DL_CACHE1SIZE(%r8), %r9
++#else
++ mov _dl_cache1size, %r9
++#endif
++
++ .p2align 4
++
++L(strlen32loop):
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ sub $32, %r9
++
++ mov 8 (%rsi), %rax
++ lea 8 (%rsi), %rsi
++
++ jbe L(strlen32loop)
++
++L(strlen32after):
++
++L(strlenpretry):
++
++L(strlenpre): # 64-byte prefetch
++# mov $0xfefefefefefefeff, %rcx
++# mov (%rsi), %rax
++
++ .p2align 4
++
++L(strlenpreloop):
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %rdx, %rdx
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %rdx, %r8
++ jnz L(strlentail)
++
++ prefetcht0 512 (%rsi)
++
++ mov 8 (%rsi), %rax
++ add $8, %rsi
++
++ jmp L(strlenpreloop)
++
++ .p2align 4
++
++L(strlenpreafter):
++
++L(strlentailtry):
++
++L(strlentail): # 4-byte tail
++
++L(strlentailloop):
++ test %al, %al
++ jz L(exit)
++
++ inc %rsi
++
++ test %ah, %ah
++ jz L(exit)
++
++ inc %rsi
++
++ test $0x00ff0000, %eax
++ jz L(exit)
++
++ inc %rsi
++
++ test $0xff000000, %eax
++ jz L(exit)
++
++ inc %rsi
++
++ shr $32, %rax
++ jmp L(strlentailloop)
++
++L(strlentailafter):
++
++ .p2align 4
++
++L(exit):
++ lea (%rdi, %rsi), %rax
++ ret
++
+ END (strlen)
+ libc_hidden_builtin_def (strlen)
+Index: sysdeps/x86_64/dl-machine.h
+===================================================================
+--- sysdeps/x86_64/dl-machine.h.orig
++++ sysdeps/x86_64/dl-machine.h
+@@ -219,6 +219,40 @@ dl_platform_init (void)
+ if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
+ /* Avoid an empty string which would disturb us. */
+ GLRO(dl_platform) = NULL;
++
++ long int t1, t2;
++ t1 = 0;
++ t2 = 0;
++
++ asm (
++ "mov $0x80000000, %%eax # get highest level of support\n\t"
++ "cpuid\n\t"
++ "cmp $0x80000006, %%eax # check for support of cache info\n\t"
++ "jb 1f\n\t"
++ "mov $0x80000005, %%eax # get L1 info\n\t"
++ "cpuid\n\t"
++ "shr $24, %%ecx\n\t"
++ "shl $10, %%ecx\n\t"
++ "mov %%rcx, %0\n\t"
++ "mov $0x80000006, %%eax # get L2 info\n\t"
++ "cpuid\n\t"
++ "shr $16, %%ecx\n\t"
++ "shl $10, %%ecx\n\t"
++ "mov %%rcx, %1\n\t"
++ "1:\n\t"
++ :"=r" (t1), "=r" (t2) :: "%rbx", "%rax", "%rcx", "%rdx"
++ );
++
++ if (t1)
++ {
++ GLRO(dl_cache1size) = t1;
++ GLRO(dl_cache1sizehalf) = t1 / 2;
++ }
++ if (t2)
++ {
++ GLRO(dl_cache2size) = t2;
++ GLRO(dl_cache2sizehalf) = t2 / 2;
++ }
+ }
+
+ static inline Elf64_Addr
+Index: sysdeps/x86_64/Makefile
+===================================================================
+--- sysdeps/x86_64/Makefile.orig
++++ sysdeps/x86_64/Makefile
+@@ -4,6 +4,9 @@ long-double-fcts = yes
+ ifeq ($(subdir),csu)
+ sysdep_routines += hp-timing
+ elide-routines.os += hp-timing
++
++# get offset to rtld_global._dl_*
++gen-as-const-headers += rtld-global-offsets.sym
+ endif
+
+ ifeq ($(subdir),gmon)
+Index: sysdeps/x86_64/strcpy.S
+===================================================================
+--- sysdeps/x86_64/strcpy.S.orig
++++ sysdeps/x86_64/strcpy.S
+@@ -1,159 +1,833 @@
+-/* strcpy/stpcpy implementation for x86-64.
+- Copyright (C) 2002 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+- Contributed by Andreas Jaeger , 2002.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
+- License as published by the Free Software Foundation; either
+- version 2.1 of the License, or (at your option) any later version.
+-
+- The GNU C Library is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, write to the Free
+- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+- 02111-1307 USA. */
+-
+-#include
+-#include "asm-syntax.h"
+-#include "bp-sym.h"
+-#include "bp-asm.h"
++# $Header: /K8_Projects/Glibc/amd64strcpy.S 7 2/12/04 19:06 Emenezes $
+
+-#ifndef USE_AS_STPCPY
++# (c) 2002 Advanced Micro Devices, Inc.
++# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
++# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
++# LICENSE FOUND IN THE "README" FILE THAT IS
++# INCLUDED WITH THIS FILE
++
++#include "sysdep.h"
++#include
++
++ /* XXX: strncpy is broken, just use this for strcpy for now. */
++#ifdef PIC
++ .globl _rtld_local_ro
++ .hidden _rtld_local_ro
++ .set _rtld_local_ro,_rtld_global_ro
++#endif
++#ifndef STRCPY
+ # define STRCPY strcpy
+ #endif
++#define LABEL(s) L(strcpy##s)
++
++ .text
++
++ENTRY (STRCPY) # (char *, const char *)
++
++#ifdef USE_AS_STRNCPY // (char *, const char *, size_t)
++ test %rdx, %rdx # (char *, const char *, size_t)
++ mov %rdx, %r11
++ jz LABEL(exitn) # early exit
++#endif
++
++ xor %edx, %edx
++
++LABEL(aligntry):
++ mov %rsi, %r8 # align by source
++ and $7, %r8
++ jz LABEL(alignafter)
++
++LABEL(align): # 8-byte align
++ sub $8, %r8
+
+- .text
+-ENTRY (BP_SYM (STRCPY))
+- movq %rsi, %rcx /* Source register. */
+- andl $7, %ecx /* mask alignment bits */
+- movq %rdi, %rdx /* Duplicate destination pointer. */
+-
+- jz 5f /* aligned => start loop */
+-
+- neg %ecx /* We need to align to 8 bytes. */
+- addl $8,%ecx
+- /* Search the first bytes directly. */
+-0:
+- movb (%rsi), %al /* Fetch a byte */
+- testb %al, %al /* Is it NUL? */
+- movb %al, (%rdx) /* Store it */
+- jz 4f /* If it was NUL, done! */
+- incq %rsi
+- incq %rdx
+- decl %ecx
+- jnz 0b
+-
+-5:
+- movq $0xfefefefefefefeff,%r8
+-
+- /* Now the sources is aligned. Unfortunatly we cannot force
+- to have both source and destination aligned, so ignore the
+- alignment of the destination. */
+ .p2align 4
+-1:
+- /* 1st unroll. */
+- movq (%rsi), %rax /* Read double word (8 bytes). */
+- addq $8, %rsi /* Adjust pointer for next word. */
+- movq %rax, %r9 /* Save a copy for NUL finding. */
+- addq %r8, %r9 /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rax, %r9 /* (word+magic)^word */
+- orq %r8, %r9 /* set all non-carry bits */
+- incq %r9 /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+-
+- jnz 3f /* found NUL => return pointer */
+-
+- movq %rax, (%rdx) /* Write value to destination. */
+- addq $8, %rdx /* Adjust pointer. */
+-
+- /* 2nd unroll. */
+- movq (%rsi), %rax /* Read double word (8 bytes). */
+- addq $8, %rsi /* Adjust pointer for next word. */
+- movq %rax, %r9 /* Save a copy for NUL finding. */
+- addq %r8, %r9 /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rax, %r9 /* (word+magic)^word */
+- orq %r8, %r9 /* set all non-carry bits */
+- incq %r9 /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+-
+- jnz 3f /* found NUL => return pointer */
+-
+- movq %rax, (%rdx) /* Write value to destination. */
+- addq $8, %rdx /* Adjust pointer. */
+-
+- /* 3rd unroll. */
+- movq (%rsi), %rax /* Read double word (8 bytes). */
+- addq $8, %rsi /* Adjust pointer for next word. */
+- movq %rax, %r9 /* Save a copy for NUL finding. */
+- addq %r8, %r9 /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rax, %r9 /* (word+magic)^word */
+- orq %r8, %r9 /* set all non-carry bits */
+- incq %r9 /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+-
+- jnz 3f /* found NUL => return pointer */
+-
+- movq %rax, (%rdx) /* Write value to destination. */
+- addq $8, %rdx /* Adjust pointer. */
+-
+- /* 4th unroll. */
+- movq (%rsi), %rax /* Read double word (8 bytes). */
+- addq $8, %rsi /* Adjust pointer for next word. */
+- movq %rax, %r9 /* Save a copy for NUL finding. */
+- addq %r8, %r9 /* add the magic value to the word. We get
+- carry bits reported for each byte which
+- is *not* 0 */
+- jnc 3f /* highest byte is NUL => return pointer */
+- xorq %rax, %r9 /* (word+magic)^word */
+- orq %r8, %r9 /* set all non-carry bits */
+- incq %r9 /* add 1: if one carry bit was *not* set
+- the addition will not result in 0. */
+-
+- jnz 3f /* found NUL => return pointer */
+-
+- movq %rax, (%rdx) /* Write value to destination. */
+- addq $8, %rdx /* Adjust pointer. */
+- jmp 1b /* Next iteration. */
+
+- /* Do the last few bytes. %rax contains the value to write.
+- The loop is unrolled twice. */
++LABEL(alignloop):
++#ifdef USE_AS_STRNCPY
++ dec %r11
++ jl LABEL(exitn)
++#endif
++
++ mov (%rsi, %rdx), %al # check if same character
++ test %al, %al # check if character a NUL
++ mov %al, (%rdi, %rdx)
++ jz LABEL(exit)
++
++ inc %edx
++ inc %r8
++ jnz LABEL(alignloop)
++
+ .p2align 4
++
++LABEL(alignafter):
++
++LABEL(8try):
++ mov $0xfefefefefefefeff, %rcx
++
++LABEL(8): # 8-byte
++ mov (%rsi, %rdx), %rax
++
++LABEL(8loop):
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++LABEL(8after):
++
++LABEL(64try):
++#ifdef PIC
++ mov _rtld_local_ro@GOTPCREL(%rip), %r8
++ mov RTLD_GLOBAL_DL_CACHE1SIZEHALF(%r8), %r9
++#else
++ mov _dl_cache1sizehalf, %r9
++#endif
++
++
++LABEL(64): # 64-byte
++
++ .p2align 4
++
++LABEL(64loop):
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ cmp %r9, %rdx
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ lea 8 (%rdx), %rdx
++
++ jbe LABEL(64loop)
++
++LABEL(64after):
++
++LABEL(pretry):
++#ifdef PIC
++ mov _rtld_local_ro@GOTPCREL(%rip), %r8
++ mov RTLD_GLOBAL_DL_CACHE2SIZEHALF(%r8), %r9
++#else
++ mov _dl_cache2sizehalf, %r9
++#endif
++
++LABEL(pre): # 64-byte prefetch
++
++ .p2align 4
++
++LABEL(preloop):
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ mov %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %edx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(tail)
++
++ cmp %r9, %rdx
++
++ mov %rax, (%rdi, %rdx)
++ prefetcht0 512 + 8 (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ prefetcht0 512 + 8 (%rsi, %rdx)
++ lea 8 (%rdx), %rdx
++
++ jb LABEL(preloop)
++
++ .p2align 4
++
++LABEL(preafter):
++
++LABEL(NTtry):
++ sfence
++
++LABEL(NT): # 64-byte NT
++
++ .p2align 4
++
++LABEL(NTloop):
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ add $8, %rdx
++
++#ifdef USE_AS_STRNCPY
++ sub $8, %r11
++ jl LABEL(tail)
++#endif
++
++ mov %rcx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ xor %rax, %r8
++ or %rcx, %r8
++ sub %r10, %r8
++ jnz LABEL(NTtail)
++
++ movnti %rax, (%rdi, %rdx)
++ mov 8 (%rsi, %rdx), %rax
++ prefetchnta 768 + 8 (%rsi, %rdx)
++ add $8, %rdx
++
++ jmp LABEL(NTloop)
++
++ .p2align 4
++
++LABEL(NTtail):
++ sfence
++
++ .p2align 4
++
++LABEL(NTafter):
++
++LABEL(tailtry):
++
++LABEL(tail): # 1-byte tail
++#ifdef USE_AS_STRNCPY
++ add $8, %r11
++#endif
++
++ .p2align 4
++
++LABEL(tailloop):
++#ifdef USE_AS_STRNCPY
++ dec %r11
++ jl LABEL(exitn)
++#endif
++
++ test %al, %al
++ mov %al, (%rdi, %rdx)
++ jz LABEL(exit)
++
++ inc %rdx
++
++#ifdef USE_AS_STRNCPY
++ dec %r11
++ jl LABEL(exitn)
++
++ mov %ah, %al
++#endif
++
++ test %ah, %ah
++ mov %ah, (%rdi, %rdx)
++ jz LABEL(exit)
++
++ inc %rdx
++
++#ifdef USE_AS_STRNCPY
++ dec %r11
++ jl LABEL(exitn)
++#endif
++
++ shr $16, %rax
++
++ test %al, %al
++ mov %al, (%rdi, %rdx)
++ jz LABEL(exit)
++
++ inc %rdx
++
++#ifdef USE_AS_STRNCPY
++ dec %r11
++ jl LABEL(exitn)
++
++ mov %ah, %al
++#endif
++
++ test %ah, %ah
++ mov %ah, (%rdi, %rdx)
++ jz LABEL(exit)
++
++ shr $16, %rax
++ inc %rdx
++
++ jmp LABEL(tailloop)
++
++ .p2align 4
++
++LABEL(tailafter):
++
++LABEL(exit):
++#ifdef USE_AS_STRNCPY
++ test %r11, %r11
++ mov %r11, %rcx
++
++#ifdef USE_AS_STPCPY
++ lea (%rdi, %rdx), %r8
++#else
++ mov %rdi, %r8
++#endif
++
++ jz 2f
++
++ xor %eax, %eax # bzero () would do too, but usually there are only a handfull of bytes left
++ shr $3, %rcx
++ lea 1 (%rdi, %rdx), %rdi
++ jz 1f
++
++ rep stosq
++
++1:
++ mov %r11d, %ecx
++ and $7, %ecx
++ jz 2f
++
++ .p2align 4,, 3
++
+ 3:
+- /* Note that stpcpy needs to return with the value of the NUL
+- byte. */
+- movb %al, (%rdx) /* 1st byte. */
+- testb %al, %al /* Is it NUL. */
+- jz 4f /* yes, finish. */
+- incq %rdx /* Increment destination. */
+- movb %ah, (%rdx) /* 2nd byte. */
+- testb %ah, %ah /* Is it NUL?. */
+- jz 4f /* yes, finish. */
+- incq %rdx /* Increment destination. */
+- shrq $16, %rax /* Shift... */
+- jmp 3b /* and look at next two bytes in %rax. */
++ dec %ecx
++ mov %al, (%rdi, %rcx)
++ jnz 3b
++
++ .p2align 4,, 3
++
++2:
++ mov %r8, %rax
++ ret
++
++#endif
++
++ .p2align 4
+
+-4:
++LABEL(exitn):
+ #ifdef USE_AS_STPCPY
+- movq %rdx, %rax /* Destination is return value. */
++ lea (%rdi, %rdx), %rax
+ #else
+- movq %rdi, %rax /* Source is return value. */
++ mov %rdi, %rax
+ #endif
+- retq
+-END (BP_SYM (STRCPY))
+-#ifndef USE_AS_STPCPY
+-libc_hidden_builtin_def (strcpy)
++
++ ret
++
++END (STRCPY)
++#if !defined USE_AS_STPCPY && !defined USE_AS_STRNCPY
++libc_hidden_builtin_def (STRCPY)
+ #endif
+Index: sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
+===================================================================
+--- sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c.orig
++++ sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
+@@ -1,5 +1,5 @@
+ #ifdef IS_IN_ldconfig
+ # include
+ #else
+-# include
++# include
+ #endif
+Index: sysdeps/x86_64/dl-procinfo.c
+===================================================================
+--- /dev/null
++++ sysdeps/x86_64/dl-procinfo.c
+@@ -0,0 +1,108 @@
++/* Data for x86-64 version of processor capability information.
++ Copyright (C) 2004 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Andreas Jaeger , 2004.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* This information must be kept in sync with the _DL_HWCAP_COUNT and
++ _DL_PLATFORM_COUNT definitions in procinfo.h.
++
++ If anything should be added here check whether the size of each string
++ is still ok with the given array size.
++
++ All the #ifdefs in the definitions ar equite irritating but
++ necessary if we want to avoid duplicating the information. There
++ are three different modes:
++
++ - PROCINFO_DECL is defined. This means we are only interested in
++ declarations.
++
++ - PROCINFO_DECL is not defined:
++
++ + if SHARED is defined the file is included in an array
++ initializer. The .element = { ... } syntax is needed.
++
++ + if SHARED is not defined a normal array initialization is
++ needed.
++ */
++
++#ifndef PROCINFO_CLASS
++#define PROCINFO_CLASS
++#endif
++
++ /* _dl_cache1size: size of L1 cache */
++#if !defined PROCINFO_DECL && defined SHARED
++ ._dl_cache1size
++#else
++PROCINFO_CLASS long int _dl_cache1size
++#endif
++#ifndef PROCINFO_DECL
++= 1024 * 64
++#endif
++#if !defined SHARED || defined PROCINFO_DECL
++;
++#else
++,
++#endif
++
++ /* _dl_cache1sizehalf: 1/2 size of L1 cache */
++#if !defined PROCINFO_DECL && defined SHARED
++ ._dl_cache1sizehalf
++#else
++PROCINFO_CLASS long int _dl_cache1sizehalf
++#endif
++#ifndef PROCINFO_DECL
++= 1024 * 64 / 2
++#endif
++#if !defined SHARED || defined PROCINFO_DECL
++;
++#else
++,
++#endif
++
++ /* _dl_cache2size: size of L2 cache */
++#if !defined PROCINFO_DECL && defined SHARED
++ ._dl_cache2size
++#else
++PROCINFO_CLASS long int _dl_cache2size
++#endif
++#ifndef PROCINFO_DECL
++= 1024 * 1024
++#endif
++#if !defined SHARED || defined PROCINFO_DECL
++;
++#else
++,
++#endif
++
++ /* _dl_cache2size: 1/2 size of L2 cache */
++#if !defined PROCINFO_DECL && defined SHARED
++ ._dl_cache2sizehalf
++#else
++PROCINFO_CLASS long int _dl_cache2sizehalf
++#endif
++#ifndef PROCINFO_DECL
++= 1024 * 1024 / 2
++#endif
++#if !defined SHARED || defined PROCINFO_DECL
++;
++#else
++,
++#endif
++
++#undef PROCINFO_DECL
++#undef PROCINFO_CLASS
+Index: sysdeps/x86_64/elf/rtld-global-offsets.sym
+===================================================================
+--- /dev/null
++++ sysdeps/x86_64/elf/rtld-global-offsets.sym
+@@ -0,0 +1,10 @@
++#define SHARED 1
++
++#include
++
++#define rtdl_global_offsetof(mem) offsetof (struct rtld_global_ro, mem)
++
++RTLD_GLOBAL_DL_CACHE1SIZE rtdl_global_offsetof (_dl_cache1size)
++RTLD_GLOBAL_DL_CACHE1SIZEHALF rtdl_global_offsetof (_dl_cache1sizehalf)
++RTLD_GLOBAL_DL_CACHE2SIZE rtdl_global_offsetof (_dl_cache2size)
++RTLD_GLOBAL_DL_CACHE2SIZEHALF rtdl_global_offsetof (_dl_cache2sizehalf)
+Index: sysdeps/x86_64/memcmp.S
+===================================================================
+--- /dev/null
++++ sysdeps/x86_64/memcmp.S
+@@ -0,0 +1,442 @@
++# $Header: /K8_Projects/Glibc/amd64memcmp.S 4 10/06/03 10:57 Emenezes $
++
++# (c) 2002 Advanced Micro Devices, Inc.
++# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
++# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
++# LICENSE FOUND IN THE "README" FILE THAT IS
++# INCLUDED WITH THIS FILE
++
++#include "sysdep.h"
++#include
++
++#ifdef PIC
++ .globl _rtld_local_ro
++ .hidden _rtld_local_ro
++ .set _rtld_local_ro,_rtld_global_ro
++#endif
++
++ .text
++
++ENTRY (memcmp) # (const void *, const void*, size_t)
++
++L(memcmptry1):
++ cmp $8, %rdx
++ jae L(memcmp1after)
++
++L(memcmp1): # 1-byte
++ test %rdx, %rdx
++ mov $0, %eax
++ jz L(memcmpexit)
++
++L(memcmp1loop):
++ movzbl (%rdi), %eax
++ movzbl (%rsi), %ecx
++ sub %ecx, %eax
++ jnz L(memcmpexit)
++
++ dec %rdx
++
++ lea 1 (%rdi), %rdi
++ lea 1 (%rsi), %rsi
++
++ jnz L(memcmp1loop)
++
++L(memcmpexit):
++ rep
++ ret
++
++ .p2align 4
++
++L(memcmp1after):
++
++L(memcmp8try):
++ cmp $32, %rdx
++ jae L(memcmp8after)
++
++L(memcmp8): # 8-byte
++ mov %edx, %ecx
++ shr $3, %ecx
++ jz L(memcmp1)
++
++ .p2align 4
++
++L(memcmp8loop):
++ mov (%rsi), %rax
++ cmp (%rdi), %rax
++ jne L(memcmp1)
++
++ sub $8, %rdx
++ dec %ecx
++
++ lea 8 (%rsi), %rsi
++ lea 8 (%rdi), %rdi
++
++ jnz L(memcmp8loop)
++
++L(memcmp8skip):
++ and $7, %edx
++ jnz L(memcmp1)
++
++ xor %eax, %eax
++ ret
++
++ .p2align 4
++
++L(memcmp8after):
++
++L(memcmp32try):
++ cmp $2048, %rdx
++ ja L(memcmp32after)
++
++L(memcmp32): # 32-byte
++ mov %edx, %ecx
++ shr $5, %ecx
++ jz L(memcmp8)
++
++ .p2align 4
++
++L(memcmp32loop):
++ mov (%rsi), %rax
++ mov 8 (%rsi), %r8
++ mov 16 (%rsi), %r9
++ mov 24 (%rsi), %r10
++ sub (%rdi), %rax
++ sub 8 (%rdi), %r8
++ sub 16 (%rdi), %r9
++ sub 24 (%rdi), %r10
++
++ or %rax, %r8
++ or %r9, %r10
++ or %r8, %r10
++ jnz L(memcmp8)
++
++ sub $32, %rdx
++ dec %ecx
++
++ lea 32 (%rsi), %rsi
++ lea 32 (%rdi), %rdi
++
++ jnz L(memcmp32loop)
++
++L(memcmp32skip):
++ and $31, %edx
++ jnz L(memcmp8)
++
++ xor %eax, %eax
++ ret
++
++ .p2align 4
++
++L(memcmp32after):
++
++#ifdef PIC
++ mov _rtld_local_ro@GOTPCREL(%rip), %r8
++ mov RTLD_GLOBAL_DL_CACHE1SIZEHALF(%r8), %r9
++#else
++ mov _dl_cache1sizehalf, %r9
++#endif
++ prefetcht0 (%r9)
++
++
++.alignsrctry:
++ mov %esi, %r8d # align by source
++
++ and $7, %r8d
++ jz .alignsrcafter # not unaligned
++
++.alignsrc: # align
++ lea -8 (%r8, %rdx), %rdx
++ sub $8, %r8d
++
++# .p2align 4
++
++.alignsrcloop:
++ movzbl (%rdi), %eax
++ movzbl (%rsi), %ecx
++ sub %ecx, %eax
++ jnz L(memcmpexit)
++
++ inc %r8d
++
++ lea 1 (%rdi), %rdi
++ lea 1 (%rsi), %rsi
++
++ jnz .alignsrcloop
++
++ .p2align 4
++
++.alignsrcafter:
++
++
++L(memcmp64try):
++#ifdef PIC
++ mov _rtld_local_ro@GOTPCREL(%rip), %r8
++ mov RTLD_GLOBAL_DL_CACHE1SIZEHALF(%r8), %rcx
++#else
++ mov _dl_cache1sizehalf, %rcx
++#endif
++ cmp %rdx, %rcx
++ cmova %rdx, %rcx
++
++L(memcmp64): # 64-byte
++ shr $6, %rcx
++ jz L(memcmp32)
++
++ .p2align 4
++
++L(memcmp64loop):
++ mov (%rsi), %rax
++ mov 8 (%rsi), %r8
++ sub (%rdi), %rax
++ sub 8 (%rdi), %r8
++ or %r8, %rax
++
++ mov 16 (%rsi), %r9
++ mov 24 (%rsi), %r10
++ sub 16 (%rdi), %r9
++ sub 24 (%rdi), %r10
++ or %r10, %r9
++
++ or %r9, %rax
++ jnz L(memcmp32)
++
++ mov 32 (%rsi), %rax
++ mov 40 (%rsi), %r8
++ sub 32 (%rdi), %rax
++ sub 40 (%rdi), %r8
++ or %r8, %rax
++
++ mov 48 (%rsi), %r9
++ mov 56 (%rsi), %r10
++ sub 48 (%rdi), %r9
++ sub 56 (%rdi), %r10
++ or %r10, %r9
++
++ or %r9, %rax
++ jnz L(memcmp32)
++
++ lea 64 (%rsi), %rsi
++ lea 64 (%rdi), %rdi
++
++ sub $64, %rdx
++ dec %rcx
++ jnz L(memcmp64loop)
++
++# .p2align 4
++
++L(memcmp64skip):
++ cmp $2048, %rdx
++ ja L(memcmp64after)
++
++ test %edx, %edx
++ jnz L(memcmp32)
++
++ xor %eax, %eax
++ ret
++
++ .p2align 4
++
++L(memcmp64after):
++
++L(memcmppretry):
++
++L(memcmppre): # 64-byte prefetching
++#ifdef PIC
++ mov _rtld_local_ro@GOTPCREL(%rip), %r8
++ mov RTLD_GLOBAL_DL_CACHE2SIZEHALF(%r8), %rcx
++#else
++ mov _dl_cache2sizehalf, %rcx
++#endif
++ cmp %rdx, %rcx
++ cmova %rdx, %rcx
++
++ shr $6, %rcx
++ jz L(memcmppreskip)
++
++ prefetcht0 512 (%rsi)
++ prefetcht0 512 (%rdi)
++
++ mov (%rsi), %rax
++ mov 8 (%rsi), %r9
++ mov 16 (%rsi), %r10
++ mov 24 (%rsi), %r11
++ sub (%rdi), %rax
++ sub 8 (%rdi), %r9
++ sub 16 (%rdi), %r10
++ sub 24 (%rdi), %r11
++
++ or %r9, %rax
++ or %r11, %r10
++ or %r10, %rax
++ jnz L(memcmp32)
++
++ mov 32 (%rsi), %rax
++ mov 40 (%rsi), %r9
++ mov 48 (%rsi), %r10
++ mov 56 (%rsi), %r11
++ sub 32 (%rdi), %rax
++ sub 40 (%rdi), %r9
++ sub 48 (%rdi), %r10
++ sub 56 (%rdi), %r11
++
++ or %r9, %rax
++ or %r11, %r10
++ or %r10, %rax
++ jnz L(memcmp32)
++
++ lea 64 (%rsi), %rsi
++ lea 64 (%rdi), %rdi
++
++ sub $64, %rdx
++ dec %rcx
++
++ .p2align 4
++
++L(memcmppreloop):
++ prefetcht0 512 (%rsi)
++ prefetcht0 512 (%rdi)
++
++ mov (%rsi), %rax
++ mov 8 (%rsi), %r9
++ mov 16 (%rsi), %r10
++ mov 24 (%rsi), %r11
++ sub (%rdi), %rax
++ sub 8 (%rdi), %r9
++ sub 16 (%rdi), %r10
++ sub 24 (%rdi), %r11
++
++ or %r9, %rax
++ or %r11, %r10
++ or %r10, %rax
++ jnz L(memcmp32)
++
++ mov 32 (%rsi), %rax
++ mov 40 (%rsi), %r9
++ mov 48 (%rsi), %r10
++ mov 56 (%rsi), %r11
++ sub 32 (%rdi), %rax
++ sub 40 (%rdi), %r9
++ sub 48 (%rdi), %r10
++ sub 56 (%rdi), %r11
++
++ or %r9, %rax
++ or %r11, %r10
++ or %r10, %rax
++ jnz L(memcmp32)
++
++ lea 64 (%rsi), %rsi
++ lea 64 (%rdi), %rdi
++
++ sub $64, %rdx
++ dec %rcx
++ jnz L(memcmppreloop)
++
++# .p2align 4
++
++L(memcmppreskip):
++ cmp $2048, %rdx
++ ja L(memcmppreafter)
++
++ test %edx, %edx
++ jnz L(memcmp32)
++
++ xor %eax, %eax
++ ret
++
++ .p2align 4
++
++L(memcmppreafter):
++
++L(memcmp128try):
++
++L(memcmp128): # 128-byte
++ mov %rdx, %rcx
++ shr $7, %rcx
++ jz L(memcmp128skip)
++
++ .p2align 4
++
++L(memcmp128loop):
++ prefetcht0 512 (%rsi)
++ prefetcht0 512 (%rdi)
++
++ mov (%rsi), %rax
++ mov 8 (%rsi), %r8
++ sub (%rdi), %rax
++ sub 8 (%rdi), %r8
++ mov 16 (%rsi), %r9
++ mov 24 (%rsi), %r10
++ sub 16 (%rdi), %r9
++ sub 24 (%rdi), %r10
++
++ or %r8, %rax
++ or %r9, %r10
++ or %r10, %rax
++
++ mov 32 (%rsi), %r8
++ mov 40 (%rsi), %r9
++ sub 32 (%rdi), %r8
++ sub 40 (%rdi), %r9
++ mov 48 (%rsi), %r10
++ mov 56 (%rsi), %r11
++ sub 48 (%rdi), %r10
++ sub 56 (%rdi), %r11
++
++ or %r9, %r8
++ or %r11, %r10
++ or %r10, %r8
++
++ or %r8, %rax
++ jnz L(memcmp32)
++
++ prefetcht0 576 (%rsi)
++ prefetcht0 576 (%rdi)
++
++ mov 64 (%rsi), %rax
++ mov 72 (%rsi), %r8
++ sub 64 (%rdi), %rax
++ sub 72 (%rdi), %r8
++ mov 80 (%rsi), %r9
++ mov 88 (%rsi), %r10
++ sub 80 (%rdi), %r9
++ sub 88 (%rdi), %r10
++
++ or %r8, %rax
++ or %r9, %r10
++ or %r10, %rax
++
++ mov 96 (%rsi), %r8
++ mov 104 (%rsi), %r9
++ sub 96 (%rdi), %r8
++ sub 104 (%rdi), %r9
++ mov 112 (%rsi), %r10
++ mov 120 (%rsi), %r11
++ sub 112 (%rdi), %r10
++ sub 120 (%rdi), %r11
++
++ or %r9, %r8
++ or %r11, %r10
++ or %r10, %r8
++
++ or %r8, %rax
++ jnz L(memcmp32)
++
++ sub $128, %rdx
++ dec %rcx
++
++ lea 128 (%rsi), %rsi
++ lea 128 (%rdi), %rdi
++
++ jnz L(memcmp128loop)
++
++L(memcmp128skip):
++ and $127, %edx
++ jnz L(memcmp32)
++
++ xor %eax, %eax
++ ret
++
++END (memcmp)
++
++#undef bcmp
++weak_alias (memcmp, bcmp)
+Index: sysdeps/x86_64/strncmp.S
+===================================================================
+--- /dev/null
++++ sysdeps/x86_64/strncmp.S
+@@ -0,0 +1,15 @@
++# $Header: /K8_Projects/Glibc/amd64strncpy.S 1 8/29/03 16:37 Emenezes $
++
++# (c) 2002 Advanced Micro Devices, Inc.
++# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
++# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
++# LICENSE FOUND IN THE "README" FILE THAT IS
++# INCLUDED WITH THIS FILE
++
++#define USE_AS_STRNCMP
++#define strcmp strncmp
++
++#include "strcmp.S"
++
++weak_alias (strncmp, __strncmp)
++libc_hidden_builtin_def (strncmp)
+Index: sysdeps/x86_64/strcmp.S
+===================================================================
+--- sysdeps/x86_64/strcmp.S.orig
++++ sysdeps/x86_64/strcmp.S
+@@ -1,45 +1,487 @@
+-/* Highly optimized version for x86-64.
+- Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+- Based on i686 version contributed by Ulrich Drepper
+- , 1999.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
+- License as published by the Free Software Foundation; either
+- version 2.1 of the License, or (at your option) any later version.
+-
+- The GNU C Library is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, write to the Free
+- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+- 02111-1307 USA. */
+-
+-#include
+-#include "asm-syntax.h"
+-#include "bp-sym.h"
+-#include "bp-asm.h"
++# $Header: /K8_Projects/Glibc/amd64strcmp.S 10 2/10/04 11:48 Emenezes $
++
++# (c) 2002 Advanced Micro Devices, Inc.
++# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
++# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
++# LICENSE FOUND IN THE "README" FILE THAT IS
++# INCLUDED WITH THIS FILE
++
++#include "sysdep.h"
++
++#define LABEL(s) L##s
+
+ .text
+-ENTRY (BP_SYM (strcmp))
+-L(oop): movb (%rdi), %al
+- cmpb (%rsi), %al
+- jne L(neq)
+- incq %rdi
+- incq %rsi
+- testb %al, %al
+- jnz L(oop)
+-
+- xorl %eax, %eax
+- ret
+-
+-L(neq): movl $1, %eax
+- movl $-1, %ecx
+- cmovbl %ecx, %eax
+- ret
+-END (BP_SYM (strcmp))
++
++ENTRY (strcmp) # (const char *, const char *)
++
++ xor %ecx, %ecx
++
++#ifdef USE_AS_STRNCMP // (const char *, const char *, size_t)
++ mov %r14, -8 (%rsp)
++ mov %rdx, %r14
++
++ test %rdx, %rdx
++ mov %edx, %eax
++ jz .LABEL(exitz)
++#endif
++
++.LABEL(aligntry):
++ mov %rsi, %r8 # align by "source"
++ and $8 - 1, %r8 # between 0 and 8 characters compared
++ jz .LABEL(alignafter)
++
++.LABEL(align):
++ sub $8, %r8
++
++ .p2align 4
++
++.LABEL(alignloop):
++ mov (%rsi, %rcx), %al
++ mov (%rdi, %rcx), %dl
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .LABEL(exitafter)
++#endif
++
++ cmp %dl, %al # check if same character
++ jne .LABEL(exitafter)
++ test %al, %al # check if character a NUL
++ jz .LABEL(exitafter)
++
++ inc %ecx
++
++ inc %r8
++ jnz .LABEL(alignloop)
++
++ .p2align 4
++
++.LABEL(alignafter):
++
++ mov %r15, -32 (%rsp)
++ mov %rbp, -24 (%rsp)
++ mov %rbx, -16 (%rsp)
++
++.LABEL(pagealigntry): # page align by "destination"
++ mov $4096, %r15d # page size is 4096
++ lea (%rdi, %rcx), %ebp
++ and $4095, %ebp # page mask
++ sub %r15d, %ebp
++
++.LABEL(64): # 64-byte
++ mov $0xfefefefefefefeff, %rbx # magic number
++
++ .p2align 4
++
++.LABEL(64loop):
++ add $64, %ebp # check if "destination" crosses a page unevenly
++ jle .LABEL(64gobble)
++
++ sub %r15d, %ebp
++ lea 64 (%rcx), %r8
++
++ .p2align 4
++
++.LABEL(64nibble):
++ mov (%rsi, %rcx), %al
++ mov (%rdi, %rcx), %dl
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al # check if same character
++ jne .exit
++ test %al, %al # check if character a NUL
++ jz .exit
++
++ inc %ecx
++
++ cmp %ecx, %r8d
++ ja .LABEL(64nibble)
++
++ .p2align 4
++
++.LABEL(64gobble):
++ mov (%rsi, %rcx), %rax
++ mov (%rdi, %rcx), %rdx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ mov 8 (%rsi, %rcx), %rax
++ mov 8 (%rdi, %rcx), %rdx
++ add $8, %ecx
++
++#ifdef USE_AS_STRNCMP
++ sub $8, %r14
++ jl .LABEL(tail)
++#endif
++
++ mov %rbx, %r8
++ add %rax, %r8
++ sbb %r10, %r10
++
++ mov %rbx, %r9
++ add %rdx, %r9
++ sbb %r11, %r11
++
++ xor %rax, %r8
++ or %rbx, %r8
++ sub %r10, %r8
++ jnz .LABEL(tail)
++
++ xor %rdx, %r9
++ or %rbx, %r9
++ sub %r11, %r9
++ jnz .LABEL(tail)
++
++ cmp %rdx, %rax
++ jne .LABEL(tail)
++
++ add $8, %ecx
++
++ jmp .LABEL(64loop)
++
++.LABEL(64after):
++
++.LABEL(tailtry):
++# mov (%rsi, %rcx), %rax
++# mov (%rdi, %rcx), %rdx
++# add $8, %rcx
++
++.LABEL(tail): # byte tail
++#ifdef USE_AS_STRNCMP
++ add $7, %r14
++#endif
++
++ cmp %dl, %al # check if same character
++ jne .exit
++ test %al, %al # check if character a NUL
++ jz .exit
++
++ shr $8, %rax
++ shr $8, %rdx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++ test %al, %al
++ jz .exit
++
++ shr $8, %rax
++ shr $8, %rdx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++ test %al, %al
++ jz .exit
++
++ shr $8, %rax
++ shr $8, %rdx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++ test %al, %al
++ jz .exit
++
++ shr $8, %rax
++ shr $8, %rdx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++ test %al, %al
++ jz .exit
++
++ shr $8, %eax
++ shr $8, %edx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++ test %al, %al
++ jz .exit
++
++ shr $8, %eax
++ shr $8, %edx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++ test %al, %al
++ jz .exit
++
++ shr $8, %eax
++ shr $8, %edx
++
++#ifdef USE_AS_STRNCMP
++ dec %r14
++ jl .exit
++#endif
++
++ cmp %dl, %al
++ jne .exit
++# test %al, %al
++# jz .exit
++
++ .p2align 4,, 15
++
++.LABEL(tailafter):
++
++.exit:
++ mov -32 (%rsp), %r15
++ mov -24 (%rsp), %rbp
++ mov -16 (%rsp), %rbx
++
++ .p2align 4,, 3
++
++.LABEL(exitafter):
++#ifdef USE_AS_STRNCMP
++ test %r14, %r14
++ cmovl %edx, %eax
++#endif
++
++ movzx %al, %eax
++ movzx %dl, %edx
++ sub %eax, %edx
++ xchg %edx, %eax
++
++#ifdef USE_AS_STRNCMP
++.LABEL(exitz):
++ mov -8 (%rsp), %r14
++#endif
++ ret
++
++END (strcmp)
+ libc_hidden_builtin_def (strcmp)
+Index: sysdeps/x86_64/memcpy.S
+===================================================================
+--- sysdeps/x86_64/memcpy.S.orig
++++ sysdeps/x86_64/memcpy.S
+@@ -39,7 +39,7 @@
+
+ .text
+
+-#if defined PIC && !defined NOT_IN_libc
++#if defined PIC && !defined NOT_IN_libc && !defined USE_AS_BCOPY
+ ENTRY (__memcpy_chk)
+
+ cmpq %rdx, %rcx
diff --git a/glibc-2.3.3-execstack.diff b/glibc-2.3.3-execstack.diff
new file mode 100644
index 0000000..16436db
--- /dev/null
+++ b/glibc-2.3.3-execstack.diff
@@ -0,0 +1,45 @@
+--- locale/programs/3level.h
++++ locale/programs/3level.h 2004/09/26 06:58:48
+@@ -204,6 +204,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/glibc-2.3.3-nscd-db-path.diff b/glibc-2.3.3-nscd-db-path.diff
index 14242a5..4ce88be 100644
--- a/glibc-2.3.3-nscd-db-path.diff
+++ b/glibc-2.3.3-nscd-db-path.diff
@@ -1,8 +1,10 @@
-Index: glibc-2.17.90/nscd/nscd.h
-===================================================================
---- glibc-2.17.90.orig/nscd/nscd.h
-+++ glibc-2.17.90/nscd/nscd.h
-@@ -112,11 +112,11 @@ struct database_dyn
+2004-12-09 Thorsten Kukuk
+
+ * nscd/nscd.h: Move persistent storage back to /var/run/nscd
+
+--- nscd/nscd.h
++++ nscd/nscd.h 2004/12/09 13:17:35
+@@ -87,10 +87,10 @@
/* Paths of the file for the persistent storage. */
@@ -10,12 +12,10 @@ Index: glibc-2.17.90/nscd/nscd.h
-#define _PATH_NSCD_GROUP_DB "/var/db/nscd/group"
-#define _PATH_NSCD_HOSTS_DB "/var/db/nscd/hosts"
-#define _PATH_NSCD_SERVICES_DB "/var/db/nscd/services"
--#define _PATH_NSCD_NETGROUP_DB "/var/db/nscd/netgroup"
-+#define _PATH_NSCD_PASSWD_DB "/var/lib/nscd/passwd"
-+#define _PATH_NSCD_GROUP_DB "/var/lib/nscd/group"
-+#define _PATH_NSCD_HOSTS_DB "/var/lib/nscd/hosts"
-+#define _PATH_NSCD_SERVICES_DB "/var/lib/nscd/services"
-+#define _PATH_NSCD_NETGROUP_DB "/var/lib/nscd/netgroup"
++#define _PATH_NSCD_PASSWD_DB "/var/run/nscd/passwd"
++#define _PATH_NSCD_GROUP_DB "/var/run/nscd/group"
++#define _PATH_NSCD_HOSTS_DB "/var/run/nscd/hosts"
++#define _PATH_NSCD_SERVICES_DB "/var/run/nscd/services"
/* Path used when not using persistent storage. */
#define _PATH_NSCD_XYZ_DB_TMP "/var/run/nscd/dbXXXXXX"
diff --git a/glibc-2.3.4-gb18030-big5hkscs.diff.bz2 b/glibc-2.3.4-gb18030-big5hkscs.diff.bz2
new file mode 100644
index 0000000..818e0b9
--- /dev/null
+++ b/glibc-2.3.4-gb18030-big5hkscs.diff.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:901fe715360fd55d2d83ceab113bacca58a2b9cba3673d80b184760976236ffd
+size 1036487
diff --git a/glibc-2.3.5-nscd-zeronegtimeout.diff b/glibc-2.3.5-nscd-zeronegtimeout.diff
new file mode 100644
index 0000000..744c1b7
--- /dev/null
+++ b/glibc-2.3.5-nscd-zeronegtimeout.diff
@@ -0,0 +1,111 @@
+Index: nscd/aicache.c
+===================================================================
+--- nscd/aicache.c.orig
++++ nscd/aicache.c
+@@ -515,10 +515,15 @@ next_nip:
+ if (fd != -1)
+ TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
+
+- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
+- IDX_result_data);
+ /* If we cannot permanently store the result, so be it. */
+- if (dataset != NULL)
++ if (db->negtimeout == 0)
++ {
++ /* Mark the old entry as obsolete. */
++ if (dh != NULL)
++ dh->usable = false;
++ dataset = NULL;
++ }
++ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, IDX_result_data)) == NULL)
+ {
+ dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
+ dataset->head.recsize = total;
+Index: nscd/grpcache.c
+===================================================================
+--- nscd/grpcache.c.orig
++++ nscd/grpcache.c
+@@ -113,10 +113,14 @@ cache_addgr (struct database_dyn *db, in
+ written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
+ MSG_NOSIGNAL));
+
+- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
+- IDX_result_data);
+ /* If we cannot permanently store the result, so be it. */
+- if (dataset != NULL)
++ if (db->negtimeout == 0)
++ {
++ /* Mark the old entry as obsolete. */
++ if (dh != NULL)
++ dh->usable = false;
++ }
++ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, IDX_result_data)) == NULL)
+ {
+ dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
+ dataset->head.recsize = total;
+Index: nscd/hstcache.c
+===================================================================
+--- nscd/hstcache.c.orig
++++ nscd/hstcache.c
+@@ -119,10 +119,14 @@ cache_addhst (struct database_dyn *db, i
+ MSG_NOSIGNAL)) != total)
+ all_written = false;
+
+- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
+- IDX_result_data);
+ /* If we cannot permanently store the result, so be it. */
+- if (dataset != NULL)
++ if (db->negtimeout == 0)
++ {
++ /* Mark the old entry as obsolete. */
++ if (dh != NULL)
++ dh->usable = false;
++ }
++ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, IDX_result_data)) == NULL)
+ {
+ dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
+ dataset->head.recsize = total;
+Index: nscd/initgrcache.c
+===================================================================
+--- nscd/initgrcache.c.orig
++++ nscd/initgrcache.c
+@@ -197,10 +197,14 @@ addinitgroupsX (struct database_dyn *db,
+ written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
+ MSG_NOSIGNAL));
+
+- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
+- IDX_result_data);
+ /* If we cannot permanently store the result, so be it. */
+- if (dataset != NULL)
++ if (db->negtimeout == 0)
++ {
++ /* Mark the old entry as obsolete. */
++ if (dh != NULL)
++ dh->usable = false;
++ }
++ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, IDX_result_data)) == NULL)
+ {
+ dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
+ dataset->head.recsize = total;
+Index: nscd/pwdcache.c
+===================================================================
+--- nscd/pwdcache.c.orig
++++ nscd/pwdcache.c
+@@ -120,10 +120,14 @@ cache_addpw (struct database_dyn *db, in
+ written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
+ MSG_NOSIGNAL));
+
+- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
+- IDX_result_data);
+ /* If we cannot permanently store the result, so be it. */
+- if (dataset != NULL)
++ if (db->negtimeout == 0)
++ {
++ /* Mark the old entry as obsolete. */
++ if (dh != NULL)
++ dh->usable = false;
++ }
++ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, IDX_result_data)) == NULL)
+ {
+ dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
+ dataset->head.recsize = total;
diff --git a/glibc-bindresvport-blacklist.diff b/glibc-2.3.90-bindresvport.blacklist.diff
similarity index 60%
rename from glibc-bindresvport-blacklist.diff
rename to glibc-2.3.90-bindresvport.blacklist.diff
index 3fb3a4f..3e8a581 100644
--- a/glibc-bindresvport-blacklist.diff
+++ b/glibc-2.3.90-bindresvport.blacklist.diff
@@ -1,28 +1,28 @@
-Index: glibc-2.17.90/sunrpc/bindrsvprt.c
-===================================================================
---- glibc-2.17.90.orig/sunrpc/bindrsvprt.c
-+++ glibc-2.17.90/sunrpc/bindrsvprt.c
-@@ -29,6 +29,9 @@
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+--- sunrpc/bindrsvprt.c
++++ sunrpc/bindrsvprt.c 2005/11/23 13:36:23
+@@ -30,28 +30,108 @@
+ * Copyright (c) 1987 by Sun Microsystems, Inc.
*/
+#include
+#include
-+#include
#include
++#include
#include
#include
-@@ -42,6 +45,93 @@
- */
- __libc_lock_define_initialized (static, lock);
+ #include
+ #include
+ #include
+#define STARTPORT 600
+#define LOWPORT 512
+#define ENDPORT (IPPORT_RESERVED - 1)
+#define NPORTS (ENDPORT - STARTPORT + 1)
+
-+/* Read the file /etc/rpc.blacklisted, so that we don't bind to these
-+ ports. */
++/*
++ * Read the file /etc/rpc.blacklisted, so that we don't bind
++ * to this ports.
++ */
+
+static int blacklist_read;
+static int *list;
@@ -36,16 +36,13 @@ Index: glibc-2.17.90/sunrpc/bindrsvprt.c
+ size_t buflen = 0;
+ int size = 0, ptr = 0;
+
-+ __libc_lock_lock (lock);
-+ if (blacklist_read)
-+ goto unlock;
+ blacklist_read = 1;
+
+ fp = fopen ("/etc/bindresvport.blacklist", "r");
-+ if (fp == NULL)
-+ goto unlock;
++ if (NULL == fp)
++ return;
+
-+ while (!feof_unlocked (fp))
++ while (!feof (fp))
+ {
+ unsigned long port;
+ char *tmp, *cp;
@@ -54,59 +51,56 @@ Index: glibc-2.17.90/sunrpc/bindrsvprt.c
+ break;
+
+ cp = buf;
-+ /* Remove comments. */
-+ tmp = strchr (cp, '#');
++ tmp = strchr (cp, '#'); /* remove comments */
+ if (tmp)
+ *tmp = '\0';
-+ /* Remove spaces and tabs. */
-+ while (isspace ((unsigned char) *cp))
++ while (isspace ((int)*cp)) /* remove spaces and tabs */
+ ++cp;
-+ /* Ignore empty lines. */
-+ if (*cp == '\0')
++ if (*cp == '\0') /* ignore empty lines */
+ continue;
+ if (cp[strlen (cp) - 1] == '\n')
+ cp[strlen (cp) - 1] = '\0';
+
+ port = strtoul (cp, &tmp, 0);
-+ while (isspace ((unsigned char) *tmp))
++ while (isspace(*tmp))
+ ++tmp;
+ if (*tmp != '\0' || (port == ULONG_MAX && errno == ERANGE))
+ continue;
+
-+ /* Don't bother with out-of-range ports. */
++ /* Don't bother with out-of-range ports */
+ if (port < LOWPORT || port > ENDPORT)
+ continue;
+
+ if (ptr >= size)
+ {
+ size += 10;
-+ int *new_list = realloc (list, size * sizeof (int));
-+ if (new_list == NULL)
++ list = realloc (list, size * sizeof (int));
++ if (list == NULL)
+ {
-+ free (list);
-+ list = NULL;
+ free (buf);
-+ goto unlock;
++ return;
+ }
-+ list = new_list;
+ }
+
+ list[ptr++] = port;
+ }
+
+ fclose (fp);
-+ free (buf);
++
++ if (buf)
++ free (buf);
++
+ list_size = ptr;
-+
-+ unlock:
-+ __libc_lock_unlock (lock);
+}
-+
+
/*
* Bind a socket to a privileged IP port
*/
-@@ -52,12 +142,11 @@ bindresvport (int sd, struct sockaddr_in
+ int
+ bindresvport (int sd, struct sockaddr_in *sin)
+ {
++ static short startport = STARTPORT;
+ static short port;
struct sockaddr_in myaddr;
int i;
@@ -114,15 +108,13 @@ Index: glibc-2.17.90/sunrpc/bindrsvprt.c
-#define LOWPORT 512
-#define ENDPORT (IPPORT_RESERVED - 1)
-#define NPORTS (ENDPORT - STARTPORT + 1)
- static short startport = STARTPORT;
-
+- static short startport = STARTPORT;
+ if (!blacklist_read)
+ load_blacklist ();
-+
+
if (sin == (struct sockaddr_in *) 0)
{
- sin = &myaddr;
-@@ -75,6 +164,7 @@ bindresvport (int sd, struct sockaddr_in
+@@ -70,6 +148,7 @@
port = (__getpid () % NPORTS) + STARTPORT;
}
@@ -130,7 +122,7 @@ Index: glibc-2.17.90/sunrpc/bindrsvprt.c
/* Initialize to make gcc happy. */
int res = -1;
-@@ -86,12 +176,22 @@ bindresvport (int sd, struct sockaddr_in
+@@ -78,12 +157,22 @@
again:
for (i = 0; i < nports; ++i)
{
@@ -141,7 +133,7 @@ Index: glibc-2.17.90/sunrpc/bindrsvprt.c
+
+ sin->sin_port = htons (port);
+
-+ /* Check that this port is not blacklisted. */
++ /* Check, if this port is not blacklisted. */
+ for (j = 0; j < list_size; j++)
+ if (port == list[j])
+ goto try_next_port;
@@ -150,7 +142,7 @@ Index: glibc-2.17.90/sunrpc/bindrsvprt.c
if (res >= 0 || errno != EADDRINUSE)
break;
+
-+ try_next_port:
++try_next_port:
+ if (++port > endport)
+ port = startport;
}
diff --git a/glibc-2.3.90-fnmatch.diff b/glibc-2.3.90-fnmatch.diff
new file mode 100644
index 0000000..8ada08b
--- /dev/null
+++ b/glibc-2.3.90-fnmatch.diff
@@ -0,0 +1,58 @@
+When fnmatch detects an invalid multibyte character it should fall back to
+single byte matching, so that "*" has a chance to match such a string.
+
+Andreas.
+
+2005-04-12 Andreas Schwab
+
+ * posix/fnmatch.c (fnmatch): If conversion to wide character
+ fails fall back to single byte matching.
+
+Index: posix/fnmatch.c
+===================================================================
+--- posix/fnmatch.c.orig 2007-05-18 10:40:34.000000000 +0200
++++ posix/fnmatch.c 2007-05-18 13:21:47.199478000 +0200
+@@ -327,6 +327,7 @@
+ # if HANDLE_MULTIBYTE
+ if (__builtin_expect (MB_CUR_MAX, 1) != 1)
+ {
++ const char *orig_pattern = pattern;
+ mbstate_t ps;
+ size_t n;
+ const char *p;
+@@ -378,10 +379,8 @@
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ n = mbsrtowcs (wstring, &p, n + 1, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ if (p)
+ memset (&ps, '\0', sizeof (ps));
+ }
+@@ -389,10 +388,8 @@
+ {
+ n = mbsrtowcs (NULL, &string, 0, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ assert (mbsinit (&ps));
+ (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+@@ -400,6 +397,9 @@
+
+ return internal_fnwmatch (wpattern, wstring, wstring + n,
+ flags & FNM_PERIOD, flags, NULL);
++
++ try_singlebyte:
++ pattern = orig_pattern;
+ }
+ # endif /* mbstate_t and mbsrtowcs or _LIBC. */
+
diff --git a/glibc-2.3.90-langpackdir.diff b/glibc-2.3.90-langpackdir.diff
index e2da5c0..6231d5a 100644
--- a/glibc-2.3.90-langpackdir.diff
+++ b/glibc-2.3.90-langpackdir.diff
@@ -1,33 +1,40 @@
-Index: glibc-2.24/intl/loadmsgcat.c
+Index: intl/loadmsgcat.c
===================================================================
---- glibc-2.24.orig/intl/loadmsgcat.c
-+++ glibc-2.24/intl/loadmsgcat.c
-@@ -829,8 +829,47 @@ _nl_load_domain (struct loaded_l10nfile
+RCS file: /cvs/glibc/libc/intl/loadmsgcat.c,v
+retrieving revision 1.57
+diff -u -p -r1.57 loadmsgcat.c
+--- intl/loadmsgcat.c 28 Jul 2007 20:34:43 -0000 1.57
++++ intl/loadmsgcat.c 31 Aug 2007 15:36:40 -0000
+@@ -806,8 +806,52 @@ _nl_load_domain (domain_file, domainbind
if (domain_file->filename == NULL)
goto out;
- /* Try to open the addressed file. */
-- fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+- fd = open (domain_file->filename, O_RDONLY);
+ /* Replace /locale/ with /usr/share/locale-langpack/ */
+ const char *langpackdir = "/usr/share/locale-langpack/";
+ char *filename_langpack = malloc (strlen (domain_file->filename) +
-+ strlen (langpackdir));
++ strlen (langpackdir));
+ if (filename_langpack != NULL)
+ {
+ char *p = strstr (domain_file->filename, "/locale/");
+ if (p != NULL)
+ {
+ strcpy (filename_langpack, langpackdir);
-+ strcpy (&filename_langpack[strlen (langpackdir)], p + 8);
-+ fd = open (filename_langpack, O_RDONLY | O_BINARY);
++ strcpy (&filename_langpack[strlen (langpackdir)],
++ (p+8));
++ if ((fd = open (filename_langpack, O_RDONLY)) == -1)
++ fd = open (domain_file->filename, O_RDONLY);
+ }
++ else
++ /* Try to open the addressed file. */
++ fd = open (domain_file->filename, O_RDONLY);
+
+ free (filename_langpack);
+ }
-+
-+ if (fd == -1)
++ else
+ /* Try to open the addressed file. */
-+ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
++ fd = open (domain_file->filename, O_RDONLY);
+
+ if (fd == -1)
+ {
@@ -41,8 +48,9 @@ Index: glibc-2.24/intl/loadmsgcat.c
+ if (p != NULL)
+ {
+ strcpy (filename_bundle, bundle_dir);
-+ strcpy (&filename_bundle[strlen (bundle_dir)], p + 8);
-+ fd = open (filename_bundle, O_RDONLY | O_BINARY);
++ strcpy (&filename_bundle[strlen (bundle_dir)],
++ (p+8));
++ fd = open (filename_bundle, O_RDONLY);
+ }
+
+ free (filename_bundle);
diff --git a/glibc-2.3.90-ld.so-madvise.diff b/glibc-2.3.90-ld.so-madvise.diff
new file mode 100644
index 0000000..9f661e9
--- /dev/null
+++ b/glibc-2.3.90-ld.so-madvise.diff
@@ -0,0 +1,76 @@
+Index: elf/dl-load.c
+===================================================================
+--- elf/dl-load.c.orig
++++ elf/dl-load.c
+@@ -1219,6 +1219,9 @@ cannot allocate TLS data structures for
+ goto call_lose_errno;
+ }
+
++ if (GLRO(dl_madvise))
++ posix_fadvise (fd, c->mapoff, maplength, POSIX_FADV_WILLNEED);
++
+ l->l_map_end = l->l_map_start + maplength;
+ l->l_addr = l->l_map_start - c->mapstart;
+
+Index: elf/dl-support.c
+===================================================================
+--- elf/dl-support.c.orig
++++ elf/dl-support.c
+@@ -41,6 +41,7 @@ size_t _dl_platformlen;
+
+ int _dl_debug_mask;
+ int _dl_lazy;
++int _dl_madvise;
+ ElfW(Addr) _dl_use_load_bias = -2;
+ int _dl_dynamic_weak;
+
+@@ -240,6 +241,8 @@ _dl_non_dynamic_init (void)
+
+ _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0';
+
++ _dl_madvise = *(getenv ("LD_NOMADVISE") ?: "") == '\0';
++
+ _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0';
+
+ _dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0';
+Index: elf/rtld.c
+===================================================================
+--- elf/rtld.c.orig
++++ elf/rtld.c
+@@ -152,6 +152,7 @@ struct rtld_global_ro _rtld_global_ro at
+ ._dl_lazy = 1,
+ ._dl_fpu_control = _FPU_DEFAULT,
+ ._dl_pointer_guard = 1,
++ ._dl_madvise = 1,
+
+ /* Function pointers. */
+ ._dl_debug_printf = _dl_debug_printf,
+@@ -2619,6 +2620,14 @@ process_envvars (enum mode *modep)
+ break;
+
+ case 9:
++ /* Test whether we should not advise the kernel
++ about memory usage. */
++ if (memcmp (envline, "NOMADVISE", 9) == 0)
++ {
++ GLRO(dl_madvise) = envline[10] == '\0';
++ break;
++ }
++
+ /* Test whether we want to see the content of the auxiliary
+ array passed up from the kernel. */
+ if (!INTUSE(__libc_enable_secure)
+Index: sysdeps/generic/ldsodefs.h
+===================================================================
+--- sysdeps/generic/ldsodefs.h.orig
++++ sysdeps/generic/ldsodefs.h
+@@ -567,6 +567,9 @@ struct rtld_global_ro
+ /* Do we do lazy relocations? */
+ EXTERN int _dl_lazy;
+
++ /* Should we advise kernel about memory usage? */
++ EXTERN int _dl_madvise;
++
+ /* Nonzero if runtime lookups should not update the .got/.plt. */
+ EXTERN int _dl_bind_not;
+
diff --git a/glibc-2.3.90-noversion.diff b/glibc-2.3.90-noversion.diff
index b7102c9..f4cedd4 100644
--- a/glibc-2.3.90-noversion.diff
+++ b/glibc-2.3.90-noversion.diff
@@ -1,8 +1,6 @@
-Index: glibc-2.20/elf/rtld.c
-===================================================================
---- glibc-2.20.orig/elf/rtld.c
-+++ glibc-2.20/elf/rtld.c
-@@ -1591,6 +1591,52 @@ ERROR: ld.so: object '%s' cannot be load
+--- elf/rtld.c
++++ elf/rtld.c 2005/04/12 10:05:38
+@@ -1672,6 +1672,53 @@
}
}
@@ -18,31 +16,32 @@ Index: glibc-2.20/elf/rtld.c
+ */
+#define LIB_NOVERSION "/lib/obsolete/noversion/libNoVersion.so.1"
+
-+ if (__glibc_unlikely (main_map->l_info[DT_NUM + DT_THISPROCNUM
++ if (__builtin_expect (main_map->l_info[DT_NUM + DT_THISPROCNUM
+ + DT_VERSIONTAGIDX (DT_VERNEED)]
-+ == NULL)
-+ && (main_map->l_info[DT_DEBUG] != 0
++ == NULL, 0)
++ && (main_map->l_info[DT_DEBUG]
+ || !(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)))
+ {
-+ struct stat64 test_st;
++ struct stat test_st;
+ int test_fd;
-+ bool can_load;
++ int can_load;
+
+ HP_TIMING_NOW (start);
+
-+ can_load = true;
++ can_load = 1;
+ test_fd = __open (LIB_NOVERSION, O_RDONLY);
-+ if (test_fd < 0)
-+ can_load = false;
-+ else
-+ {
-+ if (__fxstat64 (_STAT_VER, test_fd, &test_st) < 0
-+ || test_st.st_size == 0)
-+ can_load = false;
-+ __close(test_fd);
++ if (test_fd < 0) {
++ can_load = 0;
++ } else {
++ if (__fxstat (_STAT_VER, test_fd, &test_st) < 0 || test_st.st_size == 0) {
++ can_load = 0;
+ }
++ }
+
-+ if (can_load)
++ if (test_fd >= 0) /* open did no fail.. */
++ __close(test_fd); /* avoid fd leaks */
++
++ if (can_load != 0)
+ npreloads += do_preload (LIB_NOVERSION, main_map,
+ "nonversioned binary");
+
@@ -52,6 +51,6 @@ Index: glibc-2.20/elf/rtld.c
+ }
+#endif
+
- if (__glibc_unlikely (*first_preload != NULL))
+ if (__builtin_expect (*first_preload != NULL, 0))
{
/* Set up PRELOADS with a vector of the preloaded libraries. */
diff --git a/glibc-2.3.locales.diff.bz2 b/glibc-2.3.locales.diff.bz2
new file mode 100644
index 0000000..710a1d4
--- /dev/null
+++ b/glibc-2.3.locales.diff.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0b02688b3e712aac40c8ef77b2ef2e2996abe86350d1827458571ba2cbeeed08
+size 330830
diff --git a/glibc-2.4-china.diff b/glibc-2.4-china.diff
index e6361d3..ef7f0c9 100644
--- a/glibc-2.4-china.diff
+++ b/glibc-2.4-china.diff
@@ -1,17 +1,15 @@
-Index: glibc-2.17.90/localedata/locales/zh_TW
-===================================================================
---- glibc-2.17.90.orig/localedata/locales/zh_TW
-+++ glibc-2.17.90/localedata/locales/zh_TW
-@@ -8,7 +8,7 @@
- % exempt you from the conditions of the license if your use would
- % otherwise be governed by that license.
-
+--- localedata/locales/zh_TW
++++ localedata/locales/zh_TW 2006/04/24 09:55:16
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
-% Chinese language locale for Taiwan R.O.C.
+% Chinese language locale for Taiwan
% charmap: BIG5-CP950
%
% Original Author:
-@@ -24,7 +24,7 @@ escape_char /
+@@ -17,7 +17,7 @@
% Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
LC_IDENTIFICATION
@@ -20,3 +18,12 @@ Index: glibc-2.17.90/localedata/locales/zh_TW
source ""
address ""
contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/glibc-2.4.90-mdns-resolver.diff b/glibc-2.4.90-mdns-resolver.diff
new file mode 100644
index 0000000..106d9b5
--- /dev/null
+++ b/glibc-2.4.90-mdns-resolver.diff
@@ -0,0 +1,456 @@
+--- resolv/res_hconf.c
++++ resolv/res_hconf.c 2006/06/06 16:08:34
+@@ -58,6 +58,7 @@
+ #define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS"
+ #define ENV_MULTI "RESOLV_MULTI"
+ #define ENV_REORDER "RESOLV_REORDER"
++#define ENV_MDNS "RESOLV_MDNS"
+
+ enum parse_cbs
+ {
+@@ -80,7 +81,8 @@
+ {"multi", CB_arg_bool, HCONF_FLAG_MULTI},
+ {"nospoof", CB_arg_bool, HCONF_FLAG_SPOOF},
+ {"spoofalert", CB_arg_bool, HCONF_FLAG_SPOOFALERT},
+- {"reorder", CB_arg_bool, HCONF_FLAG_REORDER}
++ {"reorder", CB_arg_bool, HCONF_FLAG_REORDER},
++ {"mdns", CB_arg_bool, HCONF_FLAG_MDNS}
+ };
+
+ /* Structure containing the state. */
+@@ -304,6 +306,9 @@
+
+ memset (&_res_hconf, '\0', sizeof (_res_hconf));
+
++ /* Default for mdns is "on". */
++ _res_hconf.flags |= HCONF_FLAG_MDNS;
++
+ hconf_name = getenv (ENV_HOSTCONF);
+ if (hconf_name == NULL)
+ hconf_name = _PATH_HOSTCONF;
+@@ -346,6 +351,10 @@
+ arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval);
+ }
+
++ envval = getenv (ENV_MDNS);
++ if (envval)
++ arg_bool (ENV_MDNS, 1, envval, HCONF_FLAG_MDNS);
++
+ _res_hconf.initialized = 1;
+ }
+
+--- resolv/res_hconf.h
++++ resolv/res_hconf.h 2006/06/06 16:06:46
+@@ -37,6 +37,7 @@
+ # define HCONF_FLAG_SPOOFALERT (1 << 2) /* syslog warning of spoofed */
+ # define HCONF_FLAG_REORDER (1 << 3) /* list best address first */
+ # define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */
++# define HCONF_FLAG_MDNS (1 << 5) /* Disable MDNS support */
+ };
+ extern struct hconf _res_hconf;
+
+--- resolv/res_query.c
++++ resolv/res_query.c 2006/06/06 16:06:46
+@@ -83,6 +83,8 @@
+ #include
+ #include
+
++#include "res_hconf.h"
++
+ /* Options. Leave them on. */
+ /* #undef DEBUG */
+
+@@ -286,6 +288,13 @@
+ *domain && !done;
+ domain++) {
+
++ if ((_res_hconf.flags & HCONF_FLAG_MDNS) != 0) {
++ /* don't add "local" domain if query contains a dot */
++ if (dots && (!__strcasecmp(*domain, "local") ||
++ !__strcasecmp(*domain, "local.")))
++ continue;
++ }
++
+ if (domain[0][0] == '\0' ||
+ (domain[0][0] == '.' && domain[0][1] == '\0'))
+ root_on_list++;
+--- resolv/res_send.c
++++ resolv/res_send.c 2006/06/06 16:06:46
+@@ -85,6 +85,9 @@
+ #include
+ #include
+ #include
++#if defined(_LIBC) && defined(linux)
++#include
++#endif
+
+ #include
+ #include
+@@ -96,6 +99,8 @@
+ #include
+ #include
+
++#include "res_hconf.h"
++
+ #if PACKETSZ > 65536
+ #define MAXPACKET PACKETSZ
+ #else
+@@ -180,6 +185,9 @@
+ static int send_dg(res_state, const u_char *, int,
+ u_char **, int *, int *, int,
+ int *, int *, u_char **);
++static int send_dg_mdns(res_state, const u_char *, int,
++ u_char **, int *, int *, struct sockaddr_in6 *,
++ int *, int *, u_char **);
+ #ifdef DEBUG
+ static void Aerror(const res_state, FILE *, const char *, int,
+ const struct sockaddr *);
+@@ -337,6 +345,35 @@
+ u_char *ans, int anssiz, u_char **ansp)
+ {
+ int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
++ int usemdns;
++ HEADER *qhp = (HEADER *) buf;
++
++ usemdns = 0;
++ if ((_res_hconf.flags & HCONF_FLAG_MDNS) != 0 &&
++ qhp->qr == 0 && qhp->opcode == QUERY && qhp->qdcount == htons(1)) {
++ /* got one simple query */
++ const u_char *bp, *be;
++ be = buf + buflen;
++ for (bp = buf + NS_HFIXEDSZ; bp < be; )
++ if ((*bp & NS_CMPRSFLGS) != 0)
++ break;
++ else if (*bp) {
++ if (*bp == 5 && !strncasecmp(bp, "\005local\000", 7)) {
++ usemdns = 1;
++ break;
++ }
++ if (*bp == 3 && !strncasecmp(bp, "\003254\003169\007in-addr\004arpa\000", 22)) {
++ usemdns = 1;
++ break;
++ }
++ if (*bp == 1 && !strncasecmp(bp, "\0010\0018\001e\001f\003ip6\004arpa\000", 18)) {
++ usemdns = 2;
++ break;
++ }
++ bp += *bp + 1;
++ } else
++ break;
++ }
+
+ if (statp->nscount == 0) {
+ __set_errno (ESRCH);
+@@ -470,9 +507,24 @@
+ * Send request, RETRY times, or until successful.
+ */
+ for (try = 0; try < statp->retry; try++) {
+- for (ns = 0; ns < MAXNS; ns++)
++ for (ns = 0; ns < (usemdns ? 1 : MAXNS); ns++)
+ {
+ struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
++ if (usemdns == 1) {
++ static struct sockaddr_in mdns4;
++ mdns4.sin_family = AF_INET;
++ mdns4.sin_port = htons(5353);
++ mdns4.sin_addr.s_addr = htonl(0xe00000fb);
++ nsap = (struct sockaddr_in6 *)&mdns4;
++ }
++ if (usemdns == 2) {
++ static struct sockaddr_in6 mdns6;
++ mdns6.sin6_family = AF_INET6;
++ mdns6.sin6_port = htons(5353);
++ mdns6.sin6_addr.s6_addr32[0] = htonl(0xff020000);
++ mdns6.sin6_addr.s6_addr32[3] = htonl(0x000000fb);
++ nsap = &mdns6;
++ }
+
+ if (nsap == NULL)
+ goto next_ns;
+@@ -530,8 +582,11 @@
+ resplen = n;
+ } else {
+ /* Use datagrams. */
+- n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
+- ns, &v_circuit, &gotsomewhere, ansp);
++ if (usemdns)
++ n = send_dg_mdns(statp, buf, buflen, &ans, &anssiz, &terrno, nsap, &v_circuit, &gotsomewhere, ansp);
++ else
++ n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
++ ns, &v_circuit, &gotsomewhere, ansp);
+ if (n < 0)
+ return (-1);
+ if (n == 0)
+@@ -598,8 +653,15 @@
+ if (!v_circuit) {
+ if (!gotsomewhere)
+ __set_errno (ECONNREFUSED); /* no nameservers found */
+- else
++ else if (!usemdns) {
+ __set_errno (ETIMEDOUT); /* no answer obtained */
++ } else {
++ /* treat timeout as host not found */
++ HEADER *anhp = (HEADER *) ans;
++ memset(ans, 0, HFIXEDSZ);
++ anhp->rcode = NXDOMAIN;
++ return HFIXEDSZ;
++ }
+ } else
+ __set_errno (terrno);
+ return (-1);
+@@ -1045,6 +1107,255 @@
+ }
+ }
+
++static int
++send_dg_mdns(res_state statp,
++ const u_char *buf, int buflen, u_char **ansp, int *anssizp,
++ int *terrno, struct sockaddr_in6 *nsap, int *v_circuit, int *gotsomewhere, u_char **anscp)
++{
++ const HEADER *hp = (HEADER *) buf;
++ u_char *ans = *ansp;
++ int anssiz = *anssizp;
++ HEADER *anhp = (HEADER *) ans;
++ struct timespec now, timeout, finish;
++ struct pollfd pfd[32];
++ int ptimeout;
++ int fromlen, resplen, seconds, n, s;
++ int on = 1;
++ struct msghdr mhdr;
++ struct iovec iov;
++ u_char cmsgbuf[CMSG_SPACE(sizeof(int))];
++ struct cmsghdr *cmsg;
++ int ttl;
++ struct ifconf ifconf;
++ struct ifreq ifreq[64];
++ int ifreqn;
++ int i, j;
++ int ifidx[32], ifidxn;
++ struct ip_mreqn mreqn;
++
++ s = socket(nsap->sin6_family == AF_INET ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
++ if (s < 0) {
++ *terrno = errno;
++ Perror(statp, stderr, "socket(dg)", errno);
++ return (-1);
++ }
++ ifconf.ifc_len = sizeof(ifreq);
++ ifconf.ifc_req = ifreq;
++ ifidxn = 0;
++ if (ioctl(s, SIOCGIFCONF, &ifconf) == 0) {
++ ifreqn = ifconf.ifc_len / sizeof(*ifreq);
++ for (i = 0 ; i < ifreqn; i++) {
++ if (ioctl(s, SIOCGIFFLAGS, ifreq + i))
++ continue;
++ if (!(ifreq[i].ifr_flags & IFF_MULTICAST))
++ continue;
++ if (ioctl(s, SIOCGIFINDEX, ifreq + i))
++ continue;
++ for (j = 0; j < ifidxn; j++)
++ if (ifidx[j] == ifreq[i].ifr_ifindex)
++ break;
++ if (j < ifidxn)
++ continue;
++ ifidx[ifidxn++] = ifreq[i].ifr_ifindex;
++ if (ifidxn == sizeof(ifidx)/sizeof(*ifidx))
++ break;
++ }
++ }
++ j = 0;
++ for (i = 0; i < (ifidxn ? ifidxn : 1); i++) {
++ if (i) {
++ s = socket(nsap->sin6_family == AF_INET ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
++ if (!s)
++ continue;
++ }
++ if (setsockopt(s, SOL_IP, IP_RECVTTL, &on, sizeof(on))) {
++ *terrno = errno;
++ Perror(statp, stderr, "IP_RECVTTL(dg)", errno);
++ close(s);
++ continue;
++ }
++ if (ifidxn) {
++ memset(&mreqn, 0, sizeof(mreqn));
++ mreqn.imr_ifindex = ifidx[i];
++ if (setsockopt(s, SOL_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn))) {
++ *terrno = errno;
++ Perror(statp, stderr, "IP_MULTICAST_IF", errno);
++ close(s);
++ continue;
++ }
++ }
++ if (sendto(s, (char*)buf, buflen, 0,
++ (struct sockaddr *)nsap, sizeof *nsap) != buflen) {
++ Aerror(statp, stderr, "sendto", errno, *(struct sockaddr_in *)nsap);
++ close(s);
++ continue;
++ }
++ pfd[j].fd = s;
++ pfd[j].events = POLLIN;
++ j++;
++ }
++ /*
++ * Wait for reply.
++ */
++ seconds = statp->retrans;
++ if (seconds <= 0)
++ seconds = 1;
++ evNowTime(&now);
++ evConsTime(&timeout, seconds, 0);
++ evAddTime(&finish, &now, &timeout);
++ wait:
++ if (j == 0) {
++ return (0);
++ }
++
++ /* Convert struct timespec in milliseconds. */
++ ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
++ n = __poll (pfd, j, ptimeout);
++ if (n == 0) {
++ Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
++ *gotsomewhere = 1;
++ for (i = 0; i < j; i++)
++ close(pfd[i].fd);
++ return (0);
++ }
++ if (n < 0) {
++ if (errno == EINTR) {
++ evNowTime(&now);
++ if (evCmpTime(finish, now) > 0) {
++ evSubTime(&timeout, &finish, &now);
++ goto wait;
++ }
++ }
++ Perror(statp, stderr, "select", errno);
++ for (i = 0; i < j; i++)
++ close(pfd[i].fd);
++ res_nclose(statp);
++ return (0);
++ }
++ for (i = 0; i < j - 1; i++)
++ if (pfd[i].revents == POLLIN)
++ break;
++ s = pfd[i].fd;
++ __set_errno (0);
++ fromlen = sizeof(struct sockaddr_in6);
++ if (anssiz < MAXPACKET
++ && anscp
++ && (ioctl (s, FIONREAD, &resplen) < 0
++ || anssiz < resplen)) {
++ ans = malloc (MAXPACKET);
++ if (ans == NULL)
++ ans = *ansp;
++ else {
++ anssiz = MAXPACKET;
++ *anssizp = MAXPACKET;
++ *ansp = ans;
++ *anscp = ans;
++ anhp = (HEADER *) ans;
++ }
++ }
++ iov.iov_base = ans;
++ iov.iov_len = anssiz;
++ mhdr.msg_name = 0;
++ mhdr.msg_namelen = 0;
++ mhdr.msg_iov = &iov;
++ mhdr.msg_iovlen = 1;
++ mhdr.msg_control = cmsgbuf;
++ mhdr.msg_controllen = sizeof(cmsgbuf);
++ mhdr.msg_flags = 0;
++ resplen = recvmsg(s, &mhdr, 0);
++ if (resplen <= 0) {
++ if (errno == EAGAIN)
++ goto wait;
++ Perror(statp, stderr, "recvfrom", errno);
++wait2:
++ close(s);
++ if (i < j - 1)
++ memmove(pfd + i, pfd + i + 1, sizeof(*pfd) * (j - i - 1));
++ j--;
++ goto wait;
++ }
++ cmsg = CMSG_FIRSTHDR(&mhdr);
++ for (cmsg = CMSG_FIRSTHDR(&mhdr); cmsg; CMSG_NXTHDR(&mhdr, cmsg))
++ if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_TTL)
++ break;
++ if (!cmsg) {
++ Dprint(statp->options & RES_DEBUG,
++ (stdout, ";; no TTL found\n"));
++ goto wait2;
++ }
++ ttl = *(int *)CMSG_DATA(cmsg);
++ if (ttl != 255) {
++ Dprint(statp->options & RES_DEBUG,
++ (stdout, ";; answer with bad TTL: %d \n", ttl));
++ goto wait;
++ }
++ *gotsomewhere = 1;
++ if (resplen < HFIXEDSZ) {
++ /*
++ * Undersized message.
++ */
++ Dprint(statp->options & RES_DEBUG,
++ (stdout, ";; undersized: %d\n",
++ resplen));
++ *terrno = EMSGSIZE;
++ goto wait;
++ }
++ if (hp->id != anhp->id) {
++ /*
++ * response from old query, ignore it.
++ * XXX - potential security hazard could
++ * be detected here.
++ */
++ DprintQ((statp->options & RES_DEBUG) ||
++ (statp->pfcode & RES_PRF_REPLY),
++ (stdout, ";; old answer:\n"),
++ ans, (resplen > anssiz) ? anssiz : resplen);
++ goto wait;
++ }
++ if (!(statp->options & RES_INSECURE2) &&
++ !res_queriesmatch(buf, buf + buflen,
++ ans, ans + anssiz)) {
++ /*
++ * response contains wrong query? ignore it.
++ * XXX - potential security hazard could
++ * be detected here.
++ */
++ DprintQ((statp->options & RES_DEBUG) ||
++ (statp->pfcode & RES_PRF_REPLY),
++ (stdout, ";; wrong query name:\n"),
++ ans, (resplen > anssiz) ? anssiz : resplen);
++ goto wait;
++ }
++ if (anhp->rcode == SERVFAIL ||
++ anhp->rcode == NOTIMP ||
++ anhp->rcode == REFUSED) {
++ DprintQ(statp->options & RES_DEBUG,
++ (stdout, "server rejected query:\n"),
++ ans, (resplen > anssiz) ? anssiz : resplen);
++ goto wait;
++ }
++ for (i = 0; i < j; i++)
++ close(pfd[i].fd);
++#if 0
++ if (!(statp->options & RES_IGNTC) && anhp->tc) {
++ /*
++ * To get the rest of answer,
++ * use TCP with same server.
++ */
++ Dprint(statp->options & RES_DEBUG,
++ (stdout, ";; truncated answer\n"));
++ *v_circuit = 1;
++ res_nclose(statp);
++ return (1);
++ }
++#endif
++ /*
++ * All is well, or the error is fatal. Signal that the
++ * next nameserver ought not be tried.
++ */
++ return (resplen);
++}
++
+ #ifdef DEBUG
+ static void
+ Aerror(const res_state statp, FILE *file, const char *string, int error,
diff --git a/glibc-2.4.90-no_NO.diff b/glibc-2.4.90-no_NO.diff
index 64884ea..ddac96a 100644
--- a/glibc-2.4.90-no_NO.diff
+++ b/glibc-2.4.90-no_NO.diff
@@ -1,8 +1,6 @@
-Index: glibc-2.18.90/intl/locale.alias
-===================================================================
---- glibc-2.18.90.orig/intl/locale.alias
-+++ glibc-2.18.90/intl/locale.alias
-@@ -56,8 +56,6 @@ korean ko_KR.eucKR
+--- intl/locale.alias
++++ intl/locale.alias 2006/06/03 15:26:29
+@@ -58,8 +58,6 @@
korean.euc ko_KR.eucKR
ko_KR ko_KR.eucKR
lithuanian lt_LT.ISO-8859-13
@@ -11,23 +9,8 @@ Index: glibc-2.18.90/intl/locale.alias
norwegian nb_NO.ISO-8859-1
nynorsk nn_NO.ISO-8859-1
polish pl_PL.ISO-8859-2
-Index: glibc-2.18.90/localedata/SUPPORTED
-===================================================================
---- glibc-2.18.90.orig/localedata/SUPPORTED
-+++ glibc-2.18.90/localedata/SUPPORTED
-@@ -331,6 +331,8 @@ nl_NL/ISO-8859-1 \
- nl_NL@euro/ISO-8859-15 \
- nn_NO.UTF-8/UTF-8 \
- nn_NO/ISO-8859-1 \
-+no_NO.UTF-8/UTF-8 \
-+no_NO/ISO-8859-1 \
- nr_ZA/UTF-8 \
- nso_ZA/UTF-8 \
- oc_FR.UTF-8/UTF-8 \
-Index: glibc-2.18.90/localedata/locales/no_NO
-===================================================================
---- /dev/null
-+++ glibc-2.18.90/localedata/locales/no_NO
+--- localedata/locales/no_NO
++++ localedata/locales/no_NO 2006/06/03 15:26:29
@@ -0,0 +1,69 @@
+escape_char /
+comment_char %
@@ -98,3 +81,14 @@ Index: glibc-2.18.90/localedata/locales/no_NO
+LC_ADDRESS
+copy "nb_NO"
+END LC_ADDRESS
+--- localedata/SUPPORTED
++++ localedata/SUPPORTED 2006/06/03 15:27:01
+@@ -274,6 +274,8 @@
+ nl_NL@euro/ISO-8859-15 \
+ nn_NO.UTF-8/UTF-8 \
+ nn_NO/ISO-8859-1 \
++no_NO.UTF-8/UTF-8 \
++no_NO/ISO-8859-1 \
+ nr_ZA/UTF-8 \
+ nso_ZA/UTF-8 \
+ oc_FR.UTF-8/UTF-8 \
diff --git a/glibc-2.4.90-nscd.diff b/glibc-2.4.90-nscd.diff
new file mode 100644
index 0000000..115e684
--- /dev/null
+++ b/glibc-2.4.90-nscd.diff
@@ -0,0 +1,141 @@
+Index: nscd/cache.c
+===================================================================
+--- nscd/cache.c.orig
++++ nscd/cache.c
+@@ -277,28 +277,31 @@ prune_cache (struct database_dyn *table,
+ if (table->inotify_descr < 0 && table->check_file && now != LONG_MAX)
+ {
+ struct stat64 st;
++ time_t mtime;
+
+- if (stat64 (table->filename, &st) < 0)
++ mtime = stat64 (table->filename, &st) ? LONG_MAX : st.st_mtime;
++ if (mtime != table->file_mtime)
+ {
+- char buf[128];
+- /* We cannot stat() the file, disable file checking if the
+- file does not exist. */
+- dbg_log (_("cannot stat() file `%s': %s"),
+- table->filename, strerror_r (errno, buf, sizeof (buf)));
+- if (errno == ENOENT)
+- table->check_file = 0;
++ /* The file changed. Invalidate all entries. */
++ now = LONG_MAX;
++ table->file_mtime = mtime;
+ }
+- else
++ if (*table->filename2)
+ {
+- if (st.st_mtime != table->file_mtime)
++ mtime = stat64 (table->filename2, &st) ? LONG_MAX : st.st_mtime;
++ if (mtime != table->file_mtime2)
+ {
+ /* The file changed. Invalidate all entries. */
+ now = LONG_MAX;
+- table->file_mtime = st.st_mtime;
++ table->file_mtime2 = mtime;
+ }
+ }
+ }
+
++ /* now == 0 means just check for changed files */
++ if (now == (time_t)0)
++ return;
++
+ /* We run through the table and find values which are not valid anymore.
+
+ Note that for the initial step, finding the entries to be removed,
+Index: nscd/connections.c
+===================================================================
+--- nscd/connections.c.orig
++++ nscd/connections.c
+@@ -118,6 +118,7 @@ struct database_dyn dbs[lastdb] =
+ .suggested_module = DEFAULT_SUGGESTED_MODULE,
+ .reset_res = 0,
+ .filename = "/etc/passwd",
++ .filename2 = "",
+ .db_filename = _PATH_NSCD_PASSWD_DB,
+ .disabled_iov = &pwd_iov_disabled,
+ .postimeout = 3600,
+@@ -138,6 +139,7 @@ struct database_dyn dbs[lastdb] =
+ .suggested_module = DEFAULT_SUGGESTED_MODULE,
+ .reset_res = 0,
+ .filename = "/etc/group",
++ .filename2 = "",
+ .db_filename = _PATH_NSCD_GROUP_DB,
+ .disabled_iov = &grp_iov_disabled,
+ .postimeout = 3600,
+@@ -158,6 +160,7 @@ struct database_dyn dbs[lastdb] =
+ .suggested_module = DEFAULT_SUGGESTED_MODULE,
+ .reset_res = 1,
+ .filename = "/etc/hosts",
++ .filename2 = "/etc/resolv.conf",
+ .db_filename = _PATH_NSCD_HOSTS_DB,
+ .disabled_iov = &hst_iov_disabled,
+ .postimeout = 3600,
+@@ -852,15 +855,9 @@ cannot set socket to close on exec: %s;
+ /* We need the modification date of the file. */
+ struct stat64 st;
+
+- if (stat64 (dbs[cnt].filename, &st) < 0)
+- {
+- /* We cannot stat() the file, disable file checking. */
+- dbg_log (_("cannot stat() file `%s': %s"),
+- dbs[cnt].filename, strerror (errno));
+- dbs[cnt].check_file = 0;
+- }
+- else
+- dbs[cnt].file_mtime = st.st_mtime;
++ dbs[cnt].file_mtime = stat64 (dbs[cnt].filename, &st) ? LONG_MAX : st.st_mtime;
++ if (*dbs[cnt].filename2)
++ dbs[cnt].file_mtime2 = stat64 (dbs[cnt].filename2, &st) ? LONG_MAX : st.st_mtime;
+ }
+ }
+
+Index: nscd/nscd.conf
+===================================================================
+--- nscd/nscd.conf.orig
++++ nscd/nscd.conf
+@@ -61,11 +61,11 @@
+ auto-propagate group yes
+
+ enable-cache hosts yes
+- positive-time-to-live hosts 3600
+- negative-time-to-live hosts 20
++ positive-time-to-live hosts 600
++ negative-time-to-live hosts 0
+ suggested-size hosts 211
+ check-files hosts yes
+- persistent hosts yes
++ persistent hosts no
+ shared hosts yes
+ max-db-size hosts 33554432
+
+Index: nscd/nscd.h
+===================================================================
+--- nscd/nscd.h.orig
++++ nscd/nscd.h
+@@ -80,8 +80,10 @@ struct database_dyn
+ int propagate;
+ int reset_res;
+ const char filename[16];
++ const char filename2[17];
+ const char *db_filename;
+ time_t file_mtime;
++ time_t file_mtime2;
+ size_t suggested_module;
+ size_t max_db_size;
+
+Index: nscd/nscd_stat.c
+===================================================================
+--- nscd/nscd_stat.c.orig
++++ nscd/nscd_stat.c
+@@ -302,7 +302,7 @@ receive_print_stats (void)
+ data.dbs[i].maxnsearched,
+ data.dbs[i].rdlockdelayed,
+ data.dbs[i].wrlockdelayed,
+- data.dbs[i].addfailed, check_file, dbnames[i]);
++ data.dbs[i].addfailed, check_file, (strcmp(dbnames[i], "hosts") ? dbnames[i] : "{hosts,resolv.conf}"));
+ }
+
+ if (selinux_enabled)
diff --git a/glibc-2.4.90-revert-only-euro.diff b/glibc-2.4.90-revert-only-euro.diff
new file mode 100644
index 0000000..2cddb1a
--- /dev/null
+++ b/glibc-2.4.90-revert-only-euro.diff
@@ -0,0 +1,93 @@
+--- locale/iso-4217.def
++++ locale/iso-4217.def 2006/06/03 15:19:50
+@@ -8,6 +8,7 @@
+ *
+ * !!! The list has to be sorted !!!
+ */
++DEFINE_INT_CURR("ADP") /* Andorran Peseta -> EUR */
+ DEFINE_INT_CURR("AED") /* United Arab Emirates Dirham */
+ DEFINE_INT_CURR("AFN") /* Afghanistan Afgani */
+ DEFINE_INT_CURR("ALL") /* Albanian Lek */
+@@ -15,12 +16,14 @@
+ DEFINE_INT_CURR("ANG") /* Netherlands Antilles */
+ DEFINE_INT_CURR("AOA") /* Angolan Kwanza */
+ DEFINE_INT_CURR("ARS") /* Argentine Peso */
++DEFINE_INT_CURR("ATS") /* Austrian Schilling -> EUR */
+ DEFINE_INT_CURR("AUD") /* Australian Dollar */
+ DEFINE_INT_CURR("AWG") /* Aruba Guilder */
+ DEFINE_INT_CURR("AZM") /* Azerbaijan Manat */
+ DEFINE_INT_CURR("BAM") /* Bosnian and Herzegovina Convertible Mark */
+ DEFINE_INT_CURR("BBD") /* Barbados Dollar */
+ DEFINE_INT_CURR("BDT") /* Bangladesh Taka */
++DEFINE_INT_CURR("BEF") /* Belgian Franc -> EUR */
+ DEFINE_INT_CURR("BGN") /* Bulgarian Lev */
+ DEFINE_INT_CURR("BHD") /* Bahraini Dinar */
+ DEFINE_INT_CURR("BIF") /* Burundi Franc */
+@@ -45,6 +48,7 @@
+ DEFINE_INT_CURR("CVE") /* Cape Verde Escudo */
+ DEFINE_INT_CURR("CYP") /* Cypriot Pound */
+ DEFINE_INT_CURR("CZK") /* Czech Koruna */
++DEFINE_INT_CURR("DEM") /* German Mark -> EUR */
+ DEFINE_INT_CURR("DJF") /* Djibouti Franc */
+ DEFINE_INT_CURR("DKK") /* Danish Krone (Faroe Islands, Greenland) */
+ DEFINE_INT_CURR("DOP") /* Dominican Republic */
+@@ -52,16 +56,20 @@
+ DEFINE_INT_CURR("EEK") /* Estonian Kroon */
+ DEFINE_INT_CURR("EGP") /* Egyptian Pound */
+ DEFINE_INT_CURR("ERN") /* Eritrean Nakfa */
++DEFINE_INT_CURR("ESP") /* Spanish Peseta -> EUR */
+ DEFINE_INT_CURR("ETB") /* Ethiopian Birr */
+ DEFINE_INT_CURR("EUR") /* European Union Euro */
++DEFINE_INT_CURR("FIM") /* Finnish Markka -> EUR */
+ DEFINE_INT_CURR("FJD") /* Fiji Dollar */
+ DEFINE_INT_CURR("FKP") /* Falkland Islands Pound (Malvinas) */
++DEFINE_INT_CURR("FRF") /* French Franc -> EUR */
+ DEFINE_INT_CURR("GBP") /* British Pound */
+ DEFINE_INT_CURR("GEL") /* Georgia Lari */
+ DEFINE_INT_CURR("GHC") /* Ghana Cedi */
+ DEFINE_INT_CURR("GIP") /* Gibraltar Pound */
+ DEFINE_INT_CURR("GMD") /* Gambian Dalasi */
+ DEFINE_INT_CURR("GNF") /* Guinea Franc */
++DEFINE_INT_CURR("GRD") /* Greek Drachma -> EUR */
+ DEFINE_INT_CURR("GTQ") /* Guatemala Quetzal */
+ DEFINE_INT_CURR("GYD") /* Guyana Dollar */
+ DEFINE_INT_CURR("HKD") /* Hong Kong Dollar */
+@@ -70,12 +78,14 @@
+ DEFINE_INT_CURR("HTG") /* Haiti Gourde */
+ DEFINE_INT_CURR("HUF") /* Hungarian Forint */
+ DEFINE_INT_CURR("IDR") /* Indonesia Rupiah */
++DEFINE_INT_CURR("IEP") /* Irish Pound -> EUR */
+ DEFINE_INT_CURR("ILS") /* Israeli Shekel */
+ DEFINE_INT_CURR("IMP") /* Isle of Man Pounds */
+ DEFINE_INT_CURR("INR") /* Indian Rupee (Bhutan) */
+ DEFINE_INT_CURR("IQD") /* Iraqi Dinar */
+ DEFINE_INT_CURR("IRR") /* Iranian Rial */
+ DEFINE_INT_CURR("ISK") /* Iceland Krona */
++DEFINE_INT_CURR("ITL") /* Italian Lira -> EUR */
+ DEFINE_INT_CURR("JEP") /* Jersey Pound */
+ DEFINE_INT_CURR("JMD") /* Jamaican Dollar */
+ DEFINE_INT_CURR("JOD") /* Jordanian Dinar */
+@@ -95,6 +105,7 @@
+ DEFINE_INT_CURR("LRD") /* Liberian Dollar */
+ DEFINE_INT_CURR("LSL") /* Lesotho Maloti */
+ DEFINE_INT_CURR("LTL") /* Lithuanian Litas */
++DEFINE_INT_CURR("LUF") /* Luxembourg Franc -> EUR */
+ DEFINE_INT_CURR("LVL") /* Latvia Lat */
+ DEFINE_INT_CURR("LYD") /* Libyan Arab Jamahiriya Dinar */
+ DEFINE_INT_CURR("MAD") /* Moroccan Dirham */
+@@ -115,6 +126,7 @@
+ DEFINE_INT_CURR("NAD") /* Namibia Dollar */
+ DEFINE_INT_CURR("NGN") /* Nigeria Naira */
+ DEFINE_INT_CURR("NIO") /* Nicaragua Cordoba Oro */
++DEFINE_INT_CURR("NLG") /* Netherlands Guilder -> EUR */
+ DEFINE_INT_CURR("NOK") /* Norwegian Krone */
+ DEFINE_INT_CURR("NPR") /* Nepalese Rupee */
+ DEFINE_INT_CURR("NZD") /* New Zealand Dollar */
+@@ -125,6 +137,7 @@
+ DEFINE_INT_CURR("PHP") /* Philippines Peso */
+ DEFINE_INT_CURR("PKR") /* Pakistan Rupee */
+ DEFINE_INT_CURR("PLN") /* Polish Zloty */
++DEFINE_INT_CURR("PTE") /* Portugese Escudo -> EUR */
+ DEFINE_INT_CURR("PYG") /* Paraguay Guarani */
+ DEFINE_INT_CURR("QAR") /* Qatar Rial */
+ DEFINE_INT_CURR("ROL") /* Romanian Leu */
diff --git a/glibc-2.5-ppc-llrintl.diff b/glibc-2.5-ppc-llrintl.diff
new file mode 100644
index 0000000..08fc47f
--- /dev/null
+++ b/glibc-2.5-ppc-llrintl.diff
@@ -0,0 +1,18 @@
+diff -urN dummy-cpu/powerpc-cpu-v0.05/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S libc25/powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S
+--- powerpc-cpu-v0.05/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S 2006-04-06 10:50:35.000000000 -0500
++++ powerpc-cpu/sysdeps/powerpc/powerpc32/powerpc64/fpu/s_llrint.S 2007-03-14 14:55:19.113013712 -0500
+@@ -18,6 +18,7 @@
+ 02110-1301 USA. */
+
+ #include
++#include
+
+ /* long long int[r3, r4] __llrint (double x[fp1]) */
+ ENTRY (__llrint)
+@@ -41,3 +42,6 @@
+ strong_alias (__llrint, __llrintl)
+ weak_alias (__llrint, llrintl)
+ #endif
++#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
++compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
++#endif
diff --git a/glibc-2.6-configure.diff b/glibc-2.6-configure.diff
new file mode 100644
index 0000000..906b29e
--- /dev/null
+++ b/glibc-2.6-configure.diff
@@ -0,0 +1,50 @@
+Index: configure.in
+===================================================================
+RCS file: /cvs/glibc/libc/configure.in,v
+retrieving revision 1.469
+diff -u -a -p -u -p -a -r1.469 configure.in
+--- configure.in 20 Mar 2007 12:11:23 -0000 1.469
++++ configure.in 13 Jul 2007 13:40:20 -0000
+@@ -1278,7 +1278,7 @@ EOF
+ fi
+ fi
+ fi
+- rm -f conftest.[cs]
++ rm -f conftest*
+ ])
+ if test $libc_cv_visibility_attribute != yes; then
+ AC_MSG_ERROR(compiler support for visibility attribute is required)
+@@ -1294,7 +1294,7 @@ EOF
+ int bar (int x) { return x; }
+ EOF
+ libc_cv_broken_visibility_attribute=yes
+- if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s1>&AS_MESSAGE_LOG_FD); then
++ if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s >&AS_MESSAGE_LOG_FD); then
+ changequote(,)dnl
+ if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
+ changequote([,])dnl
+Index: configure
+===================================================================
+RCS file: /cvs/glibc/libc/configure,v
+retrieving revision 1.459
+diff -u -a -p -u -p -a -r1.459 configure
+--- configure 20 Mar 2007 12:11:23 -0000 1.459
++++ configure 13 Jul 2007 13:41:41 -0000
+@@ -5371,7 +5371,7 @@ EOF
+ fi
+ fi
+ fi
+- rm -f conftest.cs
++ rm -f conftest*
+
+ fi
+ echo "$as_me:$LINENO: result: $libc_cv_visibility_attribute" >&5
+@@ -5395,7 +5395,7 @@ else
+ int bar (int x) { return x; }
+ EOF
+ libc_cv_broken_visibility_attribute=yes
+- if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s1>&5'
++ if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
diff --git a/glibc-2.8-clone.diff b/glibc-2.8-clone.diff
new file mode 100644
index 0000000..ed8f017
--- /dev/null
+++ b/glibc-2.8-clone.diff
@@ -0,0 +1,50 @@
+Index: sysdeps/unix/sysv/linux/x86_64/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/x86_64/clone.S,v
+retrieving revision 1.7
+diff -u -r1.7 clone.S
+--- sysdeps/unix/sysv/linux/x86_64/clone.S 3 Dec 2006 23:12:36 -0000 1.7
++++ sysdeps/unix/sysv/linux/x86_64/clone.S 25 Jun 2008 11:26:15 -0000
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+diff -u -r1.27 clone.S
+--- sysdeps/unix/sysv/linux/i386/clone.S 3 Dec 2006 23:12:36 -0000 1.27
++++ sysdeps/unix/sysv/linux/i386/clone.S 25 Jun 2008 11:26:16 -0000
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/glibc-2.8-dlosinfo.diff b/glibc-2.8-dlosinfo.diff
new file mode 100644
index 0000000..de6c06b
--- /dev/null
+++ b/glibc-2.8-dlosinfo.diff
@@ -0,0 +1,14 @@
+Compilation fix
+
+diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
+index b13b6cf..8d22a69 100644
+--- sysdeps/unix/sysv/linux/dl-osinfo.h
++++ sysdeps/unix/sysv/linux/dl-osinfo.h
+@@ -17,6 +17,7 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include
+ #include
+ #include
+ #include
diff --git a/glibc-2.8-getconf.diff b/glibc-2.8-getconf.diff
new file mode 100644
index 0000000..a75a57e
--- /dev/null
+++ b/glibc-2.8-getconf.diff
@@ -0,0 +1,14 @@
+This is required for too noisy rpmlint.
+
+--- posix/Makefile~ 2007-11-21 05:40:26.234633000 +0100
++++ posix/Makefile 2007-11-21 05:41:02.043775000 +0100
+@@ -296,8 +296,7 @@
+ $(addprefix $(..)./scripts/mkinstalldirs ,\
+ $(filter-out $(wildcard $@),$@))
+ while read spec; do \
+- ln -f $< $@/$$spec.new || $(INSTALL_PROGRAM) $< $@/$$spec.new; \
+- mv -f $@/$$spec.new $@/$$spec; \
++ ln -s ../../bin/getconf $@/$$spec; \
+ done < $(objpfx)getconf.speclist
+
+ $(objpfx)getconf.speclist: $(objpfx)getconf
diff --git a/glibc-2.8-revert-nscleanup.diff b/glibc-2.8-revert-nscleanup.diff
new file mode 100644
index 0000000..1f6c319
--- /dev/null
+++ b/glibc-2.8-revert-nscleanup.diff
@@ -0,0 +1,824 @@
+diff --git a/inet/netinet/in.h b/inet/netinet/in.h
+index e3446a9..1366198 100644
+--- inet/netinet/in.h
++++ inet/netinet/in.h
+@@ -195,17 +195,13 @@ struct in6_addr
+ {
+ union
+ {
+- uint8_t __u6_addr8[16];
+-#if defined __USE_MISC || defined __USE_GNU
+- uint16_t __u6_addr16[8];
+- uint32_t __u6_addr32[4];
+-#endif
+- } __in6_u;
+-#define s6_addr __in6_u.__u6_addr8
+-#if defined __USE_MISC || defined __USE_GNU
+-# define s6_addr16 __in6_u.__u6_addr16
+-# define s6_addr32 __in6_u.__u6_addr32
+-#endif
++ uint8_t u6_addr8[16];
++ uint16_t u6_addr16[8];
++ uint32_t u6_addr32[4];
++ } in6_u;
++#define s6_addr in6_u.u6_addr8
++#define s6_addr16 in6_u.u6_addr16
++#define s6_addr32 in6_u.u6_addr32
+ };
+
+ extern const struct in6_addr in6addr_any; /* :: */
+@@ -242,7 +238,6 @@ struct sockaddr_in6
+ };
+
+
+-#if defined __USE_MISC || defined __USE_GNU
+ /* IPv4 multicast request. */
+ struct ip_mreq
+ {
+@@ -264,8 +259,6 @@ struct ip_mreq_source
+ /* IP address of interface. */
+ struct in_addr imr_sourceaddr;
+ };
+-#endif
+-
+
+ /* Likewise, for IPv6. */
+ struct ipv6_mreq
+@@ -278,7 +271,6 @@ struct ipv6_mreq
+ };
+
+
+-#if defined __USE_MISC || defined __USE_GNU
+ /* Multicast group request. */
+ struct group_req
+ {
+@@ -345,7 +337,6 @@ struct group_filter
+ - sizeof (struct sockaddr_storage) \
+ + ((numsrc) \
+ * sizeof (struct sockaddr_storage)))
+-#endif
+
+
+ /* Get system-specific definitions. */
+@@ -431,14 +422,12 @@ extern uint16_t htons (uint16_t __hostshort)
+ && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
+ && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
+
+-#if defined __USE_MISC || defined __USE_GNU
+ /* Bind socket to a privileged IP port. */
+ extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
+
+ /* The IPv6 version of this function. */
+ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
+ __THROW;
+-#endif
+
+
+ #define IN6_IS_ADDR_MC_NODELOCAL(a) \
+@@ -461,8 +450,6 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
+ (IN6_IS_ADDR_MULTICAST(a) \
+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
+
+-
+-#ifdef __USE_GNU
+ /* IPv6 packet information. */
+ struct in6_pktinfo
+ {
+@@ -478,6 +465,7 @@ struct ip6_mtuinfo
+ };
+
+
++#ifdef __USE_GNU
+ /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
+ extern int inet6_option_space (int __nbytes)
+ __THROW __attribute_deprecated__;
+diff --git a/posix/regex.h b/posix/regex.h
+index 2132772..a058e3f 100644
+--- posix/regex.h
++++ posix/regex.h
+@@ -43,21 +43,20 @@ typedef unsigned long int active_reg_t;
+ add or remove a bit, only one other definition need change. */
+ typedef unsigned long int reg_syntax_t;
+
+-#ifdef __USE_GNU
+ /* If this bit is not set, then \ inside a bracket expression is literal.
+ If set, then such a \ quotes the following character. */
+-# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
++#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
+
+ /* If this bit is not set, then + and ? are operators, and \+ and \? are
+ literals.
+ If set, then \+ and \? are operators and + and ? are literals. */
+-# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
++#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
+
+ /* If this bit is set, then character classes are supported. They are:
+ [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
+ [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
+ If not set, then character classes are not supported. */
+-# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
++#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
+
+ /* If this bit is set, then ^ and $ are always anchors (outside bracket
+ expressions, of course).
+@@ -71,7 +70,7 @@ typedef unsigned long int reg_syntax_t;
+ POSIX draft 11.2 says that * etc. in leading positions is undefined.
+ We already implemented a previous draft which made those constructs
+ invalid, though, so we haven't changed the code back. */
+-# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
++#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
+
+ /* If this bit is set, then special characters are always special
+ regardless of where they are in the pattern.
+@@ -79,71 +78,71 @@ typedef unsigned long int reg_syntax_t;
+ some contexts; otherwise they are ordinary. Specifically,
+ * + ? and intervals are only special when not after the beginning,
+ open-group, or alternation operator. */
+-# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
++#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
+
+ /* If this bit is set, then *, +, ?, and { cannot be first in an re or
+ immediately after an alternation or begin-group operator. */
+-# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
++#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
+
+ /* If this bit is set, then . matches newline.
+ If not set, then it doesn't. */
+-# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
++#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
+
+ /* If this bit is set, then . doesn't match NUL.
+ If not set, then it does. */
+-# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
++#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
+
+ /* If this bit is set, nonmatching lists [^...] do not match newline.
+ If not set, they do. */
+-# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
++#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
+
+ /* If this bit is set, either \{...\} or {...} defines an
+ interval, depending on RE_NO_BK_BRACES.
+ If not set, \{, \}, {, and } are literals. */
+-# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
++#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
+
+ /* If this bit is set, +, ? and | aren't recognized as operators.
+ If not set, they are. */
+-# define RE_LIMITED_OPS (RE_INTERVALS << 1)
++#define RE_LIMITED_OPS (RE_INTERVALS << 1)
+
+ /* If this bit is set, newline is an alternation operator.
+ If not set, newline is literal. */
+-# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
++#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
+
+ /* If this bit is set, then `{...}' defines an interval, and \{ and \}
+ are literals.
+ If not set, then `\{...\}' defines an interval. */
+-# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
++#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
+
+ /* If this bit is set, (...) defines a group, and \( and \) are literals.
+ If not set, \(...\) defines a group, and ( and ) are literals. */
+-# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
++#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
+
+ /* If this bit is set, then \ matches .
+ If not set, then \ is a back-reference. */
+-# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
++#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
+
+ /* If this bit is set, then | is an alternation operator, and \| is literal.
+ If not set, then \| is an alternation operator, and | is literal. */
+-# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
++#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
+
+ /* If this bit is set, then an ending range point collating higher
+ than the starting range point, as in [z-a], is invalid.
+ If not set, then when ending range point collates higher than the
+ starting range point, the range is ignored. */
+-# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
++#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
+
+ /* If this bit is set, then an unmatched ) is ordinary.
+ If not set, then an unmatched ) is invalid. */
+-# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
++#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
+
+ /* If this bit is set, succeed as soon as we match the whole pattern,
+ without further backtracking. */
+-# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
++#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
+
+ /* If this bit is set, do not process the GNU regex operators.
+ If not set, then the GNU regex operators are recognized. */
+-# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
++#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
+
+ /* If this bit is set, turn on internal regex debugging.
+ If not set, and debugging was on, turn it off.
+@@ -151,30 +150,29 @@ typedef unsigned long int reg_syntax_t;
+ We define this bit always, so that all that's needed to turn on
+ debugging is to recompile regex.c; the calling code can always have
+ this bit set, and it won't affect anything in the normal case. */
+-# define RE_DEBUG (RE_NO_GNU_OPS << 1)
++#define RE_DEBUG (RE_NO_GNU_OPS << 1)
+
+ /* If this bit is set, a syntactically invalid interval is treated as
+ a string of ordinary characters. For example, the ERE 'a{1' is
+ treated as 'a\{1'. */
+-# define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
++#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+
+ /* If this bit is set, then ignore case when matching.
+ If not set, then case is significant. */
+-# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
++#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+
+ /* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
+ for ^, because it is difficult to scan the regex backwards to find
+ whether ^ should be special. */
+-# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
++#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
+
+ /* If this bit is set, then \{ cannot be first in an bre or
+ immediately after an alternation or begin-group operator. */
+-# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
++#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
+
+ /* If this bit is set, then no_sub will be set to 1 during
+ re_compile_pattern. */
+-# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+-#endif
++#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+
+ /* This global variable defines the particular regexp syntax to use (for
+ some interfaces). When a regexp is compiled, the syntax used is
+@@ -182,7 +180,6 @@ typedef unsigned long int reg_syntax_t;
+ already-compiled regexps. */
+ extern reg_syntax_t re_syntax_options;
+
+-#ifdef __USE_GNU
+ /* Define combinations of the above bits for the standard possibilities.
+ (The [[[ comments delimit what gets put into the Texinfo file, so
+ don't delete them!) */
+@@ -257,12 +254,11 @@ extern reg_syntax_t re_syntax_options;
+ /* Maximum number of duplicates an interval can allow. Some systems
+ (erroneously) define this in other header files, but we want our
+ value, so remove any previous define. */
+-# ifdef RE_DUP_MAX
+-# undef RE_DUP_MAX
+-# endif
+-/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
+-# define RE_DUP_MAX (0x7fff)
++#ifdef RE_DUP_MAX
++# undef RE_DUP_MAX
+ #endif
++/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
++#define RE_DUP_MAX (0x7fff)
+
+
+ /* POSIX `cflags' bits (i.e., information for `regcomp'). */
+@@ -341,16 +337,7 @@ typedef enum
+ private to the regex routines. */
+
+ #ifndef RE_TRANSLATE_TYPE
+-# define __RE_TRANSLATE_TYPE unsigned char *
+-# ifdef __USE_GNU
+-# define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
+-# endif
+-#endif
+-
+-#ifdef __USE_GNU
+-# define __REPB_PREFIX(name) name
+-#else
+-# define __REPB_PREFIX(name) __##name
++# define RE_TRANSLATE_TYPE unsigned char *
+ #endif
+
+ struct re_pattern_buffer
+@@ -358,27 +345,27 @@ struct re_pattern_buffer
+ /* Space that holds the compiled pattern. It is declared as
+ `unsigned char *' because its elements are sometimes used as
+ array indexes. */
+- unsigned char *__REPB_PREFIX(buffer);
++ unsigned char *buffer;
+
+ /* Number of bytes to which `buffer' points. */
+- unsigned long int __REPB_PREFIX(allocated);
++ unsigned long int allocated;
+
+ /* Number of bytes actually used in `buffer'. */
+- unsigned long int __REPB_PREFIX(used);
++ unsigned long int used;
+
+ /* Syntax setting with which the pattern was compiled. */
+- reg_syntax_t __REPB_PREFIX(syntax);
++ reg_syntax_t syntax;
+
+ /* Pointer to a fastmap, if any, otherwise zero. re_search uses the
+ fastmap, if there is one, to skip over impossible starting points
+ for matches. */
+- char *__REPB_PREFIX(fastmap);
++ char *fastmap;
+
+ /* Either a translate table to apply to all characters before
+ comparing them, or zero for no translation. The translation is
+ applied to a pattern when it is compiled and to a string when it
+ is matched. */
+- __RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
++ RE_TRANSLATE_TYPE translate;
+
+ /* Number of subexpressions found by the compiler. */
+ size_t re_nsub;
+@@ -387,36 +374,34 @@ struct re_pattern_buffer
+ Well, in truth it's used only in `re_search_2', to see whether or
+ not we should use the fastmap, so we don't set this absolutely
+ perfectly; see `re_compile_fastmap' (the `duplicate' case). */
+- unsigned __REPB_PREFIX(can_be_null) : 1;
++ unsigned can_be_null : 1;
+
+ /* If REGS_UNALLOCATED, allocate space in the `regs' structure
+ for `max (RE_NREGS, re_nsub + 1)' groups.
+ If REGS_REALLOCATE, reallocate space if necessary.
+ If REGS_FIXED, use what's there. */
+-#ifdef __USE_GNU
+-# define REGS_UNALLOCATED 0
+-# define REGS_REALLOCATE 1
+-# define REGS_FIXED 2
+-#endif
+- unsigned __REPB_PREFIX(regs_allocated) : 2;
++#define REGS_UNALLOCATED 0
++#define REGS_REALLOCATE 1
++#define REGS_FIXED 2
++ unsigned regs_allocated : 2;
+
+ /* Set to zero when `regex_compile' compiles a pattern; set to one
+ by `re_compile_fastmap' if it updates the fastmap. */
+- unsigned __REPB_PREFIX(fastmap_accurate) : 1;
++ unsigned fastmap_accurate : 1;
+
+ /* If set, `re_match_2' does not return information about
+ subexpressions. */
+- unsigned __REPB_PREFIX(no_sub) : 1;
++ unsigned no_sub : 1;
+
+ /* If set, a beginning-of-line anchor doesn't match at the beginning
+ of the string. */
+- unsigned __REPB_PREFIX(not_bol) : 1;
++ unsigned not_bol : 1;
+
+ /* Similarly for an end-of-line anchor. */
+- unsigned __REPB_PREFIX(not_eol) : 1;
++ unsigned not_eol : 1;
+
+ /* If true, an anchor at a newline matches. */
+- unsigned __REPB_PREFIX(newline_anchor) : 1;
++ unsigned newline_anchor : 1;
+ };
+
+ typedef struct re_pattern_buffer regex_t;
+@@ -425,7 +410,6 @@ typedef struct re_pattern_buffer regex_t;
+ typedef int regoff_t;
+
+
+-#ifdef __USE_GNU
+ /* This is the structure we store register match data in. See
+ regex.texinfo for a full description of what registers match. */
+ struct re_registers
+@@ -439,9 +423,8 @@ struct re_registers
+ /* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
+ `re_match_2' returns information about at least this many registers
+ the first time a `regs' structure is passed. */
+-# ifndef RE_NREGS
+-# define RE_NREGS 30
+-# endif
++#ifndef RE_NREGS
++# define RE_NREGS 30
+ #endif
+
+
+@@ -456,7 +439,6 @@ typedef struct
+
+ /* Declarations for routines. */
+
+-#ifdef __USE_GNU
+ /* Sets the current default syntax to SYNTAX, and return the old syntax.
+ You can also simply assign to the `re_syntax_options' variable. */
+ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
+@@ -521,9 +503,8 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer,
+ struct re_registers *__regs,
+ unsigned int __num_regs,
+ regoff_t *__starts, regoff_t *__ends);
+-#endif /* Use GNU */
+
+-#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
++#if defined _REGEX_RE_COMP || defined _LIBC
+ # ifndef _CRAY
+ /* 4.2 bsd compatibility. */
+ extern char *re_comp (const char *);
+diff --git a/resolv/netdb.h b/resolv/netdb.h
+index a260c48..7c5c9c9 100644
+--- resolv/netdb.h
++++ resolv/netdb.h
+@@ -62,6 +62,8 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
+
+
+ /* Possible values left in `h_errno'. */
++#define NETDB_INTERNAL -1 /* See errno. */
++#define NETDB_SUCCESS 0 /* No problem. */
+ #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
+ #define TRY_AGAIN 2 /* Non-Authoritative Host not found,
+ or SERVERFAIL. */
+@@ -69,11 +71,7 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
+ NOTIMP. */
+ #define NO_DATA 4 /* Valid name, no data record of requested
+ type. */
+-#if defined __USE_MISC || defined __USE_GNU
+-# define NETDB_INTERNAL -1 /* See errno. */
+-# define NETDB_SUCCESS 0 /* No problem. */
+-# define NO_ADDRESS NO_DATA /* No address, look for MX record. */
+-#endif
++#define NO_ADDRESS NO_DATA /* No address, look for MX record. */
+
+ #ifdef __USE_XOPEN2K
+ /* Highest reserved Internet port number. */
+@@ -85,14 +83,13 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
+ # define SCOPE_DELIMITER '%'
+ #endif
+
+-#if defined __USE_MISC || defined __USE_GNU
+ /* Print error indicated by `h_errno' variable on standard error. STR
+ if non-null is printed before the error string. */
+ extern void herror (__const char *__str) __THROW;
+
+ /* Return string associated with error ERR_NUM. */
+ extern __const char *hstrerror (int __err_num) __THROW;
+-#endif
++
+
+
+ /* Description of data base entry for a single host. */
+@@ -103,9 +100,7 @@ struct hostent
+ int h_addrtype; /* Host address type. */
+ int h_length; /* Length of address. */
+ char **h_addr_list; /* List of addresses from name server. */
+-#if defined __USE_MISC || defined __USE_GNU
+-# define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
+-#endif
++#define h_addr h_addr_list[0] /* Address, for backward compatibility. */
+ };
+
+ /* Open host data base files and mark them as staying open even after
+@@ -595,15 +590,15 @@ struct gaicb
+ # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
+ # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
+ # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
++# define EAI_NODATA -5 /* No address associated with NAME. */
+ # define EAI_FAMILY -6 /* `ai_family' not supported. */
+ # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
+ # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
++# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
+ # define EAI_MEMORY -10 /* Memory allocation failure. */
+ # define EAI_SYSTEM -11 /* System error returned in `errno'. */
+ # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
+ # ifdef __USE_GNU
+-# define EAI_NODATA -5 /* No address associated with NAME. */
+-# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
+ # define EAI_INPROGRESS -100 /* Processing request in progress. */
+ # define EAI_CANCELED -101 /* Request canceled. */
+ # define EAI_NOTCANCELED -102 /* Request not canceled. */
+@@ -612,10 +607,8 @@ struct gaicb
+ # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
+ # endif
+
+-# ifdef __USE_MISC
+-# define NI_MAXHOST 1025
+-# define NI_MAXSERV 32
+-# endif
++# define NI_MAXHOST 1025
++# define NI_MAXSERV 32
+
+ # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
+ # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
+diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
+index 433c033..6880a2e 100644
+--- sysdeps/unix/sysv/linux/bits/in.h
++++ sysdeps/unix/sysv/linux/bits/in.h
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1991-1999, 2000, 2004, 2008 Free Software Foundation, Inc.
++/* Copyright (C) 1991-1999, 2000, 2004 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
+@@ -43,18 +43,16 @@
+ #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */
+ #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */
+ #define IP_MSFILTER 41
+-#if defined __USE_MISC || defined __USE_GNU
+-# define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */
+-# define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */
+-# define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/
+-# define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */
+-# define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */
+-# define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/
+-# define MCAST_MSFILTER 48
+-
+-# define MCAST_EXCLUDE 0
+-# define MCAST_INCLUDE 1
+-#endif
++#define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */
++#define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */
++#define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/
++#define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */
++#define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */
++#define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/
++#define MCAST_MSFILTER 48
++
++#define MCAST_EXCLUDE 0
++#define MCAST_INCLUDE 1
+
+ #define IP_ROUTER_ALERT 5 /* bool */
+ #define IP_PKTINFO 8 /* bool */
+@@ -78,7 +76,6 @@
+ #define IP_DEFAULT_MULTICAST_LOOP 1
+ #define IP_MAX_MEMBERSHIPS 20
+
+-#if defined __USE_MISC || defined __USE_GNU
+ /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
+ The `ip_dst' field is used for the first-hop gateway when using a
+ source route (this gets put into the header proper). */
+@@ -103,7 +100,6 @@ struct in_pktinfo
+ struct in_addr ipi_spec_dst; /* Routing destination address */
+ struct in_addr ipi_addr; /* Header destination address */
+ };
+-#endif
+
+ /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
+ The first word in the comment at the right is the data type used;
+diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
+index ceb6013..11bb607 100644
+--- sysdeps/unix/sysv/linux/bits/socket.h
++++ sysdeps/unix/sysv/linux/bits/socket.h
+@@ -26,8 +26,10 @@
+ #endif
+
+ #define __need_size_t
++#define __need_NULL
+ #include
+
++#include
+ #include
+
+ /* Type for length arguments in socket calls. */
+@@ -154,7 +156,11 @@ struct sockaddr
+
+ /* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+-#define __ss_aligntype unsigned long int
++#if ULONG_MAX > 0xffffffff
++# define __ss_aligntype __uint64_t
++#else
++# define __ss_aligntype __uint32_t
++#endif
+ #define _SS_SIZE 128
+ #define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+@@ -257,7 +263,7 @@ struct cmsghdr
+ #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+ #define CMSG_FIRSTHDR(mhdr) \
+ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
+- ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
++ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+ #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+ & (size_t) ~(sizeof (size_t) - 1))
+ #define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+@@ -301,74 +307,18 @@ enum
+ #endif
+ };
+
+-#ifdef __USE_GNU
+ /* User visible structure for SCM_CREDENTIALS message */
++
+ struct ucred
+ {
+ pid_t pid; /* PID of sending process. */
+ uid_t uid; /* UID of sending process. */
+ gid_t gid; /* GID of sending process. */
+ };
+-#endif
+-
+-/* Ugly workaround for unclean kernel headers. */
+-#if !defined __USE_MISC && !defined __USE_GNU
+-# ifndef FIOGETOWN
+-# define __SYS_SOCKET_H_undef_FIOGETOWN
+-# endif
+-# ifndef FIOSETOWN
+-# define __SYS_SOCKET_H_undef_FIOSETOWN
+-# endif
+-# ifndef SIOCATMARK
+-# define __SYS_SOCKET_H_undef_SIOCATMARK
+-# endif
+-# ifndef SIOCGPGRP
+-# define __SYS_SOCKET_H_undef_SIOCGPGRP
+-# endif
+-# ifndef SIOCGSTAMP
+-# define __SYS_SOCKET_H_undef_SIOCGSTAMP
+-# endif
+-# ifndef SIOCGSTAMPNS
+-# define __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+-# endif
+-# ifndef SIOCSPGRP
+-# define __SYS_SOCKET_H_undef_SIOCSPGRP
+-# endif
+-#endif
+
+ /* Get socket manipulation related informations from kernel headers. */
+ #include
+
+-#if !defined __USE_MISC && !defined __USE_GNU
+-# ifdef __SYS_SOCKET_H_undef_FIOGETOWN
+-# undef __SYS_SOCKET_H_undef_FIOGETOWN
+-# undef FIOGETOWN
+-# endif
+-# ifdef __SYS_SOCKET_H_undef_FIOSETOWN
+-# undef __SYS_SOCKET_H_undef_FIOSETOWN
+-# undef FIOSETOWN
+-# endif
+-# ifdef __SYS_SOCKET_H_undef_SIOCATMARK
+-# undef __SYS_SOCKET_H_undef_SIOCATMARK
+-# undef SIOCATMARK
+-# endif
+-# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP
+-# undef __SYS_SOCKET_H_undef_SIOCGPGRP
+-# undef SIOCGPGRP
+-# endif
+-# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP
+-# undef __SYS_SOCKET_H_undef_SIOCGSTAMP
+-# undef SIOCGSTAMP
+-# endif
+-# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+-# undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+-# undef SIOCGSTAMPNS
+-# endif
+-# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP
+-# undef __SYS_SOCKET_H_undef_SIOCSPGRP
+-# undef SIOCSPGRP
+-# endif
+-#endif
+
+ /* Structure used to manipulate the SO_LINGER option. */
+ struct linger
+diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
+index 286c1a2..add2c8e 100644
+--- sysdeps/unix/sysv/linux/x86_64/bits/stat.h
++++ sysdeps/unix/sysv/linux/x86_64/bits/stat.h
+@@ -61,7 +61,7 @@ struct stat
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ #if __WORDSIZE == 64
+- int __pad0;
++ int pad0;
+ #endif
+ __dev_t st_rdev; /* Device number, if device. */
+ #if __WORDSIZE == 32
+@@ -129,7 +129,7 @@ struct stat64
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ #if __WORDSIZE == 64
+- int __pad0;
++ int pad0;
+ __dev_t st_rdev; /* Device number, if device. */
+ __off_t st_size; /* Size of file, in bytes. */
+ #else
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index 9a27efd..c911345 100644
+--- sysdeps/posix/getaddrinfo.c
++++ sysdeps/posix/getaddrinfo.c
+@@ -1105,22 +1105,22 @@ static const struct prefixentry *labels;
+ static const struct prefixentry default_labels[] =
+ {
+ /* See RFC 3484 for the details. */
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }
+- }, 128, 0 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 16, 2 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 96, 3 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } }
+- }, 96, 4 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } },
++ 128, 0 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 16, 2 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 96, 3 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
++ 96, 4 },
+ /* The next two entries differ from RFC 3484. We need to treat
+ IPv6 site-local addresses special because they are never NATed,
+ unlike site-locale IPv4 addresses. If this would not happen, on
+@@ -1128,23 +1128,23 @@ static const struct prefixentry default_labels[] =
+ sorting would prefer the IPv6 site-local addresses, causing
+ unnecessary delays when trying to connect to a global IPv6 address
+ through a site-local IPv6 address. */
+- { { .__in6_u
+- = { .__u6_addr8 = { 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 10, 5 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 7, 6 },
++ { { .in6_u
++ = { .u6_addr8 = { 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 10, 5 },
++ { { .in6_u
++ = { .u6_addr8 = { 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 7, 6 },
+ /* Additional rule for Teredo tunnels. */
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 32, 7 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 0, 1 }
++ { { .in6_u
++ = { .u6_addr8 = { 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 32, 7 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 0, 1 }
+ };
+
+
+@@ -1155,26 +1155,26 @@ static const struct prefixentry *precedence;
+ static const struct prefixentry default_precedence[] =
+ {
+ /* See RFC 3484 for the details. */
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }
+- }, 128, 50 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 16, 30 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 96, 20 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } }
+- }, 96, 10 },
+- { { .__in6_u
+- = { .__u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+- }, 0, 40 }
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } },
++ 128, 50 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 16, 30 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 96, 20 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
++ 96, 10 },
++ { { .in6_u
++ = { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
++ 0, 40 }
+ };
+
+
diff --git a/glibc-2.9-2008111711.tar.bz2 b/glibc-2.9-2008111711.tar.bz2
new file mode 100644
index 0000000..4d0f2fc
--- /dev/null
+++ b/glibc-2.9-2008111711.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:adabcdd26bd71d7cb15bfc2fbb3efc29ad9d166a2a3f25bed097e14489264de8
+size 15308055
diff --git a/glibc-c-utf8-locale.patch b/glibc-c-utf8-locale.patch
deleted file mode 100644
index 13f6318..0000000
--- a/glibc-c-utf8-locale.patch
+++ /dev/null
@@ -1,267 +0,0 @@
-From 2eda7b462b415105f5a05c1323372d4e39d46439 Mon Sep 17 00:00:00 2001
-From: Mike FABIAN
-Date: Mon, 10 Aug 2015 15:58:12 +0200
-Subject: [PATCH] Add a C.UTF-8 locale
-
----
- localedata/SUPPORTED | 1 +
- localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 239 insertions(+)
- create mode 100644 localedata/locales/C
-
-diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
-index 8ca023e..2a78391 100644
---- a/localedata/SUPPORTED
-+++ b/localedata/SUPPORTED
-@@ -1,6 +1,7 @@
- # This file names the currently supported and somewhat tested locales.
- # If you have any additions please file a glibc bug report.
- SUPPORTED-LOCALES=\
-+C.UTF-8/UTF-8 \
- aa_DJ.UTF-8/UTF-8 \
- aa_DJ/ISO-8859-1 \
- aa_ER/UTF-8 \
-diff --git a/localedata/locales/C b/localedata/locales/C
-new file mode 100644
-index 0000000..fdf460e
---- /dev/null
-+++ b/localedata/locales/C
-@@ -0,0 +1,238 @@
-+escape_char /
-+comment_char %
-+% Locale for C locale in UTF-8
-+
-+LC_IDENTIFICATION
-+title "C locale"
-+source ""
-+address ""
-+contact ""
-+email "mfabian@redhat.com"
-+tel ""
-+fax ""
-+language "C"
-+territory ""
-+revision "1.0"
-+date "2015-08-10"
-+%
-+category "i18n:2012";LC_IDENTIFICATION
-+category "i18n:2012";LC_CTYPE
-+category "i18n:2012";LC_COLLATE
-+category "i18n:2012";LC_TIME
-+category "i18n:2012";LC_NUMERIC
-+category "i18n:2012";LC_MONETARY
-+category "i18n:2012";LC_MESSAGES
-+category "i18n:2012";LC_PAPER
-+category "i18n:2012";LC_NAME
-+category "i18n:2012";LC_ADDRESS
-+category "i18n:2012";LC_TELEPHONE
-+category "i18n:2012";LC_MEASUREMENT
-+END LC_IDENTIFICATION
-+
-+LC_CTYPE
-+copy "i18n"
-+
-+translit_start
-+include "translit_combining";""
-+translit_end
-+
-+END LC_CTYPE
-+
-+LC_COLLATE
-+order_start forward
-+
-+..
-+
-+
-+..
-+
-+
-+..
-+
-+
-+..
-+
-+
-+..
-+
-+
-+..
-+
-+UNDEFINED
-+order_end
-+END LC_COLLATE
-+
-+LC_MONETARY
-+% This is the 14652 i18n fdcc-set definition for
-+% the LC_MONETARY category
-+% (except for the int_curr_symbol and currency_symbol, they are empty in
-+% the 14652 i18n fdcc-set definition and also empty in
-+% glibc/locale/C-monetary.c. But localedef complains in that case).
-+%
-+% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
-+% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
-+int_curr_symbol ""
-+% Using "$" for currency_symbol. But maybe would be better?
-+% U+00A4 is the "generic currency symbol"
-+% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
-+currency_symbol ""
-+mon_decimal_point ""
-+mon_thousands_sep ""
-+mon_grouping -1
-+positive_sign ""
-+negative_sign ""
-+int_frac_digits -1
-+frac_digits -1
-+p_cs_precedes -1
-+int_p_sep_by_space -1
-+p_sep_by_space -1
-+n_cs_precedes -1
-+int_n_sep_by_space -1
-+n_sep_by_space -1
-+p_sign_posn -1
-+n_sign_posn -1
-+%
-+END LC_MONETARY
-+
-+LC_NUMERIC
-+% This is the POSIX Locale definition for
-+% the LC_NUMERIC category.
-+%
-+decimal_point ""
-+thousands_sep ""
-+grouping -1
-+END LC_NUMERIC
-+
-+LC_TIME
-+% This is the POSIX Locale definition for
-+% the LC_TIME category.
-+%
-+% Abbreviated weekday names (%a)
-+abday "";"";/
-+ "";"";/
-+ "";"";/
-+ ""
-+
-+% Full weekday names (%A)
-+day "";/
-+ "";/
-+ "";/
-+ "";/
-+ "";/
-+ "";/
-+ ""
-+
-+% Abbreviated month names (%b)
-+abmon "";"";/
-+ "";"