Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=e80ce22394c86da32dd6bee3215710e23c77c711

commit e80ce22394c86da32dd6bee3215710e23c77c711
Author: crazy <[email protected]>
Date:   Fri Feb 19 19:47:09 2016 +0100

Revert "glibc-2.23-1-x86_64"
This reverts commit eadbc7bd8a190de6ae64e5e0b770eea70c5ad3db.
* don't do that without to bump and rebuild the *whole* toolchain!!!

diff --git a/source/base/glibc/FrugalBuild b/source/base/glibc/FrugalBuild
index 8d4ec19..d253f3c 100644
--- a/source/base/glibc/FrugalBuild
+++ b/source/base/glibc/FrugalBuild
@@ -4,8 +4,8 @@


pkgname=glibc
-pkgver=2.23
-pkgrel=1
+pkgver=2.22
+pkgrel=8
pkgdesc="GNU C Library"
url="http://www.gnu.org/software/libc/libc.html";
depends=()
@@ -15,8 +15,10 @@ groups=('base' 'chroot-core')
archs=('i686' 'x86_64' 'arm')
Fup2gnubz2
_dlurl="http://ftp.gnu.org/pub/gnu/glibc";
-source=($_dlurl/glibc-$pkgver.tar.xz)
-signatures=($_dlurl/glibc-$pkgver.tar.xz.sig)
+source=($_dlurl/glibc-$pkgver.tar.xz \
+       glibc-2.22-upstream-fixes.patch \
+       glibc-2.22-CVE-2015-7547.patch)
+signatures=($_dlurl/glibc-$pkgver.tar.xz.sig '' '')
options=('scriptlet' 'noccache')


