Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809148/?format=api
{ "id": 809148, "url": "http://patchwork.ozlabs.org/api/patches/809148/?format=api", "web_url": "http://patchwork.ozlabs.org/project/buildroot/patch/20170902205423.21288-12-romain.naour@gmail.com/", "project": { "id": 27, "url": "http://patchwork.ozlabs.org/api/projects/27/?format=api", "name": "Buildroot development", "link_name": "buildroot", "list_id": "buildroot.buildroot.org", "list_email": "buildroot@buildroot.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170902205423.21288-12-romain.naour@gmail.com>", "list_archive_url": null, "date": "2017-09-02T20:54:23", "name": "[v2,11/11] package/glibc: backport fixes for glibc bug 21930", "commit_ref": null, "pull_url": null, "state": "awaiting-upstream", "archived": false, "hash": "bb6206e0c89cf66efd75be34fb4c7b59460df2f5", "submitter": { "id": 67942, "url": "http://patchwork.ozlabs.org/api/people/67942/?format=api", "name": "Romain Naour", "email": "romain.naour@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/buildroot/patch/20170902205423.21288-12-romain.naour@gmail.com/mbox/", "series": [ { "id": 1178, "url": "http://patchwork.ozlabs.org/api/series/1178/?format=api", "web_url": "http://patchwork.ozlabs.org/project/buildroot/list/?series=1178", "date": "2017-09-02T20:54:12", "name": "glibc: bump to 2.26", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/1178/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809148/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809148/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<buildroot-bounces@busybox.net>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "buildroot@lists.busybox.net" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "buildroot@osuosl.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=busybox.net\n\t(client-ip=140.211.166.136; helo=silver.osuosl.org;\n\tenvelope-from=buildroot-bounces@busybox.net;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"dOKQXKSY\"; dkim-atps=neutral" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xl7f80Hdwz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 3 Sep 2017 06:54:55 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 5CB9C3061D;\n\tSat, 2 Sep 2017 20:54:53 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id f+YXmYPLq1SD; Sat, 2 Sep 2017 20:54:49 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 4D06D24B96;\n\tSat, 2 Sep 2017 20:54:49 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id DFC941C121F\n\tfor <buildroot@lists.busybox.net>;\n\tSat, 2 Sep 2017 20:54:43 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id D75E582E12\n\tfor <buildroot@lists.busybox.net>;\n\tSat, 2 Sep 2017 20:54:43 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id Ym39ROxyr5yy for <buildroot@lists.busybox.net>;\n\tSat, 2 Sep 2017 20:54:42 +0000 (UTC)", "from mail-wr0-f173.google.com (mail-wr0-f173.google.com\n\t[209.85.128.173])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id D1B6B81E69\n\tfor <buildroot@buildroot.org>; Sat, 2 Sep 2017 20:54:41 +0000 (UTC)", "by mail-wr0-f173.google.com with SMTP id p14so7056964wrg.3\n\tfor <buildroot@buildroot.org>; Sat, 02 Sep 2017 13:54:41 -0700 (PDT)", "from localhost.localdomain\n\t([2a01:e35:1391:67d0:e6f9:2d2f:1a1e:79bf])\n\tby smtp.gmail.com with ESMTPSA id\n\t52sm2295647wru.59.2017.09.02.13.54.38\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSat, 02 Sep 2017 13:54:39 -0700 (PDT)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=KWtCVFqWhRmtLBB9Wz3biAOB3zsAMy6ms60T9j77RvE=;\n\tb=dOKQXKSYMlsnnniE8ah3Ho72x9KkThNx71IiYWplhpO5d48TnSMR9OgjUwpwGhPigM\n\t17sOTcTqsxSeKUOAlrVNiKDISuIuUTOYXB5EW3kF10CtpwCEVravXwXocfKiYDUovFpN\n\tMZ4/uLNgt5Yqj14OanOklXdDyt0HCiDvtJpiLwvrOflFyqHREcM6GI73cn13yFGeKZEe\n\tzUBGi5R/dl5bFB9FHIxZuxy8zPy8dMuV6fSgnakrKKIAXBhjE1JRM9SCUw+EVCKUtE4H\n\tMkFGxGUoYXYd+d6nuDrLbUtCfKd19ua6zTT5LzFo+mNUSBC2fjflb8f4xw4GxmbdMBbc\n\tvNRQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=KWtCVFqWhRmtLBB9Wz3biAOB3zsAMy6ms60T9j77RvE=;\n\tb=XwWhy7yYbsgcPYD/in/HiSGgAnvYEo5oCwv/SwF0LQkjf3KmmSqdd76LXiiJd5H52W\n\tSBiRYsvfE/TYgFEm0a99Ol9+tPOsk7AaM9yvh/I2QxFOULPFU8AL264ObtKfxDIIlo5d\n\txEDahed+hAgb1evfzcynrcLWp0BtSez/Pl4T2HTn/HhAs5GX/A9QKYZMCJJqN+tXH0OF\n\tEDKditph+G7EuxNjsriHEDQxUq13CbhQCkhxvMYU90AueGYCMH3snXiflAoNFq8KhRU6\n\t6ef+T4+YVoV4wtkSGPA0fW8HZbcnlWpTbzY3ISCTMABxU8Dr7KBbL0y8Iqp1nWzckfbx\n\tfmJg==", "X-Gm-Message-State": "AHPjjUgzR/malesAsV5uU/NIemu74i+ClnQpFt8zNuzgSL2zrfoSX03c\n\tphD1eazbluTDIXI5utM=", "X-Google-Smtp-Source": "ADKCNb6rg0VKJz0eDb7bW+48QqhhFXfTiG3YuopTJdfdTOGyT/i6vjE9X9GLylMzOUvXllJM0TobOQ==", "X-Received": "by 10.223.176.13 with SMTP id f13mr3240558wra.206.1504385679719; \n\tSat, 02 Sep 2017 13:54:39 -0700 (PDT)", "From": "Romain Naour <romain.naour@gmail.com>", "To": "buildroot@buildroot.org", "Date": "Sat, 2 Sep 2017 22:54:23 +0200", "Message-Id": "<20170902205423.21288-12-romain.naour@gmail.com>", "X-Mailer": "git-send-email 2.9.5", "In-Reply-To": "<20170902205423.21288-1-romain.naour@gmail.com>", "References": "<20170902205423.21288-1-romain.naour@gmail.com>", "Cc": "Romain Naour <romain.naour@gmail.com>", "Subject": "[Buildroot] [PATCH v2 11/11] package/glibc: backport fixes for\n\tglibc bug 21930", "X-BeenThere": "buildroot@busybox.net", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Discussion and development of buildroot <buildroot.busybox.net>", "List-Unsubscribe": "<http://lists.busybox.net/mailman/options/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=unsubscribe>", "List-Archive": "<http://lists.busybox.net/pipermail/buildroot/>", "List-Post": "<mailto:buildroot@busybox.net>", "List-Help": "<mailto:buildroot-request@busybox.net?subject=help>", "List-Subscribe": "<http://lists.busybox.net/mailman/listinfo/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "buildroot-bounces@busybox.net", "Sender": "\"buildroot\" <buildroot-bounces@busybox.net>" }, "content": "Backport patches from glibc 2.26 stable branch.\n\n[1] https://sourceware.org/ml/libc-alpha/2017-08/msg00586.html\n[2] https://sourceware.org/bugzilla/show_bug.cgi?id=21930\n\nSigned-off-by: Romain Naour <romain.naour@gmail.com>\n---\n ...__builtin_types_compatible_p-in-C-mode-bu.patch | 50 +++++\n ...02-Do-not-use-generic-selection-in-C-mode.patch | 56 +++++\n ...-version-of-issignaling-that-does-not-use.patch | 225 +++++++++++++++++++++\n ...ersion-of-issignaling-when-__NO_LONG_DOUB.patch | 47 +++++\n ...-version-of-iszero-that-does-not-use-__MA.patch | 210 +++++++++++++++++++\n 5 files changed, 588 insertions(+)\n create mode 100644 package/glibc/0001-Do-not-use-__builtin_types_compatible_p-in-C-mode-bu.patch\n create mode 100644 package/glibc/0002-Do-not-use-generic-selection-in-C-mode.patch\n create mode 100644 package/glibc/0003-Provide-a-C-version-of-issignaling-that-does-not-use.patch\n create mode 100644 package/glibc/0004-Fix-the-C-version-of-issignaling-when-__NO_LONG_DOUB.patch\n create mode 100644 package/glibc/0005-Provide-a-C-version-of-iszero-that-does-not-use-__MA.patch", "diff": "diff --git a/package/glibc/0001-Do-not-use-__builtin_types_compatible_p-in-C-mode-bu.patch b/package/glibc/0001-Do-not-use-__builtin_types_compatible_p-in-C-mode-bu.patch\nnew file mode 100644\nindex 0000000..27a785e\n--- /dev/null\n+++ b/package/glibc/0001-Do-not-use-__builtin_types_compatible_p-in-C-mode-bu.patch\n@@ -0,0 +1,50 @@\n+From f7439f9b1089e17b6721f28e228682831a2f0135 Mon Sep 17 00:00:00 2001\n+From: \"Gabriel F. T. Gomes\" <gftg@linux.vnet.ibm.com>\n+Date: Mon, 21 Aug 2017 14:23:27 +0200\n+Subject: [PATCH] Do not use __builtin_types_compatible_p in C++ mode (bug\n+ 21930)\n+\n+The logic to define isinf for float128 depends on the availability of\n+__builtin_types_compatible_p, which is only available in C mode,\n+however, the conditionals do not check for C or C++ mode. This lead to\n+an error in libstdc++ configure, as reported by bug 21930.\n+\n+This patch adds a conditional for C mode in the definition of isinf for\n+float128. No definition is provided in C++ mode, since libstdc++\n+headers undefine isinf.\n+\n+Tested for powerpc64le (glibc test suite and libstdc++-v3 configure).\n+\n+\t[BZ #21930]\n+\t* math/math.h (isinf): Check if in C or C++ mode before using\n+\t__builtin_types_compatible_p, since this is a C mode feature.\n+\n+(cherry picked from commit 47a67213a9f51c5f8816d240500b10db605d8b77)\n+[Romain rebase on glibc 2.26]\n+Signed-off-by: Romain Naour <romain.naour@gmail.com>\n+---\n+ math/math.h | 8 ++++++--\n+ 1 file changed, 6 insertions(+), 2 deletions(-)\n+\n+diff --git a/math/math.h b/math/math.h\n+index e217080..dea8dbe 100644\n+--- a/math/math.h\n++++ b/math/math.h\n+@@ -442,8 +442,12 @@ enum\n+ \n+ /* Return nonzero value if X is positive or negative infinity. */\n+ # if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \\\n+- && !defined __SUPPORT_SNAN__\n+- /* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */\n++ && !defined __SUPPORT_SNAN__ && !defined __cplusplus\n++ /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,\n++ use the helper function, __isinff128, with older compilers. This is\n++ only provided for C mode, because in C++ mode, GCC has no support\n++ for __builtin_types_compatible_p (and when in C++ mode, this macro is\n++ not used anyway, because libstdc++ headers undefine it). */\n+ # define isinf(x) \\\n+ (__builtin_types_compatible_p (__typeof (x), _Float128) \\\n+ ? __isinff128 (x) : __builtin_isinf_sign (x))\n+-- \n+2.9.5\n+\ndiff --git a/package/glibc/0002-Do-not-use-generic-selection-in-C-mode.patch b/package/glibc/0002-Do-not-use-generic-selection-in-C-mode.patch\nnew file mode 100644\nindex 0000000..7321eeb\n--- /dev/null\n+++ b/package/glibc/0002-Do-not-use-generic-selection-in-C-mode.patch\n@@ -0,0 +1,56 @@\n+From bb21afc362a3ecba07ab386a0bc4385e75fbd4b5 Mon Sep 17 00:00:00 2001\n+From: \"Gabriel F. T. Gomes\" <gftg@linux.vnet.ibm.com>\n+Date: Mon, 14 Aug 2017 17:51:51 -0300\n+Subject: [PATCH] Do not use generic selection in C++ mode\n+\n+The logic to protect the use of generic selection (_Generic) does not\n+check for C or C++ mode, however, generic selection is a C-only\n+feature.\n+\n+Tested for powerpc64le.\n+\n+\t* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if\n+\tin C++ mode.\n+\n+(cherry picked from commit 6913ad65e00bb32417ad39c41d292b976171e27e)\n+[Romain rebase on glibc 2.26]\n+Signed-off-by: Romain Naour <romain.naour@gmail.com>\n+---\n+ misc/sys/cdefs.h | 19 ++++++++++---------\n+ 1 file changed, 10 insertions(+), 9 deletions(-)\n+\n+diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h\n+index 06523bf..0c80821 100644\n+--- a/misc/sys/cdefs.h\n++++ b/misc/sys/cdefs.h\n+@@ -464,17 +464,18 @@\n+ # define __glibc_macro_warning(msg)\n+ #endif\n+ \n+-/* Support for generic selection (ISO C11) is available in GCC since\n+- version 4.9. Previous versions do not provide generic selection,\n+- even though they might set __STDC_VERSION__ to 201112L, when in\n+- -std=c11 mode. Thus, we must check for !defined __GNUC__ when\n+- testing __STDC_VERSION__ for generic selection support.\n++/* Generic selection (ISO C11) is a C-only feature, available in GCC\n++ since version 4.9. Previous versions do not provide generic\n++ selection, even though they might set __STDC_VERSION__ to 201112L,\n++ when in -std=c11 mode. Thus, we must check for !defined __GNUC__\n++ when testing __STDC_VERSION__ for generic selection support.\n+ On the other hand, Clang also defines __GNUC__, so a clang-specific\n+ check is required to enable the use of generic selection. */\n+-#if __GNUC_PREREQ (4, 9) \\\n+- || __glibc_clang_has_extension (c_generic_selections) \\\n+- || (!defined __GNUC__ && defined __STDC_VERSION__ \\\n+-\t&& __STDC_VERSION__ >= 201112L)\n++#if !defined __cplusplus \\\n++ && (__GNUC_PREREQ (4, 9) \\\n++\t|| __glibc_clang_has_extension (c_generic_selections) \\\n++\t|| (!defined __GNUC__ && defined __STDC_VERSION__ \\\n++\t && __STDC_VERSION__ >= 201112L))\n+ # define __HAVE_GENERIC_SELECTION 1\n+ #else\n+ # define __HAVE_GENERIC_SELECTION 0\n+-- \n+2.9.5\n+\ndiff --git a/package/glibc/0003-Provide-a-C-version-of-issignaling-that-does-not-use.patch b/package/glibc/0003-Provide-a-C-version-of-issignaling-that-does-not-use.patch\nnew file mode 100644\nindex 0000000..b9cd3df\n--- /dev/null\n+++ b/package/glibc/0003-Provide-a-C-version-of-issignaling-that-does-not-use.patch\n@@ -0,0 +1,225 @@\n+From 9bcf391a21677c6d5fa1c2be71554ec181e24f39 Mon Sep 17 00:00:00 2001\n+From: \"Gabriel F. T. Gomes\" <gftg@linux.vnet.ibm.com>\n+Date: Mon, 14 Aug 2017 13:46:15 -0300\n+Subject: [PATCH] Provide a C++ version of issignaling that does not use\n+ __MATH_TG\n+\n+The macro __MATH_TG contains the logic to select between long double and\n+_Float128, when these types are ABI-distinct. This logic relies on\n+__builtin_types_compatible_p, which is not available in C++ mode.\n+\n+On the other hand, C++ function overloading provides the means to\n+distinguish between the floating-point types. The overloading\n+resolution will match the correct parameter regardless of type\n+qualifiers, i.e.: const and volatile.\n+\n+Tested for powerpc64le, s390x, and x86_64.\n+\n+\t* math/math.h [defined __cplusplus] (issignaling): Provide a C++\n+\tdefinition for issignaling that does not rely on __MATH_TG,\n+\tsince __MATH_TG uses __builtin_types_compatible_p, which is only\n+\tavailable in C mode.\n+\t(CFLAGS-test-math-issignaling.cc): New variable.\n+\t* math/Makefile [CXX] (tests): Add test-math-issignaling.\n+\t* math/test-math-issignaling.cc: New test for C++ implementation\n+\tof type-generic issignaling.\n+\t* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]\n+\t(CXXFLAGS-test-math-issignaling.cc): Add -mfloat128 to the build\n+\toptions of test-math-issignaling on powerpc64le.\n+\n+(cherry picked from commit a16e8bc08edca84d507715c66d6cddbbc7ed3b62)\n+[Romain rebase on glibc 2.26]\n+Signed-off-by: Romain Naour <romain.naour@gmail.com>\n+---\n+ math/Makefile | 3 +-\n+ math/math.h | 19 +++++-\n+ math/test-math-issignaling.cc | 113 +++++++++++++++++++++++++++++++++++\n+ sysdeps/powerpc/powerpc64le/Makefile | 1 +\n+ 4 files changed, 134 insertions(+), 2 deletions(-)\n+ create mode 100644 math/test-math-issignaling.cc\n+\n+diff --git a/math/Makefile b/math/Makefile\n+index e09b0c0..0130fcf 100644\n+--- a/math/Makefile\n++++ b/math/Makefile\n+@@ -203,7 +203,7 @@ tests-static = test-fpucw-static test-fpucw-ieee-static \\\n+ \t test-signgam-ullong-static test-signgam-ullong-init-static\n+ \n+ ifneq (,$(CXX))\n+-tests += test-math-isinff test-math-iszero\n++tests += test-math-isinff test-math-iszero test-math-issignaling\n+ endif\n+ \n+ ifneq (no,$(PERL))\n+@@ -350,6 +350,7 @@ CFLAGS-test-signgam-ullong-init-static.c = -std=c99\n+ \n+ CFLAGS-test-math-isinff.cc = -std=gnu++11\n+ CFLAGS-test-math-iszero.cc = -std=gnu++11\n++CFLAGS-test-math-issignaling.cc = -std=gnu++11\n+ \n+ CFLAGS-test-iszero-excess-precision.c = -fexcess-precision=standard\n+ CFLAGS-test-iseqsig-excess-precision.c = -fexcess-precision=standard\n+diff --git a/math/math.h b/math/math.h\n+index dea8dbe..add86af 100644\n+--- a/math/math.h\n++++ b/math/math.h\n+@@ -474,7 +474,24 @@ enum\n+ # include <bits/iscanonical.h>\n+ \n+ /* Return nonzero value if X is a signaling NaN. */\n+-# define issignaling(x) __MATH_TG ((x), __issignaling, (x))\n++# ifndef __cplusplus\n++# define issignaling(x) __MATH_TG ((x), __issignaling, (x))\n++# else\n++ /* In C++ mode, __MATH_TG cannot be used, because it relies on\n++ __builtin_types_compatible_p, which is a C-only builtin. On the\n++ other hand, overloading provides the means to distinguish between\n++ the floating-point types. The overloading resolution will match\n++ the correct parameter (regardless of type qualifiers (i.e.: const\n++ and volatile). */\n++extern \"C++\" {\n++inline int issignaling (float __val) { return __issignalingf (__val); }\n++inline int issignaling (double __val) { return __issignaling (__val); }\n++inline int issignaling (long double __val) { return __issignalingl (__val); }\n++# if __HAVE_DISTINCT_FLOAT128\n++inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }\n++# endif\n++} /* extern C++ */\n++# endif\n+ \n+ /* Return nonzero value if X is subnormal. */\n+ # define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)\n+diff --git a/math/test-math-issignaling.cc b/math/test-math-issignaling.cc\n+new file mode 100644\n+index 0000000..22ae9e1\n+--- /dev/null\n++++ b/math/test-math-issignaling.cc\n+@@ -0,0 +1,113 @@\n++/* Test for the C++ implementation of issignaling.\n++ Copyright (C) 2017 Free Software Foundation, Inc.\n++ This file is part of the GNU C Library.\n++\n++ The GNU C Library is free software; you can redistribute it and/or\n++ modify it under the terms of the GNU Lesser General Public\n++ License as published by the Free Software Foundation; either\n++ version 2.1 of the License, or (at your option) any later version.\n++\n++ The GNU C Library is distributed in the hope that it will be useful,\n++ but WITHOUT ANY WARRANTY; without even the implied warranty of\n++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n++ Lesser General Public License for more details.\n++\n++ You should have received a copy of the GNU Lesser General Public\n++ License along with the GNU C Library; if not, see\n++ <http://www.gnu.org/licenses/>. */\n++\n++#define _GNU_SOURCE 1\n++#include <math.h>\n++#include <stdio.h>\n++\n++#include <limits>\n++\n++/* There is no signaling_NaN for _Float128 in std::numeric_limits.\n++ Include ieee754_float128.h and use the bitfields in the union\n++ ieee854_float128.ieee_nan to build a signaling NaN. */\n++#if __HAVE_DISTINCT_FLOAT128\n++# include <ieee754_float128.h>\n++#endif\n++\n++static bool errors;\n++\n++static void\n++check (int actual, int expected, const char *actual_expr, int line)\n++{\n++ if (actual != expected)\n++ {\n++ errors = true;\n++ printf (\"%s:%d: error: %s\\n\", __FILE__, line, actual_expr);\n++ printf (\"%s:%d: expected: %d\\n\", __FILE__, line, expected);\n++ printf (\"%s:%d: actual: %d\\n\", __FILE__, line, actual);\n++ }\n++}\n++\n++#define CHECK(actual, expected) \\\n++ check ((actual), (expected), #actual, __LINE__)\n++\n++template <class T>\n++static void\n++check_type ()\n++{\n++ typedef std::numeric_limits<T> limits;\n++ CHECK (issignaling (T{0}), 0);\n++ if (limits::has_infinity)\n++ {\n++ CHECK (issignaling (limits::infinity ()), 0);\n++ CHECK (issignaling (-limits::infinity ()), 0);\n++ }\n++ if (limits::has_quiet_NaN)\n++ CHECK (issignaling (limits::quiet_NaN ()), 0);\n++ if (limits::has_signaling_NaN)\n++ CHECK (issignaling (limits::signaling_NaN ()), 1);\n++}\n++\n++#if __HAVE_DISTINCT_FLOAT128\n++static void\n++check_float128 ()\n++{\n++ ieee854_float128 q;\n++\n++ q.d = 0;\n++ CHECK (issignaling (q.d), 0);\n++\n++ /* Infinity. */\n++ q.ieee.negative = 0;\n++ q.ieee.exponent = 0x7FFF;\n++ q.ieee.mantissa0 = 0x0000;\n++ q.ieee.mantissa1 = 0x00000000;\n++ q.ieee.mantissa2 = 0x00000000;\n++ q.ieee.mantissa3 = 0x00000000;\n++ CHECK (issignaling (q.d), 0);\n++\n++ /* Quiet NaN. */\n++ q.ieee_nan.quiet_nan = 1;\n++ q.ieee_nan.mantissa0 = 0x0000;\n++ CHECK (issignaling (q.d), 0);\n++\n++ /* Still a quiet NaN. */\n++ q.ieee_nan.quiet_nan = 1;\n++ q.ieee_nan.mantissa0 = 0x4000;\n++ CHECK (issignaling (q.d), 0);\n++\n++ /* Signaling NaN. */\n++ q.ieee_nan.quiet_nan = 0;\n++ q.ieee_nan.mantissa0 = 0x4000;\n++ CHECK (issignaling (q.d), 1);\n++}\n++#endif\n++\n++static int\n++do_test (void)\n++{\n++ check_type<float> ();\n++ check_type<double> ();\n++ check_type<long double> ();\n++#if __HAVE_DISTINCT_FLOAT128\n++ check_float128 ();\n++#endif\n++ return errors;\n++}\n++\n++#include <support/test-driver.c>\n+diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile\n+index 77617b6..19adbfa 100644\n+--- a/sysdeps/powerpc/powerpc64le/Makefile\n++++ b/sysdeps/powerpc/powerpc64le/Makefile\n+@@ -16,6 +16,7 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128\n+ $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128\n+ $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128\n+ CFLAGS-libm-test-support-float128.c += -mfloat128\n++CFLAGS-test-math-issignaling.cc += -mfloat128\n+ $(objpfx)test-float128% $(objpfx)test-ifloat128%: \\\n+ gnulib-tests += $(f128-loader-link)\n+ endif\n+-- \n+2.9.5\n+\ndiff --git a/package/glibc/0004-Fix-the-C-version-of-issignaling-when-__NO_LONG_DOUB.patch b/package/glibc/0004-Fix-the-C-version-of-issignaling-when-__NO_LONG_DOUB.patch\nnew file mode 100644\nindex 0000000..5e32f75\n--- /dev/null\n+++ b/package/glibc/0004-Fix-the-C-version-of-issignaling-when-__NO_LONG_DOUB.patch\n@@ -0,0 +1,47 @@\n+From 9dbd8386a1b706beb30291a7e76bbfe69c2620cf Mon Sep 17 00:00:00 2001\n+From: \"Gabriel F. T. Gomes\" <gftg@linux.vnet.ibm.com>\n+Date: Wed, 23 Aug 2017 10:16:54 -0300\n+Subject: [PATCH] Fix the C++ version of issignaling when __NO_LONG_DOUBLE_MATH\n+ is defined\n+\n+When __NO_LONG_DOUBLE_MATH is defined, __issignalingl is not available,\n+thus issignaling with long double argument should call __issignaling,\n+instead.\n+\n+Tested for powerpc64le.\n+\n+\t* math/math.h [defined __cplusplus] (issignaling): In the long\n+\tdouble case, call __issignalingl only if __NO_LONG_DOUBLE_MATH\n+\tis not defined. Call __issignaling, otherwise.\n+\n+(cherry picked from commit 3d7b66f66cb223e899a7ebc0f4c20f13e711c9e0)\n+[Romain rebase on glibc 2.26]\n+Signed-off-by: Romain Naour <romain.naour@gmail.com>\n+---\n+ math/math.h | 10 +++++++++-\n+ 1 file changed, 9 insertions(+), 1 deletion(-)\n+\n+diff --git a/math/math.h b/math/math.h\n+index add86af..60dfa31 100644\n+--- a/math/math.h\n++++ b/math/math.h\n+@@ -486,7 +486,15 @@ enum\n+ extern \"C++\" {\n+ inline int issignaling (float __val) { return __issignalingf (__val); }\n+ inline int issignaling (double __val) { return __issignaling (__val); }\n+-inline int issignaling (long double __val) { return __issignalingl (__val); }\n++inline int\n++issignaling (long double __val)\n++{\n++# ifdef __NO_LONG_DOUBLE_MATH\n++ return __issignaling (__val);\n++# else\n++ return __issignalingl (__val);\n++# endif\n++}\n+ # if __HAVE_DISTINCT_FLOAT128\n+ inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }\n+ # endif\n+-- \n+2.9.5\n+\ndiff --git a/package/glibc/0005-Provide-a-C-version-of-iszero-that-does-not-use-__MA.patch b/package/glibc/0005-Provide-a-C-version-of-iszero-that-does-not-use-__MA.patch\nnew file mode 100644\nindex 0000000..e12c843\n--- /dev/null\n+++ b/package/glibc/0005-Provide-a-C-version-of-iszero-that-does-not-use-__MA.patch\n@@ -0,0 +1,210 @@\n+From 45970aa26d1af87b016ef95b4b35c566aeb6e841 Mon Sep 17 00:00:00 2001\n+From: \"Gabriel F. T. Gomes\" <gftg@linux.vnet.ibm.com>\n+Date: Tue, 22 Aug 2017 16:34:42 -0300\n+Subject: [PATCH] Provide a C++ version of iszero that does not use __MATH_TG\n+ (bug 21930)\n+\n+When signaling nans are enabled (with -fsignaling-nans), the C++ version\n+of iszero uses the fpclassify macro, which is defined with __MATH_TG.\n+However, when support for float128 is available, __MATH_TG uses the\n+builtin __builtin_types_compatible_p, which is only available in C mode.\n+\n+This patch refactors the C++ version of iszero so that it uses function\n+overloading to select between the floating-point types, instead of\n+relying on fpclassify and __MATH_TG.\n+\n+Tested for powerpc64le, s390x, x86_64, and with build-many-glibcs.py.\n+\n+\t[BZ #21930]\n+\t* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]\n+\t(iszero): New C++ implementation that does not use\n+\tfpclassify/__MATH_TG/__builtin_types_compatible_p, when\n+\tsignaling nans are enabled, since __builtin_types_compatible_p\n+\tis a C-only feature.\n+\t* math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is\n+\tdefined, include ieee754_float128.h for access to the union and\n+\tmember ieee854_float128.ieee.\n+\t[__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128.\n+\t[__HAVE_DISTINCT_FLOAT128] (check_float128): New function.\n+\t* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]\n+\t(CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build\n+\toptions of test-math-zero on powerpc64le.\n+\n+(cherry picked from commit 42496114ec0eb7d6d039d05d4262e109951c600c)\n+[Romain rebase on glibc 2.26]\n+Signed-off-by: Romain Naour <romain.naour@gmail.com>\n+---\n+ math/math.h | 33 +++++++++++++--\n+ math/test-math-iszero.cc | 79 ++++++++++++++++++++++++++++++++++++\n+ sysdeps/powerpc/powerpc64le/Makefile | 3 +-\n+ 3 files changed, 110 insertions(+), 5 deletions(-)\n+\n+diff --git a/math/math.h b/math/math.h\n+index 60dfa31..7c0fc6d 100644\n+--- a/math/math.h\n++++ b/math/math.h\n+@@ -513,15 +513,40 @@ inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }\n+ # endif\n+ # else\t/* __cplusplus */\n+ extern \"C++\" {\n++# ifdef __SUPPORT_SNAN__\n++inline int\n++iszero (float __val)\n++{\n++ return __fpclassifyf (__val) == FP_ZERO;\n++}\n++inline int\n++iszero (double __val)\n++{\n++ return __fpclassify (__val) == FP_ZERO;\n++}\n++inline int\n++iszero (long double __val)\n++{\n++# ifdef __NO_LONG_DOUBLE_MATH\n++ return __fpclassify (__val) == FP_ZERO;\n++# else\n++ return __fpclassifyl (__val) == FP_ZERO;\n++# endif\n++}\n++# if __HAVE_DISTINCT_FLOAT128\n++inline int\n++iszero (_Float128 __val)\n++{\n++ return __fpclassifyf128 (__val) == FP_ZERO;\n++}\n++# endif\n++# else\n+ template <class __T> inline bool\n+ iszero (__T __val)\n+ {\n+-# ifdef __SUPPORT_SNAN__\n+- return fpclassify (__val) == FP_ZERO;\n+-# else\n+ return __val == 0;\n+-# endif\n+ }\n++# endif\n+ } /* extern C++ */\n+ # endif\t/* __cplusplus */\n+ #endif /* Use IEC_60559_BFP_EXT. */\n+diff --git a/math/test-math-iszero.cc b/math/test-math-iszero.cc\n+index 027e972..5c07261 100644\n+--- a/math/test-math-iszero.cc\n++++ b/math/test-math-iszero.cc\n+@@ -22,6 +22,13 @@\n+ \n+ #include <limits>\n+ \n++/* Support for _Float128 in std::numeric_limits is limited.\n++ Include ieee754_float128.h and use the bitfields in the union\n++ ieee854_float128.ieee_nan to build corner-case inputs. */\n++#if __HAVE_DISTINCT_FLOAT128\n++# include <ieee754_float128.h>\n++#endif\n++\n+ static bool errors;\n+ \n+ static void\n+@@ -72,12 +79,84 @@ check_type ()\n+ std::numeric_limits<T>::has_denorm == std::denorm_absent);\n+ }\n+ \n++#if __HAVE_DISTINCT_FLOAT128\n++static void\n++check_float128 ()\n++{\n++ ieee854_float128 q;\n++\n++ q.d = 0.0Q;\n++ CHECK (iszero (q.d), 1);\n++ q.d = -0.0Q;\n++ CHECK (iszero (q.d), 1);\n++ q.d = 1.0Q;\n++ CHECK (iszero (q.d), 0);\n++ q.d = -1.0Q;\n++ CHECK (iszero (q.d), 0);\n++\n++ /* Normal min. */\n++ q.ieee.negative = 0;\n++ q.ieee.exponent = 0x0001;\n++ q.ieee.mantissa0 = 0x0000;\n++ q.ieee.mantissa1 = 0x00000000;\n++ q.ieee.mantissa2 = 0x00000000;\n++ q.ieee.mantissa3 = 0x00000000;\n++ CHECK (iszero (q.d), 0);\n++ q.ieee.negative = 1;\n++ CHECK (iszero (q.d), 0);\n++\n++ /* Normal max. */\n++ q.ieee.negative = 0;\n++ q.ieee.exponent = 0x7FFE;\n++ q.ieee.mantissa0 = 0xFFFF;\n++ q.ieee.mantissa1 = 0xFFFFFFFF;\n++ q.ieee.mantissa2 = 0xFFFFFFFF;\n++ q.ieee.mantissa3 = 0xFFFFFFFF;\n++ CHECK (iszero (q.d), 0);\n++ q.ieee.negative = 1;\n++ CHECK (iszero (q.d), 0);\n++\n++ /* Infinity. */\n++ q.ieee.negative = 0;\n++ q.ieee.exponent = 0x7FFF;\n++ q.ieee.mantissa0 = 0x0000;\n++ q.ieee.mantissa1 = 0x00000000;\n++ q.ieee.mantissa2 = 0x00000000;\n++ q.ieee.mantissa3 = 0x00000000;\n++ CHECK (iszero (q.d), 0);\n++\n++ /* Quiet NaN. */\n++ q.ieee_nan.quiet_nan = 1;\n++ q.ieee_nan.mantissa0 = 0x0000;\n++ CHECK (iszero (q.d), 0);\n++\n++ /* Signaling NaN. */\n++ q.ieee_nan.quiet_nan = 0;\n++ q.ieee_nan.mantissa0 = 0x4000;\n++ CHECK (iszero (q.d), 0);\n++\n++ /* Denormal min. */\n++ q.ieee.negative = 0;\n++ q.ieee.exponent = 0x0000;\n++ q.ieee.mantissa0 = 0x0000;\n++ q.ieee.mantissa1 = 0x00000000;\n++ q.ieee.mantissa2 = 0x00000000;\n++ q.ieee.mantissa3 = 0x00000001;\n++ CHECK (iszero (q.d), 0);\n++ q.ieee.negative = 1;\n++ CHECK (iszero (q.d), 0);\n++}\n++#endif\n++\n+ static int\n+ do_test (void)\n+ {\n+ check_type<float> ();\n+ check_type<double> ();\n+ check_type<long double> ();\n++#if __HAVE_DISTINCT_FLOAT128\n++ check_float128 ();\n++#endif\n+ return errors;\n+ }\n+ \n+diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile\n+index 19adbfa..dea2290 100644\n+--- a/sysdeps/powerpc/powerpc64le/Makefile\n++++ b/sysdeps/powerpc/powerpc64le/Makefile\n+@@ -17,7 +17,8 @@ $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -\n+ $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128\n+ CFLAGS-libm-test-support-float128.c += -mfloat128\n+ CFLAGS-test-math-issignaling.cc += -mfloat128\n+-$(objpfx)test-float128% $(objpfx)test-ifloat128%: \\\n++CFLAGS-test-math-iszero.cc += -mfloat128\n++$(objpfx)test-float128% $(objpfx)test-ifloat128% $(objpfx)test-math-iszero: \\\n+ gnulib-tests += $(f128-loader-link)\n+ endif\n+ \n+-- \n+2.9.5\n+\n", "prefixes": [ "v2", "11/11" ] }