summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO26
-rw-r--r--0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch110
-rw-r--r--0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch223
-rw-r--r--PKGBUILD67
-rw-r--r--bz20338.patch114
-rw-r--r--glibc-58270c0049404ef2f878fdd45df55f17f0b8c1f7.patch1128
6 files changed, 161 insertions, 1507 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 4b9af5729bfe..5666ba11047c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,17 @@
# Generated by mksrcinfo v8
-# Sat Sep 23 13:36:02 UTC 2017
+# Fri May 11 17:47:38 UTC 2018
pkgbase = arm-linux-gnueabihf-glibc
pkgdesc = GNU C Library (arm-linux-gnueabihf)
- pkgver = 2.26
- pkgrel = 4
+ pkgver = 2.27
+ pkgrel = 3
url = http://www.gnu.org/software/libc/
arch = any
license = GPL
license = LGPL
- makedepends = arm-linux-gnueabihf-gcc-stage2>=7.2.0-3
+ makedepends = arm-linux-gnueabihf-gcc-stage2>=8.1.0-1
makedepends = gperf
- depends = arm-linux-gnueabihf-linux-api-headers>=4.12.7-1
- provides = arm-linux-gnueabihf-glibc-headers=2.26
+ depends = arm-linux-gnueabihf-linux-api-headers>=4.16.1-1
+ provides = arm-linux-gnueabihf-glibc-headers=2.27
provides = arm-linux-gnueabihf-eglibc
conflicts = arm-linux-gnueabihf-glibc-headers
conflicts = arm-linux-gnueabihf-eglibc
@@ -19,16 +19,12 @@ pkgbase = arm-linux-gnueabihf-glibc
options = !buildflags
options = !strip
options = staticlibs
- source = http://ftp.gnu.org/gnu/libc/glibc-2.26.tar.xz
- source = http://ftp.gnu.org/gnu/libc/glibc-2.26.tar.xz.sig
- source = glibc-58270c0049404ef2f878fdd45df55f17f0b8c1f7.patch
- source = 0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
- source = 0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch
- md5sums = 102f637c3812f81111f48f2427611be1
+ source = https://ftp.gnu.org/gnu/glibc/glibc-2.27.tar.xz
+ source = https://ftp.gnu.org/gnu/glibc/glibc-2.27.tar.xz.sig
+ source = bz20338.patch
+ md5sums = 898cd5656519ffbc3a03fe811dd89e82
md5sums = SKIP
- md5sums = 7ce099a4060f59b7b7dd5ca66605f4e8
- md5sums = cbc073315c00b03898b7fc614274d6b3
- md5sums = bd9b13f3294b6357baa809e4416b9f44
+ md5sums = dc0d3ad59aeaaf591b085a77de6e03e9
pkgname = arm-linux-gnueabihf-glibc
diff --git a/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch b/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
deleted file mode 100644
index 5bd40130dee2..000000000000
--- a/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From fc5ad7024c620cdfe9b76e94638aac83b99c5bf8 Mon Sep 17 00:00:00 2001
-From: Andreas Schwab <schwab@suse.de>
-Date: Tue, 8 Aug 2017 16:21:58 +0200
-Subject: [PATCH] Don't use IFUNC resolver for longjmp or system in libpthread
- (bug 21041)
-
-Unlike the vfork forwarder and like the fork forwarder as in bug 19861,
-there won't be a problem when the compiler does not turn this into a tail
-call.
----
- nptl/pt-longjmp.c | 31 ++++++++++---------------------
- nptl/pt-system.c | 24 ++++++++----------------
- 3 files changed, 18 insertions(+), 37 deletions(-)
-
-diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c
-index 2ef757e687f..8f3c6b3a09f 100644
---- a/nptl/pt-longjmp.c
-+++ b/nptl/pt-longjmp.c
-@@ -25,21 +25,14 @@
- symbol in libpthread, but the historical ABI requires it. For static
- linking, there is no need to provide anything here--the libc version
- will be linked in. For shared library ABI compatibility, there must be
-- longjmp and siglongjmp symbols in libpthread.so; so we define them using
-- IFUNC to redirect to the libc function. */
-+ longjmp and siglongjmp symbols in libpthread.so.
-
--#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
--
--# if HAVE_IFUNC
--
--# undef INIT_ARCH
--# define INIT_ARCH()
--# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp)
--
--extern __typeof(longjmp) longjmp_ifunc;
--extern __typeof(siglongjmp) siglongjmp_ifunc;
-+ With an IFUNC resolver, it would be possible to avoid the indirection,
-+ but the IFUNC resolver might run before the __libc_longjmp symbol has
-+ been relocated, in which case the IFUNC resolver would not be able to
-+ provide the correct address. */
-
--# else /* !HAVE_IFUNC */
-+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
- static void __attribute__ ((noreturn, used))
- longjmp_compat (jmp_buf env, int val)
-@@ -47,14 +40,10 @@ longjmp_compat (jmp_buf env, int val)
- __libc_longjmp (env, val);
- }
-
--# define DEFINE_LONGJMP(name) strong_alias (longjmp_compat, name)
--
--# endif /* HAVE_IFUNC */
--
--DEFINE_LONGJMP (longjmp_ifunc)
--compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0);
-+strong_alias (longjmp_compat, longjmp_alias)
-+compat_symbol (libpthread, longjmp_alias, longjmp, GLIBC_2_0);
-
--strong_alias (longjmp_ifunc, siglongjmp_ifunc)
--compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0);
-+strong_alias (longjmp_alias, siglongjmp_alias)
-+compat_symbol (libpthread, siglongjmp_alias, siglongjmp, GLIBC_2_0);
-
- #endif
-diff --git a/nptl/pt-system.c b/nptl/pt-system.c
-index f8ca6ba0d94..b30ddf2b398 100644
---- a/nptl/pt-system.c
-+++ b/nptl/pt-system.c
-@@ -25,29 +25,21 @@
- libpthread, but the historical ABI requires it. For static linking,
- there is no need to provide anything here--the libc version will be
- linked in. For shared library ABI compatibility, there must be a
-- 'system' symbol in libpthread.so; so we define it using IFUNC to
-- redirect to the libc function. */
-+ 'system' symbol in libpthread.so.
-
--#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
--
--# if HAVE_IFUNC
--
--extern __typeof(system) system_ifunc;
--# undef INIT_ARCH
--# define INIT_ARCH()
--libc_ifunc (system_ifunc, &__libc_system)
-+ With an IFUNC resolver, it would be possible to avoid the indirection,
-+ but the IFUNC resolver might run before the __libc_system symbol has
-+ been relocated, in which case the IFUNC resolver would not be able to
-+ provide the correct address. */
-
--# else /* !HAVE_IFUNC */
-+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
- static int __attribute__ ((used))
- system_compat (const char *line)
- {
- return __libc_system (line);
- }
--strong_alias (system_compat, system_ifunc)
--
--# endif /* HAVE_IFUNC */
--
--compat_symbol (libpthread, system_ifunc, system, GLIBC_2_0);
-+strong_alias (system_compat, system_alias)
-+compat_symbol (libpthread, system_alias, system, GLIBC_2_0);
-
- #endif
---
-2.14.1
-
diff --git a/0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch b/0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch
deleted file mode 100644
index 9d1f6ed66a05..000000000000
--- a/0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch
+++ /dev/null
@@ -1,223 +0,0 @@
-From 45ff34638f034877b6a490c217d6a0632ce263f4 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Mon, 11 Sep 2017 08:18:11 -0700
-Subject: [PATCH] x86: Add x86_64 to x86-64 HWCAP [BZ #22093]
-
-Before glibc 2.26, ld.so set dl_platform to "x86_64" and searched the
-"x86_64" subdirectory when loading a shared library. ld.so in glibc
-2.26 was changed to set dl_platform to "haswell" or "xeon_phi", based
-on supported ISAs. This led to shared library loading failure for
-shared libraries placed under the "x86_64" subdirectory.
-
-This patch adds "x86_64" to x86-64 dl_hwcap so that ld.so will always
-search the "x86_64" subdirectory when loading a shared library.
-
-NB: We can't set x86-64 dl_platform to "x86-64" since ld.so will skip
-the "haswell" and "xeon_phi" subdirectories on "haswell" and "xeon_phi"
-machines.
-
-Tested on i686 and x86-64.
-
- [BZ #22093]
- * sysdeps/x86/cpu-features.c (init_cpu_features): Initialize
- GLRO(dl_hwcap) to HWCAP_X86_64 for x86-64.
- * sysdeps/x86/dl-hwcap.h (HWCAP_COUNT): Updated.
- (HWCAP_IMPORTANT): Likewise.
- (HWCAP_X86_64): New enum.
- (HWCAP_X86_AVX512_1): Updated.
- * sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): Add "x86_64".
- * sysdeps/x86_64/Makefile (tests): Add tst-x86_64-1.
- (modules-names): Add x86_64/tst-x86_64mod-1.
- (LDFLAGS-tst-x86_64mod-1.so): New.
- ($(objpfx)tst-x86_64-1): Likewise.
- ($(objpfx)x86_64/tst-x86_64mod-1.os): Likewise.
- (tst-x86_64-1-clean): Likewise.
- * sysdeps/x86_64/tst-x86_64-1.c: New file.
- * sysdeps/x86_64/tst-x86_64mod-1.c: Likewise.
----
- sysdeps/x86/cpu-features.c | 3 ++-
- sysdeps/x86/dl-hwcap.h | 12 +++++++-----
- sysdeps/x86/dl-procinfo.c | 4 ++--
- sysdeps/x86_64/Makefile | 17 +++++++++++++++++
- sysdeps/x86_64/tst-x86_64-1.c | 26 ++++++++++++++++++++++++++
- sysdeps/x86_64/tst-x86_64mod-1.c | 22 ++++++++++++++++++++++
- 7 files changed, 76 insertions(+), 8 deletions(-)
- create mode 100644 sysdeps/x86_64/tst-x86_64-1.c
- create mode 100644 sysdeps/x86_64/tst-x86_64mod-1.c
-
-diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
-index 6f900840d4..c267f17b76 100644
---- a/sysdeps/x86/cpu-features.c
-+++ b/sysdeps/x86/cpu-features.c
-@@ -336,7 +336,6 @@ no_cpuid:
-
- /* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86. */
- GLRO(dl_platform) = NULL;
-- GLRO(dl_hwcap) = 0;
- #if !HAVE_TUNABLES && defined SHARED
- /* The glibc.tune.hwcap_mask tunable is initialized already, so no need to do
- this. */
-@@ -344,6 +343,7 @@ no_cpuid:
- #endif
-
- #ifdef __x86_64__
-+ GLRO(dl_hwcap) = HWCAP_X86_64;
- if (cpu_features->kind == arch_kind_intel)
- {
- if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
-@@ -374,6 +374,7 @@ no_cpuid:
- GLRO(dl_platform) = "haswell";
- }
- #else
-+ GLRO(dl_hwcap) = 0;
- if (CPU_FEATURES_CPU_P (cpu_features, SSE2))
- GLRO(dl_hwcap) |= HWCAP_X86_SSE2;
-
-diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
-index c95668415a..38627e9eef 100644
---- a/sysdeps/x86/dl-hwcap.h
-+++ b/sysdeps/x86/dl-hwcap.h
-@@ -24,15 +24,16 @@
- # define HWCAP_PLATFORMS_START 0
- # define HWCAP_PLATFORMS_COUNT 4
- # define HWCAP_START 0
--# define HWCAP_COUNT 2
--# define HWCAP_IMPORTANT (HWCAP_X86_SSE2 | HWCAP_X86_AVX512_1)
-+# define HWCAP_COUNT 3
-+# define HWCAP_IMPORTANT \
-+ (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
- #elif defined __x86_64__
- /* For 64 bit, only cover x86-64 platforms and capabilities. */
- # define HWCAP_PLATFORMS_START 2
- # define HWCAP_PLATFORMS_COUNT 4
- # define HWCAP_START 1
--# define HWCAP_COUNT 2
--# define HWCAP_IMPORTANT (HWCAP_X86_AVX512_1)
-+# define HWCAP_COUNT 3
-+# define HWCAP_IMPORTANT (HWCAP_X86_64 | HWCAP_X86_AVX512_1)
- #else
- /* For 32 bit, only cover i586, i686 and SSE2. */
- # define HWCAP_PLATFORMS_START 0
-@@ -45,7 +46,8 @@
- enum
- {
- HWCAP_X86_SSE2 = 1 << 0,
-- HWCAP_X86_AVX512_1 = 1 << 1
-+ HWCAP_X86_64 = 1 << 1,
-+ HWCAP_X86_AVX512_1 = 1 << 2
- };
-
- static inline const char *
-diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
-index 43ab8fe25b..0192feb850 100644
---- a/sysdeps/x86/dl-procinfo.c
-+++ b/sysdeps/x86/dl-procinfo.c
-@@ -58,11 +58,11 @@ PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features
- #if !defined PROCINFO_DECL && defined SHARED
- ._dl_x86_hwcap_flags
- #else
--PROCINFO_CLASS const char _dl_x86_hwcap_flags[2][9]
-+PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9]
- #endif
- #ifndef PROCINFO_DECL
- = {
-- "sse2", "avx512_1"
-+ "sse2", "x86_64", "avx512_1"
- }
- #endif
- #if !defined SHARED || defined PROCINFO_DECL
-diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
-index 7f3ffe34ba..1514805f4a 100644
---- a/sysdeps/x86_64/Makefile
-+++ b/sysdeps/x86_64/Makefile
-@@ -52,6 +52,12 @@ $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o
- CFLAGS-tst-quad1pie.c = $(PIE-ccflag)
- CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
-
-+tests += tst-x86_64-1
-+modules-names += x86_64/tst-x86_64mod-1
-+LDFLAGS-tst-x86_64mod-1.so = -Wl,-soname,tst-x86_64mod-1.so
-+
-+$(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
-+
- tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \
- tst-audit10 tst-sse tst-avx tst-avx512
- test-extras += tst-audit4-aux tst-audit10-aux \
-@@ -124,3 +130,14 @@ endif
- ifeq ($(subdir),csu)
- gen-as-const-headers += tlsdesc.sym rtld-offsets.sym
- endif
-+
-+$(objpfx)x86_64/tst-x86_64mod-1.os: $(objpfx)tst-x86_64mod-1.os
-+ $(make-target-directory)
-+ rm -f $@
-+ ln $< $@
-+
-+do-tests-clean common-mostlyclean: tst-x86_64-1-clean
-+
-+.PHONY: tst-x86_64-1-clean
-+tst-x86_64-1-clean:
-+ -rm -rf $(objpfx)x86_64
-diff --git a/sysdeps/x86_64/tst-x86_64-1.c b/sysdeps/x86_64/tst-x86_64-1.c
-new file mode 100644
-index 0000000000..ba1a55cdaf
---- /dev/null
-+++ b/sysdeps/x86_64/tst-x86_64-1.c
-@@ -0,0 +1,26 @@
-+/* Test searching the "x86_64" directory for shared libraries.
-+ Copyright (C) 2017 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/>. */
-+
-+extern void foo (void);
-+
-+int
-+main (void)
-+{
-+ foo ();
-+ return 0;
-+}
-diff --git a/sysdeps/x86_64/tst-x86_64mod-1.c b/sysdeps/x86_64/tst-x86_64mod-1.c
-new file mode 100644
-index 0000000000..83dfafb5a8
---- /dev/null
-+++ b/sysdeps/x86_64/tst-x86_64mod-1.c
-@@ -0,0 +1,22 @@
-+/* Test searching the "x86_64" directory for shared libraries.
-+ Copyright (C) 2017 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/>. */
-+
-+void
-+foo (void)
-+{
-+}
---
-2.13.2
-
diff --git a/PKGBUILD b/PKGBUILD
index 6272dadb3513..d30da13b8df7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,41 +7,57 @@
_target="arm-linux-gnueabihf"
pkgname=${_target}-glibc
-pkgver=2.26
-pkgrel=4
+pkgver=2.27
+pkgrel=3
pkgdesc="GNU C Library (${_target})"
arch=('any')
url="http://www.gnu.org/software/libc/"
license=(GPL LGPL)
-depends=("${_target}-linux-api-headers>=4.12.7-1")
-makedepends=("${_target}-gcc-stage2>=7.2.0-3" gperf)
+depends=("${_target}-linux-api-headers>=4.16.1-1")
+makedepends=("${_target}-gcc-stage2>=8.1.0-1" gperf)
provides=("${_target}-glibc-headers=${pkgver}" "${_target}-eglibc")
conflicts=("${_target}-glibc-headers" "${_target}-eglibc")
replaces=("${_target}-glibc-headers")
options=(!buildflags !strip staticlibs)
-_commit=58270c0049404ef2f878fdd45df55f17f0b8c1f7
-source=(http://ftp.gnu.org/gnu/libc/glibc-${pkgver}.tar.xz{,.sig}
- glibc-${_commit}.patch
- 0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch
- 0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch)
-md5sums=('102f637c3812f81111f48f2427611be1'
+_commit=23158b08a0908f381459f273a984c6fd328363cb
+#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit
+source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz{,.sig}
+ bz20338.patch)
+validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8) # Carlos O'Donell
+md5sums=('898cd5656519ffbc3a03fe811dd89e82'
'SKIP'
- '7ce099a4060f59b7b7dd5ca66605f4e8'
- 'cbc073315c00b03898b7fc614274d6b3'
- 'bd9b13f3294b6357baa809e4416b9f44')
-validpgpkeys=('BC7C7372637EC10C57D7AA6579C43DFBF1CF2187') # Siddhesh Poyarekar
+ 'dc0d3ad59aeaaf591b085a77de6e03e9')
prepare() {
- mkdir glibc-build
- cd glibc-$pkgver
+ mkdir -p glibc-build
- patch -p1 -i "$srcdir/glibc-$_commit.patch"
+ [[ -d glibc-$pkgver ]] && ln -s glibc-$pkgver glibc
+ cd glibc
- patch -p1 -i "$srcdir/0001-Don-t-use-IFUNC-resolver-for-longjmp-or-system-in-li.patch"
- patch -p1 -i "$srcdir/0002-x86-Add-x86_64-to-x86-64-HWCAP-BZ-22093.patch"
+ local i; for i in ${source[@]}; do
+ case ${i%::*} in
+ *.patch)
+ msg2 "Applying ${i}"
+ patch -p1 -i "$srcdir/${i}"
+ ;;
+ esac
+ done
}
build() {
+ local _configure_flags=(
+ --prefix=/
+ --with-headers=/usr/${_target}/include
+ --enable-add-ons
+ --enable-bind-now
+ --enable-lock-elision
+ --disable-multi-arch
+ --enable-stack-protector=strong
+ --enable-stackguard-randomization
+ --disable-profile
+ --disable-werror
+ )
+
cd glibc-build
echo "slibdir=/lib" >> configparms
@@ -59,20 +75,9 @@ build() {
export RANLIB=${_target}-ranlib
"$srcdir/glibc-$pkgver/configure" \
- --prefix=/ \
--libdir=/lib \
--libexecdir=/lib \
- --with-headers=/usr/${_target}/include \
- --enable-add-ons \
- --enable-bind-now \
- --enable-lock-elision \
- --disable-multi-arch \
- --enable-obsolete-nsl \
- --enable-obsolete-rpc \
- --enable-stack-protector=strong \
- --enable-stackguard-randomization \
- --disable-profile \
- --disable-werror \
+ ${_configure_flags[@]} \
--target=${_target} \
--host=${_target} \
--build=${CHOST}
diff --git a/bz20338.patch b/bz20338.patch
new file mode 100644
index 000000000000..d223e9f08882
--- /dev/null
+++ b/bz20338.patch
@@ -0,0 +1,114 @@
+From 74250a7cdf106d4ca7d9506e6d5dc7c448dc3434 Mon Sep 17 00:00:00 2001
+From: David Michael <david.michael@coreos.com>
+Date: Thu, 15 Dec 2016 15:22:57 -0800
+Subject: [PATCH] gshadow: Sync fgetsgent_r.c with grp/fgetgrent_r.c
+
+ [BZ #20338]
+ * gshadow/fgetsgent_r.c: Include <libio/iolibio.h>.
+ (flockfile): New macro.
+ (funlockfile): Likewise.
+ (__fgetsgent_r): Sync with __fgetgrent_r.
+ * nss/nss_files/files-sgrp.c: Fix "fgetsgent_r.c" typo.
+---
+ gshadow/fgetsgent_r.c | 35 ++++++++++++++++++++++++-----------
+ nss/nss_files/files-sgrp.c | 2 +-
+ 2 files changed, 25 insertions(+), 12 deletions(-)
+
+diff --git a/gshadow/fgetsgent_r.c b/gshadow/fgetsgent_r.c
+index b70f6fa..02cd33a 100644
+--- a/gshadow/fgetsgent_r.c
++++ b/gshadow/fgetsgent_r.c
+@@ -20,39 +20,44 @@
+ #include <gshadow.h>
+ #include <stdio.h>
+
++#include <libio/iolibio.h>
++#define flockfile(s) _IO_flockfile (s)
++#define funlockfile(s) _IO_funlockfile (s)
++
+ /* Define a line parsing function using the common code
+ used in the nss_files module. */
+
+ #define STRUCTURE sgrp
+ #define ENTNAME sgent
+-#define EXTERN_PARSER 1
++#define EXTERN_PARSER 1
+ struct sgent_data {};
+
+ #include <nss/nss_files/files-parse.c>
+
+
+-/* Read one shadow entry from the given stream. */
++/* Read one entry from the given stream. */
+ int
+ __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen,
+ struct sgrp **result)
+ {
+ char *p;
++ int parse_result;
+
+- _IO_flockfile (stream);
++ flockfile (stream);
+ do
+ {
+ buffer[buflen - 1] = '\xff';
+ p = fgets_unlocked (buffer, buflen, stream);
+- if (p == NULL && feof_unlocked (stream))
++ if (__builtin_expect (p == NULL, 0) && feof_unlocked (stream))
+ {
+- _IO_funlockfile (stream);
++ funlockfile (stream);
+ *result = NULL;
+ __set_errno (ENOENT);
+ return errno;
+ }
+- if (p == NULL || buffer[buflen - 1] != '\xff')
++ if (__builtin_expect (p == NULL, 0) || buffer[buflen - 1] != '\xff')
+ {
+- _IO_funlockfile (stream);
++ funlockfile (stream);
+ *result = NULL;
+ __set_errno (ERANGE);
+ return errno;
+@@ -61,13 +66,21 @@ __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen,
+ /* Skip leading blanks. */
+ while (isspace (*p))
+ ++p;
+- } while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
++ } while (*p == '\0' || *p == '#' /* Ignore empty and comment lines. */
+ /* Parse the line. If it is invalid, loop to
+ get the next line of the file to parse. */
+- ! parse_line (buffer, (void *) resbuf, (void *) buffer, buflen,
+- &errno));
++ || ! (parse_result = parse_line (p, resbuf,
++ (void *) buffer, buflen,
++ &errno)));
++
++ funlockfile (stream);
+
+- _IO_funlockfile (stream);
++ if (__builtin_expect (parse_result, 0) == -1)
++ {
++ /* The parser ran out of space. */
++ *result = NULL;
++ return errno;
++ }
+
+ *result = resbuf;
+ return 0;
+diff --git a/nss/nss_files/files-sgrp.c b/nss/nss_files/files-sgrp.c
+index 15dc659..05c3805 100644
+--- a/nss/nss_files/files-sgrp.c
++++ b/nss/nss_files/files-sgrp.c
+@@ -23,7 +23,7 @@
+ #define DATABASE "gshadow"
+ struct sgent_data {};
+
+-/* Our parser function is already defined in sgetspent_r.c, so use that
++/* Our parser function is already defined in sgetsgent_r.c, so use that
+ to parse lines from the database file. */
+ #define EXTERN_PARSER
+ #include "files-parse.c"
+--
+2.7.4
+
diff --git a/glibc-58270c0049404ef2f878fdd45df55f17f0b8c1f7.patch b/glibc-58270c0049404ef2f878fdd45df55f17f0b8c1f7.patch
deleted file mode 100644
index 658114161f0c..000000000000
--- a/glibc-58270c0049404ef2f878fdd45df55f17f0b8c1f7.patch
+++ /dev/null
@@ -1,1128 +0,0 @@
-diff --git a/ChangeLog b/ChangeLog
-index 8dbfc7eaff..23ded7f03d 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,135 @@
-+2017-08-28 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
-+
-+ [BZ #21930]
-+ * math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
-+ (iszero): New C++ implementation that does not use
-+ fpclassify/__MATH_TG/__builtin_types_compatible_p, when
-+ signaling nans are enabled, since __builtin_types_compatible_p
-+ is a C-only feature.
-+ * math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is
-+ defined, include ieee754_float128.h for access to the union and
-+ member ieee854_float128.ieee.
-+ [__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128.
-+ [__HAVE_DISTINCT_FLOAT128] (check_float128): New function.
-+ * sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
-+ (CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build
-+ options of test-math-zero on powerpc64le.
-+
-+2017-08-24 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
-+
-+ * math/math.h [defined __cplusplus] (issignaling): In the long
-+ double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH
-+ is not defined. Call __issignaling, otherwise.
-+
-+2017-08-22 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
-+
-+ * math/math.h [defined __cplusplus] (issignaling): Provide a C++
-+ definition for issignaling that does not rely on __MATH_TG,
-+ since __MATH_TG uses __builtin_types_compatible_p, which is only
-+ available in C mode.
-+ (CFLAGS-test-math-issignaling.cc): New variable.
-+ * math/Makefile [CXX] (tests): Add test-math-issignaling.
-+ * math/test-math-issignaling.cc: New test for C++ implementation
-+ of type-generic issignaling.
-+ * sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
-+ (CXXFLAGS-test-math-issignaling.cc): Add -mfloat128 to the build
-+ options of test-math-issignaling on powerpc64le.
-+
-+2017-08-16 Andreas Schwab <schwab@suse.de>
-+
-+ [BZ #16750]
-+ CVE-2009-5064
-+ * elf/ldd.bash.in: Never run file directly.
-+
-+2017-08-10 Florian Weimer <fweimer@redhat.com>
-+
-+ * inet/net-internal.h (__inet6_scopeid_pton): Remove
-+ attribute_hidden, internal_function.
-+ * inet/inet6_scopeid_pton.c (__inet6_scopeid_pton): Remove
-+ internal_function.
-+
-+2017-08-21 Florian Weimer <fweimer@redhat.com>
-+
-+ [BZ #21972]
-+ * assert/assert.h (assert): Use static_cast (bool) for C++.
-+ Use the ternary operator in the warning branch for GNU C.
-+ * assert/Makefile (tests): Add tst-assert-c++, tst-assert-g++.
-+ (CFLAGS-tst-assert-c++.o): Compile in C++11 mode.
-+ (CFLAGS-tst-assert-g++.o): Compile in GnU C++11 mode.
-+ (LDLIBS-tst-assert-c++, LDLIBS-tst-assert-g++): Link with libstdc++.
-+ * assert/tst-assert-c++.cc, assert/tst-assert-g++.cc: New files.
-+
-+2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
-+
-+ * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
-+ in C++ mode.
-+
-+2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
-+
-+ [BZ #21930]
-+ * math/math.h (isinf): Check if in C or C++ mode before using
-+ __builtin_types_compatible_p, since this is a C mode feature.
-+
-+2017-08-10 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
-+
-+ [BZ #21941]
-+ * sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
-+ xssqrtqp requires operands to be in Vector Registers
-+ (Altivec/VMX), replace the register constraint 'wq' with 'v'.
-+ * sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
-+ (__ieee754_sqrtf128): Likewise.
-+
-+2017-08-11 Florian Weimer <fweimer@redhat.com>
-+
-+ [BZ #21242]
-+ * assert/assert.h [__GNUC__ && !__STRICT_ANSI__] (assert):
-+ Suppress pedantic warning resulting from statement expression.
-+ (__ASSERT_FUNCTION): Add missing __extension__.
-+
-+2017-08-10 Florian Weimer <fweimer@redhat.com>
-+
-+ * malloc/malloc.c (get_max_fast): Reimplement as an inline
-+ function which calls __builtin_unreachable.
-+
-+2017-08-09 Florian Weimer <fweimer@redhat.com>
-+
-+ [BZ #21932]
-+ * nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put
-+ before early return.
-+
-+2017-08-09 Adhemerval Zanella <adhemerval.zanella@linaro.org>
-+
-+ [BZ #21780]
-+ * sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
-+ EOPNOTSUPP.
-+ * sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
-+ * sysdeps/posix/pwritev2.c (pwritev2): Likewise.
-+ * sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
-+ * sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
-+ * sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
-+ * sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
-+ * sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.
-+
-+2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
-+
-+ [BZ #21871]
-+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set
-+ bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
-+
-+2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
-+
-+ * stdlib/getentropy.c (getentropy): Change return type to int.
-+
-+2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
-+
-+ * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.
-+
-+2017-08-03 Florian Weimer <fweimer@redhat.com>
-+
-+ [BZ #21885]
-+ * sysdeps/posix/getaddrinfo.c (gethosts): Release resolver context
-+ on memory allocation failure.
-+
- 2017-08-02 Siddhesh Poyarekar <siddhesh@sourceware.org>
-
- * version.h (RELEASE): Set to "stable"
-diff --git a/NEWS b/NEWS
-index 8295f20c0a..756e849643 100644
---- a/NEWS
-+++ b/NEWS
-@@ -5,6 +5,28 @@ 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.26.1
-+
-+Security related changes:
-+
-+ CVE-2009-5064: The ldd script would sometimes run the program under
-+ examination directly, without preventing code execution through the
-+ dynamic linker. (The glibc project disputes that this is a security
-+ vulnerability; only trusted binaries must be examined using the ldd
-+ script.)
-+
-+The following bugs are resolved with this release:
-+
-+ [16750] ldd: Never run file directly.
-+ [21242] assert: Suppress pedantic warning caused by statement expression
-+ [21780] posix: Set p{read,write}v2 to return ENOTSUP
-+ [21871] x86-64: Use _dl_runtime_resolve_opt only with AVX512F
-+ [21885] getaddrinfo: Release resolver context on error in gethosts
-+ [21930] Do not use __builtin_types_compatible_p in C++ mode
-+ [21932] Unpaired __resolv_context_get in generic get*_r implementation
-+ [21941] powerpc: Restrict xssqrtqp operands to Vector Registers
-+ [21972] assert macro requires operator== (int) for its argument type
-+
- Version 2.26
-
- Major new features:
-diff --git a/assert/Makefile b/assert/Makefile
-index 1c3be9b01f..9ec1be81a9 100644
---- a/assert/Makefile
-+++ b/assert/Makefile
-@@ -25,6 +25,15 @@ include ../Makeconfig
- headers := assert.h
-
- routines := assert assert-perr __assert
--tests := test-assert test-assert-perr
-+tests := test-assert test-assert-perr tst-assert-c++ tst-assert-g++
-
- include ../Rules
-+
-+ifeq ($(have-cxx-thread_local),yes)
-+CFLAGS-tst-assert-c++.o = -std=c++11
-+LDLIBS-tst-assert-c++ = -lstdc++
-+CFLAGS-tst-assert-g++.o = -std=gnu++11
-+LDLIBS-tst-assert-g++ = -lstdc++
-+else
-+tests-unsupported += tst-assert-c++ tst-assert-g++
-+endif
-diff --git a/assert/assert.h b/assert/assert.h
-index 22f019537c..640c95c063 100644
---- a/assert/assert.h
-+++ b/assert/assert.h
-@@ -85,19 +85,29 @@ __END_DECLS
- /* When possible, define assert so that it does not add extra
- parentheses around EXPR. Otherwise, those added parentheses would
- suppress warnings we'd expect to be detected by gcc's -Wparentheses. */
--# if !defined __GNUC__ || defined __STRICT_ANSI__
-+# if defined __cplusplus
-+# define assert(expr) \
-+ (static_cast <bool> (expr) \
-+ ? void (0) \
-+ : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
-+# elif !defined __GNUC__ || defined __STRICT_ANSI__
- # define assert(expr) \
- ((expr) \
- ? __ASSERT_VOID_CAST (0) \
- : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
- # else
-+/* The first occurrence of EXPR is not evaluated due to the sizeof,
-+ but will trigger any pedantic warnings masked by the __extension__
-+ for the second occurrence. The ternary operator is required to
-+ support function pointers and bit fields in this context, and to
-+ suppress the evaluation of variable length arrays. */
- # define assert(expr) \
-- ({ \
-+ ((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
- if (expr) \
- ; /* empty */ \
- else \
- __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
-- })
-+ }))
- # endif
-
- # ifdef __USE_GNU
-@@ -113,7 +123,7 @@ __END_DECLS
- C9x has a similar variable called __func__, but prefer the GCC one since
- it demangles C++ function names. */
- # if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
--# define __ASSERT_FUNCTION __PRETTY_FUNCTION__
-+# define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__
- # else
- # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
- # define __ASSERT_FUNCTION __func__
-diff --git a/assert/tst-assert-c++.cc b/assert/tst-assert-c++.cc
-new file mode 100644
-index 0000000000..12a5e690cb
---- /dev/null
-+++ b/assert/tst-assert-c++.cc
-@@ -0,0 +1,78 @@
-+/* Tests for interactions between C++ and assert.
-+ Copyright (C) 2017 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 <assert.h>
-+
-+/* The C++ standard requires that if the assert argument is a constant
-+ subexpression, then the assert itself is one, too. */
-+constexpr int
-+check_constexpr ()
-+{
-+ return (assert (true), 1);
-+}
-+
-+/* Objects of this class can be contextually converted to bool, but
-+ cannot be compared to int. */
-+struct no_int
-+{
-+ no_int () = default;
-+ no_int (const no_int &) = delete;
-+
-+ explicit operator bool () const
-+ {
-+ return true;
-+ }
-+
-+ bool operator! () const; /* No definition. */
-+ template <class T> bool operator== (T) const; /* No definition. */
-+ template <class T> bool operator!= (T) const; /* No definition. */
-+};
-+
-+/* This class tests that operator== is not used by assert. */
-+struct bool_and_int
-+{
-+ bool_and_int () = default;
-+ bool_and_int (const no_int &) = delete;
-+
-+ explicit operator bool () const
-+ {
-+ return true;
-+ }
-+
-+ bool operator! () const; /* No definition. */
-+ template <class T> bool operator== (T) const; /* No definition. */
-+ template <class T> bool operator!= (T) const; /* No definition. */
-+};
-+
-+static int
-+do_test ()
-+{
-+ {
-+ no_int value;
-+ assert (value);
-+ }
-+
-+ {
-+ bool_and_int value;
-+ assert (value);
-+ }
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/assert/tst-assert-g++.cc b/assert/tst-assert-g++.cc
-new file mode 100644
-index 0000000000..8c06402825
---- /dev/null
-+++ b/assert/tst-assert-g++.cc
-@@ -0,0 +1,19 @@
-+/* Tests for interactions between C++ and assert. GNU C++11 version.
-+ Copyright (C) 2017 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 <tst-assert-c++.cc>
-diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
-index 7dd1fccf24..686785e235 100644
---- a/elf/ldd.bash.in
-+++ b/elf/ldd.bash.in
-@@ -164,18 +164,6 @@ warning: you do not have execution permission for" "\`$file'" >&2
- fi
- done
- case $ret in
-- 0)
-- # If the program exits with exit code 5, it means the process has been
-- # invoked with __libc_enable_secure. Fall back to running it through
-- # the dynamic linker.
-- try_trace "$file"
-- rc=$?
-- if [ $rc = 5 ]; then
-- try_trace "$RTLD" "$file"
-- rc=$?
-- fi
-- [ $rc = 0 ] || result=1
-- ;;
- 1)
- # This can be a non-ELF binary or no binary at all.
- nonelf "$file" || {
-@@ -183,7 +171,7 @@ warning: you do not have execution permission for" "\`$file'" >&2
- result=1
- }
- ;;
-- 2)
-+ 0|2)
- try_trace "$RTLD" "$file" || result=1
- ;;
- *)
-diff --git a/inet/inet6_scopeid_pton.c b/inet/inet6_scopeid_pton.c
-index e09b1cb34d..cc8803fa10 100644
---- a/inet/inet6_scopeid_pton.c
-+++ b/inet/inet6_scopeid_pton.c
-@@ -28,7 +28,7 @@
-
- /* Parse SOURCE as a scope ID for ADDRESS. Return 0 on success and -1
- on error. */
--internal_function int
-+int
- __inet6_scopeid_pton (const struct in6_addr *address, const char *scope,
- uint32_t *result)
- {
-diff --git a/inet/net-internal.h b/inet/net-internal.h
-index 2b2632c7ba..b2135893e8 100644
---- a/inet/net-internal.h
-+++ b/inet/net-internal.h
-@@ -25,8 +25,7 @@
- #include <sys/time.h>
-
- int __inet6_scopeid_pton (const struct in6_addr *address,
-- const char *scope, uint32_t *result)
-- internal_function attribute_hidden;
-+ const char *scope, uint32_t *result);
- libc_hidden_proto (__inet6_scopeid_pton)
-
-
-diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 54e406bcb6..e3ff778113 100644
---- a/malloc/malloc.c
-+++ b/malloc/malloc.c
-@@ -1658,6 +1658,9 @@ typedef struct malloc_chunk *mfastbinptr;
- #define arena_is_corrupt(A) (((A)->flags & ARENA_CORRUPTION_BIT))
- #define set_arena_corrupt(A) ((A)->flags |= ARENA_CORRUPTION_BIT)
-
-+/* Maximum size of memory handled in fastbins. */
-+static INTERNAL_SIZE_T global_max_fast;
-+
- /*
- Set value of max_fast.
- Use impossibly small value if 0.
-@@ -1668,8 +1671,20 @@ typedef struct malloc_chunk *mfastbinptr;
- #define set_max_fast(s) \
- global_max_fast = (((s) == 0) \
- ? SMALLBIN_WIDTH : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK))
--#define get_max_fast() global_max_fast
-
-+static inline INTERNAL_SIZE_T
-+get_max_fast (void)
-+{
-+ /* Tell the GCC optimizers that global_max_fast is never larger
-+ than MAX_FAST_SIZE. This avoids out-of-bounds array accesses in
-+ _int_malloc after constant propagation of the size parameter.
-+ (The code never executes because malloc preserves the
-+ global_max_fast invariant, but the optimizers may not recognize
-+ this.) */
-+ if (global_max_fast > MAX_FAST_SIZE)
-+ __builtin_unreachable ();
-+ return global_max_fast;
-+}
-
- /*
- ----------- Internal state representation and initialization -----------
-@@ -1797,9 +1812,6 @@ static struct malloc_par mp_ =
- #endif
- };
-
--/* Maximum size of memory handled in fastbins. */
--static INTERNAL_SIZE_T global_max_fast;
--
- /*
- Initialize a malloc_state struct.
-
-diff --git a/math/Makefile b/math/Makefile
-index e09b0c0545..0130fcf38b 100644
---- a/math/Makefile
-+++ b/math/Makefile
-@@ -203,7 +203,7 @@ tests-static = test-fpucw-static test-fpucw-ieee-static \
- test-signgam-ullong-static test-signgam-ullong-init-static
-
- ifneq (,$(CXX))
--tests += test-math-isinff test-math-iszero
-+tests += test-math-isinff test-math-iszero test-math-issignaling
- endif
-
- ifneq (no,$(PERL))
-@@ -350,6 +350,7 @@ CFLAGS-test-signgam-ullong-init-static.c = -std=c99
-
- CFLAGS-test-math-isinff.cc = -std=gnu++11
- CFLAGS-test-math-iszero.cc = -std=gnu++11
-+CFLAGS-test-math-issignaling.cc = -std=gnu++11
-
- CFLAGS-test-iszero-excess-precision.c = -fexcess-precision=standard
- CFLAGS-test-iseqsig-excess-precision.c = -fexcess-precision=standard
-diff --git a/math/math.h b/math/math.h
-index e21708045a..7c0fc6dbb3 100644
---- a/math/math.h
-+++ b/math/math.h
-@@ -442,8 +442,12 @@ enum
-
- /* Return nonzero value if X is positive or negative infinity. */
- # if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
-- && !defined __SUPPORT_SNAN__
-- /* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */
-+ && !defined __SUPPORT_SNAN__ && !defined __cplusplus
-+ /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,
-+ use the helper function, __isinff128, with older compilers. This is
-+ only provided for C mode, because in C++ mode, GCC has no support
-+ for __builtin_types_compatible_p (and when in C++ mode, this macro is
-+ not used anyway, because libstdc++ headers undefine it). */
- # define isinf(x) \
- (__builtin_types_compatible_p (__typeof (x), _Float128) \
- ? __isinff128 (x) : __builtin_isinf_sign (x))
-@@ -470,7 +474,32 @@ enum
- # include <bits/iscanonical.h>
-
- /* Return nonzero value if X is a signaling NaN. */
--# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
-+# ifndef __cplusplus
-+# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
-+# else
-+ /* In C++ mode, __MATH_TG cannot be used, because it relies on
-+ __builtin_types_compatible_p, which is a C-only builtin. On the
-+ other hand, overloading provides the means to distinguish between
-+ the floating-point types. The overloading resolution will match
-+ the correct parameter (regardless of type qualifiers (i.e.: const
-+ and volatile). */
-+extern "C++" {
-+inline int issignaling (float __val) { return __issignalingf (__val); }
-+inline int issignaling (double __val) { return __issignaling (__val); }
-+inline int
-+issignaling (long double __val)
-+{
-+# ifdef __NO_LONG_DOUBLE_MATH
-+ return __issignaling (__val);
-+# else
-+ return __issignalingl (__val);
-+# endif
-+}
-+# if __HAVE_DISTINCT_FLOAT128
-+inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }
-+# endif
-+} /* extern C++ */
-+# endif
-
- /* Return nonzero value if X is subnormal. */
- # define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
-@@ -484,15 +513,40 @@ enum
- # endif
- # else /* __cplusplus */
- extern "C++" {
-+# ifdef __SUPPORT_SNAN__
-+inline int
-+iszero (float __val)
-+{
-+ return __fpclassifyf (__val) == FP_ZERO;
-+}
-+inline int
-+iszero (double __val)
-+{
-+ return __fpclassify (__val) == FP_ZERO;
-+}
-+inline int
-+iszero (long double __val)
-+{
-+# ifdef __NO_LONG_DOUBLE_MATH
-+ return __fpclassify (__val) == FP_ZERO;
-+# else
-+ return __fpclassifyl (__val) == FP_ZERO;
-+# endif
-+}
-+# if __HAVE_DISTINCT_FLOAT128
-+inline int
-+iszero (_Float128 __val)
-+{
-+ return __fpclassifyf128 (__val) == FP_ZERO;
-+}
-+# endif
-+# else
- template <class __T> inline bool
- iszero (__T __val)
- {
--# ifdef __SUPPORT_SNAN__
-- return fpclassify (__val) == FP_ZERO;
--# else
- return __val == 0;
--# endif
- }
-+# endif
- } /* extern C++ */
- # endif /* __cplusplus */
- #endif /* Use IEC_60559_BFP_EXT. */
-diff --git a/math/test-math-issignaling.cc b/math/test-math-issignaling.cc
-new file mode 100644
-index 0000000000..22ae9e1bca
---- /dev/null
-+++ b/math/test-math-issignaling.cc
-@@ -0,0 +1,113 @@
-+/* Test for the C++ implementation of issignaling.
-+ Copyright (C) 2017 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/>. */
-+
-+#define _GNU_SOURCE 1
-+#include <math.h>
-+#include <stdio.h>
-+
-+#include <limits>
-+
-+/* There is no signaling_NaN for _Float128 in std::numeric_limits.
-+ Include ieee754_float128.h and use the bitfields in the union
-+ ieee854_float128.ieee_nan to build a signaling NaN. */
-+#if __HAVE_DISTINCT_FLOAT128
-+# include <ieee754_float128.h>
-+#endif
-+
-+static bool errors;
-+
-+static void
-+check (int actual, int expected, const char *actual_expr, int line)
-+{
-+ if (actual != expected)
-+ {
-+ errors = true;
-+ printf ("%s:%d: error: %s\n", __FILE__, line, actual_expr);
-+ printf ("%s:%d: expected: %d\n", __FILE__, line, expected);
-+ printf ("%s:%d: actual: %d\n", __FILE__, line, actual);
-+ }
-+}
-+
-+#define CHECK(actual, expected) \
-+ check ((actual), (expected), #actual, __LINE__)
-+
-+template <class T>
-+static void
-+check_type ()
-+{
-+ typedef std::numeric_limits<T> limits;
-+ CHECK (issignaling (T{0}), 0);
-+ if (limits::has_infinity)
-+ {
-+ CHECK (issignaling (limits::infinity ()), 0);
-+ CHECK (issignaling (-limits::infinity ()), 0);
-+ }
-+ if (limits::has_quiet_NaN)
-+ CHECK (issignaling (limits::quiet_NaN ()), 0);
-+ if (limits::has_signaling_NaN)
-+ CHECK (issignaling (limits::signaling_NaN ()), 1);
-+}
-+
-+#if __HAVE_DISTINCT_FLOAT128
-+static void
-+check_float128 ()
-+{
-+ ieee854_float128 q;
-+
-+ q.d = 0;
-+ CHECK (issignaling (q.d), 0);
-+
-+ /* Infinity. */
-+ q.ieee.negative = 0;
-+ q.ieee.exponent = 0x7FFF;
-+ q.ieee.mantissa0 = 0x0000;
-+ q.ieee.mantissa1 = 0x00000000;
-+ q.ieee.mantissa2 = 0x00000000;
-+ q.ieee.mantissa3 = 0x00000000;
-+ CHECK (issignaling (q.d), 0);
-+
-+ /* Quiet NaN. */
-+ q.ieee_nan.quiet_nan = 1;
-+ q.ieee_nan.mantissa0 = 0x0000;
-+ CHECK (issignaling (q.d), 0);
-+
-+ /* Still a quiet NaN. */
-+ q.ieee_nan.quiet_nan = 1;
-+ q.ieee_nan.mantissa0 = 0x4000;
-+ CHECK (issignaling (q.d), 0);
-+
-+ /* Signaling NaN. */
-+ q.ieee_nan.quiet_nan = 0;
-+ q.ieee_nan.mantissa0 = 0x4000;
-+ CHECK (issignaling (q.d), 1);
-+}
-+#endif
-+
-+static int
-+do_test (void)
-+{
-+ check_type<float> ();
-+ check_type<double> ();
-+ check_type<long double> ();
-+#if __HAVE_DISTINCT_FLOAT128
-+ check_float128 ();
-+#endif
-+ return errors;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/math/test-math-iszero.cc b/math/test-math-iszero.cc
-index 027e972654..5c07261626 100644
---- a/math/test-math-iszero.cc
-+++ b/math/test-math-iszero.cc
-@@ -22,6 +22,13 @@
-
- #include <limits>
-
-+/* Support for _Float128 in std::numeric_limits is limited.
-+ Include ieee754_float128.h and use the bitfields in the union
-+ ieee854_float128.ieee_nan to build corner-case inputs. */
-+#if __HAVE_DISTINCT_FLOAT128
-+# include <ieee754_float128.h>
-+#endif
-+
- static bool errors;
-
- static void
-@@ -72,12 +79,84 @@ check_type ()
- std::numeric_limits<T>::has_denorm == std::denorm_absent);
- }
-
-+#if __HAVE_DISTINCT_FLOAT128
-+static void
-+check_float128 ()
-+{
-+ ieee854_float128 q;
-+
-+ q.d = 0.0Q;
-+ CHECK (iszero (q.d), 1);
-+ q.d = -0.0Q;
-+ CHECK (iszero (q.d), 1);
-+ q.d = 1.0Q;
-+ CHECK (iszero (q.d), 0);
-+ q.d = -1.0Q;
-+ CHECK (iszero (q.d), 0);
-+
-+ /* Normal min. */
-+ q.ieee.negative = 0;
-+ q.ieee.exponent = 0x0001;
-+ q.ieee.mantissa0 = 0x0000;
-+ q.ieee.mantissa1 = 0x00000000;
-+ q.ieee.mantissa2 = 0x00000000;
-+ q.ieee.mantissa3 = 0x00000000;
-+ CHECK (iszero (q.d), 0);
-+ q.ieee.negative = 1;
-+ CHECK (iszero (q.d), 0);
-+
-+ /* Normal max. */
-+ q.ieee.negative = 0;
-+ q.ieee.exponent = 0x7FFE;
-+ q.ieee.mantissa0 = 0xFFFF;
-+ q.ieee.mantissa1 = 0xFFFFFFFF;
-+ q.ieee.mantissa2 = 0xFFFFFFFF;
-+ q.ieee.mantissa3 = 0xFFFFFFFF;
-+ CHECK (iszero (q.d), 0);
-+ q.ieee.negative = 1;
-+ CHECK (iszero (q.d), 0);
-+
-+ /* Infinity. */
-+ q.ieee.negative = 0;
-+ q.ieee.exponent = 0x7FFF;
-+ q.ieee.mantissa0 = 0x0000;
-+ q.ieee.mantissa1 = 0x00000000;
-+ q.ieee.mantissa2 = 0x00000000;
-+ q.ieee.mantissa3 = 0x00000000;
-+ CHECK (iszero (q.d), 0);
-+
-+ /* Quiet NaN. */
-+ q.ieee_nan.quiet_nan = 1;
-+ q.ieee_nan.mantissa0 = 0x0000;
-+ CHECK (iszero (q.d), 0);
-+
-+ /* Signaling NaN. */
-+ q.ieee_nan.quiet_nan = 0;
-+ q.ieee_nan.mantissa0 = 0x4000;
-+ CHECK (iszero (q.d), 0);
-+
-+ /* Denormal min. */
-+ q.ieee.negative = 0;
-+ q.ieee.exponent = 0x0000;
-+ q.ieee.mantissa0 = 0x0000;
-+ q.ieee.mantissa1 = 0x00000000;
-+ q.ieee.mantissa2 = 0x00000000;
-+ q.ieee.mantissa3 = 0x00000001;
-+ CHECK (iszero (q.d), 0);
-+ q.ieee.negative = 1;
-+ CHECK (iszero (q.d), 0);
-+}
-+#endif
-+
- static int
- do_test (void)
- {
- check_type<float> ();
- check_type<double> ();
- check_type<long double> ();
-+#if __HAVE_DISTINCT_FLOAT128
-+ check_float128 ();
-+#endif
- return errors;
- }
-
-diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
-index 06523bfe9c..0c808216a4 100644
---- a/misc/sys/cdefs.h
-+++ b/misc/sys/cdefs.h
-@@ -464,17 +464,18 @@
- # define __glibc_macro_warning(msg)
- #endif
-
--/* Support for generic selection (ISO C11) is available in GCC since
-- version 4.9. Previous versions do not provide generic selection,
-- even though they might set __STDC_VERSION__ to 201112L, when in
-- -std=c11 mode. Thus, we must check for !defined __GNUC__ when
-- testing __STDC_VERSION__ for generic selection support.
-+/* Generic selection (ISO C11) is a C-only feature, available in GCC
-+ since version 4.9. Previous versions do not provide generic
-+ selection, even though they might set __STDC_VERSION__ to 201112L,
-+ when in -std=c11 mode. Thus, we must check for !defined __GNUC__
-+ when testing __STDC_VERSION__ for generic selection support.
- On the other hand, Clang also defines __GNUC__, so a clang-specific
- check is required to enable the use of generic selection. */
--#if __GNUC_PREREQ (4, 9) \
-- || __glibc_clang_has_extension (c_generic_selections) \
-- || (!defined __GNUC__ && defined __STDC_VERSION__ \
-- && __STDC_VERSION__ >= 201112L)
-+#if !defined __cplusplus \
-+ && (__GNUC_PREREQ (4, 9) \
-+ || __glibc_clang_has_extension (c_generic_selections) \
-+ || (!defined __GNUC__ && defined __STDC_VERSION__ \
-+ && __STDC_VERSION__ >= 201112L))
- # define __HAVE_GENERIC_SELECTION 1
- #else
- # define __HAVE_GENERIC_SELECTION 0
-diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
-index 6c547ea1ca..bce80e05dd 100644
---- a/nss/getXXbyYY_r.c
-+++ b/nss/getXXbyYY_r.c
-@@ -234,6 +234,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
- H_ERRNO_VAR_P))
- {
- case -1:
-+# ifdef NEED__RES
-+ __resolv_context_put (res_ctx);
-+# endif
- return errno;
- case 1:
- #ifdef NEED_H_ERRNO
-@@ -253,7 +256,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
- nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
- H_ERRNO_VAR);
- if (nscd_status >= 0)
-- return nscd_status;
-+ {
-+# ifdef NEED__RES
-+ __resolv_context_put (res_ctx);
-+# endif
-+ return nscd_status;
-+ }
- }
- #endif
-
-diff --git a/stdlib/getentropy.c b/stdlib/getentropy.c
-index a71d4cd8f5..a88bbf8de3 100644
---- a/stdlib/getentropy.c
-+++ b/stdlib/getentropy.c
-@@ -21,7 +21,7 @@
-
- /* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on
- success and -1 on failure. */
--ssize_t
-+int
- getentropy (void *buffer, size_t length)
- {
- __set_errno (ENOSYS);
-diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
-index 81dd1a09ea..053f5ec972 100644
---- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
-+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
-@@ -58,7 +58,7 @@ double: 1
- float128: 2
- idouble: 1
- ifloat128: 2
--ildouble: 4
-+ildouble: 5
- ldouble: 3
-
- Function: "asin":
-@@ -1154,8 +1154,8 @@ float128: 4
- idouble: 3
- ifloat: 3
- ifloat128: 4
--ildouble: 7
--ldouble: 7
-+ildouble: 8
-+ldouble: 8
-
- Function: Imaginary part of "clog10_upward":
- double: 1
-@@ -2013,8 +2013,8 @@ double: 3
- float: 4
- idouble: 3
- ifloat: 4
--ildouble: 5
--ldouble: 5
-+ildouble: 6
-+ldouble: 6
-
- Function: "hypot":
- double: 1
-@@ -2205,8 +2205,8 @@ float128: 8
- idouble: 3
- ifloat: 4
- ifloat128: 8
--ildouble: 5
--ldouble: 5
-+ildouble: 6
-+ldouble: 6
-
- Function: "log":
- double: 1
-diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
-index efa7118498..699411cc92 100644
---- a/sysdeps/posix/getaddrinfo.c
-+++ b/sysdeps/posix/getaddrinfo.c
-@@ -255,6 +255,8 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
- break; \
- if (!scratch_buffer_grow (tmpbuf)) \
- { \
-+ __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \
-+ __resolv_context_put (res_ctx); \
- result = -EAI_MEMORY; \
- goto free_and_return; \
- } \
-diff --git a/sysdeps/posix/preadv2.c b/sysdeps/posix/preadv2.c
-index 2a7cf11e27..d27f7028ed 100644
---- a/sysdeps/posix/preadv2.c
-+++ b/sysdeps/posix/preadv2.c
-@@ -28,7 +28,7 @@ preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
- {
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
-
-diff --git a/sysdeps/posix/preadv64v2.c b/sysdeps/posix/preadv64v2.c
-index e084f3f9e1..ce7cb40bf2 100644
---- a/sysdeps/posix/preadv64v2.c
-+++ b/sysdeps/posix/preadv64v2.c
-@@ -25,7 +25,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
- {
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
-
-diff --git a/sysdeps/posix/pwritev2.c b/sysdeps/posix/pwritev2.c
-index 5b7650c4fc..7ec8cbc407 100644
---- a/sysdeps/posix/pwritev2.c
-+++ b/sysdeps/posix/pwritev2.c
-@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
- {
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
-
-diff --git a/sysdeps/posix/pwritev64v2.c b/sysdeps/posix/pwritev64v2.c
-index 0f2f9ef863..be98aeed9d 100644
---- a/sysdeps/posix/pwritev64v2.c
-+++ b/sysdeps/posix/pwritev64v2.c
-@@ -26,7 +26,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
- {
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
-
-diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h
-index d8fd4923ac..396fd0562e 100644
---- a/sysdeps/powerpc/fpu/math_private.h
-+++ b/sysdeps/powerpc/fpu/math_private.h
-@@ -30,7 +30,7 @@ extern __always_inline _Float128
- __ieee754_sqrtf128 (_Float128 __x)
- {
- _Float128 __z;
-- asm ("xssqrtqp %0,%1" : "=wq" (__z) : "wq" (__x));
-+ asm ("xssqrtqp %0,%1" : "=v" (__z) : "v" (__x));
- return __z;
- }
- #endif
-diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
-index 77617b670a..dea2290736 100644
---- a/sysdeps/powerpc/powerpc64le/Makefile
-+++ b/sysdeps/powerpc/powerpc64le/Makefile
-@@ -16,7 +16,9 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
- $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
- $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
- CFLAGS-libm-test-support-float128.c += -mfloat128
--$(objpfx)test-float128% $(objpfx)test-ifloat128%: \
-+CFLAGS-test-math-issignaling.cc += -mfloat128
-+CFLAGS-test-math-iszero.cc += -mfloat128
-+$(objpfx)test-float128% $(objpfx)test-ifloat128% $(objpfx)test-math-iszero: \
- gnulib-tests += $(f128-loader-link)
- endif
-
-diff --git a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
-index 769d3f8922..59fd8269f5 100644
---- a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
-+++ b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
-@@ -30,7 +30,7 @@ __float128
- __ieee754_sqrtf128 (__float128 a)
- {
- __float128 z;
-- asm ("xssqrtqp %0,%1" : "=wq" (z) : "wq" (a));
-+ asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a));
- return z;
- }
- strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)
-diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
-index 11fe85eaa8..137e2dd791 100644
---- a/sysdeps/unix/sysv/linux/preadv2.c
-+++ b/sysdeps/unix/sysv/linux/preadv2.c
-@@ -32,7 +32,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
- # ifdef __NR_preadv2
- ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
- LO_HI_LONG (offset), flags);
-- if (result >= 0 || errno != ENOSYS)
-+ if (result >= 0)
- return result;
- # endif
- /* Trying to emulate the preadv2 syscall flags is troublesome:
-@@ -46,7 +46,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
-
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
- return preadv (fd, vector, count, offset);
-diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
-index 9d7f8c9893..8f413253f4 100644
---- a/sysdeps/unix/sysv/linux/preadv64v2.c
-+++ b/sysdeps/unix/sysv/linux/preadv64v2.c
-@@ -30,7 +30,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
- #ifdef __NR_preadv64v2
- ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
- LO_HI_LONG (offset), flags);
-- if (result >= 0 || errno != ENOSYS)
-+ if (result >= 0)
- return result;
- #endif
- /* Trying to emulate the preadv2 syscall flags is troublesome:
-@@ -44,7 +44,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
-
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
- return preadv64 (fd, vector, count, offset);
-diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
-index 72f0471f96..8e5032fe2f 100644
---- a/sysdeps/unix/sysv/linux/pwritev2.c
-+++ b/sysdeps/unix/sysv/linux/pwritev2.c
-@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
- # ifdef __NR_pwritev2
- ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
- LO_HI_LONG (offset), flags);
-- if (result >= 0 || errno != ENOSYS)
-+ if (result >= 0)
- return result;
- # endif
- /* Trying to emulate the pwritev2 syscall flags is troublesome:
-@@ -42,7 +42,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
-
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
- return pwritev (fd, vector, count, offset);
-diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
-index def9a0bc57..d2800c6657 100644
---- a/sysdeps/unix/sysv/linux/pwritev64v2.c
-+++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
-@@ -30,7 +30,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
- #ifdef __NR_pwritev64v2
- ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
- LO_HI_LONG (offset), flags);
-- if (result >= 0 || errno != ENOSYS)
-+ if (result >= 0)
- return result;
- #endif
- /* Trying to emulate the pwritev2 syscall flags is troublesome:
-@@ -44,7 +44,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
-
- if (flags != 0)
- {
-- __set_errno (EOPNOTSUPP);
-+ __set_errno (ENOTSUP);
- return -1;
- }
- return pwritev64 (fd, vector, count, offset);
-diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
-index 1d087ea732..6f900840d4 100644
---- a/sysdeps/x86/cpu-features.c
-+++ b/sysdeps/x86/cpu-features.c
-@@ -244,10 +244,13 @@ init_cpu_features (struct cpu_features *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;
-