diff --git a/source/base/glibc/glibc-2.22-CVE-2015-7547.patch 
b/source/base/glibc/glibc-2.22-CVE-2015-7547.patch
new file mode 100644
index 0000000..525ee49
--- /dev/null
+++ b/source/base/glibc/glibc-2.22-CVE-2015-7547.patch
@@ -0,0 +1,572 @@
+CVE-2015-7547
+
+2016-02-15  Carlos O'Donell  <[email protected]>
+
+       [BZ #18665]
+       * resolv/nss_dns/dns-host.c (gaih_getanswer_slice): Always set
+       *herrno_p.
+       (gaih_getanswer): Document functional behviour. Return tryagain
+       if any result is tryagain.
+       * resolv/res_query.c (__libc_res_nsearch): Set buffer size to zero
+       when freed.
+       * resolv/res_send.c: Add copyright text.
+       (__libc_res_nsend): Document that MAXPACKET is expected.
+       (send_vc): Document. Remove buffer reuse.
+       (send_dg): Document. Remove buffer reuse. Set *thisanssizp to set the
+       size of the buffer. Add Dprint for truncated UDP buffer.
+
+diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
+index a255d5e..47cfe27 100644
+--- a/resolv/nss_dns/dns-host.c
++++ b/resolv/nss_dns/dns-host.c
+@@ -1031,7 +1031,10 @@ gaih_getanswer_slice (const querybuf *answer, int 
anslen, const char *qname,
+   int h_namelen = 0;
+
+   if (ancount == 0)
+-    return NSS_STATUS_NOTFOUND;
++    {
++      *h_errnop = HOST_NOT_FOUND;
++      return NSS_STATUS_NOTFOUND;
++    }
+
+   while (ancount-- > 0 && cp < end_of_message && had_error == 0)
+     {
+@@ -1208,7 +1211,14 @@ gaih_getanswer_slice (const querybuf *answer, int 
anslen, const char *qname,
+   /* Special case here: if the resolver sent a result but it only
+      contains a CNAME while we are looking for a T_A or T_AAAA record,
+      we fail with NOTFOUND instead of TRYAGAIN.  */
+-  return canon == NULL ? NSS_STATUS_TRYAGAIN : NSS_STATUS_NOTFOUND;
++  if (canon != NULL)
++    {
++      *h_errnop = HOST_NOT_FOUND;
++      return NSS_STATUS_NOTFOUND;
++    }
++
++  *h_errnop = NETDB_INTERNAL;
++  return NSS_STATUS_TRYAGAIN;
+ }
+
+
+@@ -1222,11 +1232,101 @@ gaih_getanswer (const querybuf *answer1, int anslen1, 
const querybuf *answer2,
+
+   enum nss_status status = NSS_STATUS_NOTFOUND;
+
++  /* Combining the NSS status of two distinct queries requires some
++     compromise and attention to symmetry (A or AAAA queries can be
++     returned in any order).  What follows is a breakdown of how this
++     code is expected to work and why. We discuss only SUCCESS,
++     TRYAGAIN, NOTFOUND and UNAVAIL, since they are the only returns
++     that apply (though RETURN and MERGE exist).  We make a distinction
++     between TRYAGAIN (recoverable) and TRYAGAIN' (not-recoverable).
++     A recoverable TRYAGAIN is almost always due to buffer size issues
++     and returns ERANGE in errno and the caller is expected to retry
++     with a larger buffer.
++
++     Lastly, you may be tempted to make significant changes to the
++     conditions in this code to bring about symmetry between responses.
++     Please don't change anything without due consideration for
++     expected application behaviour.  Some of the synthesized responses
++     aren't very well thought out and sometimes appear to imply that
++     IPv4 responses are always answer 1, and IPv6 responses are always
++     answer 2, but that's not true (see the implemetnation of send_dg
++     and send_vc to see response can arrive in any order, particlarly
++     for UDP). However, we expect it holds roughly enough of the time
++     that this code works, but certainly needs to be fixed to make this
++     a more robust implementation.
++
++     ----------------------------------------------
++     | Answer 1 Status /   | Synthesized | Reason |
++     | Answer 2 Status     | Status      |        |
++     |--------------------------------------------|
++     | SUCCESS/SUCCESS     | SUCCESS     | [1]    |
++     | SUCCESS/TRYAGAIN    | TRYAGAIN    | [5]    |
++     | SUCCESS/TRYAGAIN'   | SUCCESS     | [1]    |
++     | SUCCESS/NOTFOUND    | SUCCESS     | [1]    |
++     | SUCCESS/UNAVAIL     | SUCCESS     | [1]    |
++     | TRYAGAIN/SUCCESS    | TRYAGAIN    | [2]    |
++     | TRYAGAIN/TRYAGAIN   | TRYAGAIN    | [2]    |
++     | TRYAGAIN/TRYAGAIN'  | TRYAGAIN    | [2]    |
++     | TRYAGAIN/NOTFOUND   | TRYAGAIN    | [2]    |
++     | TRYAGAIN/UNAVAIL    | TRYAGAIN    | [2]    |
++     | TRYAGAIN'/SUCCESS   | SUCCESS     | [3]    |
++     | TRYAGAIN'/TRYAGAIN  | TRYAGAIN    | [3]    |
++     | TRYAGAIN'/TRYAGAIN' | TRYAGAIN'   | [3]    |
++     | TRYAGAIN'/NOTFOUND  | TRYAGAIN'   | [3]    |
++     | TRYAGAIN'/UNAVAIL   | UNAVAIL     | [3]    |
++     | NOTFOUND/SUCCESS    | SUCCESS     | [3]    |
++     | NOTFOUND/TRYAGAIN   | TRYAGAIN    | [3]    |
++     | NOTFOUND/TRYAGAIN'  | TRYAGAIN'   | [3]    |
++     | NOTFOUND/NOTFOUND   | NOTFOUND    | [3]    |
++     | NOTFOUND/UNAVAIL    | UNAVAIL     | [3]    |
++     | UNAVAIL/SUCCESS     | UNAVAIL     | [4]    |
++     | UNAVAIL/TRYAGAIN    | UNAVAIL     | [4]    |
++     | UNAVAIL/TRYAGAIN'   | UNAVAIL     | [4]    |
++     | UNAVAIL/NOTFOUND    | UNAVAIL     | [4]    |
++     | UNAVAIL/UNAVAIL     | UNAVAIL     | [4]    |
++     ----------------------------------------------
++
++     [1] If the first response is a success we return success.
++         This ignores the state of the second answer and in fact
++         incorrectly sets errno and h_errno to that of the second
++       answer.  However because the response is a success we ignore
++       *errnop and *h_errnop (though that means you touched errno on
++         success).  We are being conservative here and returning the
++         likely IPv4 response in the first answer as a success.
++
++     [2] If the first response is a recoverable TRYAGAIN we return
++       that instead of looking at the second response.  The
++       expectation here is that we have failed to get an IPv4 response
++       and should retry both queries.
++
++     [3] If the first response was not a SUCCESS and the second
++       response is not NOTFOUND (had a SUCCESS, need to TRYAGAIN,
++       or failed entirely e.g. TRYAGAIN' and UNAVAIL) then use the
++       result from the second response, otherwise the first responses
++       status is used.  Again we have some odd side-effects when the
++       second response is NOTFOUND because we overwrite *errnop and
++       *h_errnop that means that a first answer of NOTFOUND might see
++       its *errnop and *h_errnop values altered.  Whether it matters
++       in practice that a first response NOTFOUND has the wrong
++       *errnop and *h_errnop is undecided.
++
++     [4] If the first response is UNAVAIL we return that instead of
++       looking at the second response.  The expectation here is that
++       it will have failed similarly e.g. configuration failure.
++
++     [5] Testing this code is complicated by the fact that truncated
++       second response buffers might be returned as SUCCESS if the
++       first answer is a SUCCESS.  To fix this we add symmetry to
++       TRYAGAIN with the second response.  If the second response
++       is a recoverable error we now return TRYAGIN even if the first
++       response was SUCCESS.  */
++
+   if (anslen1 > 0)
+     status = gaih_getanswer_slice(answer1, anslen1, qname,
+                                 &pat, &buffer, &buflen,
+                                 errnop, h_errnop, ttlp,
+                                 &first);
++
+   if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
+        || (status == NSS_STATUS_TRYAGAIN
+          /* We want to look at the second answer in case of an
+@@ -1242,8 +1342,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, 
const querybuf *answer2,
+                                                    &pat, &buffer, &buflen,
+                                                    errnop, h_errnop, ttlp,
+                                                    &first);
++      /* Use the second response status in some cases.  */
+       if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
+       status = status2;
++      /* Do not return a truncated second response (unless it was
++         unavoidable e.g. unrecoverable TRYAGAIN).  */
++      if (status == NSS_STATUS_SUCCESS
++        && (status2 == NSS_STATUS_TRYAGAIN
++            && *errnop == ERANGE && *h_errnop != NO_RECOVERY))
++      status = NSS_STATUS_TRYAGAIN;
+     }
+
+   return status;
+diff --git a/resolv/res_query.c b/resolv/res_query.c
+index 4a9b3b3..95470a9 100644
+--- a/resolv/res_query.c
++++ b/resolv/res_query.c
+@@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
+                 {
+                   free (*answerp2);
+                   *answerp2 = NULL;
++                  *nanswerp2 = 0;
+                   *answerp2_malloced = 0;
+                 }
+       }
+@@ -447,6 +448,7 @@ __libc_res_nsearch(res_state statp,
+                         {
+                           free (*answerp2);
+                           *answerp2 = NULL;
++                          *nanswerp2 = 0;
+                           *answerp2_malloced = 0;
+                         }
+
+@@ -521,6 +523,7 @@ __libc_res_nsearch(res_state statp,
+         {
+           free (*answerp2);
+           *answerp2 = NULL;
++          *nanswerp2 = 0;
+           *answerp2_malloced = 0;
+         }
+       if (saved_herrno != -1)
+diff --git a/resolv/res_send.c b/resolv/res_send.c
+index a968b95..21843f1 100644
+--- a/resolv/res_send.c
++++ b/resolv/res_send.c
+@@ -1,3 +1,20 @@
++/* Copyright (C) 2016 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
+ /*
+  * Copyright (c) 1985, 1989, 1993
+  *    The Regents of the University of California.  All rights reserved.
+@@ -355,6 +372,8 @@ __libc_res_nsend(res_state statp, const u_char *buf, int 
buflen,
+ #ifdef USE_HOOKS
+       if (__glibc_unlikely (statp->qhook || statp->rhook))       {
+               if (anssiz < MAXPACKET && ansp) {
++                      /* Always allocate MAXPACKET, callers expect
++                         this specific size.  */
+                       u_char *buf = malloc (MAXPACKET);
+                       if (buf == NULL)
+                               return (-1);
+@@ -630,6 +649,77 @@ get_nsaddr (res_state statp, int n)
+     return (struct sockaddr *) (void *) &statp->nsaddr_list[n];
+ }
+
++/* The send_vc function is responsible for sending a DNS query over TCP
++   to the nameserver numbered NS from the res_state STATP i.e.
++   EXT(statp).nssocks[ns].  The function supports sending both IPv4 and
++   IPv6 queries at the same serially on the same socket.
++
++   Please note that for TCP there is no way to disable sending both
++   queries, unlike UDP, which honours RES_SNGLKUP and RES_SNGLKUPREOP
++   and sends the queries serially and waits for the result after each
++   sent query.  This implemetnation should be corrected to honour these
++   options.
++
++   Please also note that for TCP we send both queries over the same
++   socket one after another.  This technically violates best practice
++   since the server is allowed to read the first query, respond, and
++   then close the socket (to service another client).  If the server
++   does this, then the remaining second query in the socket data buffer
++   will cause the server to send the client an RST which will arrive
++   asynchronously and the client's OS will likely tear down the socket
++   receive buffer resulting in a potentially short read and lost
++   response data.  This will force the client to retry the query again,
++   and this process may repeat until all servers and connection resets
++   are exhausted and then the query will fail.  It's not known if this
++   happens with any frequency in real DNS server implementations.  This
++   implementation should be corrected to use two sockets by default for
++   parallel queries.
++
++   The query stored in BUF of BUFLEN length is sent first followed by
++   the query stored in BUF2 of BUFLEN2 length.  Queries are sent
++   serially on the same socket.
++
++   Answers to the query are stored firstly in *ANSP up to a max of
++   *ANSSIZP bytes.  If more than *ANSSIZP bytes are needed and ANSCP
++   is non-NULL (to indicate that modifying the answer buffer is allowed)
++   then malloc is used to allocate a new response buffer and ANSCP and
++   ANSP will both point to the new buffer.  If more than *ANSSIZP bytes
++   are needed but ANSCP is NULL, then as much of the response as
++   possible is read into the buffer, but the results will be truncated.
++   When truncation happens because of a small answer buffer the DNS
++   packets header feild TC will bet set to 1, indicating a truncated
++   message and the rest of the socket data will be read and discarded.
++
++   Answers to the query are stored secondly in *ANSP2 up to a max of
++   *ANSSIZP2 bytes, with the actual response length stored in
++   *RESPLEN2.  If more than *ANSSIZP bytes are needed and ANSP2
++   is non-NULL (required for a second query) then malloc is used to
++   allocate a new response buffer, *ANSSIZP2 is set to the new buffer
++   size and *ANSP2_MALLOCED is set to 1.
++
++   The ANSP2_MALLOCED argument will eventually be removed as the
++   change in buffer pointer can be used to detect the buffer has
++   changed and that the caller should use free on the new buffer.
++
++   Note that the answers may arrive in any order from the server and
++   therefore the first and second answer buffers may not correspond to
++   the first and second queries.
++
++   It is not supported to call this function with a non-NULL ANSP2
++   but a NULL ANSCP.  Put another way, you can call send_vc with a
++   single unmodifiable buffer or two modifiable buffers, but no other
++   combination is supported.
++
++   It is the caller's responsibility to free the malloc allocated
++   buffers by detecting that the pointers have changed from their
++   original values i.e. *ANSCP or *ANSP2 has changed.
++
++   If errors are encountered then *TERRNO is set to an appropriate
++   errno value and a zero result is returned for a recoverable error,
++   and a less-than zero result is returned for a non-recoverable error.
++
++   If no errors are encountered then *TERRNO is left unmodified and
++   a the length of the first response in bytes is returned.  */
+ static int
+ send_vc(res_state statp,
+       const u_char *buf, int buflen, const u_char *buf2, int buflen2,
+@@ -639,11 +729,7 @@ send_vc(res_state statp,
+ {
+       const HEADER *hp = (HEADER *) buf;
+       const HEADER *hp2 = (HEADER *) buf2;
+-      u_char *ans = *ansp;
+-      int orig_anssizp = *anssizp;
+-      // XXX REMOVE
+-      // int anssiz = *anssizp;
+-      HEADER *anhp = (HEADER *) ans;
++      HEADER *anhp = (HEADER *) *ansp;
+       struct sockaddr *nsap = get_nsaddr (statp, ns);
+       int truncating, connreset, n;
+       /* On some architectures compiler might emit a warning indicating
+@@ -731,6 +817,8 @@ send_vc(res_state statp,
+        * Receive length & response
+        */
+       int recvresp1 = 0;
++      /* Skip the second response if there is no second query.
++           To do that we mark the second response as received.  */
+       int recvresp2 = buf2 == NULL;
+       uint16_t rlen16;
+  read_len:
+@@ -767,40 +855,14 @@ send_vc(res_state statp,
+       u_char **thisansp;
+       int *thisresplenp;
+       if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
++              /* We have not received any responses
++                 yet or we only have one response to
++                 receive.  */
+               thisanssizp = anssizp;
+               thisansp = anscp ?: ansp;
+               assert (anscp != NULL || ansp2 == NULL);
+               thisresplenp = &resplen;
+       } else {
+-              if (*anssizp != MAXPACKET) {
+-                      /* No buffer allocated for the first
+-                         reply.  We can try to use the rest
+-                         of the user-provided buffer.  */
+-#if __GNUC_PREREQ (4, 7)
+-                      DIAG_PUSH_NEEDS_COMMENT;
+-                      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+-#endif
+-#if _STRING_ARCH_unaligned
+-                      *anssizp2 = orig_anssizp - resplen;
+-                      *ansp2 = *ansp + resplen;
+-#else
+-                      int aligned_resplen
+-                        = ((resplen + __alignof__ (HEADER) - 1)
+-                           & ~(__alignof__ (HEADER) - 1));
+-                      *anssizp2 = orig_anssizp - aligned_resplen;
+-                      *ansp2 = *ansp + aligned_resplen;
+-#endif
+-#if __GNUC_PREREQ (4, 7)
+-                      DIAG_POP_NEEDS_COMMENT;
+-#endif
+-              } else {
+-                      /* The first reply did not fit into the
+-                         user-provided buffer.  Maybe the second
+-                         answer will.  */
+-                      *anssizp2 = orig_anssizp;
+-                      *ansp2 = *ansp;
+-              }
+-
+               thisanssizp = anssizp2;
+               thisansp = ansp2;
+               thisresplenp = resplen2;
+@@ -804,10 +870,14 @@ send_vc(res_state statp,
+       anhp = (HEADER *) *thisansp;
+
+       *thisresplenp = rlen;
+-      if (rlen > *thisanssizp) {
+-              /* Yes, we test ANSCP here.  If we have two buffers
+-                 both will be allocatable.  */
+-              if (__glibc_likely (anscp != NULL))       {
++      /* Is the answer buffer too small?  */
++      if (*thisanssizp < rlen) {
++              /* If the current buffer is not the the static
++                 user-supplied buffer then we can reallocate
++                 it.  */
++              if (thisansp != NULL && thisansp != ansp) {
++                      /* Always allocate MAXPACKET, callers expect
++                         this specific size.  */
+                       u_char *newp = malloc (MAXPACKET);
+                       if (newp == NULL) {
+                               *terrno = ENOMEM;
+@@ -819,6 +889,9 @@ send_vc(res_state statp,
+                       if (thisansp == ansp2)
+                         *ansp2_malloced = 1;
+                       anhp = (HEADER *) newp;
++                      /* A uint16_t can't be larger than MAXPACKET
++                         thus it's safe to allocate MAXPACKET but
++                         read RLEN bytes instead.  */
+                       len = rlen;
+               } else {
+                       Dprint(statp->options & RES_DEBUG,
+@@ -948,6 +1021,66 @@ reopen (res_state statp, int *terrno, int ns)
+       return 1;
+ }
+
++/* The send_dg function is responsible for sending a DNS query over UDP
++   to the nameserver numbered NS from the res_state STATP i.e.
++   EXT(statp).nssocks[ns].  The function supports IPv4 and IPv6 queries
++   along with the ability to send the query in parallel for both stacks
++   (default) or serially (RES_SINGLKUP).  It also supports serial lookup
++   with a close and reopen of the socket used to talk to the server
++   (RES_SNGLKUPREOP) to work around broken name servers.
++
++   The query stored in BUF of BUFLEN length is sent first followed by
++   the query stored in BUF2 of BUFLEN2 length.  Queries are sent
++   in parallel (default) or serially (RES_SINGLKUP or RES_SNGLKUPREOP).
++
++   Answers to the query are stored firstly in *ANSP up to a max of
++   *ANSSIZP bytes.  If more than *ANSSIZP bytes are needed and ANSCP
++   is non-NULL (to indicate that modifying the answer buffer is allowed)
++   then malloc is used to allocate a new response buffer and ANSCP and
++   ANSP will both point to the new buffer.  If more than *ANSSIZP bytes
++   are needed but ANSCP is NULL, then as much of the response as
++   possible is read into the buffer, but the results will be truncated.
++   When truncation happens because of a small answer buffer the DNS
++   packets header feild TC will bet set to 1, indicating a truncated
++   message, while the rest of the UDP packet is discarded.
++
++   Answers to the query are stored secondly in *ANSP2 up to a max of
++   *ANSSIZP2 bytes, with the actual response length stored in
++   *RESPLEN2.  If more than *ANSSIZP bytes are needed and ANSP2
++   is non-NULL (required for a second query) then malloc is used to
++   allocate a new response buffer, *ANSSIZP2 is set to the new buffer
++   size and *ANSP2_MALLOCED is set to 1.
++
++   The ANSP2_MALLOCED argument will eventually be removed as the
++   change in buffer pointer can be used to detect the buffer has
++   changed and that the caller should use free on the new buffer.
++
++   Note that the answers may arrive in any order from the server and
++   therefore the first and second answer buffers may not correspond to
++   the first and second queries.
++
++   It is not supported to call this function with a non-NULL ANSP2
++   but a NULL ANSCP.  Put another way, you can call send_vc with a
++   single unmodifiable buffer or two modifiable buffers, but no other
++   combination is supported.
++
++   It is the caller's responsibility to free the malloc allocated
++   buffers by detecting that the pointers have changed from their
++   original values i.e. *ANSCP or *ANSP2 has changed.
++
++   If an answer is truncated because of UDP datagram DNS limits then
++   *V_CIRCUIT is set to 1 and the return value non-zero to indicate to
++   the caller to retry with TCP.  The value *GOTSOMEWHERE is set to 1
++   if any progress was made reading a response from the nameserver and
++   is used by the caller to distinguish between ECONNREFUSED and
++   ETIMEDOUT (the latter if *GOTSOMEWHERE is 1).
++
++   If errors are encountered then *TERRNO is set to an appropriate
++   errno value and a zero result is returned for a recoverable error,
++   and a less-than zero result is returned for a non-recoverable error.
++
++   If no errors are encountered then *TERRNO is left unmodified and
++   a the length of the first response in bytes is returned.  */
+ static int
+ send_dg(res_state statp,
+       const u_char *buf, int buflen, const u_char *buf2, int buflen2,
+@@ -957,8 +1090,6 @@ send_dg(res_state statp,
+ {
+       const HEADER *hp = (HEADER *) buf;
+       const HEADER *hp2 = (HEADER *) buf2;
+-      u_char *ans = *ansp;
+-      int orig_anssizp = *anssizp;
+       struct timespec now, timeout, finish;
+       struct pollfd pfd[1];
+       int ptimeout;
+@@ -991,6 +1122,8 @@ send_dg(res_state statp,
+       int need_recompute = 0;
+       int nwritten = 0;
+       int recvresp1 = 0;
++      /* Skip the second response if there is no second query.
++           To do that we mark the second response as received.  */
+       int recvresp2 = buf2 == NULL;
+       pfd[0].fd = EXT(statp).nssocks[ns];
+       pfd[0].events = POLLOUT;
+@@ -1154,55 +1287,56 @@ send_dg(res_state statp,
+               int *thisresplenp;
+
+               if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
++                      /* We have not received any responses
++                         yet or we only have one response to
++                         receive.  */
+                       thisanssizp = anssizp;
+                       thisansp = anscp ?: ansp;
+                       assert (anscp != NULL || ansp2 == NULL);
+                       thisresplenp = &resplen;
+               } else {
+-                      if (*anssizp != MAXPACKET) {
+-                              /* No buffer allocated for the first
+-                                 reply.  We can try to use the rest
+-                                 of the user-provided buffer.  */
+-#if _STRING_ARCH_unaligned
+-                              *anssizp2 = orig_anssizp - resplen;
+-                              *ansp2 = *ansp + resplen;
+-#else
+-                              int aligned_resplen
+-                                = ((resplen + __alignof__ (HEADER) - 1)
+-                                   & ~(__alignof__ (HEADER) - 1));
+-                              *anssizp2 = orig_anssizp - aligned_resplen;
+-                              *ansp2 = *ansp + aligned_resplen;
+-#endif
+-                      } else {
+-                              /* The first reply did not fit into the
+-                                 user-provided buffer.  Maybe the second
+-                                 answer will.  */
+-                              *anssizp2 = orig_anssizp;
+-                              *ansp2 = *ansp;
+-                      }
+-
+                       thisanssizp = anssizp2;
+                       thisansp = ansp2;
+                       thisresplenp = resplen2;
+               }
+
+               if (*thisanssizp < MAXPACKET
+-                  /* Yes, we test ANSCP here.  If we have two buffers
+-                     both will be allocatable.  */
+-                  && anscp
++                  /* If the current buffer is not the the static
++                     user-supplied buffer then we can reallocate
++                     it.  */
++                  && (thisansp != NULL && thisansp != ansp)
+ #ifdef FIONREAD
++                  /* Is the size too small?  */
+                   && (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0
+                       || *thisanssizp < *thisresplenp)
+ #endif
+                     ) {
++                      /* Always allocate MAXPACKET, callers expect
++                         this specific size.  */
+                       u_char *newp = malloc (MAXPACKET);
+                       if (newp != NULL) {
+-                              *anssizp = MAXPACKET;
+-                              *thisansp = ans = newp;
++                              *thisanssizp = MAXPACKET;
++                              *thisansp = newp;
+                               if (thisansp == ansp2)
+                                 *ansp2_malloced = 1;
+                       }
+               }
++              /* We could end up with truncation if anscp was NULL
++                 (not allowed to change caller's buffer) and the
++                 response buffer size is too small.  This isn't a
++                 reliable way to detect truncation because the ioctl
++                 may be an inaccurate report of the UDP message size.
++                 Therefore we use this only to issue debug output.
++                 To do truncation accurately with UDP we need
++                 MSG_TRUNC which is only available on Linux.  We
++                 can abstract out the Linux-specific feature in the
++                 future to detect truncation.  */
++              if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
++                      Dprint(statp->options & RES_DEBUG,
++                             (stdout, ";; response may be truncated (UDP)\n")
++                      );
++              }
++
+               HEADER *anhp = (HEADER *) *thisansp;
+               socklen_t fromlen = sizeof(struct sockaddr_in6);
+               assert (sizeof(from) <= fromlen);
+
diff --git a/source/base/glibc/glibc-2.22-upstream-fixes.patch 
b/source/base/glibc/glibc-2.22-upstream-fixes.patch
new file mode 100644
index 0000000..7991d33
--- /dev/null
+++ b/source/base/glibc/glibc-2.22-upstream-fixes.patch
@@ -0,0 +1,666 @@
+diff --git a/ChangeLog b/ChangeLog
+index cb9124e..d0d2cbd 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,74 @@
++2015-08-31  Brett Neumeier <[email protected]>
++
++      [BZ #18870]
++      * sysdeps/sparc/sparc32/sem_open.c: Add missing #include
++
++2015-08-28  Mike Frysinger  <[email protected]>
++
++      [BZ #18887]
++      * misc/Makefile (tests): Add tst-mntent-blank-corrupt and
++      tst-mntent-blank-passno.
++      * misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
++      * misc/tst-mntent-blank-corrupt.c: New test.
++      * misc/tst-mntent-blank-passno.c: New test ripped from ...
++      * misc/tst-mntent.c (do_test): ... here.
++
++2015-08-25  Roland McGrath  <[email protected]>
++
++      * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
++      if the weak reference is not null.
++
++2015-08-19  Andrew Senkevich  <[email protected]>
++
++      [BZ #18796]
++      * scripts/test-installation.pl: Don't add -lmvec to build options
++      if libmvec wasn't built.
++      * NEWS: Mention this fix.
++
++2015-08-10  Maxim Ostapenko  <[email protected]>
++
++      [BZ #18778]
++      * elf/Makefile (tests): Add Add tst-nodelete2.
++      (modules-names): Add tst-nodelete2mod.
++      (tst-nodelete2mod.so-no-z-defs): New.
++      ($(objpfx)tst-nodelete2): Likewise.
++      ($(objpfx)tst-nodelete2.out): Likewise.
++      (LDFLAGS-tst-nodelete2): Likewise.
++      * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
++      out of loop through all loaded libraries.
++      * elf/tst-nodelete2.c: New file.
++      * elf/tst-nodelete2mod.c: Likewise.
++
++2015-08-10  Andreas Schwab  <[email protected]>
++
++      [BZ #18781]
++      * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
++      MORE_OFLAGS to oflag.
++      * io/test-lfs.c (do_test): Test openat64.
++
++2015-08-08  John David Anglin  <[email protected]>
++
++      [BZ #18787]
++      * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise
++      clobber registers.
++      (atomic_compare_and_exchange_val_acq): Use register asms to assign
++      operand registers.  Use register %r20 for EAGAIN and EDEADLOCK checks.
++      Cast return to __typeof (oldval).
++
++2015-08-08  Mike Frysinger  <[email protected]>
++
++      * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file
++      in _LINUX_MICROBLAZE_SYSDEP_H defines.  Include sysdeps/unix/sysdep.h
++      and delete sys/syscall.h include.
++
++2015-08-07  Mike Frysinger  <[email protected]>
++
++      * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def.
++
++2015-08-05  Zack Weinberg  <[email protected]>
++
++      * misc/regexp.h: Update comments.
++
+ 2015-08-05  Carlos O'Donell  <[email protected]>
+
+       * version.h (RELEASE): Set to "stable".
+diff --git a/NEWS b/NEWS
+index 4c31de7..ce0255a 100644
+--- a/NEWS
++++ b/NEWS
+@@ -5,6 +5,12 @@ See the end for copying conditions.
+ Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
+ using `glibc' in the "product" field.
+
++Version 2.22.1
++
++* The following bugs are resolved with this release:
++
++  18778, 18781, 18787, 18796, 18870, 18887.
++
+ Version 2.22
+
+ * The following bugs are resolved with this release:
+@@ -84,7 +90,7 @@ Version 2.22
+   release.  Use of this header will trigger a deprecation warning.
+   Application developers should update their code to use <regex.h> instead.
+
+-  This header was formerly part of SUSv2, but was deprecated in 1997 and
++  This header was formerly part of SUS, but was deprecated in 1994 and
+   removed from the standard in 2001.  Also, the glibc implementation
+   leaks memory.  See BZ#18681 for more details.
+
+diff --git a/elf/Makefile b/elf/Makefile
+index 4ceeaf8..71a18a1 100644
+--- a/elf/Makefile
++++ b/elf/Makefile
+@@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload 
origtest resolvfail \
+        tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
+        tst-nodelete) \
+        tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
+-       tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
++       tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
++       tst-nodelete2
+ #      reldep9
+ ifeq ($(build-hardcoded-path-in-tests),yes)
+ tests += tst-dlopen-aout
+@@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 
testobj5 testobj6 \
+               tst-initorder2d \
+               tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
+               tst-array5dep tst-null-argv-lib \
+-              tst-tlsalign-lib tst-nodelete-opened-lib
++              tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
+ ifeq (yes,$(have-protected-data))
+ modules-names += tst-protected1moda tst-protected1modb
+ tests += tst-protected1a tst-protected1b
+@@ -594,6 +595,7 @@ tst-auditmod9b.so-no-z-defs = yes
+ tst-nodelete-uniquemod.so-no-z-defs = yes
+ tst-nodelete-rtldmod.so-no-z-defs = yes
+ tst-nodelete-zmod.so-no-z-defs = yes
++tst-nodelete2mod.so-no-z-defs = yes
+
+ ifeq ($(build-shared),yes)
+ # Build all the modules even when not actually running test programs.
+@@ -1164,6 +1166,11 @@ $(objpfx)tst-nodelete.out: 
$(objpfx)tst-nodelete-uniquemod.so \
+ LDFLAGS-tst-nodelete = -rdynamic
+ LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
+
++$(objpfx)tst-nodelete2: $(libdl)
++$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
++
++LDFLAGS-tst-nodelete2 = -rdynamic
++
+ $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
+       cmp $^ > $@; \
+       $(evaluate-test)
+diff --git a/elf/dl-close.c b/elf/dl-close.c
+index 9105277..c897247 100644
+--- a/elf/dl-close.c
++++ b/elf/dl-close.c
+@@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
+   char done[nloaded];
+   struct link_map *maps[nloaded];
+
++  /* Clear DF_1_NODELETE to force object deletion.  We don't need to touch
++     l_tls_dtor_count because forced object deletion only happens when an
++     error occurs during object load.  Destructor registration for TLS
++     non-POD objects should not have happened till then for this
++     object.  */
++  if (force)
++    map->l_flags_1 &= ~DF_1_NODELETE;
++
+   /* Run over the list and assign indexes to the link maps and enter
+      them into the MAPS array.  */
+   int idx = 0;
+@@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
+       maps[idx] = l;
+       ++idx;
+
+-      /* Clear DF_1_NODELETE to force object deletion.  We don't need to touch
+-       l_tls_dtor_count because forced object deletion only happens when an
+-       error occurs during object load.  Destructor registration for TLS
+-       non-POD objects should not have happened till then for this
+-       object.  */
+-      if (force)
+-      l->l_flags_1 &= ~DF_1_NODELETE;
+     }
+   assert (idx == nloaded);
+
+diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
+new file mode 100644
+index 0000000..388e8af
+--- /dev/null
++++ b/elf/tst-nodelete2.c
+@@ -0,0 +1,37 @@
++#include "../dlfcn/dlfcn.h"
++#include <stdio.h>
++#include <stdlib.h>
++#include <gnu/lib-names.h>
++
++static int
++do_test (void)
++{
++  int result = 0;
++
++  printf ("\nOpening pthread library.\n");
++  void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
++
++  /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
++     happens.  We should clear DF_1_NODELETE for failed library only, because
++     doing this for others (e.g. libpthread) might cause them to be unloaded,
++     that may lead to some global references (e.g. __rtld_lock_unlock) to be
++     broken.  The dlopen should fail because of undefined symbols in shared
++     library, that cause DF_1_NODELETE to be cleared.  For libpthread, this
++     flag should be set, because if not, SIGSEGV will happen in dlclose.  */
++  if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
++    {
++      printf ("Unique symbols test failed\n");
++      result = 1;
++    }
++
++  if (pthread)
++    dlclose (pthread);
++
++  if (result == 0)
++    printf ("SUCCESS\n");
++
++  return result;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c
+new file mode 100644
+index 0000000..e88c756
+--- /dev/null
++++ b/elf/tst-nodelete2mod.c
+@@ -0,0 +1,7 @@
++/* Undefined symbol.  */
++extern int not_exist (void);
++
++int foo (void)
++{
++  return not_exist ();
++}
+diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc
+deleted file mode 100644
+index 1e8f368..0000000
+--- a/elf/tst-znodelete-zlib.cc
++++ /dev/null
+@@ -1,6 +0,0 @@
+-extern int not_exist (void);
+-
+-int foo (void)
+-{
+-  return  not_exist ();
+-}
+diff --git a/io/test-lfs.c b/io/test-lfs.c
+index 539c2a2..b6ebae4 100644
+--- a/io/test-lfs.c
++++ b/io/test-lfs.c
+@@ -144,7 +144,7 @@ test_ftello (void)
+ int
+ do_test (int argc, char *argv[])
+ {
+-  int ret;
++  int ret, fd2;
+   struct stat64 statbuf;
+
+   ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
+@@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
+     error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
+          (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
+
++  fd2 = openat64 (AT_FDCWD, name, O_RDWR);
++  if (fd2 == -1)
++    {
++      if (errno == ENOSYS)
++      {
++        /* Silently ignore this test.  */
++        error (0, 0, "openat64 is not supported");
++      }
++      else
++      error (EXIT_FAILURE, errno, "openat64 failed to open big file");
++    }
++  else
++    {
++      ret = close (fd2);
++
++      if (ret == -1)
++      error (EXIT_FAILURE, errno, "error closing file");
++    }
++
+   test_ftello ();
+
+   return 0;
+diff --git a/misc/Makefile b/misc/Makefile
+index aecb0da..2f5edf6 100644
+--- a/misc/Makefile
++++ b/misc/Makefile
+@@ -76,7 +76,8 @@ install-lib := libg.a
+ gpl2lgpl := error.c error.h
+
+ tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
+-       tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
++       tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
++       tst-mntent-blank-corrupt tst-mntent-blank-passno
+ ifeq ($(run-built-tests),yes)
+ tests-special += $(objpfx)tst-error1-mem.out
+ endif
+diff --git a/misc/mntent_r.c b/misc/mntent_r.c
+index 6159873..4f26998 100644
+--- a/misc/mntent_r.c
++++ b/misc/mntent_r.c
+@@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char 
*buffer, int bufsiz)
+       end_ptr = strchr (buffer, '\n');
+       if (end_ptr != NULL)    /* chop newline */
+       {
+-        while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
++        /* Do not walk past the start of buffer if it's all whitespace.  */
++        while (end_ptr != buffer
++               && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
+             end_ptr--;
+         *end_ptr = '\0';
+       }
+diff --git a/misc/regexp.h b/misc/regexp.h
+index 3460989..42394f7 100644
+--- a/misc/regexp.h
++++ b/misc/regexp.h
+@@ -19,10 +19,11 @@
+ #ifndef _REGEXP_H
+ #define _REGEXP_H     1
+
+-/* The contents of this header file were standardized in the
+-   Single Unix Specification, Version 2 (1997) but marked as
+-   LEGACY; new applications were already being encouraged to
+-   use <regex.h> instead.  POSIX.1-2001 removed this header.
++/* The contents of this header file were originally standardized in
++   the Single Unix Specification, Issue 3 (1992).  In Issue 4 (1994)
++   the header was marked as TO BE WITHDRAWN, and new applications
++   were encouraged to use <regex.h> instead.  It was officially
++   withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
+
+    This header is provided only for backward compatibility.
+    It will be removed in the next release of the GNU C Library.
+diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
+new file mode 100644
+index 0000000..92266a3
+--- /dev/null
++++ b/misc/tst-mntent-blank-corrupt.c
+@@ -0,0 +1,45 @@
++/* Make sure blank lines does not cause memory corruption BZ #18887.
++
++   Copyright (C) 2009-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
++   <http://www.gnu.org/licenses/>.  */
++
++#include <mntent.h>
++#include <stdio.h>
++#include <string.h>
++
++/* Make sure blank lines don't trigger memory corruption.  This doesn't happen
++   for all targets though, so it's a best effort test BZ #18887.  */
++static int
++do_test (void)
++{
++  FILE *fp;
++
++  fp = tmpfile ();
++  fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
++  rewind (fp);
++
++  /* The corruption happens here ...  */
++  getmntent (fp);
++  /* ... but trigers here.  */
++  endmntent (fp);
++
++  /* If the test failed, we would crash, and not hit this point.  */
++  return 0;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
+new file mode 100644
+index 0000000..fc04291
+--- /dev/null
++++ b/misc/tst-mntent-blank-passno.c
+@@ -0,0 +1,53 @@
++/* Make sure trailing whitespace is handled properly BZ #17273.
++
++   Copyright (C) 2009-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
++   <http://www.gnu.org/licenses/>.  */
++
++#include <mntent.h>
++#include <stdio.h>
++#include <string.h>
++
++/* Check entries to make sure trailing whitespace is ignored and we return the
++   correct passno value BZ #17273.  */
++static int
++do_test (void)
++{
++  int result = 0;
++  FILE *fp;
++  struct mntent *mnt;
++
++  fp = tmpfile ();
++  fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
++  rewind (fp);
++
++  mnt = getmntent (fp);
++  if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
++      || strcmp (mnt->mnt_dir, "/bar dir") != 0
++      || strcmp (mnt->mnt_type, "auto") != 0
++      || strcmp (mnt->mnt_opts, "bind") != 0
++      || mnt->mnt_freq != 0
++      || mnt->mnt_passno != 0)
++    {
++      puts ("Error while reading entry with trailing whitespaces");
++      result = 1;
++    }
++
++  return result;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
+index 876c89f..820b354 100644
+--- a/misc/tst-mntent.c
++++ b/misc/tst-mntent.c
+@@ -73,26 +73,6 @@ main (int argc, char *argv[])
+         puts ("Error while reading written entry back in");
+         result = 1;
+       }
+-
+-      /* Part III: Entry with whitespaces at the end of a line. */
+-      rewind (fp);
+-
+-      fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
+-
+-      rewind (fp);
+-
+-      mnt = getmntent (fp);
+-
+-      if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
+-        || strcmp (mnt->mnt_dir, "/bar dir") != 0
+-        || strcmp (mnt->mnt_type, "auto") != 0
+-        || strcmp (mnt->mnt_opts, "bind") != 0
+-        || mnt->mnt_freq != 0
+-        || mnt->mnt_passno != 0)
+-      {
+-        puts ("Error while reading entry with trailing whitespaces");
+-        result = 1;
+-      }
+    }
+
+   return result;
+diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
+index cac1562..79b2b3e 100755
+--- a/scripts/test-installation.pl
++++ b/scripts/test-installation.pl
+@@ -80,16 +80,25 @@ arglist: while (@ARGV) {
+ # We expect none or one argument.
+ if ($#ARGV == -1) {
+     $soversions="soversions.mk";
++    $config="config.make";
+ } elsif ($#ARGV == 0) {
+     if (-d $ARGV[0]) {
+       $soversions = "$ARGV[0]/soversions.mk";
++      $config = "$ARGV[0]/config.make";
+     } else {
+-      $soversions = $ARGV[0];
++      $soversions = $dir = $ARGV[0];
++      $dir =~ s!/?[^/]*/*$!!;
++      $config = $dir . "/config.make";
+     }
+ } else {
+     die "Wrong number of arguments.";
+ }
+
++if (system ("grep -q \"build-mathvec = yes\" $config") == 0) {
++    $build_mathvec = 1;
++} else {
++    $build_mathvec = 0;
++}
+
+ # Read names and versions of all shared libraries that are part of
+ # glibc
+@@ -111,6 +120,8 @@ while (<SOVERSIONS>) {
+     # - libthread_db since it contains unresolved references
+     # - it's just a test NSS module
+     # - We don't provide the libgcc so we don't test it
++    # - libmvec if it wasn't built
++    next if ($build_mathvec == 0 && $name eq "mvec");
+     if ($name ne "nss_ldap" && $name ne "db1"
+       && !($name =~/^nss1_/) && $name ne "thread_db"
+       && $name ne "nss_test1" && $name ne "libgcc_s") {
+diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
+index b707c19..89d8baf 100644
+--- a/sysdeps/hppa/dl-symaddr.c
++++ b/sysdeps/hppa/dl-symaddr.c
+@@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) 
*ref)
+   else
+     return (void *) value;
+ }
++rtld_hidden_def (_dl_symbol_address)
+diff --git a/sysdeps/nacl/start.c b/sysdeps/nacl/start.c
+index a4b6dd3..8e8bc1a 100644
+--- a/sysdeps/nacl/start.c
++++ b/sysdeps/nacl/start.c
+@@ -44,6 +44,10 @@
+ /* The application defines this, of course.  */
+ extern int main (int argc, char **argv, char **envp);
+
++/* But maybe it defines this too, in which case it takes precedence.  */
++extern int __nacl_main (int argc, char **argv, char **envp)
++  __attribute__ ((weak));
++
+ /* These are defined in libc.  */
+ extern int __libc_csu_init (int argc, char **argv, char **envp);
+ extern void __libc_csu_fini (void);
+@@ -59,7 +63,7 @@ _start (uint32_t info[])
+ {
+   /* The generic code actually assumes that envp follows argv.  */
+
+-  __libc_start_main (&main,
++  __libc_start_main (&__nacl_main ?: &main,
+                    nacl_startup_argc (info),
+                    nacl_startup_argv (info),
+                    nacl_startup_auxv (info),
+diff --git a/sysdeps/sparc/sparc32/sem_open.c 
b/sysdeps/sparc/sparc32/sem_open.c
+index 16cb9ad..59df2d7 100644
+--- a/sysdeps/sparc/sparc32/sem_open.c
++++ b/sysdeps/sparc/sparc32/sem_open.c
+@@ -29,6 +29,7 @@
+ #include <sys/mman.h>
+ #include <sys/stat.h>
+ #include "semaphoreP.h"
++#include <futex-internal.h>
+ #include <shm-directory.h>
+
+
+diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h 
b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
+index abde83e..6e73504 100644
+--- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
++++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
+@@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t;
+ #define _LWS "0xb0"
+ #define _LWS_CAS "0"
+ /* Note r31 is the link register.  */
+-#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", 
"r28", "r31", "memory"
++#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory"
+ /* String constant for -EAGAIN.  */
+ #define _ASM_EAGAIN "-11"
+ /* String constant for -EDEADLOCK.  */
+ #define _ASM_EDEADLOCK "-45"
+
+ #if __ASSUME_LWS_CAS
+-/* The only basic operation needed is compare and exchange.  */
++/* The only basic operation needed is compare and exchange.  The mem
++   pointer must be word aligned.  */
+ # define atomic_compare_and_exchange_val_acq(mem, newval, oldval)     \
+   ({                                                                  \
+-     volatile int lws_errno;                                          \
+-     __typeof__ (*mem) lws_ret;                                               
\
+-     asm volatile(                                                    \
++     register long lws_errno asm("r21");                              \
++     register unsigned long lws_ret asm("r28");                               
\
++     register unsigned long lws_mem asm("r26") = (unsigned long)(mem);        
\
++     register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\
++     register unsigned long lws_new asm("r24") = (unsigned long)(newval);\
++     __asm__ __volatile__(                                            \
+       "0:                                     \n\t"                   \
+-      "copy   %2, %%r26                       \n\t"                   \
+-      "copy   %3, %%r25                       \n\t"                   \
+-      "copy   %4, %%r24                       \n\t"                   \
+       "ble    " _LWS "(%%sr2, %%r0)           \n\t"                   \
+       "ldi    " _LWS_CAS ", %%r20             \n\t"                   \
+-      "ldi    " _ASM_EAGAIN ", %%r24          \n\t"                   \
+-      "cmpb,=,n %%r24, %%r21, 0b              \n\t"                   \
++      "ldi    " _ASM_EAGAIN ", %%r20          \n\t"                   \
++      "cmpb,=,n %%r20, %%r21, 0b              \n\t"                   \
+       "nop                                    \n\t"                   \
+-      "ldi    " _ASM_EDEADLOCK ", %%r25       \n\t"                   \
+-      "cmpb,=,n %%r25, %%r21, 0b              \n\t"                   \
++      "ldi    " _ASM_EDEADLOCK ", %%r20       \n\t"                   \
++      "cmpb,=,n %%r20, %%r21, 0b              \n\t"                   \
+       "nop                                    \n\t"                   \
+-      "stw    %%r28, %0                       \n\t"                   \
+-      "stw    %%r21, %1                       \n\t"                   \
+-      : "=m" (lws_ret), "=m" (lws_errno)                              \
+-        : "r" (mem), "r" (oldval), "r" (newval)                               
\
++      : "=r" (lws_ret), "=r" (lws_errno)                              \
++      : "r" (lws_mem), "r" (lws_old), "r" (lws_new)                   \
+       : _LWS_CLOBBER                                                  \
+      );                                                                       
\
+                                                                       \
+-     if(lws_errno == -EFAULT || lws_errno == -ENOSYS)                 \
++     if (lws_errno == -EFAULT || lws_errno == -ENOSYS)                        
\
+       ABORT_INSTRUCTION;                                              \
+                                                                       \
+-     lws_ret;                                                         \
++     (__typeof (oldval)) lws_ret;                                     \
+    })
+
+ # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval)    \
+diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h 
b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
+index 83c0340..9d5c542 100644
+--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
++++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
+@@ -16,8 +16,11 @@
+    License along with the GNU C Library; if not, see
+    <http://www.gnu.org/licenses/>.  */
+
++#ifndef _LINUX_MICROBLAZE_SYSDEP_H
++#define _LINUX_MICROBLAZE_SYSDEP_H 1
++
++#include <sysdeps/unix/sysdep.h>
+ #include <sysdeps/microblaze/sysdep.h>
+-#include <sys/syscall.h>
+
+ /* Defines RTLD_PRIVATE_ERRNO.  */
+ #include <dl-sysdep.h>
+@@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL:                            \
+ # define PTR_DEMANGLE(var) (void) (var)
+
+ #endif /* not __ASSEMBLER__ */
++
++#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
+diff --git a/sysdeps/unix/sysv/linux/openat.c 
b/sysdeps/unix/sysv/linux/openat.c
+index 6777123..ad8e31d 100644
+--- a/sysdeps/unix/sysv/linux/openat.c
++++ b/sysdeps/unix/sysv/linux/openat.c
+@@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
+       va_end (arg);
+     }
+
++  /* We have to add the O_LARGEFILE flag for openat64.  */
++#ifdef MORE_OFLAGS
++  oflag |= MORE_OFLAGS;
++#endif
++
+   return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
+ }
+ libc_hidden_def (__OPENAT)
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to