All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/13] libucontext: Add recipe
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 02/13] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Help musl based systems provide ucontext APIs, these APIs are used in
some common applications e.g. chromium browser

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../0001-pass-LDFLAGS-to-link-step.patch      | 31 ++++++++++
 meta/recipes-core/musl/libucontext_git.bb     | 62 +++++++++++++++++++
 3 files changed, 94 insertions(+)
 create mode 100644 meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
 create mode 100644 meta/recipes-core/musl/libucontext_git.bb

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 01afc25b93..a80e85a2f6 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -386,6 +386,7 @@ RECIPE_MAINTAINER_pn-libtirpc = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-libtool = "Robert Yang <liezhi.yang@windriver.com>"
 RECIPE_MAINTAINER_pn-libtool-cross = "Robert Yang <liezhi.yang@windriver.com>"
 RECIPE_MAINTAINER_pn-libtool-native = "Robert Yang <liezhi.yang@windriver.com>"
+RECIPE_MAINTAINER_pn-libucontext = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER_pn-libunistring = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER_pn-libunwind = "Bruce Ashfield <bruce.ashfield@gmail.com>"
 RECIPE_MAINTAINER_pn-liburcu = "Alexander Kanavin <alex.kanavin@gmail.com>"
diff --git a/meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch b/meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
new file mode 100644
index 0000000000..0ab8caf3e6
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
@@ -0,0 +1,31 @@
+From 12d45d250d08e96e889e38e77273c3ef73e6fc97 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 25 Nov 2019 15:07:35 -0800
+Subject: [PATCH] pass LDFLAGS to link step
+
+This helps to use OE specific linker flags and fixes
+
+do_package_qa: QA Issue: No GNU_HASH in the ELF binary
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 8a605fd..d1c9637 100644
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,7 @@ ${LIBUCONTEXT_STATIC_NAME}: ${LIBUCONTEXT_OBJ}
+ 
+ ${LIBUCONTEXT_NAME}: ${LIBUCONTEXT_OBJ}
+ 	$(CC) -o ${LIBUCONTEXT_NAME} -Wl,-soname,${LIBUCONTEXT_SONAME} \
+-		-shared ${LIBUCONTEXT_OBJ}
++		-shared ${LIBUCONTEXT_OBJ} ${LDFLAGS}
+ 
+ ${LIBUCONTEXT_SONAME}: ${LIBUCONTEXT_NAME}
+ 	ln -sf ${LIBUCONTEXT_NAME} ${LIBUCONTEXT_SONAME}
+-- 
+2.24.0
+
diff --git a/meta/recipes-core/musl/libucontext_git.bb b/meta/recipes-core/musl/libucontext_git.bb
new file mode 100644
index 0000000000..72e15aa9a4
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext_git.bb
@@ -0,0 +1,62 @@
+# Copyright (C) 2019 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "ucontext implementation featuring glibc-compatible ABI"
+HOMEPAGE = "https://github.com/kaniini/libucontext"
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=864cc1445419406b7093e8e531c9515e"
+SECTION = "libs"
+DEPENDS = ""
+
+PV = "0.1.3+${SRCPV}"
+SRCREV = "e6b4d7516dae9b200e94fcfcb9ebc9331389655f"
+SRC_URI = "git://code.foxkit.us/adelie/libucontext.git;protocol=https \
+           file://0001-pass-LDFLAGS-to-link-step.patch \
+"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = ".*-musl.*"
+
+valid_archs = "\
+i386 x86 \
+ppc powerpc powerpc64 ppc64  \
+arm aarch64 \
+s390 \
+"
+
+def map_kernel_arch(a, d):
+    import re
+
+    valid_archs = d.getVar('valid_archs').split()
+
+    if   re.match('(i.86|athlon)$', a):         return 'x86'
+    elif re.match('x86.64$', a):                return 'x86_64'
+    elif re.match('armeb$', a):                 return 'arm'
+    elif re.match('aarch64$', a):               return 'aarch64'
+    elif re.match('aarch64_be$', a):            return 'aarch64'
+    elif re.match('aarch64_ilp32$', a):         return 'aarch64'
+    elif re.match('aarch64_be_ilp32$', a):      return 'aarch64'
+    elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a):      return 'mips'
+    elif re.match('p(pc|owerpc)', a):           return 'ppc'
+    elif re.match('p(pc64|owerpc64)', a):       return 'ppc64'
+    elif re.match('riscv64$', a):               return 'riscv64'
+    elif a in valid_archs:                      return a
+    else:
+        if not d.getVar("TARGET_OS").startswith("linux"):
+            return a
+        bb.error("cannot map '%s' to a linux kernel architecture" % a)
+
+export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
+
+CFLAGS += "-Iarch/${ARCH}"
+
+EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
+
+do_compile() {
+    oe_runmake ARCH=${ARCH}
+}
+
+do_install() {
+    oe_runmake ARCH="${ARCH}" DESTDIR="${D}" install
+}
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 00/13] glibc/musl/go updates
@ 2020-01-26 19:27 Khem Raj
  2020-01-26 19:27 ` [PATCH 01/13] libucontext: Add recipe Khem Raj
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

This patchet addresses few things together

* Glibc is updated to latest snapshot before 2.31 release
* Drop clang helping glibc fortify patch
* Drop ppc cacheline optimization patch from eglibc days
* Update musl to latest, add libucontext to help musl app world
* Support Go on RISCV, support is currently not upstream and enabled in
  meta-riscv but few pieces are needed in core to make it work
* Fix gcc10 found issues in ruby and fix nss build failure
* rv32 will now ask for 5.4 for minimum kernel starting glibc 2.31+

The following changes since commit ca3993cc4b13d4e661228cee6fb9448adfd0a4ba:

  bitbake: tests/fetch: Allow wget upgrade tests to run against a local server (2020-01-22 15:56:39 +0000)

are available in the Git repository at:

  git://git.yoctoproject.org/poky-contrib kraj/pu
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=kraj/pu

Khem Raj (13):
  libucontext: Add recipe
  nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS
  ruby: Remove __has_include and __has_include_next from preprocessed
    header file
  perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE
  Musl: Update to latest master
  glibc: Update to final 2.31 release
  glibc: Drop fortify refactoring patch
  gettext: Drop overloadable attibute for getcwd declaration
  riscv32: Bump oldest kernel to 5.4
  go.bbclass: Disable PIE on riscv
  go-dep: Fix bolt for riscv64
  Disable CGO on riscv64
  go: Disable PIE on RISCV

 meta/classes/go.bbclass                       |    3 +-
 meta/conf/bitbake.conf                        |    2 +-
 meta/conf/distro/include/maintainers.inc      |    1 +
 .../gettext/gettext-0.20.1/overloadable.patch |   22 -
 meta/recipes-core/gettext/gettext_0.20.1.bb   |    2 -
 .../glibc/cross-localedef-native_2.31.bb      |    9 +-
 meta/recipes-core/glibc/glibc-version.inc     |    2 +-
 ...dd-hardlink-resolver-from-util-linux.patch |    2 +-
 ...-fix-ups-hardlink-to-make-it-compile.patch |    2 +-
 ...Look-for-host-system-ld.so.cache-as-.patch |    2 +-
 ...Fix-buffer-overrun-with-a-relocated-.patch |    2 +-
 ...Raise-the-size-of-arrays-containing-.patch |    2 +-
 ...k-glibc-Allow-64-bit-atomics-for-x86.patch |    2 +-
 ...Make-relocatable-install-for-locales.patch |    2 +-
 ...5500-e6500-603e-fsqrt-implementation.patch |    2 +-
 ...RE_KNOWN_INTERPRETER_NAMES-to-known-.patch |    2 +-
 ...undefined-reference-to-__sqrt_finite.patch |    2 +-
 ...-are-now-inline-functions-and-call-o.patch |    2 +-
 ...443-which-explains-what-the-patch-do.patch |    2 +-
 ...m-err-tab.pl-with-specific-dirs-in-S.patch |    2 +-
 ...-are-now-inline-functions-and-call-o.patch |    2 +-
 ...igure.ac-handle-correctly-libc_cv_ro.patch |    2 +-
 .../glibc/0016-Add-unused-attribute.patch     |    2 +-
 ...the-path-sets-wrong-config-variables.patch |    2 +-
 ...zone-re-written-tzselect-as-posix-sh.patch |    2 +-
 ...bash-dependency-for-nscd-init-script.patch |    2 +-
 ...ss-building-and-testing-instructions.patch |    2 +-
 ...glibc-Help-bootstrap-cross-toolchain.patch |    2 +-
 ...2-eglibc-Clear-cache-lines-on-ppc8xx.patch |   80 -
 ...glibc-Resolve-__fpscr_values-on-SH4.patch} |    2 +-
 ...ort-cross-locale-generation-support.patch} |    2 +-
 ...efine-DUMMY_LOCALE_T-if-not-defined.patch} |    2 +-
 ...archive-uses-a-hard-coded-locale-pa.patch} |    2 +-
 ...e-_dl_build_local_scope-breadth-fir.patch} |    2 +-
 ...t-no-lines-in-bison-generated-files.patch} |    2 +-
 ...028-inject-file-assembly-directives.patch} |    2 +-
 ...ybe-uninitialized-errors-with-Os-BZ.patch} |    2 +-
 .../0031-Refactor-FORTIFY-in-glibc.patch      | 2780 -----------------
 meta/recipes-core/glibc/glibc_2.31.bb         |   18 +-
 .../0001-pass-LDFLAGS-to-link-step.patch      |   31 +
 meta/recipes-core/musl/libucontext_git.bb     |   62 +
 meta/recipes-core/musl/musl_git.bb            |    2 +-
 ...bolt_riscv64-Add-support-for-riscv64.patch |   33 +
 meta/recipes-devtools/go/go-dep_0.5.4.bb      |    1 +
 meta/recipes-devtools/go/go_1.13.bb           |    6 +-
 .../ruby/ruby/remove_has_include_macros.patch |   26 +
 meta/recipes-devtools/ruby/ruby_2.6.5.bb      |    1 +
 meta/recipes-kernel/perf/perf.bb              |    2 +
 ...figure-option-to-disable-ARM-HW-cryp.patch |   25 +-
 49 files changed, 227 insertions(+), 2939 deletions(-)
 delete mode 100644 meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch
 delete mode 100644 meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
 rename meta/recipes-core/glibc/glibc/{0023-eglibc-Resolve-__fpscr_values-on-SH4.patch => 0022-eglibc-Resolve-__fpscr_values-on-SH4.patch} (96%)
 rename meta/recipes-core/glibc/glibc/{0024-eglibc-Forward-port-cross-locale-generation-support.patch => 0023-eglibc-Forward-port-cross-locale-generation-support.patch} (99%)
 rename meta/recipes-core/glibc/glibc/{0025-Define-DUMMY_LOCALE_T-if-not-defined.patch => 0024-Define-DUMMY_LOCALE_T-if-not-defined.patch} (92%)
 rename meta/recipes-core/glibc/glibc/{0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch => 0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch} (97%)
 rename meta/recipes-core/glibc/glibc/{0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch => 0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch} (95%)
 rename meta/recipes-core/glibc/glibc/{0028-intl-Emit-no-lines-in-bison-generated-files.patch => 0027-intl-Emit-no-lines-in-bison-generated-files.patch} (93%)
 rename meta/recipes-core/glibc/glibc/{0029-inject-file-assembly-directives.patch => 0028-inject-file-assembly-directives.patch} (99%)
 rename meta/recipes-core/glibc/glibc/{0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch => 0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch} (96%)
 delete mode 100644 meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch
 create mode 100644 meta/recipes-core/musl/libucontext/0001-pass-LDFLAGS-to-link-step.patch
 create mode 100644 meta/recipes-core/musl/libucontext_git.bb
 create mode 100644 meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch
 create mode 100644 meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch

-- 
2.25.0



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 02/13] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
  2020-01-26 19:27 ` [PATCH 01/13] libucontext: Add recipe Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 03/13] ruby: Remove __has_include and __has_include_next from preprocessed header file Khem Raj
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Use NSS_USE_ARM_HW_CRYPTO to detect USE_ARM_GCM, since there are
dependent, without this we control the crypto code function inclusion in
build but do not control the call sites, which can result in undefined
symbols e.g.

Linux_SINGLE_SHLIB/gcm.o: in function `gcmHash_InitContext':
/usr/src/debug/nss/3.49.1-r0/nss-3.49.1/nss/lib/freebl/gcm.c:112: undefined reference to `gcm_HashInit_hw'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...figure-option-to-disable-ARM-HW-cryp.patch | 25 ++++++++++++++++---
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch b/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
index fe29d19882..803c06b218 100644
--- a/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
+++ b/meta/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
@@ -12,20 +12,19 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  nss/lib/freebl/Makefile | 3 +++
  1 file changed, 3 insertions(+)
 
-diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
-index 06506f0..a8b015d 100644
 --- a/nss/lib/freebl/Makefile
 +++ b/nss/lib/freebl/Makefile
-@@ -125,6 +125,8 @@ else
+@@ -125,6 +125,9 @@ else
          DEFINES += -DNSS_X86
  endif
  endif
 +
 +ifdef NSS_USE_ARM_HW_CRYPTO
++    DEFINES += -DNSS_USE_ARM_HW_CRYPTO
  ifeq ($(CPU_ARCH),aarch64)
      DEFINES += -DUSE_HW_AES
      EXTRA_SRCS += aes-armv8.c gcm-aarch64.c
-@@ -145,6 +147,7 @@ ifeq ($(CPU_ARCH),arm)
+@@ -146,6 +149,7 @@ ifeq ($(CPU_ARCH),arm)
          endif
      endif
  endif
@@ -33,3 +32,21 @@ index 06506f0..a8b015d 100644
  
  ifeq ($(OS_TARGET),OSF1)
      DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD
+--- a/nss/lib/freebl/gcm.c
++++ b/nss/lib/freebl/gcm.c
+@@ -17,6 +17,7 @@
+ 
+ #include <limits.h>
+ 
++#ifdef NSS_USE_ARM_HW_CRYPTO
+ /* old gcc doesn't support some poly64x2_t intrinsic */
+ #if defined(__aarch64__) && defined(IS_LITTLE_ENDIAN) && \
+     (defined(__clang__) || defined(__GNUC__) && __GNUC__ > 6)
+@@ -28,6 +29,7 @@
+  * that compiler uses -mfpu=neon only. */
+ #define USE_ARM_GCM
+ #endif
++#endif
+ 
+ /* Forward declarations */
+ SECStatus gcm_HashInit_hw(gcmHashContext *ghash);
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 03/13] ruby: Remove __has_include and __has_include_next from preprocessed header file
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
  2020-01-26 19:27 ` [PATCH 01/13] libucontext: Add recipe Khem Raj
  2020-01-26 19:27 ` [PATCH 02/13] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 04/13] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

one of the build steps ruby has is that it generated rb_mjit_header.h
during configure using gcc preprocessor using -dD which emits built-in
defines as well, problem happens when this header is later included in
subsequent compiles, where compiler errors out stating that an existing
internal define is redefined

| /tmp/20200123-2021083-2c601q.h:13849:9: error: "__has_include" cannot be used as a macro name
| 13849 | #define __has_include __has_include
|       |         ^~~~~~~~~~~~~
| compilation terminated due to -Wfatal-errors.

Since compiler already will take care of it internally we can edit it
out from this header file

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../ruby/ruby/remove_has_include_macros.patch | 26 +++++++++++++++++++
 meta/recipes-devtools/ruby/ruby_2.6.5.bb      |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch

diff --git a/meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch b/meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch
new file mode 100644
index 0000000000..a1e6330445
--- /dev/null
+++ b/meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch
@@ -0,0 +1,26 @@
+Filter out __has_include* compiler defines
+
+They are internal to compiler and this header is later on includes in C
+files, but newer gcc >= 10 complains about it.
+
+error in initial header file:
+| In file included from /tmp/20200124-86625-14hiju4.c:1:
+| /tmp/20200124-86625-11y6l6i.h:13849:9: error: "__has_include" cannot be used as a macro name
+| 13849 | #define __has_include __has_include
+|       |         ^~~~~~~~~~~~~
+| compilation terminated due to -Wfatal-errors.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- a/common.mk
++++ b/common.mk
+@@ -221,6 +221,8 @@ $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT
+ 		$(TIMESTAMPDIR)/$(arch)/.time
+ 	$(ECHO) building $(@F:.time=.h)
+ 	$(Q) $(CPP) -DMJIT_HEADER $(MJIT_HEADER_FLAGS) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/vm.c $(CPPOUTFLAG)$(@F:.time=.h).new
++	$(Q)sed -i -e "/#define __has_include __has_include/d" $(@F:.time=.h).new
++	$(Q)sed -i -e "/#define __has_include_next __has_include_next/d" $(@F:.time=.h).new
+ 	$(Q) $(IFCHANGE) "--timestamp=$@" $(@F:.time=.h) $(@F:.time=.h).new
+ 
+ $(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).h: $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time
diff --git a/meta/recipes-devtools/ruby/ruby_2.6.5.bb b/meta/recipes-devtools/ruby/ruby_2.6.5.bb
index 1828f65d51..0cdf6ee09f 100644
--- a/meta/recipes-devtools/ruby/ruby_2.6.5.bb
+++ b/meta/recipes-devtools/ruby/ruby_2.6.5.bb
@@ -2,6 +2,7 @@ require ruby.inc
 
 SRC_URI += " \
            file://0003-configure.ac-check-finite-isinf-isnan-as-macros-firs.patch \
+           file://remove_has_include_macros.patch \
            file://run-ptest \
            "
 
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 04/13] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (2 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 03/13] ruby: Remove __has_include and __has_include_next from preprocessed header file Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 05/13] Musl: Update to latest master Khem Raj
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

python code underneath is smart and pokes at python installation in
sysroot for compile environment, the overrides from EXTRA_OEMAKE are
ofcourse preferred but it falls back to python3's distutils/sysconfig
for rest of them, and it does use CCLD and LDSHARED for linking, when we
use clang to compile python3 then it encodes these variables to be clang
however, when building perf we inherit kernel which forces gcc to be
used for compiling perf, which then mixes both compilers due to CCLD and
LDSHARED demands. Therefore override CCLD and LDSHARED in make
environment helps python/distutils to use right linker

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-kernel/perf/perf.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 840f3008b5..6d1b06693d 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -73,6 +73,8 @@ EXTRA_OEMAKE = '\
     CROSS_COMPILE=${TARGET_PREFIX} \
     ARCH=${ARCH} \
     CC="${CC}" \
+    CCLD="${CC}" \
+    LDSHARED="${CC} -shared" \
     AR="${AR}" \
     LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 05/13] Musl: Update to latest master
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (3 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 04/13] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 06/13] glibc: Update to final 2.31 release Khem Raj
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Detailed changelog [1]

https://git.musl-libc.org/cgit/musl/log/?qt=range&q=70d80609558153a996833392999c69cdb74e1119..91e662d1d941215eb024787db5e910dbfb5b169f

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/musl/musl_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 92149b5632..1676e2844c 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -4,7 +4,7 @@
 require musl.inc
 inherit linuxloader
 
-SRCREV = "70d80609558153a996833392999c69cdb74e1119"
+SRCREV = "91e662d1d941215eb024787db5e910dbfb5b169f"
 
 BASEVER = "1.1.24"
 
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (4 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 05/13] Musl: Update to latest master Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-28 11:02   ` Martin Jansa
  2020-01-26 19:27 ` [PATCH 07/13] glibc: Drop fortify refactoring patch Khem Raj
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Drop ppc 8xx clear cache optimization, which we have been carrying
through eglibc days, it has been redone in glibc now

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../glibc/cross-localedef-native_2.31.bb      |   9 +-
 meta/recipes-core/glibc/glibc-version.inc     |   2 +-
 ...dd-hardlink-resolver-from-util-linux.patch |   2 +-
 ...-fix-ups-hardlink-to-make-it-compile.patch |   2 +-
 ...Look-for-host-system-ld.so.cache-as-.patch |   2 +-
 ...Fix-buffer-overrun-with-a-relocated-.patch |   2 +-
 ...Raise-the-size-of-arrays-containing-.patch |   2 +-
 ...k-glibc-Allow-64-bit-atomics-for-x86.patch |   2 +-
 ...Make-relocatable-install-for-locales.patch |   2 +-
 ...5500-e6500-603e-fsqrt-implementation.patch |   2 +-
 ...RE_KNOWN_INTERPRETER_NAMES-to-known-.patch |   2 +-
 ...undefined-reference-to-__sqrt_finite.patch |   2 +-
 ...-are-now-inline-functions-and-call-o.patch |   2 +-
 ...443-which-explains-what-the-patch-do.patch |   2 +-
 ...m-err-tab.pl-with-specific-dirs-in-S.patch |   2 +-
 ...-are-now-inline-functions-and-call-o.patch |   2 +-
 ...igure.ac-handle-correctly-libc_cv_ro.patch |   2 +-
 .../glibc/0016-Add-unused-attribute.patch     |   2 +-
 ...the-path-sets-wrong-config-variables.patch |   2 +-
 ...zone-re-written-tzselect-as-posix-sh.patch |   2 +-
 ...bash-dependency-for-nscd-init-script.patch |   2 +-
 ...ss-building-and-testing-instructions.patch |   2 +-
 ...glibc-Help-bootstrap-cross-toolchain.patch |   2 +-
 ...2-eglibc-Clear-cache-lines-on-ppc8xx.patch |  80 ---
 ...glibc-Resolve-__fpscr_values-on-SH4.patch} |   2 +-
 ...ort-cross-locale-generation-support.patch} |   2 +-
 ...efine-DUMMY_LOCALE_T-if-not-defined.patch} |   2 +-
 ...archive-uses-a-hard-coded-locale-pa.patch} |   2 +-
 ...e-_dl_build_local_scope-breadth-fir.patch} |   2 +-
 ...t-no-lines-in-bison-generated-files.patch} |   2 +-
 ...028-inject-file-assembly-directives.patch} |   2 +-
 ...ybe-uninitialized-errors-with-Os-BZ.patch} |   2 +-
 ...h => 0030-Refactor-FORTIFY-in-glibc.patch} | 648 +++++++++---------
 meta/recipes-core/glibc/glibc_2.31.bb         |  19 +-
 34 files changed, 367 insertions(+), 449 deletions(-)
 delete mode 100644 meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
 rename meta/recipes-core/glibc/glibc/{0023-eglibc-Resolve-__fpscr_values-on-SH4.patch => 0022-eglibc-Resolve-__fpscr_values-on-SH4.patch} (96%)
 rename meta/recipes-core/glibc/glibc/{0024-eglibc-Forward-port-cross-locale-generation-support.patch => 0023-eglibc-Forward-port-cross-locale-generation-support.patch} (99%)
 rename meta/recipes-core/glibc/glibc/{0025-Define-DUMMY_LOCALE_T-if-not-defined.patch => 0024-Define-DUMMY_LOCALE_T-if-not-defined.patch} (92%)
 rename meta/recipes-core/glibc/glibc/{0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch => 0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch} (97%)
 rename meta/recipes-core/glibc/glibc/{0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch => 0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch} (95%)
 rename meta/recipes-core/glibc/glibc/{0028-intl-Emit-no-lines-in-bison-generated-files.patch => 0027-intl-Emit-no-lines-in-bison-generated-files.patch} (93%)
 rename meta/recipes-core/glibc/glibc/{0029-inject-file-assembly-directives.patch => 0028-inject-file-assembly-directives.patch} (99%)
 rename meta/recipes-core/glibc/glibc/{0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch => 0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch} (96%)
 rename meta/recipes-core/glibc/glibc/{0031-Refactor-FORTIFY-in-glibc.patch => 0030-Refactor-FORTIFY-in-glibc.patch} (93%)

diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.31.bb b/meta/recipes-core/glibc/cross-localedef-native_2.31.bb
index a267a591d4..24de55d929 100644
--- a/meta/recipes-core/glibc/cross-localedef-native_2.31.bb
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.31.bb
@@ -31,11 +31,10 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0019-Remove-bash-dependency-for-nscd-init-script.patch \
            file://0020-eglibc-Cross-building-and-testing-instructions.patch \
            file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \
-           file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
-           file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
-           file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
-           file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
-           file://0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
+           file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \
+           file://0023-eglibc-Forward-port-cross-locale-generation-support.patch \
+           file://0024-Define-DUMMY_LOCALE_T-if-not-defined.patch \
+           file://0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
 "
 # Makes for a rather long rev (22 characters), but...
 #
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
index dca1916e80..c2cfb7e2f1 100644
--- a/meta/recipes-core/glibc/glibc-version.inc
+++ b/meta/recipes-core/glibc/glibc-version.inc
@@ -1,6 +1,6 @@
 SRCBRANCH ?= "master"
 PV = "2.30.9000"
-SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
+SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
 SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
 
 GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
index 9b75f2a62f..d0786be8b8 100644
--- a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
+++ b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
@@ -1,4 +1,4 @@
-From 169720859cf8f9133882a13f588b15f44b7b8ae6 Mon Sep 17 00:00:00 2001
+From 3dcf144e998aed17b3fb957a255b1e923ba07d71 Mon Sep 17 00:00:00 2001
 From: Jason Wessel <jason.wessel@windriver.com>
 Date: Sat, 7 Dec 2019 09:59:22 -0800
 Subject: [PATCH] localedef: Add hardlink resolver from util-linux
diff --git a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
index 029292fe36..5222e37d1a 100644
--- a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
+++ b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
@@ -1,4 +1,4 @@
-From 9b966b758d0c96ef6654251689318614ef10becc Mon Sep 17 00:00:00 2001
+From b52dba15527380cc18635e3696e0ef87efee9a84 Mon Sep 17 00:00:00 2001
 From: Jason Wessel <jason.wessel@windriver.com>
 Date: Sat, 7 Dec 2019 10:01:37 -0800
 Subject: [PATCH] localedef: fix-ups hardlink to make it compile
diff --git a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
index e1c3512e4e..4cdc8354b6 100644
--- a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
+++ b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
@@ -1,4 +1,4 @@
-From 14ddf13b7fc2e39a1ae657ceb3963e35731e95d0 Mon Sep 17 00:00:00 2001
+From 6987ad183770cb56680ccc4f6ea065a04f31ccb6 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:48:24 +0000
 Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
diff --git a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
index 523b6da897..62e12897f5 100644
--- a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
+++ b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
@@ -1,4 +1,4 @@
-From 3ac58bf1028841cc0a8fa7f258cbf21466740360 Mon Sep 17 00:00:00 2001
+From 7806340c2accc2c51e7e861b618c29fb5609a007 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:50:00 +0000
 Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK
diff --git a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
index 4d88d9b413..294c2b975e 100644
--- a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
+++ b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
@@ -1,4 +1,4 @@
-From 702d68cbdf405e086f72e2a062127cbea43045ec Mon Sep 17 00:00:00 2001
+From 1b97befbe693eb93a77b6098f6ae1394a53462f4 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:51:38 +0000
 Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
diff --git a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
index 0d070a93b9..db8b6c0f1c 100644
--- a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
+++ b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
@@ -1,4 +1,4 @@
-From f9993e652bd4a0f03402d0c527cf24b83d0ff7ea Mon Sep 17 00:00:00 2001
+From a752857cc342ee5136c9a593037b6ee6ff8af8ee Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 31 Dec 2015 14:35:35 -0800
 Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
diff --git a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
index 66abcce3ce..d9985c2fdc 100644
--- a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
+++ b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
@@ -1,4 +1,4 @@
-From ee9d5e423e4a709ae5a62abfb476863b3b57378f Mon Sep 17 00:00:00 2001
+From 3df91d1d8b9c7a01b3ef8133c4f9b9764227d583 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:55:12 -0700
 Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
diff --git a/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
index 4f3ed38065..3dac325380 100644
--- a/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
+++ b/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
@@ -1,4 +1,4 @@
-From 2cc7b79157ce17144791dda1a2e3a6dc4902c736 Mon Sep 17 00:00:00 2001
+From 61b6c9737897c5828ef4b40699ee0a74c570034a Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:01:50 +0000
 Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation
diff --git a/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
index 6e4259f4ff..456f91fb8e 100644
--- a/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
+++ b/meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
@@ -1,4 +1,4 @@
-From e6ff3960d9e4ed6a9a4be70732313127f0e6d0e0 Mon Sep 17 00:00:00 2001
+From 13beb1f428ec06778590bf526d6e641f73d5cf62 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:11:22 +0000
 Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
diff --git a/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch b/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
index 91da344089..01446abc43 100644
--- a/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
+++ b/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
@@ -1,4 +1,4 @@
-From ad055d58bd99b80e41face63bf20db3f04afa4e3 Mon Sep 17 00:00:00 2001
+From 4483a83074a340a921e319b88d72166f18e0df0b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:15:07 +0000
 Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
diff --git a/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
index 6a5a44af9d..451f372650 100644
--- a/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
+++ b/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
@@ -1,4 +1,4 @@
-From ac4450bc74dc0754a3724f1bebb2290c4dc29d72 Mon Sep 17 00:00:00 2001
+From 347b2e31d010b04c42e78157a028aa1d58fe0f5e Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:16:38 +0000
 Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
diff --git a/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch b/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
index e8eaa4d90b..a0b46c0479 100644
--- a/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
+++ b/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
@@ -1,4 +1,4 @@
-From 0c73e17d5ea7c88247c1bfbb03511b0ccb6ba6b4 Mon Sep 17 00:00:00 2001
+From 8ca8e5cd78cbd37a713e1181f8f6641b57352aa8 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:20:09 +0000
 Subject: [PATCH] Quote from bug 1443 which explains what the patch does :
diff --git a/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
index 3b3611f448..736de8cf04 100644
--- a/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
+++ b/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
@@ -1,4 +1,4 @@
-From 6a1ebbab0643fb2169314bcf1a0850b0f06dd27e Mon Sep 17 00:00:00 2001
+From 21509735678990760d5ebf9d0c65efa4b52b838d Mon Sep 17 00:00:00 2001
 From: Ting Liu <b28495@freescale.com>
 Date: Wed, 19 Dec 2012 04:39:57 -0600
 Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S}
diff --git a/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
index b35de40eea..e73b640c16 100644
--- a/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
+++ b/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
@@ -1,4 +1,4 @@
-From 106aee1de5c95fc9e02f10c05537dcc39f8478f4 Mon Sep 17 00:00:00 2001
+From e33deb119734ef443ef44c42a00a569f90e1e149 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:24:46 +0000
 Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
diff --git a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
index 5669341916..0cdd0567df 100644
--- a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
+++ b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
@@ -1,4 +1,4 @@
-From 6c07d094556606ce7c1dc08f4dd3bc6af483364f Mon Sep 17 00:00:00 2001
+From c50cae36e90c41849301a9a668adf31e81e43a07 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:27:10 +0000
 Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly
diff --git a/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch b/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch
index 3e5bba5a59..574e7c3503 100644
--- a/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch
+++ b/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch
@@ -1,4 +1,4 @@
-From 8a8c81ba4e652dddb730d3dad2fecab1ee65fd9c Mon Sep 17 00:00:00 2001
+From c323125744020a29f79e50dc4d024b55c482eafc Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:28:41 +0000
 Subject: [PATCH] Add unused attribute
diff --git a/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch
index 0b626bdfac..49089af41e 100644
--- a/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch
+++ b/meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch
@@ -1,4 +1,4 @@
-From 601b2d11b6ddd974f0e1685f70e0d368e706d976 Mon Sep 17 00:00:00 2001
+From c421cd7e885497a99179b982dc4a27e8405f8857 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:31:06 +0000
 Subject: [PATCH] 'yes' within the path sets wrong config variables
diff --git a/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch
index f18c7a1107..20b0ee98ea 100644
--- a/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch
+++ b/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch
@@ -1,4 +1,4 @@
-From 8678c584bca244fe9a3f8926eabb6b6c7e9784f1 Mon Sep 17 00:00:00 2001
+From 2023d88c355b8af6458c8e39ce38b75c1ca4ea2a Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:33:03 +0000
 Subject: [PATCH] timezone: re-written tzselect as posix sh
diff --git a/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch
index 82026694de..1c15a51308 100644
--- a/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch
+++ b/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch
@@ -1,4 +1,4 @@
-From a78f21f2f9b9246cd12b310833313328e8f646ed Mon Sep 17 00:00:00 2001
+From 06da20d9f89907e5f2777537244e6589ca3c9703 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 31 Dec 2015 14:33:02 -0800
 Subject: [PATCH] Remove bash dependency for nscd init script
diff --git a/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch
index f8f3efe582..eda5565371 100644
--- a/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch
+++ b/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch
@@ -1,4 +1,4 @@
-From 7c48f61b0c5ef6274df4b03609991d383adc5df0 Mon Sep 17 00:00:00 2001
+From 5641452a24f76c5dafa3749a542fcac93f77390f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:42:58 +0000
 Subject: [PATCH] eglibc: Cross building and testing instructions
diff --git a/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch
index 02e5def339..6374ea4086 100644
--- a/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch
+++ b/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch
@@ -1,4 +1,4 @@
-From 86a6e94e86664976b305c24e5a52093fe962240a Mon Sep 17 00:00:00 2001
+From 6a32d5bf40deee5d12d24c06f3ea9b5479c16802 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:49:28 +0000
 Subject: [PATCH] eglibc: Help bootstrap cross toolchain
diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
deleted file mode 100644
index 913aea9563..0000000000
--- a/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From b397d653670dd02d8310e1d6f0f19a8da90ebafa Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 31 Dec 2015 15:15:09 -0800
-Subject: [PATCH] eglibc: Clear cache lines on ppc8xx
-
-2007-06-13  Nathan Sidwell  <nathan@codesourcery.com>
-            Mark Shinwell  <shinwell@codesourcery.com>
-
-        * sysdeps/unix/sysv/linux/powerpc/libc-start.c
-        (__libc_start_main): Detect 8xx parts and clear
-        __cache_line_size if detected.
-        * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-        (DL_PLATFORM_AUXV): Likewise.
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c  | 14 +++++++++++++-
- sysdeps/unix/sysv/linux/powerpc/libc-start.c | 16 +++++++++++++++-
- 2 files changed, 28 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-index 5d65bc6303..c786f9aa7e 100644
---- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-@@ -24,9 +24,21 @@ int __cache_line_size attribute_hidden;
- /* Scan the Aux Vector for the "Data Cache Block Size" entry.  If found
-    verify that the static extern __cache_line_size is defined by checking
-    for not NULL.  If it is defined then assign the cache block size
--   value to __cache_line_size.  */
-+   value to __cache_line_size.  This is used by memset to
-+   optimize setting to zero.  We have to detect 8xx processors, which
-+   have buggy dcbz implementations that cannot report page faults
-+   correctly.  That requires reading SPR, which is a privileged
-+   operation.  Fortunately 2.2.18 and later emulates PowerPC mfspr
-+   reads from the PVR register.   */
- #define DL_PLATFORM_AUXV						      \
-       case AT_DCACHEBSIZE:						      \
-+	if (__LINUX_KERNEL_VERSION >= 0x020218)				      \
-+	  {								      \
-+	    unsigned pvr = 0;						      \
-+	    asm ("mfspr %0, 287" : "=r" (pvr));				      \
-+	    if ((pvr & 0xffff0000) == 0x00500000)			      \
-+	      break;							      \
-+	  }								      \
- 	__cache_line_size = av->a_un.a_val;				      \
- 	break;
- 
-diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
-index 93f8659fa6..9bb07b36be 100644
---- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
-+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
-@@ -73,11 +73,25 @@ __libc_start_main (int argc, char **argv,
- 
-   /* Initialize the __cache_line_size variable from the aux vector.  For the
-      static case, we also need _dl_hwcap, _dl_hwcap2 and _dl_platform, so we
--     can call __tcb_parse_hwcap_and_convert_at_platform ().  */
-+     can call __tcb_parse_hwcap_and_convert_at_platform ().
-+
-+     This is used by memset to optimize setting to zero.  We have to
-+     detect 8xx processors, which have buggy dcbz implementations that
-+     cannot report page faults correctly.  That requires reading SPR,
-+     which is a privileged operation.  Fortunately 2.2.18 and later
-+     emulates PowerPC mfspr reads from the PVR register.  */
-   for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
-     switch (av->a_type)
-       {
-       case AT_DCACHEBSIZE:
-+	if (__LINUX_KERNEL_VERSION >= 0x020218)
-+	  {
-+	    unsigned pvr = 0;
-+
-+	    asm ("mfspr %0, 287" : "=r" (pvr) :);
-+	    if ((pvr & 0xffff0000) == 0x00500000)
-+	      break;
-+	  }
- 	__cache_line_size = av->a_un.a_val;
- 	break;
- #ifndef SHARED
diff --git a/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch
similarity index 96%
rename from meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch
rename to meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch
index cc8ddeea6f..2a503c811e 100644
--- a/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch
+++ b/meta/recipes-core/glibc/glibc/0022-eglibc-Resolve-__fpscr_values-on-SH4.patch
@@ -1,4 +1,4 @@
-From 02b69fc14ae1d6309e4e17081842b1f89bd40338 Mon Sep 17 00:00:00 2001
+From 25c21857a3fc0eb26831616ba88a696dd31ecba1 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 00:55:53 +0000
 Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
diff --git a/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch
similarity index 99%
rename from meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
rename to meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch
index 72278a6822..1a90f22db6 100644
--- a/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
+++ b/meta/recipes-core/glibc/glibc/0023-eglibc-Forward-port-cross-locale-generation-support.patch
@@ -1,4 +1,4 @@
-From 42fc64ee872491667749499db50e3c51d6a4bfb3 Mon Sep 17 00:00:00 2001
+From 30008327aadf0c775e644bb387d7c25952ed05b5 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 18 Mar 2015 01:33:49 +0000
 Subject: [PATCH] eglibc: Forward port cross locale generation support
diff --git a/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch b/meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch
similarity index 92%
rename from meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
rename to meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch
index d359518751..15e460eb08 100644
--- a/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
+++ b/meta/recipes-core/glibc/glibc/0024-Define-DUMMY_LOCALE_T-if-not-defined.patch
@@ -1,4 +1,4 @@
-From 5e565710aa061ffffd34d8400910c35a8d50a4ec Mon Sep 17 00:00:00 2001
+From 067f71a381ce6626ef1179be3dd90c4ed2aa52fb Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 20 Apr 2016 21:11:00 -0700
 Subject: [PATCH] Define DUMMY_LOCALE_T if not defined
diff --git a/meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
similarity index 97%
rename from meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
rename to meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
index 8df09d82ee..543f65d6ea 100644
--- a/meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
+++ b/meta/recipes-core/glibc/glibc/0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
@@ -1,4 +1,4 @@
-From c5b63c8eafc00e01556edd2acff4c541448924cf Mon Sep 17 00:00:00 2001
+From 8f4b0bac85d14b184e08848b02de3f30775f05b1 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:42:06 -0700
 Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
diff --git a/meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch b/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
similarity index 95%
rename from meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
rename to meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
index 55250d8d8e..5f6ee40f22 100644
--- a/meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
+++ b/meta/recipes-core/glibc/glibc/0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
@@ -1,4 +1,4 @@
-From d3349ae8d9b17fecf6ef560b845d04d682db291c Mon Sep 17 00:00:00 2001
+From 1dad746ce93928a57b2fe618c74722f710751826 Mon Sep 17 00:00:00 2001
 From: Mark Hatle <mark.hatle@windriver.com>
 Date: Thu, 18 Aug 2016 14:07:58 -0500
 Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first
diff --git a/meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch b/meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch
similarity index 93%
rename from meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch
rename to meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch
index 06d23c988d..2c317d58aa 100644
--- a/meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch
+++ b/meta/recipes-core/glibc/glibc/0027-intl-Emit-no-lines-in-bison-generated-files.patch
@@ -1,4 +1,4 @@
-From 3650ad7f01509138aa72f235e680c9d4f6c09a7d Mon Sep 17 00:00:00 2001
+From 3c8d9eae83ab4f1677afc9b379f97114e8503363 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Aug 2018 09:44:00 -0700
 Subject: [PATCH] intl: Emit no lines in bison generated files
diff --git a/meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch b/meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch
similarity index 99%
rename from meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch
rename to meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch
index 62e615786d..e1a030d10c 100644
--- a/meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch
+++ b/meta/recipes-core/glibc/glibc/0028-inject-file-assembly-directives.patch
@@ -1,4 +1,4 @@
-From a9be0c7c67e67d870e2c5e0ece4f6ac76e5c0fe2 Mon Sep 17 00:00:00 2001
+From 420454f7098b5445730caa855c37b8143bfccc1b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Thu, 29 Nov 2018 17:29:35 -0800
 Subject: [PATCH] inject file assembly directives
diff --git a/meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
similarity index 96%
rename from meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
rename to meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
index 195b1b0081..c8c359f2b8 100644
--- a/meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
+++ b/meta/recipes-core/glibc/glibc/0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
@@ -1,4 +1,4 @@
-From eaa1e89df6d760c3719e7060662c60b41ab6e87b Mon Sep 17 00:00:00 2001
+From 66963ad83bdd3b075006ddca9dfe357aed181d6a Mon Sep 17 00:00:00 2001
 From: Martin Jansa <martin.jansa@gmail.com>
 Date: Mon, 17 Dec 2018 21:36:18 +0000
 Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
diff --git a/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch b/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch
similarity index 93%
rename from meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch
rename to meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch
index fe10218c31..7fe71ad92f 100644
--- a/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch
+++ b/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch
@@ -1,4 +1,4 @@
-From 4a6f67ae2438c5e7f9cd627d5cf4a7148b9ad18d Mon Sep 17 00:00:00 2001
+From fecfc4050ce075e543fb1cf19d6d1da481260b95 Mon Sep 17 00:00:00 2001
 From: George Burgess IV <gbiv@google.com>
 Date: Sat, 11 Jan 2020 10:33:19 -0800
 Subject: [PATCH] Refactor FORTIFY in glibc
@@ -24,9 +24,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  wcsmbs/bits/wchar2.h            | 487 ++++++++++++++------------------
  14 files changed, 1093 insertions(+), 837 deletions(-)
 
+diff --git a/io/bits/fcntl2.h b/io/bits/fcntl2.h
+index 85b922dab8..04cc377040 100644
 --- a/io/bits/fcntl2.h
 +++ b/io/bits/fcntl2.h
-@@ -32,10 +32,28 @@ extern int __REDIRECT (__open_2, (const
+@@ -32,10 +32,28 @@ extern int __REDIRECT (__open_2, (const char *__path, int __oflag),
  extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...),
  		       open64) __nonnull ((1));
  #endif
@@ -59,7 +61,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  __fortify_function int
  open (const char *__path, int __oflag, ...)
-@@ -58,16 +76,37 @@ open (const char *__path, int __oflag, .
+@@ -58,16 +76,37 @@ open (const char *__path, int __oflag, ...)
  
    return __open_alias (__path, __oflag, __va_arg_pack ());
  }
@@ -101,7 +103,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  __fortify_function int
  open64 (const char *__path, int __oflag, ...)
-@@ -90,6 +129,9 @@ open64 (const char *__path, int __oflag,
+@@ -90,6 +129,9 @@ open64 (const char *__path, int __oflag, ...)
  
    return __open64_alias (__path, __oflag, __va_arg_pack ());
  }
@@ -111,7 +113,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  
-@@ -108,10 +150,32 @@ extern int __REDIRECT (__openat_alias, (
+@@ -108,10 +150,32 @@ extern int __REDIRECT (__openat_alias, (int __fd, const char *__path,
  					int __oflag, ...), openat64)
       __nonnull ((2));
  # endif
@@ -148,7 +150,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  __fortify_function int
  openat (int __fd, const char *__path, int __oflag, ...)
-@@ -134,6 +198,9 @@ openat (int __fd, const char *__path, in
+@@ -134,6 +198,9 @@ openat (int __fd, const char *__path, int __oflag, ...)
  
    return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
  }
@@ -158,7 +160,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  # ifdef __USE_LARGEFILE64
-@@ -142,11 +209,34 @@ extern int __openat64_2 (int __fd, const
+@@ -142,11 +209,34 @@ extern int __openat64_2 (int __fd, const char *__path, int __oflag)
  extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path,
  					  int __oflag, ...), openat64)
       __nonnull ((2));
@@ -197,7 +199,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  __fortify_function int
  openat64 (int __fd, const char *__path, int __oflag, ...)
  {
-@@ -168,5 +258,8 @@ openat64 (int __fd, const char *__path,
+@@ -168,5 +258,8 @@ openat64 (int __fd, const char *__path, int __oflag, ...)
  
    return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
  }
@@ -206,9 +208,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +#  undef __warn_openat64_missing_mode
  # endif
  #endif
+diff --git a/io/bits/poll2.h b/io/bits/poll2.h
+index dca49717db..cc149711af 100644
 --- a/io/bits/poll2.h
 +++ b/io/bits/poll2.h
-@@ -27,25 +27,20 @@ extern int __REDIRECT (__poll_alias, (st
+@@ -27,25 +27,20 @@ extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds,
  				      int __timeout), poll);
  extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout,
  		       __SIZE_TYPE__ __fdslen);
@@ -244,7 +248,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  #ifdef __USE_GNU
  extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
-@@ -54,28 +49,21 @@ extern int __REDIRECT (__ppoll_alias, (s
+@@ -54,28 +49,21 @@ extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
  extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds,
  			const struct timespec *__timeout,
  			const __sigset_t *__ss, __SIZE_TYPE__ __fdslen);
@@ -284,9 +288,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  __END_DECLS
+diff --git a/io/fcntl.h b/io/fcntl.h
+index 21b60c264d..83f2c8e117 100644
 --- a/io/fcntl.h
 +++ b/io/fcntl.h
-@@ -325,7 +325,7 @@ extern int posix_fallocate64 (int __fd,
+@@ -325,7 +325,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
  
  /* Define some inlines helping to catch common problems.  */
  #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
@@ -295,18 +301,17 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  # include <bits/fcntl2.h>
  #endif
  
+diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
+index 60bc81735e..1338f418ba 100644
 --- a/libio/bits/stdio2.h
 +++ b/libio/bits/stdio2.h
-@@ -29,12 +29,23 @@ extern int __vsprintf_chk (char *__restr
+@@ -29,12 +29,23 @@ extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
  			   const char *__restrict __format,
  			   __gnuc_va_list __ap) __THROW;
  
 -#ifdef __va_arg_pack
 -__fortify_function int
 -__NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
--{
--  return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
--				  __bos (__s), __fmt, __va_arg_pack ());
 +#define __mul_may_overflow(size, n) \
 +  ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2)))
 +
@@ -316,7 +321,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +__fortify_potential_overload int
 +__NTH (sprintf (char *__restrict const __clang_pass_object_size __s,
 +		const char *__restrict __fmt, ...))
-+{
+ {
+-  return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
+-				  __bos (__s), __fmt, __va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_BUILTIN (sprintf, __s,
 +					    __USE_FORTIFY_LEVEL - 1,
@@ -327,7 +334,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  }
  #elif !defined __cplusplus
  # define sprintf(str, ...) \
-@@ -42,9 +53,9 @@ __NTH (sprintf (char *__restrict __s, co
+@@ -42,9 +53,9 @@ __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
  			   __VA_ARGS__)
  #endif
  
@@ -340,7 +347,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
  				   __bos (__s), __fmt, __ap);
-@@ -59,13 +70,21 @@ extern int __vsnprintf_chk (char *__rest
+@@ -59,13 +70,21 @@ extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
  			    size_t __slen, const char *__restrict __format,
  			    __gnuc_va_list __ap) __THROW;
  
@@ -348,9 +355,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -__fortify_function int
 -__NTH (snprintf (char *__restrict __s, size_t __n,
 -		 const char *__restrict __fmt, ...))
--{
--  return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
--				   __bos (__s), __fmt, __va_arg_pack ());
 +# ifdef __FORTIFY_ARG_PACK_OK
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 4))) int
 +__NTH (snprintf (char *__restrict const __clang_pass_object_size __s,
@@ -358,7 +362,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +     /* GCC's builtin will catch this, so we just need to cover clang here.  */
 +     __clang_warning_if (__bos_static_lt (__n, __s),
 +			 "call to snprintf may overflow the destination buffer")
-+{
+ {
+-  return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
+-				   __bos (__s), __fmt, __va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_BUILTIN (snprintf, __s, __n,
 +					    __USE_FORTIFY_LEVEL - 1,
@@ -369,7 +375,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  }
  # elif !defined __cplusplus
  #  define snprintf(str, len, ...) \
-@@ -73,9 +92,12 @@ __NTH (snprintf (char *__restrict __s, s
+@@ -73,9 +92,12 @@ __NTH (snprintf (char *__restrict __s, size_t __n,
  			    __VA_ARGS__)
  # endif
  
@@ -385,38 +391,34 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
  				    __bos (__s), __fmt, __ap);
-@@ -93,18 +115,27 @@ extern int __vfprintf_chk (FILE *__restr
+@@ -93,18 +115,27 @@ extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
  extern int __vprintf_chk (int __flag, const char *__restrict __format,
  			  __gnuc_va_list __ap);
  
 -# ifdef __va_arg_pack
 -__fortify_function int
 -fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
--{
--  return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
--			__va_arg_pack ());
--}
--
--__fortify_function int
--printf (const char *__restrict __fmt, ...)
--{
--  return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 +# ifdef __FORTIFY_ARG_PACK_OK
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
 +fprintf (FILE *__restrict const __clang_pass_object_size __stream,
 +	 const char *__restrict __fmt, ...)
-+{
+ {
+-  return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
+-			__va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_CHK (fprintf, __stream,
 +					__USE_FORTIFY_LEVEL - 1, __fmt,
 +					__FORTIFY_ARG_PACK);
 +  __FORTIFY_FREE_ARG_PACK();
 +  return __result;
-+}
-+
+ }
+ 
+-__fortify_function int
+-printf (const char *__restrict __fmt, ...)
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 2))) int
 +printf (const char *__restrict const __clang_pass_object_size __fmt, ...)
-+{
+ {
+-  return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_CHK (printf, __USE_FORTIFY_LEVEL - 1, __fmt,
 +					__FORTIFY_ARG_PACK);
@@ -425,7 +427,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  }
  # elif !defined __cplusplus
  #  define printf(...) \
-@@ -113,8 +144,9 @@ printf (const char *__restrict __fmt, ..
+@@ -113,8 +144,9 @@ printf (const char *__restrict __fmt, ...)
    __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
  # endif
  
@@ -437,7 +439,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
  #ifdef __USE_EXTERN_INLINES
    return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-@@ -122,9 +154,8 @@ vprintf (const char *__restrict __fmt, _
+@@ -122,9 +154,8 @@ vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
    return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
  #endif
  }
@@ -449,21 +451,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  	  const char *__restrict __fmt, __gnuc_va_list __ap)
  {
    return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-@@ -137,20 +168,26 @@ extern int __vdprintf_chk (int __fd, int
+@@ -137,20 +168,26 @@ extern int __vdprintf_chk (int __fd, int __flag,
  			   const char *__restrict __fmt, __gnuc_va_list __arg)
       __attribute__ ((__format__ (__printf__, 3, 0)));
  
 -#  ifdef __va_arg_pack
 -__fortify_function int
 -dprintf (int __fd, const char *__restrict __fmt, ...)
--{
--  return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
--			__va_arg_pack ());
 +#  ifdef __FORTIFY_ARG_PACK_OK
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
 +dprintf (int __fd, const char *__restrict const __clang_pass_object_size __fmt,
 +	...)
-+{
+ {
+-  return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
+-			__va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_CHK (dprintf, __fd, __USE_FORTIFY_LEVEL - 1,
 +					__fmt, __FORTIFY_ARG_PACK);
@@ -484,21 +485,13 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
  }
-@@ -174,28 +211,49 @@ extern int __obstack_vprintf_chk (struct
+@@ -174,28 +211,49 @@ extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
  				  __gnuc_va_list __args)
       __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
  
 -#  ifdef __va_arg_pack
 -__fortify_function int
 -__NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...))
--{
--  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
--			 __va_arg_pack ());
--}
--
--__fortify_function int
--__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt,
--		   ...))
 +#  ifdef __FORTIFY_ARG_PACK_OK
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3)))
 +__wur int
@@ -507,31 +500,34 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
 -  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
 -			 __va_arg_pack ());
--}
--
--__fortify_function int
--__NTH (obstack_printf (struct obstack *__restrict __obstack,
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr,
 +					__USE_FORTIFY_LEVEL - 1, __fmt,
 +					__FORTIFY_ARG_PACK);
 +  __FORTIFY_FREE_ARG_PACK();
 +  return __result;
-+}
-+
+ }
+ 
+-__fortify_function int
+-__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt,
+-		   ...))
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3)))
 +__wur int
 +__NTH (__asprintf (char **__restrict const __clang_pass_object_size __ptr,
 +		   const char *__restrict __fmt, ...))
-+{
+ {
+-  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
+-			 __va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr,
 +					__USE_FORTIFY_LEVEL - 1, __fmt,
 +					__FORTIFY_ARG_PACK);
 +  __FORTIFY_FREE_ARG_PACK();
 +  return __result;
-+}
-+
+ }
+ 
+-__fortify_function int
+-__NTH (obstack_printf (struct obstack *__restrict __obstack,
 +__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
 +__NTH (obstack_printf (struct obstack *
 +			 __restrict const __clang_pass_object_size __obstack,
@@ -553,7 +549,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  }
  #  elif !defined __cplusplus
  #   define asprintf(ptr, ...) \
-@@ -206,15 +264,17 @@ __NTH (obstack_printf (struct obstack *_
+@@ -206,15 +264,17 @@ __NTH (obstack_printf (struct obstack *__restrict __obstack,
    __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
  #  endif
  
@@ -576,17 +572,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  			const char *__restrict __fmt, __gnuc_va_list __ap))
  {
    return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
-@@ -227,17 +287,20 @@ __NTH (obstack_vprintf (struct obstack *
+@@ -227,17 +287,20 @@ __NTH (obstack_vprintf (struct obstack *__restrict __obstack,
  
  #if __GLIBC_USE (DEPRECATED_GETS)
  extern char *__gets_chk (char *__str, size_t) __wur;
 -extern char *__REDIRECT (__gets_warn, (char *__str), gets)
 -     __wur __warnattr ("please use fgets or getline instead, gets can't "
 -		       "specify buffer size");
-+extern char *__REDIRECT_NTH (__gets_alias, (char *__buf), gets) __wur;
- 
+-
 -__fortify_function __wur char *
 -gets (char *__str)
++extern char *__REDIRECT_NTH (__gets_alias, (char *__buf), gets) __wur;
++
 +__fortify_potential_overload __wur char *
 +gets (char *const __clang_pass_object_size __str)
 +__FORTIFY_PRECONDITIONS
@@ -603,7 +600,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
-@@ -245,25 +308,20 @@ extern char *__fgets_chk (char *__restri
+@@ -245,25 +308,20 @@ extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
  extern char *__REDIRECT (__fgets_alias,
  			 (char *__restrict __s, int __n,
  			  FILE *__restrict __stream), fgets) __wur;
@@ -612,9 +609,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			  FILE *__restrict __stream), __fgets_chk)
 -     __wur __warnattr ("fgets called with bigger size than length "
 -		       "of destination buffer");
- 
+-
 -__fortify_function __wur char *
 -fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
++
 +__fortify_potential_overload __wur char *
 +fgets (char *__restrict const __clang_pass_object_size __s, int __n,
 +       FILE *__restrict __stream)
@@ -679,7 +677,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  #ifdef __USE_GNU
  extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
-@@ -303,25 +352,21 @@ extern char *__fgets_unlocked_chk (char
+@@ -303,25 +352,21 @@ extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
  extern char *__REDIRECT (__fgets_unlocked_alias,
  			 (char *__restrict __s, int __n,
  			  FILE *__restrict __stream), fgets_unlocked) __wur;
@@ -688,9 +686,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			  FILE *__restrict __stream), __fgets_unlocked_chk)
 -     __wur __warnattr ("fgets_unlocked called with bigger size than length "
 -		       "of destination buffer");
- 
+-
 -__fortify_function __wur char *
 -fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
++
 +__fortify_potential_overload __wur char *
 +fgets_unlocked (char *__restrict const __clang_pass_object_size __s, int __n,
 +		FILE *__restrict __stream)
@@ -715,7 +714,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  #ifdef __USE_MISC
-@@ -333,30 +378,19 @@ extern size_t __REDIRECT (__fread_unlock
+@@ -333,30 +378,19 @@ extern size_t __REDIRECT (__fread_unlocked_alias,
  			  (void *__restrict __ptr, size_t __size,
  			   size_t __n, FILE *__restrict __stream),
  			  fread_unlocked) __wur;
@@ -756,7 +755,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  # ifdef __USE_EXTERN_INLINES
    if (__builtin_constant_p (__size)
-@@ -381,6 +415,7 @@ fread_unlocked (void *__restrict __ptr,
+@@ -381,6 +415,7 @@ fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n,
  # endif
    return __fread_unlocked_alias (__ptr, __size, __n, __stream);
  }
@@ -765,6 +764,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -
 +#undef __mul_may_overflow
  #endif /* bits/stdio2.h.  */
+diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
+index 322192df21..68b90a5cb8 100644
 --- a/misc/bits/syslog.h
 +++ b/misc/bits/syslog.h
 @@ -20,11 +20,34 @@
@@ -803,7 +804,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  __fortify_function void
  syslog (int __pri, const char *__fmt, ...)
  {
-@@ -34,16 +57,3 @@ syslog (int __pri, const char *__fmt, ..
+@@ -34,16 +57,3 @@ syslog (int __pri, const char *__fmt, ...)
  # define syslog(pri, ...) \
    __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
  #endif
@@ -820,6 +821,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -  __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 -}
 -#endif
+diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
+index ff7144f3f3..a42ffd5d36 100644
 --- a/misc/sys/cdefs.h
 +++ b/misc/sys/cdefs.h
 @@ -118,11 +118,150 @@
@@ -1004,9 +1007,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  /* It is possible to compile containing GCC extensions even if GCC is
     run in pedantic mode if the uses are carefully marked using the
     `__extension__' keyword.  But this is not generally available before
+diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
+index b8a8211d83..895d87832e 100644
 --- a/posix/bits/unistd.h
 +++ b/posix/bits/unistd.h
-@@ -24,25 +24,19 @@ extern ssize_t __read_chk (int __fd, voi
+@@ -24,25 +24,19 @@ extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
  			   size_t __buflen) __wur;
  extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
  					  size_t __nbytes), read) __wur;
@@ -1015,10 +1020,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			    size_t __buflen), __read_chk)
 -     __wur __warnattr ("read called with bigger length than size of "
 -		       "the destination buffer");
--
+ 
 -__fortify_function __wur ssize_t
 -read (int __fd, void *__buf, size_t __nbytes)
--{
++__fortify_potential_overload __wur ssize_t
++read (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes)
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__read_warn, __nbytes, __buf,
++					"read called with bigger length than "
++					"size of the destination buffer")
+ {
 -  if (__bos0 (__buf) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__nbytes))
@@ -1027,14 +1038,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -      if (__nbytes > __bos0 (__buf))
 -	return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf));
 -    }
-+
-+__fortify_potential_overload __wur ssize_t
-+read (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__read_warn, __nbytes, __buf,
-+					"read called with bigger length than "
-+					"size of the destination buffer")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
 +    return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
    return __read_alias (__fd, __buf, __nbytes);
@@ -1043,7 +1046,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  #ifdef __USE_UNIX98
  extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
-@@ -55,67 +49,49 @@ extern ssize_t __REDIRECT (__pread_alias
+@@ -55,67 +49,49 @@ extern ssize_t __REDIRECT (__pread_alias,
  extern ssize_t __REDIRECT (__pread64_alias,
  			   (int __fd, void *__buf, size_t __nbytes,
  			    __off64_t __offset), pread64) __wur;
@@ -1098,6 +1101,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +#  define __fo_off_t __off64_t
  # endif
  
+-# ifdef __USE_LARGEFILE64
+-__fortify_function __wur ssize_t
+-pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
 +__fortify_potential_overload __wur ssize_t
 +pread (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes,
 +       __fo_off_t __offset)
@@ -1105,20 +1111,26 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread_chk_warn, __nbytes, __buf,
 +					"pread called with bigger length than "
 +					"size of the destination buffer")
-+{
+ {
+-  if (__bos0 (__buf) != (size_t) -1)
+-    {
+-      if (!__builtin_constant_p (__nbytes))
+-	return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
 +  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
 +    return __fo_pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
 +  return __fo_pread_alias (__fd, __buf, __nbytes, __offset);
 +}
 +__FORTIFY_FUNCTION_END
-+
+ 
+-      if ( __nbytes > __bos0 (__buf))
+-	return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
+-				   __bos0 (__buf));
+-    }
 +#undef __fo_pread_chk
 +#undef __fo_pread_alias
 +#undef __fo_off_t
-+
- # ifdef __USE_LARGEFILE64
--__fortify_function __wur ssize_t
--pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
+ 
++# ifdef __USE_LARGEFILE64
 +__fortify_potential_overload __wur ssize_t
 +pread64 (int __fd, void *const __clang_pass_object_size0 __buf,
 +	  size_t __nbytes, __off64_t __offset)
@@ -1126,17 +1138,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread64_warn, __nbytes, __buf,
 +					"pread64 called with bigger length "
 +					"than size of the destination buffer")
- {
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__nbytes))
--	return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
--
--      if ( __nbytes > __bos0 (__buf))
--	return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
--				   __bos0 (__buf));
--    }
--
++{
 +  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
 +    return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
    return __pread64_alias (__fd, __buf, __nbytes, __offset);
@@ -1145,7 +1147,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  # endif
  #endif
  
-@@ -128,27 +104,21 @@ extern ssize_t __REDIRECT_NTH (__readlin
+@@ -128,27 +104,21 @@ extern ssize_t __REDIRECT_NTH (__readlink_alias,
  			       (const char *__restrict __path,
  				char *__restrict __buf, size_t __len), readlink)
       __nonnull ((1, 2)) __wur;
@@ -1183,7 +1185,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  #ifdef __USE_ATFILE
-@@ -161,119 +131,104 @@ extern ssize_t __REDIRECT_NTH (__readlin
+@@ -161,119 +131,104 @@ extern ssize_t __REDIRECT_NTH (__readlinkat_alias,
  				char *__restrict __buf, size_t __len),
  			       readlinkat)
       __nonnull ((2, 3)) __wur;
@@ -1234,24 +1236,25 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			     __getcwd_chk)
 -     __wur __warnattr ("getcwd caller with bigger length than size of "
 -		       "destination buffer");
- 
+-
 -__fortify_function __wur char *
 -__NTH (getcwd (char *__buf, size_t __size))
-+__fortify_potential_overload __wur char *
-+__NTH (getcwd (char *const __clang_pass_object_size __buf, size_t __size))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getcwd_warn, __size, __buf,
-+				       "getcwd called with bigger length than "
-+				       "size of destination buffer")
- {
+-{
 -  if (__bos (__buf) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__size))
 -	return __getcwd_chk (__buf, __size, __bos (__buf));
--
+ 
 -      if (__size > __bos (__buf))
 -	return __getcwd_chk_warn (__buf, __size, __bos (__buf));
 -    }
++__fortify_potential_overload __wur char *
++__NTH (getcwd (char *const __clang_pass_object_size __buf, size_t __size))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getcwd_warn, __size, __buf,
++				       "getcwd called with bigger length than "
++				       "size of destination buffer")
++{
 +  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
 +    return __getcwd_chk (__buf, __size, __bos (__buf));
    return __getcwd_alias (__buf, __size);
@@ -1268,11 +1271,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -     __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd "
 -				       "doesn't specify buffer size");
 +     __nonnull ((1)) __wur __warnattr (__warn_getwd_use_something_else);
-+
-+extern char *__REDIRECT (__getwd_alias, (char *__str), getwd) __wur;
  
 -__fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char *
 -__NTH (getwd (char *__buf))
++extern char *__REDIRECT (__getwd_alias, (char *__str), getwd) __wur;
++
 +__fortify_potential_overload __nonnull ((1)) __attribute_deprecated__ __wur
 +char *
 +__NTH (getwd (char *const __clang_pass_object_size __buf))
@@ -1295,25 +1298,26 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			       size_t __buflen), __confstr_chk)
 -     __warnattr ("confstr called with bigger length than size of destination "
 -		 "buffer");
- 
+-
 -__fortify_function size_t
 -__NTH (confstr (int __name, char *__buf, size_t __len))
-+__fortify_potential_overload size_t
-+__NTH (confstr (int __name, char *const __clang_pass_object_size __buf,
-+		size_t __len))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__confstr_warn, __len, __buf,
-+				       "confstr called with bigger length than "
-+				       "size of destination buffer")
- {
+-{
 -  if (__bos (__buf) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__len))
 -	return __confstr_chk (__name, __buf, __len, __bos (__buf));
--
+ 
 -      if (__bos (__buf) < __len)
 -	return __confstr_chk_warn (__name, __buf, __len, __bos (__buf));
 -    }
++__fortify_potential_overload size_t
++__NTH (confstr (int __name, char *const __clang_pass_object_size __buf,
++		size_t __len))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__confstr_warn, __len, __buf,
++				       "confstr called with bigger length than "
++				       "size of destination buffer")
++{
 +  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
 +    return __confstr_chk (__name, __buf, __len, __bos (__buf));
    return __confstr_alias (__name, __buf, __len);
@@ -1333,15 +1337,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -
 -__fortify_function int
 -__NTH (getgroups (int __size, __gid_t __list[]))
--{
--  if (__bos (__list) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__size) || __size < 0)
--	return __getgroups_chk (__size, __list, __bos (__list));
--
--      if (__size * sizeof (__gid_t) > __bos (__list))
--	return __getgroups_chk_warn (__size, __list, __bos (__list));
--    }
 +
 +__fortify_potential_overload int
 +__NTH (getgroups (int __size, __gid_t *const __clang_pass_object_size __list))
@@ -1351,7 +1346,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +				       "getgroups called with bigger group "
 +				       "count than what can fit into "
 +				       "destination buffer")
-+{
+ {
+-  if (__bos (__list) != (size_t) -1)
+-    {
+-      if (!__builtin_constant_p (__size) || __size < 0)
+-	return __getgroups_chk (__size, __list, __bos (__list));
+-
+-      if (__size * sizeof (__gid_t) > __bos (__list))
+-	return __getgroups_chk_warn (__size, __list, __bos (__list));
+-    }
 +  if (__FORTIFY_CALL_CHK && __bos (__list) != (size_t) -1)
 +    return __getgroups_chk (__size, __list, __bos (__list));
    return __getgroups_alias (__size, __list);
@@ -1360,13 +1363,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
-@@ -287,19 +242,19 @@ extern int __REDIRECT_NTH (__ttyname_r_c
+@@ -287,19 +242,19 @@ extern int __REDIRECT_NTH (__ttyname_r_chk_warn,
       __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than "
  				 "size of destination buffer");
  
 -__fortify_function int
 -__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen))
--{
++__fortify_potential_overload int
++__NTH (ttyname_r (int __fd, char *const __clang_pass_object_size __buf,
++		  size_t __buflen))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ttyname_r_warn, __buflen, __buf,
++				       "ttyname_r called with bigger buflen "
++				       "than size of destination buffer")
+ {
 -  if (__bos (__buf) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__buflen))
@@ -1377,14 +1387,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -    }
 -  return __ttyname_r_alias (__fd, __buf, __buflen);
 -}
-+__fortify_potential_overload int
-+__NTH (ttyname_r (int __fd, char *const __clang_pass_object_size __buf,
-+		  size_t __buflen))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ttyname_r_warn, __buflen, __buf,
-+				       "ttyname_r called with bigger buflen "
-+				       "than size of destination buffer")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
 +    return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
 +   return __ttyname_r_alias (__fd, __buf, __buflen);
@@ -1393,7 +1395,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  #ifdef __USE_POSIX199506
-@@ -307,25 +262,19 @@ extern int __getlogin_r_chk (char *__buf
+@@ -307,25 +262,19 @@ extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
       __nonnull ((1));
  extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen),
  		       getlogin_r) __nonnull ((1));
@@ -1428,7 +1430,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  
-@@ -334,25 +283,20 @@ extern int __gethostname_chk (char *__bu
+@@ -334,25 +283,20 @@ extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
       __THROW __nonnull ((1));
  extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
  			   gethostname) __nonnull ((1));
@@ -1464,7 +1466,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  
-@@ -362,24 +306,18 @@ extern int __getdomainname_chk (char *__
+@@ -362,24 +306,18 @@ extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
  extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf,
  						   size_t __buflen),
  			   getdomainname) __nonnull ((1)) __wur;
@@ -1474,34 +1476,37 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -     __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger "
 -				       "buflen than size of destination "
 -				       "buffer");
- 
+-
 -__fortify_function int
 -__NTH (getdomainname (char *__buf, size_t __buflen))
-+__fortify_potential_overload int
-+__NTH (getdomainname (char *const __clang_pass_object_size __buf,
-+		      size_t __buflen))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getdomainname_warn, __buflen, __buf,
-+				       "getdomainname called with bigger "
-+				       "buflen than size of destination buffer")
- {
+-{
 -  if (__bos (__buf) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__buflen))
 -	return __getdomainname_chk (__buf, __buflen, __bos (__buf));
--
+ 
 -      if (__buflen > __bos (__buf))
 -	return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf));
 -    }
++__fortify_potential_overload int
++__NTH (getdomainname (char *const __clang_pass_object_size __buf,
++		      size_t __buflen))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getdomainname_warn, __buflen, __buf,
++				       "getdomainname called with bigger "
++				       "buflen than size of destination buffer")
++{
 +  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
 +    return __getdomainname_chk (__buf, __buflen, __bos (__buf));
    return __getdomainname_alias (__buf, __buflen);
  }
 +__FORTIFY_FUNCTION_END
  #endif
+diff --git a/rt/bits/mqueue2.h b/rt/bits/mqueue2.h
+index 354f0d53bf..388b63a4f8 100644
 --- a/rt/bits/mqueue2.h
 +++ b/rt/bits/mqueue2.h
-@@ -29,10 +29,47 @@ extern mqd_t __mq_open_2 (const char *__
+@@ -29,10 +29,47 @@ extern mqd_t __mq_open_2 (const char *__name, int __oflag)
  extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name,
  					       int __oflag, ...), mq_open)
       __nonnull ((1));
@@ -1551,16 +1556,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  __fortify_function mqd_t
  __NTH (mq_open (const char *__name, int __oflag, ...))
-@@ -55,3 +92,6 @@ __NTH (mq_open (const char *__name, int
+@@ -55,3 +92,6 @@ __NTH (mq_open (const char *__name, int __oflag, ...))
  
    return __mq_open_alias (__name, __oflag, __va_arg_pack ());
  }
 +#endif
 +#undef __warn_mq_open_wrong_number_of_args
 +#undef __warn_mq_open_missing_mode_and_attr
+diff --git a/rt/mqueue.h b/rt/mqueue.h
+index a2a2aa1771..5a2976d1be 100644
 --- a/rt/mqueue.h
 +++ b/rt/mqueue.h
-@@ -89,7 +89,7 @@ extern int mq_timedsend (mqd_t __mqdes,
+@@ -89,7 +89,7 @@ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
  
  /* Define some inlines helping to catch common problems.  */
  #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
@@ -1569,9 +1576,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  # include <bits/mqueue2.h>
  #endif
  
+diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h
+index c0421ce244..12d2e75f57 100644
 --- a/socket/bits/socket2.h
 +++ b/socket/bits/socket2.h
-@@ -24,25 +24,20 @@ extern ssize_t __recv_chk (int __fd, voi
+@@ -24,25 +24,20 @@ extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
  			   int __flags);
  extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
  					  int __flags), recv);
@@ -1607,7 +1616,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
  			       size_t __buflen, int __flags,
-@@ -52,26 +47,19 @@ extern ssize_t __REDIRECT (__recvfrom_al
+@@ -52,26 +47,19 @@ extern ssize_t __REDIRECT (__recvfrom_alias,
  			   (int __fd, void *__restrict __buf, size_t __n,
  			    int __flags, __SOCKADDR_ARG __addr,
  			    socklen_t *__restrict __addr_len), recvfrom);
@@ -1646,9 +1655,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
    return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
  }
 +__FORTIFY_FUNCTION_END
+diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h
+index bfdee75073..a15f965b12 100644
 --- a/stdlib/bits/stdlib.h
 +++ b/stdlib/bits/stdlib.h
-@@ -26,27 +26,27 @@ extern char *__realpath_chk (const char
+@@ -26,27 +26,27 @@ extern char *__realpath_chk (const char *__restrict __name,
  extern char *__REDIRECT_NTH (__realpath_alias,
  			     (const char *__restrict __name,
  			      char *__restrict __resolved), realpath) __wur;
@@ -1691,7 +1702,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
-@@ -54,33 +54,28 @@ extern int __ptsname_r_chk (int __fd, ch
+@@ -54,33 +54,28 @@ extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
  extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf,
  					       size_t __buflen), ptsname_r)
       __nonnull ((2));
@@ -1700,9 +1711,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			    size_t __nreal), __ptsname_r_chk)
 -     __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than "
 -				 "size of buf");
- 
+-
 -__fortify_function int
 -__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen))
++
 +__fortify_potential_overload int
 +__NTH (ptsname_r (int __fd, char *const __clang_pass_object_size __buf,
 +		  size_t __buflen))
@@ -1737,7 +1749,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
       But this would only disturb the namespace.  So we define our own
-@@ -102,29 +97,22 @@ extern size_t __REDIRECT_NTH (__mbstowcs
+@@ -102,29 +97,22 @@ extern size_t __REDIRECT_NTH (__mbstowcs_alias,
  			      (wchar_t *__restrict __dst,
  			       const char *__restrict __src,
  			       size_t __len), mbstowcs);
@@ -1747,11 +1759,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			       size_t __len, size_t __dstlen), __mbstowcs_chk)
 -     __warnattr ("mbstowcs called with dst buffer smaller than len "
 -		 "* sizeof (wchar_t)");
--
+ 
 -__fortify_function size_t
 -__NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src,
 -		 size_t __len))
-+
 +__fortify_potential_overload size_t
 +__NTH (mbstowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
 +		 const char *__restrict __src, size_t __len))
@@ -1780,7 +1791,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern size_t __wcstombs_chk (char *__restrict __dst,
-@@ -134,22 +122,17 @@ extern size_t __REDIRECT_NTH (__wcstombs
+@@ -134,22 +122,17 @@ extern size_t __REDIRECT_NTH (__wcstombs_alias,
  			      (char *__restrict __dst,
  			       const wchar_t *__restrict __src,
  			       size_t __len), wcstombs);
@@ -1813,6 +1824,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
    return __wcstombs_alias (__dst, __src, __len);
  }
 +__FORTIFY_FUNCTION_END
+diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h
+index e4d07cb50c..f73528ba7e 100644
 --- a/string/bits/string_fortified.h
 +++ b/string/bits/string_fortified.h
 @@ -22,45 +22,82 @@
@@ -1827,14 +1840,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -__fortify_function void *
 -__NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
 -	       size_t __len))
--{
--  return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
--}
--
--__fortify_function void *
--__NTH (memmove (void *__dest, const void *__src, size_t __len))
--{
--  return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
 +#define __warn_len_too_large \
 +  "function called with bigger length than the destination buffer"
 +/* Repeat bodies here to reduce 'note's if we detect a problem.  */
@@ -1857,19 +1862,23 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +__NTH (memcpy (void *__restrict const __clang_pass_object_size0 __dest,
 +	       const void *__restrict __src, size_t __len))
 +     __warn_if_dest_too_small0 (__dest, __len)
-+{
+ {
+-  return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
 +  size_t __bos_dst = __bos0 (__dest);
 +  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
 +				   && __bos_dst >= __len))
 +    return __builtin_memcpy (__dest, __src, __len);
 +  return __builtin___memcpy_chk (__dest, __src, __len, __bos_dst);
-+}
-+
+ }
+ 
+-__fortify_function void *
+-__NTH (memmove (void *__dest, const void *__src, size_t __len))
 +__fortify_potential_overload void *
 +__NTH (memmove (void *const __clang_pass_object_size0 __dest,
 +		const void *__src, size_t __len))
 +     __warn_if_dest_too_small0 (__dest, __len)
-+{
+ {
+-  return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
 +  size_t __bos_dst = __bos0 (__dest);
 +  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
 +				   && __bos_dst >= __len))
@@ -1881,13 +1890,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -__fortify_function void *
 -__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src,
 -		size_t __len))
--{
--  return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest));
 +__fortify_potential_overload void *
 +__NTH (mempcpy (void *__restrict const __clang_pass_object_size0 __dest,
 +		const void *__restrict __src, size_t __len))
 +     __warn_if_dest_too_small0 (__dest, __len)
-+{
+ {
+-  return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest));
 +  size_t __bos_dst = __bos0 (__dest);
 +  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
 +				   && __bos_dst >= __len))
@@ -1923,7 +1931,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
    if (__builtin_constant_p (__len) && __len == 0
        && (!__builtin_constant_p (__ch) || __ch != 0))
      {
-@@ -68,8 +105,13 @@ __NTH (memset (void *__dest, int __ch, s
+@@ -68,8 +105,13 @@ __NTH (memset (void *__dest, int __ch, size_t __len))
        return __dest;
      }
  #endif
@@ -1938,7 +1946,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  #ifdef __USE_MISC
  # include <bits/strings_fortified.h>
-@@ -84,24 +126,30 @@ __NTH (explicit_bzero (void *__dest, siz
+@@ -84,24 +126,30 @@ __NTH (explicit_bzero (void *__dest, size_t __len))
  }
  #endif
  
@@ -1977,7 +1985,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
  }
-@@ -112,28 +160,36 @@ extern char *__stpncpy_chk (char *__dest
+@@ -112,28 +160,36 @@ extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
  extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src,
  					       size_t __n), stpncpy);
  
@@ -2025,6 +2033,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +#undef __warn_input_str_too_large
 +#undef __warn_if_src_too_large
  #endif /* bits/string_fortified.h */
+diff --git a/string/bits/strings_fortified.h b/string/bits/strings_fortified.h
+index d4091f4f69..4d0cd02612 100644
 --- a/string/bits/strings_fortified.h
 +++ b/string/bits/strings_fortified.h
 @@ -19,16 +19,40 @@
@@ -2074,6 +2084,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +#undef __strings_size_too_small
 +#undef __strings_warn_len_too_large
  #endif
+diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
+index 86e8e23e76..1b0718119a 100644
 --- a/wcsmbs/bits/wchar2.h
 +++ b/wcsmbs/bits/wchar2.h
 @@ -20,7 +20,6 @@
@@ -2084,7 +2096,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1,
  			       const wchar_t *__restrict __s2, size_t __n,
  			       size_t __ns1) __THROW;
-@@ -28,57 +27,42 @@ extern wchar_t *__REDIRECT_NTH (__wmemcp
+@@ -28,57 +27,42 @@ extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias,
  				(wchar_t *__restrict __s1,
  				 const wchar_t *__restrict __s2, size_t __n),
  				wmemcpy);
@@ -2098,7 +2110,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -__fortify_function wchar_t *
 -__NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
 -		size_t __n))
--{
++__fortify_potential_overload wchar_t *
++__NTH (wmemcpy (wchar_t *__restrict const __clang_pass_object_size0 __s1,
++	      const wchar_t *__restrict __s2, size_t __n))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemcpy_warn, __n, __s1,
++					 sizeof (wchar_t),
++					 "wmemcpy called with length bigger "
++					 "than size of destination buffer")
+ {
 -  if (__bos0 (__s1) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__n))
@@ -2110,15 +2130,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -				   __bos0 (__s1) / sizeof (wchar_t));
 -    }
 -  return __wmemcpy_alias (__s1, __s2, __n);
-+__fortify_potential_overload wchar_t *
-+__NTH (wmemcpy (wchar_t *__restrict const __clang_pass_object_size0 __s1,
-+	      const wchar_t *__restrict __s2, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemcpy_warn, __n, __s1,
-+					 sizeof (wchar_t),
-+					 "wmemcpy called with length bigger "
-+					 "than size of destination buffer")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1)
 +    return __wmemcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t));
 +  return __wmemcpy_alias(__s1, __s2, __n);
@@ -2139,7 +2150,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -
 -__fortify_function wchar_t *
 -__NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n))
--{
++
++__fortify_potential_overload wchar_t *
++__NTH (wmemmove (wchar_t *const __clang_pass_object_size0 __s1,
++		 const wchar_t *__s2, size_t __n))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemmove_warn, __n, __s1,
++					 sizeof (wchar_t),
++					 "wmemmove called with length bigger "
++					 "than size of destination buffer")
+ {
 -  if (__bos0 (__s1) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__n))
@@ -2150,16 +2170,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -	return __wmemmove_chk_warn (__s1, __s2, __n,
 -				    __bos0 (__s1) / sizeof (wchar_t));
 -    }
-+
-+__fortify_potential_overload wchar_t *
-+__NTH (wmemmove (wchar_t *const __clang_pass_object_size0 __s1,
-+		 const wchar_t *__s2, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemmove_warn, __n, __s1,
-+					 sizeof (wchar_t),
-+					 "wmemmove called with length bigger "
-+					 "than size of destination buffer")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t) -1)
 +    return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t));
    return __wmemmove_alias (__s1, __s2, __n);
@@ -2168,7 +2178,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  #ifdef __USE_GNU
-@@ -89,29 +73,21 @@ extern wchar_t *__REDIRECT_NTH (__wmempc
+@@ -89,29 +73,21 @@ extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias,
  				(wchar_t *__restrict __s1,
  				 const wchar_t *__restrict __s2,
  				 size_t __n), wmempcpy);
@@ -2182,7 +2192,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -__fortify_function wchar_t *
 -__NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
 -		 size_t __n))
--{
++
++__fortify_potential_overload wchar_t *
++__NTH(wmempcpy(wchar_t *__restrict const __clang_pass_object_size0 __s1,
++               const wchar_t *__restrict __s2, size_t __n))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmempcpy_warn, __n, __s1,
++					 sizeof (wchar_t),
++					 "wmempcpy called with length bigger "
++					 "than size of destination buffer")
+ {
 -  if (__bos0 (__s1) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__n))
@@ -2194,16 +2213,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -				    __bos0 (__s1) / sizeof (wchar_t));
 -    }
 -  return __wmempcpy_alias (__s1, __s2, __n);
-+
-+__fortify_potential_overload wchar_t *
-+__NTH(wmempcpy(wchar_t *__restrict const __clang_pass_object_size0 __s1,
-+               const wchar_t *__restrict __s2, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmempcpy_warn, __n, __s1,
-+					 sizeof (wchar_t),
-+					 "wmempcpy called with length bigger "
-+					 "than size of destination buffer")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1)
 +    return __wmempcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t));
 +  return __wmempcpy_alias(__s1, __s2, __n);
@@ -2212,7 +2221,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  
-@@ -119,26 +95,21 @@ extern wchar_t *__wmemset_chk (wchar_t *
+@@ -119,26 +95,21 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
  			       size_t __ns) __THROW;
  extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
  						  size_t __n), wmemset);
@@ -2224,16 +2233,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -
 -__fortify_function wchar_t *
 -__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n))
--{
--  if (__bos0 (__s) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
--
--      if (__n > __bos0 (__s) / sizeof (wchar_t))
--	return __wmemset_chk_warn (__s, __c, __n,
--				   __bos0 (__s) / sizeof (wchar_t));
--    }
 +
 +__fortify_potential_overload wchar_t *
 +__NTH (wmemset (wchar_t *const __clang_pass_object_size0 __s, wchar_t __c,
@@ -2243,7 +2242,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +					 sizeof (wchar_t),
 +					 "wmemset called with length bigger "
 +					 "than size of destination buffer")
-+{
+ {
+-  if (__bos0 (__s) != (size_t) -1)
+-    {
+-      if (!__builtin_constant_p (__n))
+-	return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
+-
+-      if (__n > __bos0 (__s) / sizeof (wchar_t))
+-	return __wmemset_chk_warn (__s, __c, __n,
+-				   __bos0 (__s) / sizeof (wchar_t));
+-    }
 +  if (__FORTIFY_CALL_CHK && __bos0 (__s) != (size_t) -1)
 +    return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
    return __wmemset_alias (__s, __c, __n);
@@ -2252,7 +2260,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest,
-@@ -148,8 +119,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy
+@@ -148,8 +119,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias,
  				(wchar_t *__restrict __dest,
  				 const wchar_t *__restrict __src), wcscpy);
  
@@ -2264,7 +2272,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    if (__bos (__dest) != (size_t) -1)
      return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
-@@ -164,8 +136,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy
+@@ -164,8 +136,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias,
  				(wchar_t *__restrict __dest,
  				 const wchar_t *__restrict __src), wcpcpy);
  
@@ -2276,7 +2284,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    if (__bos (__dest) != (size_t) -1)
      return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
-@@ -180,28 +153,22 @@ extern wchar_t *__REDIRECT_NTH (__wcsncp
+@@ -180,28 +153,22 @@ extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias,
  				(wchar_t *__restrict __dest,
  				 const wchar_t *__restrict __src,
  				 size_t __n), wcsncpy);
@@ -2317,7 +2325,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest,
-@@ -211,29 +178,22 @@ extern wchar_t *__REDIRECT_NTH (__wcpncp
+@@ -211,29 +178,22 @@ extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias,
  				(wchar_t *__restrict __dest,
  				 const wchar_t *__restrict __src,
  				 size_t __n), wcpncpy);
@@ -2359,7 +2367,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest,
  			      const wchar_t *__restrict __src,
-@@ -242,8 +202,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat
+@@ -242,8 +202,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias,
  				(wchar_t *__restrict __dest,
  				 const wchar_t *__restrict __src), wcscat);
  
@@ -2371,7 +2379,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    if (__bos (__dest) != (size_t) -1)
      return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
-@@ -259,9 +220,9 @@ extern wchar_t *__REDIRECT_NTH (__wcsnca
+@@ -259,9 +220,9 @@ extern wchar_t *__REDIRECT_NTH (__wcsncat_alias,
  				 const wchar_t *__restrict __src,
  				 size_t __n), wcsncat);
  
@@ -2384,7 +2392,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    if (__bos (__dest) != (size_t) -1)
      return __wcsncat_chk (__dest, __src, __n,
-@@ -280,16 +241,34 @@ extern int __REDIRECT_NTH_LDBL (__swprin
+@@ -280,16 +241,34 @@ extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
  				 const wchar_t *__restrict __fmt, ...),
  				swprintf);
  
@@ -2427,7 +2435,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  }
  #elif !defined __cplusplus
  /* XXX We might want to have support in gcc for swprintf.  */
-@@ -300,20 +279,10 @@ __NTH (swprintf (wchar_t *__restrict __s
+@@ -300,20 +279,10 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
     : swprintf (s, n, __VA_ARGS__))
  #endif
  
@@ -2452,37 +2460,34 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
      return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
-@@ -334,18 +303,27 @@ extern int __vfwprintf_chk (__FILE *__re
+@@ -334,18 +303,27 @@ extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
  extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
  			   __gnuc_va_list __ap);
  
 -# ifdef __va_arg_pack
 -__fortify_function int
 -wprintf (const wchar_t *__restrict __fmt, ...)
--{
--  return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
--}
- 
--__fortify_function int
--fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
--{
--  return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
--			 __va_arg_pack ());
++
 +#ifdef __FORTIFY_ARG_PACK_OK
 +__fortify_potential_overload int
 +wprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt, ...)
-+{
+ {
+-  return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __r = __FORTIFY_CALL_VA_CHK (wprintf, __USE_FORTIFY_LEVEL - 1, __fmt,
 +				   __FORTIFY_ARG_PACK);
 +  __FORTIFY_FREE_ARG_PACK();
 +  return __r;
-+}
-+
+ }
+ 
+-__fortify_function int
+-fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
 +__fortify_potential_overload int
 +fwprintf (__FILE *__restrict const __clang_pass_object_size __stream,
 +	  const wchar_t *__restrict __fmt, ...)
-+{
+ {
+-  return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
+-			 __va_arg_pack ());
 +  __FORTIFY_INIT_ARG_PACK(__fmt);
 +  int __r = __FORTIFY_CALL_VA_CHK (fwprintf, __stream, __USE_FORTIFY_LEVEL - 1,
 +				   __fmt, __FORTIFY_ARG_PACK);
@@ -2491,7 +2496,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  }
  # elif !defined __cplusplus
  #  define wprintf(...) \
-@@ -354,14 +332,15 @@ fwprintf (__FILE *__restrict __stream, c
+@@ -354,14 +332,15 @@ fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
    __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
  # endif
  
@@ -2511,7 +2516,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  	   const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
  {
    return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-@@ -374,27 +353,21 @@ extern wchar_t *__fgetws_chk (wchar_t *_
+@@ -374,27 +353,21 @@ extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n,
  extern wchar_t *__REDIRECT (__fgetws_alias,
  			    (wchar_t *__restrict __s, int __n,
  			     __FILE *__restrict __stream), fgetws) __wur;
@@ -2520,28 +2525,29 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			     __FILE *__restrict __stream), __fgetws_chk)
 -     __wur __warnattr ("fgetws called with bigger size than length "
 -		       "of destination buffer");
- 
+-
 -__fortify_function __wur wchar_t *
 -fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
-+__fortify_potential_overload __wur wchar_t *
-+fgetws (wchar_t *__restrict const __clang_pass_object_size __s, int __n,
-+	__FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__fgetws_warn, __n, __s,
-+					sizeof (wchar_t),
-+					"fgetws called with length bigger "
-+					"than size of destination buffer")
- {
+-{
 -  if (__bos (__s) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__n) || __n <= 0)
 -	return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t),
 -			     __n, __stream);
--
+ 
 -      if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
 -	return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
 -				  __n, __stream);
 -    }
++__fortify_potential_overload __wur wchar_t *
++fgetws (wchar_t *__restrict const __clang_pass_object_size __s, int __n,
++	__FILE *__restrict __stream)
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__fgetws_warn, __n, __s,
++					sizeof (wchar_t),
++					"fgetws called with length bigger "
++					"than size of destination buffer")
++{
 +  if (__FORTIFY_CALL_CHK && __bos (__s) != (size_t) -1)
 +    return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream);
    return __fgetws_alias (__s, __n, __stream);
@@ -2550,7 +2556,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  #ifdef __USE_GNU
  extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
-@@ -404,28 +377,23 @@ extern wchar_t *__REDIRECT (__fgetws_unl
+@@ -404,28 +377,23 @@ extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
  			    (wchar_t *__restrict __s, int __n,
  			     __FILE *__restrict __stream), fgetws_unlocked)
    __wur;
@@ -2560,9 +2566,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			    __fgetws_unlocked_chk)
 -     __wur __warnattr ("fgetws_unlocked called with bigger size than length "
 -		       "of destination buffer");
- 
+-
 -__fortify_function __wur wchar_t *
 -fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
++
 +__fortify_potential_overload __wur wchar_t *
 +fgetws_unlocked (wchar_t *__restrict const __clang_pass_object_size __s,
 +		 int __n, __FILE *__restrict __stream)
@@ -2591,7 +2598,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  #endif
  
  
-@@ -436,9 +404,9 @@ extern size_t __REDIRECT_NTH (__wcrtomb_
+@@ -436,9 +404,9 @@ extern size_t __REDIRECT_NTH (__wcrtomb_alias,
  			      (char *__restrict __s, wchar_t __wchar,
  			       mbstate_t *__restrict __ps), wcrtomb) __wur;
  
@@ -2604,7 +2611,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  {
    /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
       But this would only disturb the namespace.  So we define our own
-@@ -462,30 +430,23 @@ extern size_t __REDIRECT_NTH (__mbsrtowc
+@@ -462,30 +430,23 @@ extern size_t __REDIRECT_NTH (__mbsrtowcs_alias,
  			       const char **__restrict __src,
  			       size_t __len, mbstate_t *__restrict __ps),
  			      mbsrtowcs);
@@ -2615,11 +2622,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			       size_t __dstlen), __mbsrtowcs_chk)
 -     __warnattr ("mbsrtowcs called with dst buffer smaller than len "
 -		 "* sizeof (wchar_t)");
--
+ 
 -__fortify_function size_t
 -__NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
 -		  size_t __len, mbstate_t *__restrict __ps))
--{
++__fortify_potential_overload size_t
++__NTH (mbsrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
++		  const char **__restrict __src, size_t __len,
++		  mbstate_t *__restrict __ps))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbsrtowcs_warn, __len, __dst,
++					sizeof (wchar_t),
++					"mbsrtowcs called with dst buffer "
++					"smaller than len * sizeof (wchar_t)")
+ {
 -  if (__bos (__dst) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__len))
@@ -2630,17 +2646,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -	return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps,
 -				     __bos (__dst) / sizeof (wchar_t));
 -    }
-+
-+__fortify_potential_overload size_t
-+__NTH (mbsrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
-+		  const char **__restrict __src, size_t __len,
-+		  mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbsrtowcs_warn, __len, __dst,
-+					sizeof (wchar_t),
-+					"mbsrtowcs called with dst buffer "
-+					"smaller than len * sizeof (wchar_t)")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
 +    return __mbsrtowcs_chk (__dst, __src, __len, __ps,
 +			    __bos (__dst) / sizeof (wchar_t));
@@ -2650,7 +2655,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern size_t __wcsrtombs_chk (char *__restrict __dst,
-@@ -497,27 +458,21 @@ extern size_t __REDIRECT_NTH (__wcsrtomb
+@@ -497,27 +458,21 @@ extern size_t __REDIRECT_NTH (__wcsrtombs_alias,
  			       const wchar_t **__restrict __src,
  			       size_t __len, mbstate_t *__restrict __ps),
  			      wcsrtombs);
@@ -2664,15 +2669,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -__fortify_function size_t
 -__NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
 -		  size_t __len, mbstate_t *__restrict __ps))
--{
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
--
--      if (__len > __bos (__dst))
--	return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst));
--    }
 +__fortify_potential_overload size_t
 +__NTH (wcsrtombs (char *__restrict const __clang_pass_object_size __dst,
 +		  const wchar_t **__restrict __src, size_t __len,
@@ -2681,7 +2677,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 +     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsrtombs_warn, __len, __dst,
 +				       "wcsrtombs called with dst buffer "
 +				       "smaller than len")
-+{
+ {
+-  if (__bos (__dst) != (size_t) -1)
+-    {
+-      if (!__builtin_constant_p (__len))
+-	return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
+-
+-      if (__len > __bos (__dst))
+-	return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst));
+-    }
 +  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
 +    return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
    return __wcsrtombs_alias (__dst, __src, __len, __ps);
@@ -2690,7 +2694,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  #ifdef __USE_GNU
-@@ -530,30 +485,23 @@ extern size_t __REDIRECT_NTH (__mbsnrtow
+@@ -530,30 +485,23 @@ extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias,
  			       const char **__restrict __src, size_t __nmc,
  			       size_t __len, mbstate_t *__restrict __ps),
  			      mbsnrtowcs);
@@ -2701,11 +2705,20 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			       size_t __dstlen), __mbsnrtowcs_chk)
 -     __warnattr ("mbsnrtowcs called with dst buffer smaller than len "
 -		 "* sizeof (wchar_t)");
--
+ 
 -__fortify_function size_t
 -__NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
 -		   size_t __nmc, size_t __len, mbstate_t *__restrict __ps))
--{
++__fortify_potential_overload size_t
++__NTH (mbsnrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
++		   const char **__restrict __src, size_t __nmc, size_t __len,
++		   mbstate_t *__restrict __ps))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__mbsnrtowcs_warn,
++				       sizeof (wchar_t) * __len, __dst,
++				       "mbsnrtowcs called with dst buffer "
++				       "smaller than len * sizeof (wchar_t)")
+ {
 -  if (__bos (__dst) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__len))
@@ -2716,17 +2729,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -	return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps,
 -				      __bos (__dst) / sizeof (wchar_t));
 -    }
-+
-+__fortify_potential_overload size_t
-+__NTH (mbsnrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
-+		   const char **__restrict __src, size_t __nmc, size_t __len,
-+		   mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__mbsnrtowcs_warn,
-+				       sizeof (wchar_t) * __len, __dst,
-+				       "mbsnrtowcs called with dst buffer "
-+				       "smaller than len * sizeof (wchar_t)")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
 +    return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps,
 +			     __bos (__dst) / sizeof (wchar_t));
@@ -2736,7 +2738,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
  
  
  extern size_t __wcsnrtombs_chk (char *__restrict __dst,
-@@ -566,28 +514,19 @@ extern size_t __REDIRECT_NTH (__wcsnrtom
+@@ -566,28 +514,19 @@ extern size_t __REDIRECT_NTH (__wcsnrtombs_alias,
  			       const wchar_t **__restrict __src,
  			       size_t __nwc, size_t __len,
  			       mbstate_t *__restrict __ps), wcsnrtombs);
@@ -2747,11 +2749,19 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -			       mbstate_t *__restrict __ps,
 -			       size_t __dstlen), __wcsnrtombs_chk)
 -     __warnattr ("wcsnrtombs called with dst buffer smaller than len");
--
+ 
 -__fortify_function size_t
 -__NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
 -		   size_t __nwc, size_t __len, mbstate_t *__restrict __ps))
--{
++__fortify_potential_overload size_t
++__NTH (wcsnrtombs (char *__restrict const __clang_pass_object_size __dst,
++		   const wchar_t **__restrict __src, size_t __nwc, size_t __len,
++		   mbstate_t *__restrict __ps))
++__FORTIFY_PRECONDITIONS
++     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsnrtombs_warn, __len, __dst,
++				       "wcsnrtombs called with dst buffer "
++				       "smaller than len")
+ {
 -  if (__bos (__dst) != (size_t) -1)
 -    {
 -      if (!__builtin_constant_p (__len))
@@ -2762,16 +2772,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 -	return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps,
 -				      __bos (__dst));
 -    }
-+
-+__fortify_potential_overload size_t
-+__NTH (wcsnrtombs (char *__restrict const __clang_pass_object_size __dst,
-+		   const wchar_t **__restrict __src, size_t __nwc, size_t __len,
-+		   mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsnrtombs_warn, __len, __dst,
-+				       "wcsnrtombs called with dst buffer "
-+				       "smaller than len")
-+{
 +  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
 +    return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst));
    return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps);
diff --git a/meta/recipes-core/glibc/glibc_2.31.bb b/meta/recipes-core/glibc/glibc_2.31.bb
index b8c570db52..3dec43e537 100644
--- a/meta/recipes-core/glibc/glibc_2.31.bb
+++ b/meta/recipes-core/glibc/glibc_2.31.bb
@@ -32,16 +32,15 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0019-Remove-bash-dependency-for-nscd-init-script.patch \
            file://0020-eglibc-Cross-building-and-testing-instructions.patch \
            file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \
-           file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
-           file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
-           file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
-           file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
-           file://0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
-           file://0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
-           file://0028-intl-Emit-no-lines-in-bison-generated-files.patch \
-           file://0029-inject-file-assembly-directives.patch \
-           file://0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
-           file://0031-Refactor-FORTIFY-in-glibc.patch \
+           file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \
+           file://0023-eglibc-Forward-port-cross-locale-generation-support.patch \
+           file://0024-Define-DUMMY_LOCALE_T-if-not-defined.patch \
+           file://0025-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
+           file://0026-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
+           file://0027-intl-Emit-no-lines-in-bison-generated-files.patch \
+           file://0028-inject-file-assembly-directives.patch \
+           file://0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
+           file://0030-Refactor-FORTIFY-in-glibc.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 07/13] glibc: Drop fortify refactoring patch
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (5 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 06/13] glibc: Update to final 2.31 release Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 23:26   ` Adrian Bunk
  2020-01-26 19:27 ` [PATCH 08/13] gettext: Drop overloadable attibute for getcwd declaration Khem Raj
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

This helps clang to do a better job with fortify on but it is better
suited for clang layer

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0030-Refactor-FORTIFY-in-glibc.patch      | 2780 -----------------
 meta/recipes-core/glibc/glibc_2.31.bb         |    1 -
 2 files changed, 2781 deletions(-)
 delete mode 100644 meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch

diff --git a/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch b/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch
deleted file mode 100644
index 7fe71ad92f..0000000000
--- a/meta/recipes-core/glibc/glibc/0030-Refactor-FORTIFY-in-glibc.patch
+++ /dev/null
@@ -1,2780 +0,0 @@
-From fecfc4050ce075e543fb1cf19d6d1da481260b95 Mon Sep 17 00:00:00 2001
-From: George Burgess IV <gbiv@google.com>
-Date: Sat, 11 Jan 2020 10:33:19 -0800
-Subject: [PATCH] Refactor FORTIFY in glibc
-
-Upstream-Status: Submitted [https://sourceware.org/ml/libc-alpha/2017-09/msg00434.html]
-
-Signed-off-by: George Burgess IV <gbiv@google.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- io/bits/fcntl2.h                | 125 ++++++--
- io/bits/poll2.h                 |  54 ++--
- io/fcntl.h                      |   2 +-
- libio/bits/stdio2.h             | 303 +++++++++++---------
- misc/bits/syslog.h              |  38 ++-
- misc/sys/cdefs.h                | 164 ++++++++++-
- posix/bits/unistd.h             | 366 ++++++++++--------------
- rt/bits/mqueue2.h               |  44 ++-
- rt/mqueue.h                     |   2 +-
- socket/bits/socket2.h           |  56 ++--
- stdlib/bits/stdlib.h            | 117 ++++----
- string/bits/string_fortified.h  | 136 ++++++---
- string/bits/strings_fortified.h |  36 ++-
- wcsmbs/bits/wchar2.h            | 487 ++++++++++++++------------------
- 14 files changed, 1093 insertions(+), 837 deletions(-)
-
-diff --git a/io/bits/fcntl2.h b/io/bits/fcntl2.h
-index 85b922dab8..04cc377040 100644
---- a/io/bits/fcntl2.h
-+++ b/io/bits/fcntl2.h
-@@ -32,10 +32,28 @@ extern int __REDIRECT (__open_2, (const char *__path, int __oflag),
- extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...),
- 		       open64) __nonnull ((1));
- #endif
--__errordecl (__open_too_many_args,
--	     "open can be called either with 2 or 3 arguments, not more");
--__errordecl (__open_missing_mode,
--	     "open with O_CREAT or O_TMPFILE in second argument needs 3 arguments");
-+
-+#define __warn_open_too_many_args \
-+  "open can be called either with 2 or 3 arguments, not more"
-+#define __warn_open_missing_mode \
-+  "open with O_CREAT in second argument needs 3 arguments"
-+#ifdef __use_clang_fortify
-+__fortify_overload __clang_prefer_this_overload int
-+open (const char *const __clang_pass_object_size __path, int __oflag)
-+     __clang_error_if (__OPEN_NEEDS_MODE (__oflag), __warn_open_missing_mode)
-+{
-+  return __open_2 (__path, __oflag);
-+}
-+
-+__fortify_overload int
-+open (const char *const __clang_pass_object_size __path, int __oflag,
-+      mode_t __mode)
-+{
-+  return __open_alias (__path, __oflag, __mode);
-+}
-+#else
-+__errordecl (__open_too_many_args, __warn_open_too_many_args);
-+__errordecl (__open_missing_mode, __warn_open_missing_mode);
- 
- __fortify_function int
- open (const char *__path, int __oflag, ...)
-@@ -58,16 +76,37 @@ open (const char *__path, int __oflag, ...)
- 
-   return __open_alias (__path, __oflag, __va_arg_pack ());
- }
-+#endif
-+#undef __warn_open_too_many_args
-+#undef __warn_open_missing_mode
- 
- 
- #ifdef __USE_LARGEFILE64
- extern int __open64_2 (const char *__path, int __oflag) __nonnull ((1));
- extern int __REDIRECT (__open64_alias, (const char *__path, int __oflag,
- 					...), open64) __nonnull ((1));
--__errordecl (__open64_too_many_args,
--	     "open64 can be called either with 2 or 3 arguments, not more");
--__errordecl (__open64_missing_mode,
--	     "open64 with O_CREAT or O_TMPFILE in second argument needs 3 arguments");
-+
-+# define __warn_open64_too_many_args \
-+  "open64 can be called either with 2 or 3 arguments, not more"
-+# define __warn_open64_missing_mode \
-+  "open64 with O_CREAT in second argument needs 3 arguments"
-+# ifdef __use_clang_fortify
-+__fortify_overload __clang_prefer_this_overload int
-+open64 (const char *const __clang_pass_object_size __path, int __oflag)
-+     __clang_error_if (__OPEN_NEEDS_MODE (__oflag), __warn_open64_missing_mode)
-+{
-+  return __open64_2 (__path, __oflag);
-+}
-+
-+__fortify_overload __clang_prefer_this_overload int
-+open64 (const char *const __clang_pass_object_size __path, int __oflag,
-+	int __mode)
-+{
-+  return __open64_alias (__path, __oflag, __mode);
-+}
-+# else
-+__errordecl (__open64_too_many_args, __warn_open64_too_many_args);
-+__errordecl (__open64_missing_mode, __warn_open64_missing_mode);
- 
- __fortify_function int
- open64 (const char *__path, int __oflag, ...)
-@@ -90,6 +129,9 @@ open64 (const char *__path, int __oflag, ...)
- 
-   return __open64_alias (__path, __oflag, __va_arg_pack ());
- }
-+# endif
-+# undef __warn_open64_too_many_args
-+# undef __warn_open64_missing_mode
- #endif
- 
- 
-@@ -108,10 +150,32 @@ extern int __REDIRECT (__openat_alias, (int __fd, const char *__path,
- 					int __oflag, ...), openat64)
-      __nonnull ((2));
- # endif
--__errordecl (__openat_too_many_args,
--	     "openat can be called either with 3 or 4 arguments, not more");
--__errordecl (__openat_missing_mode,
--	     "openat with O_CREAT or O_TMPFILE in third argument needs 4 arguments");
-+
-+# define __warn_openat_too_many_args "openat can be called either with 3 or " \
-+       "4 arguments, not more"
-+# define __warn_openat_missing_mode "openat with O_CREAT in third argument " \
-+       "needs 4 arguments"
-+# ifdef __use_clang_fortify
-+__fortify_error_function __clang_error (__warn_openat_too_many_args) int
-+openat (int __fd, const char *__path, int __oflag, int __mode, ...);
-+
-+__fortify_overload __clang_prefer_this_overload int
-+openat (int __fd, const char *const __clang_pass_object_size __path,
-+	int __oflag)
-+     __clang_error_if (__OPEN_NEEDS_MODE (__oflag), __warn_openat_missing_mode)
-+{
-+  return __openat_2 (__fd, __path, __oflag);
-+}
-+
-+__fortify_overload __clang_prefer_this_overload int
-+openat (int __fd, const char *const __clang_pass_object_size __path,
-+	int __oflag, int __mode)
-+{
-+  return __openat_alias (__fd, __path, __oflag, __mode);
-+}
-+# else
-+__errordecl (__openat_too_many_args, __warn_openat_too_many_args);
-+__errordecl (__openat_missing_mode, __warn_openat_missing_mode);
- 
- __fortify_function int
- openat (int __fd, const char *__path, int __oflag, ...)
-@@ -134,6 +198,9 @@ openat (int __fd, const char *__path, int __oflag, ...)
- 
-   return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
- }
-+# endif
-+# undef __warn_openat_too_many_args
-+# undef __warn_openat_missing_mode
- 
- 
- # ifdef __USE_LARGEFILE64
-@@ -142,11 +209,34 @@ extern int __openat64_2 (int __fd, const char *__path, int __oflag)
- extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path,
- 					  int __oflag, ...), openat64)
-      __nonnull ((2));
--__errordecl (__openat64_too_many_args,
--	     "openat64 can be called either with 3 or 4 arguments, not more");
--__errordecl (__openat64_missing_mode,
--	     "openat64 with O_CREAT or O_TMPFILE in third argument needs 4 arguments");
- 
-+#  define __warn_openat64_too_many_args "openat64 can be called either with " \
-+       "3 or 4 arguments, not more"
-+#  define __warn_openat64_missing_mode "openat64 with O_CREAT in third " \
-+       "argument needs 4 arguments"
-+
-+#  ifdef __use_clang_fortify
-+__fortify_error_function __clang_error (__warn_openat64_too_many_args) int
-+openat64 (int __fd, const char *__path, int __oflag, int __mode, ...);
-+
-+__fortify_overload __clang_prefer_this_overload int
-+openat64 (int __fd, const char *const __clang_pass_object_size __path,
-+	  int __oflag)
-+     __clang_error_if (__OPEN_NEEDS_MODE (__oflag),
-+                       __warn_openat64_missing_mode)
-+{
-+  return __openat64_2 (__fd, __path, __oflag);
-+}
-+
-+__fortify_overload __clang_prefer_this_overload int
-+openat64 (int __fd, const char *const __clang_pass_object_size __path,
-+	  int __oflag, int __mode)
-+{
-+  return __openat64_alias (__fd, __path, __oflag, __mode);
-+}
-+#  else
-+__errordecl (__openat64_too_many_args, __warn_openat64_too_many_args);
-+__errordecl (__openat64_missing_mode, __warn_openat64_missing_mode);
- __fortify_function int
- openat64 (int __fd, const char *__path, int __oflag, ...)
- {
-@@ -168,5 +258,8 @@ openat64 (int __fd, const char *__path, int __oflag, ...)
- 
-   return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
- }
-+#  endif
-+#  undef __warn_openat64_too_many_args
-+#  undef __warn_openat64_missing_mode
- # endif
- #endif
-diff --git a/io/bits/poll2.h b/io/bits/poll2.h
-index dca49717db..cc149711af 100644
---- a/io/bits/poll2.h
-+++ b/io/bits/poll2.h
-@@ -27,25 +27,20 @@ extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds,
- 				      int __timeout), poll);
- extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout,
- 		       __SIZE_TYPE__ __fdslen);
--extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds,
--					 int __timeout, __SIZE_TYPE__ __fdslen),
--		       __poll_chk)
--  __warnattr ("poll called with fds buffer too small file nfds entries");
- 
--__fortify_function int
--poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
-+__fortify_potential_overload int
-+poll (struct pollfd *const __clang_pass_object_size __fds, nfds_t __nfds,
-+      int __timeout)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__poll_warn, __nfds, __fds,
-+					sizeof (*__fds),
-+					"poll called with fds buffer too small")
- {
--  if (__bos (__fds) != (__SIZE_TYPE__) -1)
--    {
--      if (! __builtin_constant_p (__nfds))
--	return __poll_chk (__fds, __nfds, __timeout, __bos (__fds));
--      else if (__bos (__fds) / sizeof (*__fds) < __nfds)
--	return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds));
--    }
--
-+  if (__FORTIFY_CALL_CHK && __bos (__fds) != (__SIZE_TYPE__) -1)
-+    return __poll_chk (__fds, __nfds, __timeout, __bos (__fds));
-   return __poll_alias (__fds, __nfds, __timeout);
- }
--
-+__FORTIFY_FUNCTION_END
- 
- #ifdef __USE_GNU
- extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
-@@ -54,28 +49,21 @@ extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
- extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds,
- 			const struct timespec *__timeout,
- 			const __sigset_t *__ss, __SIZE_TYPE__ __fdslen);
--extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds,
--					  const struct timespec *__timeout,
--					  const __sigset_t *__ss,
--					  __SIZE_TYPE__ __fdslen),
--		       __ppoll_chk)
--  __warnattr ("ppoll called with fds buffer too small file nfds entries");
- 
--__fortify_function int
--ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout,
--       const __sigset_t *__ss)
-+__fortify_potential_overload int
-+ppoll (struct pollfd *const __clang_pass_object_size __fds, nfds_t __nfds,
-+       const struct timespec *__timeout, const __sigset_t *__ss)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__ppoll_warn, __nfds, __fds,
-+					sizeof (*__fds),
-+					"ppoll called with fds buffer too "
-+					"small file nfds entries")
- {
--  if (__bos (__fds) != (__SIZE_TYPE__) -1)
--    {
--      if (! __builtin_constant_p (__nfds))
--	return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds));
--      else if (__bos (__fds) / sizeof (*__fds) < __nfds)
--	return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss,
--				 __bos (__fds));
--    }
--
-+  if (__FORTIFY_CALL_CHK && __bos (__fds) != (__SIZE_TYPE__) -1)
-+    return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds));
-   return __ppoll_alias (__fds, __nfds, __timeout, __ss);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- __END_DECLS
-diff --git a/io/fcntl.h b/io/fcntl.h
-index 21b60c264d..83f2c8e117 100644
---- a/io/fcntl.h
-+++ b/io/fcntl.h
-@@ -325,7 +325,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
- 
- /* Define some inlines helping to catch common problems.  */
- #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
--    && defined __va_arg_pack_len
-+    && (defined __va_arg_pack_len || defined __use_clang_fortify)
- # include <bits/fcntl2.h>
- #endif
- 
-diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
-index 60bc81735e..1338f418ba 100644
---- a/libio/bits/stdio2.h
-+++ b/libio/bits/stdio2.h
-@@ -29,12 +29,23 @@ extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
- 			   const char *__restrict __format,
- 			   __gnuc_va_list __ap) __THROW;
- 
--#ifdef __va_arg_pack
--__fortify_function int
--__NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
-+#define __mul_may_overflow(size, n) \
-+  ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2)))
-+
-+#ifdef __FORTIFY_ARG_PACK_OK
-+/* clang doesn't have __va_arg_pack, so we need to defer to the va_arg versions
-+   of these functions.  */
-+__fortify_potential_overload int
-+__NTH (sprintf (char *__restrict const __clang_pass_object_size __s,
-+		const char *__restrict __fmt, ...))
- {
--  return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
--				  __bos (__s), __fmt, __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_BUILTIN (sprintf, __s,
-+					    __USE_FORTIFY_LEVEL - 1,
-+					    __bos (__s), __fmt,
-+					    __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- #elif !defined __cplusplus
- # define sprintf(str, ...) \
-@@ -42,9 +53,9 @@ __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
- 			   __VA_ARGS__)
- #endif
- 
--__fortify_function int
--__NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
--		 __gnuc_va_list __ap))
-+__fortify_potential_overload int
-+__NTH (vsprintf (char *__restrict const __clang_pass_object_size __s,
-+		const char *__restrict __fmt, __gnuc_va_list __ap))
- {
-   return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
- 				   __bos (__s), __fmt, __ap);
-@@ -59,13 +70,21 @@ extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
- 			    size_t __slen, const char *__restrict __format,
- 			    __gnuc_va_list __ap) __THROW;
- 
--# ifdef __va_arg_pack
--__fortify_function int
--__NTH (snprintf (char *__restrict __s, size_t __n,
--		 const char *__restrict __fmt, ...))
-+# ifdef __FORTIFY_ARG_PACK_OK
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 4))) int
-+__NTH (snprintf (char *__restrict const __clang_pass_object_size __s,
-+		 size_t __n, const char *__restrict __fmt, ...))
-+     /* GCC's builtin will catch this, so we just need to cover clang here.  */
-+     __clang_warning_if (__bos_static_lt (__n, __s),
-+			 "call to snprintf may overflow the destination buffer")
- {
--  return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
--				   __bos (__s), __fmt, __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_BUILTIN (snprintf, __s, __n,
-+					    __USE_FORTIFY_LEVEL - 1,
-+					    __bos (__s), __fmt,
-+					    __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- # elif !defined __cplusplus
- #  define snprintf(str, len, ...) \
-@@ -73,9 +92,12 @@ __NTH (snprintf (char *__restrict __s, size_t __n,
- 			    __VA_ARGS__)
- # endif
- 
--__fortify_function int
--__NTH (vsnprintf (char *__restrict __s, size_t __n,
--		  const char *__restrict __fmt, __gnuc_va_list __ap))
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 0))) int
-+__NTH (vsnprintf (char *__restrict const __clang_pass_object_size __s,
-+		size_t __n, const char *__restrict __fmt, __gnuc_va_list __ap))
-+     __clang_warning_if (__bos_static_lt (__n, __s),
-+			 "call to vsnprintf may overflow the destination "
-+			 "buffer")
- {
-   return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
- 				    __bos (__s), __fmt, __ap);
-@@ -93,18 +115,27 @@ extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
- extern int __vprintf_chk (int __flag, const char *__restrict __format,
- 			  __gnuc_va_list __ap);
- 
--# ifdef __va_arg_pack
--__fortify_function int
--fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
-+# ifdef __FORTIFY_ARG_PACK_OK
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
-+fprintf (FILE *__restrict const __clang_pass_object_size __stream,
-+	 const char *__restrict __fmt, ...)
- {
--  return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
--			__va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_CHK (fprintf, __stream,
-+					__USE_FORTIFY_LEVEL - 1, __fmt,
-+					__FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- 
--__fortify_function int
--printf (const char *__restrict __fmt, ...)
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 2))) int
-+printf (const char *__restrict const __clang_pass_object_size __fmt, ...)
- {
--  return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_CHK (printf, __USE_FORTIFY_LEVEL - 1, __fmt,
-+					__FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- # elif !defined __cplusplus
- #  define printf(...) \
-@@ -113,8 +144,9 @@ printf (const char *__restrict __fmt, ...)
-   __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
- # endif
- 
--__fortify_function int
--vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 0))) int
-+vprintf (const char *__restrict const __clang_pass_object_size __fmt,
-+	 __gnuc_va_list __ap)
- {
- #ifdef __USE_EXTERN_INLINES
-   return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-@@ -122,9 +154,8 @@ vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
-   return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
- #endif
- }
--
--__fortify_function int
--vfprintf (FILE *__restrict __stream,
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) int
-+vfprintf (FILE *__restrict const __clang_pass_object_size __stream,
- 	  const char *__restrict __fmt, __gnuc_va_list __ap)
- {
-   return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-@@ -137,20 +168,26 @@ extern int __vdprintf_chk (int __fd, int __flag,
- 			   const char *__restrict __fmt, __gnuc_va_list __arg)
-      __attribute__ ((__format__ (__printf__, 3, 0)));
- 
--#  ifdef __va_arg_pack
--__fortify_function int
--dprintf (int __fd, const char *__restrict __fmt, ...)
-+#  ifdef __FORTIFY_ARG_PACK_OK
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
-+dprintf (int __fd, const char *__restrict const __clang_pass_object_size __fmt,
-+	...)
- {
--  return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
--			__va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_CHK (dprintf, __fd, __USE_FORTIFY_LEVEL - 1,
-+					__fmt, __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- #  elif !defined __cplusplus
- #   define dprintf(fd, ...) \
-   __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
- #  endif
- 
--__fortify_function int
--vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) int
-+vdprintf (int __fd,
-+	 const char *__restrict const __clang_pass_object_size __fmt,
-+	 __gnuc_va_list __ap)
- {
-   return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
- }
-@@ -174,28 +211,49 @@ extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
- 				  __gnuc_va_list __args)
-      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
- 
--#  ifdef __va_arg_pack
--__fortify_function int
--__NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...))
-+#  ifdef __FORTIFY_ARG_PACK_OK
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3)))
-+__wur int
-+__NTH (asprintf (char **__restrict const __clang_pass_object_size __ptr,
-+		 const char *__restrict __fmt, ...))
- {
--  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
--			 __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr,
-+					__USE_FORTIFY_LEVEL - 1, __fmt,
-+					__FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- 
--__fortify_function int
--__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt,
--		   ...))
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3)))
-+__wur int
-+__NTH (__asprintf (char **__restrict const __clang_pass_object_size __ptr,
-+		   const char *__restrict __fmt, ...))
- {
--  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
--			 __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr,
-+					__USE_FORTIFY_LEVEL - 1, __fmt,
-+					__FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- 
--__fortify_function int
--__NTH (obstack_printf (struct obstack *__restrict __obstack,
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
-+__NTH (obstack_printf (struct obstack *
-+			 __restrict const __clang_pass_object_size __obstack,
- 		       const char *__restrict __fmt, ...))
- {
--  return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
--			       __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result =
-+#   ifdef __use_clang_fortify
-+    __obstack_vprintf_chk
-+#   else
-+    __obstack_printf_chk
-+#   endif
-+      (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
-+			     __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- #  elif !defined __cplusplus
- #   define asprintf(ptr, ...) \
-@@ -206,15 +264,17 @@ __NTH (obstack_printf (struct obstack *__restrict __obstack,
-   __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
- #  endif
- 
--__fortify_function int
--__NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt,
--		  __gnuc_va_list __ap))
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0)))
-+__wur int
-+__NTH (vasprintf (char **__restrict const __clang_pass_object_size __ptr,
-+		  const char *__restrict __fmt, __gnuc_va_list __ap))
- {
-   return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
- }
- 
--__fortify_function int
--__NTH (obstack_vprintf (struct obstack *__restrict __obstack,
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) int
-+__NTH (obstack_vprintf (struct obstack *
-+			__restrict const __clang_pass_object_size __obstack,
- 			const char *__restrict __fmt, __gnuc_va_list __ap))
- {
-   return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
-@@ -227,17 +287,20 @@ __NTH (obstack_vprintf (struct obstack *__restrict __obstack,
- 
- #if __GLIBC_USE (DEPRECATED_GETS)
- extern char *__gets_chk (char *__str, size_t) __wur;
--extern char *__REDIRECT (__gets_warn, (char *__str), gets)
--     __wur __warnattr ("please use fgets or getline instead, gets can't "
--		       "specify buffer size");
--
--__fortify_function __wur char *
--gets (char *__str)
-+extern char *__REDIRECT_NTH (__gets_alias, (char *__buf), gets) __wur;
-+
-+__fortify_potential_overload __wur char *
-+gets (char *const __clang_pass_object_size __str)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_IF (__gets_warn, __bos (__str) == (size_t) -1,
-+			   "please use fgets or getline instead, gets can't "
-+			   "specify buffer size")
- {
-   if (__bos (__str) != (size_t) -1)
-     return __gets_chk (__str, __bos (__str));
--  return __gets_warn (__str);
-+  return __gets_alias (__str);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
-@@ -245,25 +308,20 @@ extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
- extern char *__REDIRECT (__fgets_alias,
- 			 (char *__restrict __s, int __n,
- 			  FILE *__restrict __stream), fgets) __wur;
--extern char *__REDIRECT (__fgets_chk_warn,
--			 (char *__restrict __s, size_t __size, int __n,
--			  FILE *__restrict __stream), __fgets_chk)
--     __wur __warnattr ("fgets called with bigger size than length "
--		       "of destination buffer");
--
--__fortify_function __wur char *
--fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
-+
-+__fortify_potential_overload __wur char *
-+fgets (char *__restrict const __clang_pass_object_size __s, int __n,
-+       FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_IF (__fgets_warn, __bos_static_lt (__n, __s) && __n > 0,
-+			   "fgets called with bigger size than length of "
-+			   "destination buffer")
- {
-   if (__bos (__s) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n) || __n <= 0)
--	return __fgets_chk (__s, __bos (__s), __n, __stream);
--
--      if ((size_t) __n > __bos (__s))
--	return __fgets_chk_warn (__s, __bos (__s), __n, __stream);
--    }
-+    return __fgets_chk (__s, __bos (__s), __n, __stream);
-   return __fgets_alias (__s, __n, __stream);
- }
-+__FORTIFY_FUNCTION_END
- 
- extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen,
- 			   size_t __size, size_t __n,
-@@ -272,30 +330,21 @@ extern size_t __REDIRECT (__fread_alias,
- 			  (void *__restrict __ptr, size_t __size,
- 			   size_t __n, FILE *__restrict __stream),
- 			  fread) __wur;
--extern size_t __REDIRECT (__fread_chk_warn,
--			  (void *__restrict __ptr, size_t __ptrlen,
--			   size_t __size, size_t __n,
--			   FILE *__restrict __stream),
--			  __fread_chk)
--     __wur __warnattr ("fread called with bigger size * nmemb than length "
--		       "of destination buffer");
- 
--__fortify_function __wur size_t
--fread (void *__restrict __ptr, size_t __size, size_t __n,
--       FILE *__restrict __stream)
-+__fortify_potential_overload __wur size_t
-+fread (void *__restrict const __clang_pass_object_size0 __ptr, size_t __size,
-+       size_t __n, FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_IF (__fread_warn, __bos0_static_lt (__size * __n, __ptr)
-+			    && !__mul_may_overflow (__size, __n),
-+			   "fread called with bigger size * nmemb than length "
-+			   "of destination buffer")
- {
-   if (__bos0 (__ptr) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__size)
--	  || !__builtin_constant_p (__n)
--	  || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
--	return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
--
--      if (__size * __n > __bos0 (__ptr))
--	return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream);
--    }
-+    return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
-   return __fread_alias (__ptr, __size, __n, __stream);
- }
-+__FORTIFY_FUNCTION_END
- 
- #ifdef __USE_GNU
- extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
-@@ -303,25 +352,21 @@ extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
- extern char *__REDIRECT (__fgets_unlocked_alias,
- 			 (char *__restrict __s, int __n,
- 			  FILE *__restrict __stream), fgets_unlocked) __wur;
--extern char *__REDIRECT (__fgets_unlocked_chk_warn,
--			 (char *__restrict __s, size_t __size, int __n,
--			  FILE *__restrict __stream), __fgets_unlocked_chk)
--     __wur __warnattr ("fgets_unlocked called with bigger size than length "
--		       "of destination buffer");
--
--__fortify_function __wur char *
--fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
-+
-+__fortify_potential_overload __wur char *
-+fgets_unlocked (char *__restrict const __clang_pass_object_size __s, int __n,
-+		FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_IF (__fgets_unlocked_warn,
-+			   __bos_static_lt (__n, __s) && __n > 0,
-+			   "fgets_unlocked called with bigger size than length "
-+			   "of destination buffer")
- {
-   if (__bos (__s) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n) || __n <= 0)
--	return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream);
--
--      if ((size_t) __n > __bos (__s))
--	return __fgets_unlocked_chk_warn (__s, __bos (__s), __n, __stream);
--    }
-+    return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream);
-   return __fgets_unlocked_alias (__s, __n, __stream);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- #ifdef __USE_MISC
-@@ -333,30 +378,19 @@ extern size_t __REDIRECT (__fread_unlocked_alias,
- 			  (void *__restrict __ptr, size_t __size,
- 			   size_t __n, FILE *__restrict __stream),
- 			  fread_unlocked) __wur;
--extern size_t __REDIRECT (__fread_unlocked_chk_warn,
--			  (void *__restrict __ptr, size_t __ptrlen,
--			   size_t __size, size_t __n,
--			   FILE *__restrict __stream),
--			  __fread_unlocked_chk)
--     __wur __warnattr ("fread_unlocked called with bigger size * nmemb than "
--		       "length of destination buffer");
- 
--__fortify_function __wur size_t
--fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n,
--		FILE *__restrict __stream)
-+__fortify_potential_overload __wur size_t
-+fread_unlocked (void *__restrict const __clang_pass_object_size0 __ptr,
-+		size_t __size, size_t __n, FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_IF (__fread_unlocked_warn,
-+			   __bos0_static_lt (__size * __n, __ptr)
-+			    && !__mul_may_overflow(__size, __n),
-+			   "fread_unlocked called with bigger size * n than "
-+			   "length of destination buffer")
- {
-   if (__bos0 (__ptr) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__size)
--	  || !__builtin_constant_p (__n)
--	  || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
--	return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n,
--				     __stream);
--
--      if (__size * __n > __bos0 (__ptr))
--	return __fread_unlocked_chk_warn (__ptr, __bos0 (__ptr), __size, __n,
--					  __stream);
--    }
-+    return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
- 
- # ifdef __USE_EXTERN_INLINES
-   if (__builtin_constant_p (__size)
-@@ -381,6 +415,7 @@ fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n,
- # endif
-   return __fread_unlocked_alias (__ptr, __size, __n, __stream);
- }
-+__FORTIFY_FUNCTION_END
- #endif
--
-+#undef __mul_may_overflow
- #endif /* bits/stdio2.h.  */
-diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
-index 322192df21..68b90a5cb8 100644
---- a/misc/bits/syslog.h
-+++ b/misc/bits/syslog.h
-@@ -20,11 +20,34 @@
- # error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead."
- #endif
- 
-+#ifdef __USE_MISC
-+extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
-+			   __gnuc_va_list __ap)
-+     __attribute__ ((__format__ (__printf__, 3, 0)));
-+
-+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) void
-+vsyslog (int __pri, const char *const __clang_pass_object_size __fmt,
-+	 __gnuc_va_list __ap)
-+{
-+  __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-+}
-+#endif
- 
- extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...)
-      __attribute__ ((__format__ (__printf__, 3, 4)));
- 
--#ifdef __va_arg_pack
-+#if defined __use_clang_fortify && __USE_MISC
-+/* clang doesn't support __va_arg_pack, so this is only possible if we have
-+   vsyslog.  */
-+__fortify_overload __attribute__ ((__format__ (__printf__, 2, 3))) void
-+syslog (int __pri, const char *const __clang_pass_object_size __fmt, ...)
-+{
-+  __gnuc_va_list __ap;
-+  va_start (__ap, __fmt);
-+  __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-+  va_end (__ap);
-+}
-+#elif defined __va_arg_pack
- __fortify_function void
- syslog (int __pri, const char *__fmt, ...)
- {
-@@ -34,16 +57,3 @@ syslog (int __pri, const char *__fmt, ...)
- # define syslog(pri, ...) \
-   __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
- #endif
--
--
--#ifdef __USE_MISC
--extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
--			   __gnuc_va_list __ap)
--     __attribute__ ((__format__ (__printf__, 3, 0)));
--
--__fortify_function void
--vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
--{
--  __vsyslog_chk (__pri,  __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
--}
--#endif
-diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
-index ff7144f3f3..a42ffd5d36 100644
---- a/misc/sys/cdefs.h
-+++ b/misc/sys/cdefs.h
-@@ -118,11 +118,150 @@
- # define __END_DECLS
- #endif
- 
-+#if defined __clang__ && defined __has_extension
-+# define __clang_has_extension(x) __has_extension (x)
-+#else
-+# define __clang_has_extension(x) 0
-+#endif
- 
- /* Fortify support.  */
--#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
-+#define __fortify_function __extern_always_inline __attribute_artificial__
-+#if defined __clang__ && __USE_FORTIFY_LEVEL > 0 \
-+    && !defined _CLANG_FORTIFY_DISABLE \
-+    && __clang_has_extension(overloadable_unmarked)
-+# define __use_clang_fortify 1
-+/* Clang-style FORTIFY creates a different symbol for each FORTIFY'ed function,
-+   whereas GCC-style doesn't.  Thus, GCC can assume that the FORTIFY'ed
-+   function is always available externally, but clang can't.  */
-+# define __attribute_overloadable__ __attribute__ ((__overloadable__))
-+# define __attribute_transparent_overload__ \
-+  __attribute__ ((__overloadable__("transparent")))
-+# define __fortify_overload static __always_inline __attribute_overloadable__
-+/* For FORTIFY functions that exist only as decls.  */
-+# define __fortify_error_function static __attribute_overloadable__
-+# define __clang_pass_object_size_n(n) __attribute__ ((pass_object_size (n)))
-+# define __clang_warning(what) __attribute__ ((deprecated(what)))
-+# define __clang_prefer_this_overload __attribute__ ((enable_if (1, "")))
-+# define __clang_warning_if(c, m) \
-+  __attribute__ ((__diagnose_if__ ((c), (m), "warning")))
-+# define __clang_error(what) __attribute__ ((unavailable(what)))
-+# define __clang_error_if(c, m) \
-+  __attribute__ ((__diagnose_if__ ((c), (m), "error")))
-+# define __fortify_potential_overload __fortify_overload
-+#else
-+# define __fortify_potential_overload __fortify_function
-+/* Some functions/decls can be shared between clang and non-clang FORTIFY.
-+   Turning these into nops makes that possible.  */
-+# define __clang_pass_object_size_n(n)
-+# define __attribute_overloadable__
-+# define __bos_n(ptr, n) __builtin_object_size (ptr, n)
-+# define __clang_warning_if(c, m)
-+# define __clang_error_if(c, m)
-+#endif
-+
-+#define __bos_level (__USE_FORTIFY_LEVEL > 1)
-+#define __bos(ptr) __builtin_object_size (ptr, __bos_level)
- #define __bos0(ptr) __builtin_object_size (ptr, 0)
- 
-+#define __clang_pass_object_size0 __clang_pass_object_size_n (0)
-+#define __clang_pass_object_size __clang_pass_object_size_n (__bos_level)
-+
-+/* Some of these macros are awkwardly written, and more repetitive than they'd
-+   ideally need to be.  This is because both clang and gcc will emit 'note's
-+   about where these warnings originate from. For every macro that's expanded,
-+   the user sees a note that ultimately doesn't matter to them...  */
-+#ifdef __use_clang_fortify
-+# define __FORTIFY_PRECONDITIONS
-+# define __FORTIFY_FUNCTION_END
-+# define __FORTIFY_WARNING_IF(_, c, msg) __clang_warning_if(c, msg)
-+/* __builtin_constant_p isn't needed: this is only used in constructs that
-+   must be fully evaluated at compile-time.  */
-+# define __bos_static_lt_impl(bos_val, n, s) \
-+  ((bos_val) != -1ULL && (n) > (bos_val) / (s))
-+# define __FORTIFY_CALL_CHK 1
-+
-+# define __FORTIFY_BOSN_ARGS(bos_fn, n, buf, div, complaint) \
-+  (__bos_static_lt_impl (bos_fn (buf), n, div)), (complaint), "warning"
-+
-+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT2(fn_name, n, buf, div, complaint) \
-+  __attribute__ ((__diagnose_if__ \
-+	(__FORTIFY_BOSN_ARGS (__bos0, n, buf, div, complaint))))
-+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT(fn_name, n, buf, complaint) \
-+  __attribute__ ((__diagnose_if__ \
-+	(__FORTIFY_BOSN_ARGS (__bos0, n, buf, 1, complaint))))
-+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT2(fn_name, n, buf, div, complaint) \
-+  __attribute__ ((__diagnose_if__ \
-+	(__FORTIFY_BOSN_ARGS (__bos, n, buf, div, complaint))))
-+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT(fn_name, n, buf, complaint) \
-+  __attribute__ ((__diagnose_if__ \
-+	(__FORTIFY_BOSN_ARGS (__bos, n, buf, 1, complaint))))
-+#else
-+# define __FORTIFY_PRECONDITIONS {
-+# define __FORTIFY_FUNCTION_END }
-+/* __chk_fail was chosen arbitrarily. The function should never be called
-+   anyway; it just exists to be reachable after optimizations.  */
-+# define __FORTIFY_DECLARE_WARNING_FUNCTION(name, msg) \
-+  __attribute ((__warning__(msg))) \
-+  extern void __REDIRECT_NTH (name, (void), __chk_fail)
-+
-+# define __FORTIFY_WARNING_IF_BEGIN(fn_name, cond, complaint, if_cond_true) \
-+  { \
-+    if (cond) { \
-+      if_cond_true; \
-+      __FORTIFY_DECLARE_WARNING_FUNCTION (fn_name, complaint); \
-+      volatile char __t = 0; \
-+      if (__glibc_unlikely (__t)) \
-+      {
-+
-+# define __FORTIFY_WARNING_IF_END \
-+      } \
-+    } \
-+  }
-+
-+# define __FORTIFY_WARNING_IF(err_fn, cond, complaint) \
-+  __FORTIFY_WARNING_IF_BEGIN (err_fn, cond, complaint, (void)0) \
-+    err_fn (); \
-+  __FORTIFY_WARNING_IF_END
-+
-+# define __bos_static_lt_impl(bos_val, n, s) \
-+  (__builtin_constant_p (n) && (bos_val) != -1ULL && (n) > (bos_val) / (s))
-+
-+#define __FORTIFY_BOS_WARNING_BEGIN(fn_name, bos_fn, n, buf, div, complaint) \
-+  char __need_dynamic_check = !__builtin_constant_p (n); \
-+  __FORTIFY_WARNING_IF_BEGIN (fn_name, \
-+			      __bos_static_lt_impl (bos_fn (buf), n, div), \
-+			      complaint, (__need_dynamic_check = 1))
-+
-+/* Duplicate this so that the fn_name call happens with the smallest possible
-+   macro "call stack". This minimizes diagnostics about expanding macros.  */
-+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT2(err_fn, n, buf, div, complaint) \
-+  __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos0, n, buf, div, complaint) \
-+    err_fn (); \
-+  __FORTIFY_WARNING_IF_END
-+
-+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT(err_fn, n, buf, complaint) \
-+  __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos0, n, buf, 1, complaint) \
-+    err_fn (); \
-+  __FORTIFY_WARNING_IF_END
-+
-+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT2(err_fn, n, buf, div, complaint) \
-+  __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos, n, buf, div, complaint) \
-+    err_fn (); \
-+  __FORTIFY_WARNING_IF_END
-+
-+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT(err_fn, n, buf, complaint) \
-+  __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos, n, buf, 1, complaint) \
-+    err_fn (); \
-+  __FORTIFY_WARNING_IF_END
-+
-+# define __FORTIFY_CALL_CHK (__need_dynamic_check)
-+#endif
-+
-+#define __bos_static_lt2(n, e, s) __bos_static_lt_impl (__bos (e), n, s)
-+#define __bos_static_lt(n, e) __bos_static_lt2 (n, e, 1)
-+#define __bos0_static_lt2(n, e, s) __bos_static_lt_impl (__bos0 (e), n, s)
-+#define __bos0_static_lt(n, e) __bos0_static_lt2 (n, e, 1)
-+
- #if __GNUC_PREREQ (4,3)
- # define __warndecl(name, msg) \
-   extern void name (void) __attribute__((__warning__ (msg)))
-@@ -363,6 +502,29 @@
- # define __va_arg_pack_len() __builtin_va_arg_pack_len ()
- #endif
- 
-+#if defined(__use_clang_fortify)
-+/* clang doesn't support __va_arg_pack, so we need to call the v* version of
-+   FORTIFY'ed functions.  */
-+#define __FORTIFY_ARG_PACK __fortify_ap
-+#define __FORTIFY_INIT_ARG_PACK(va_arg) \
-+  __gnuc_va_list __FORTIFY_ARG_PACK; \
-+  va_start (__FORTIFY_ARG_PACK, va_arg)
-+#define __FORTIFY_CALL_VA_ALIAS(fn, ...) __v##fn##_alias (__VA_ARGS__)
-+#define __FORTIFY_CALL_VA_CHK(fn, ...) __v##fn##_chk (__VA_ARGS__)
-+#define __FORTIFY_CALL_VA_BUILTIN(fn, ...) \
-+  __builtin___v##fn##_chk (__VA_ARGS__)
-+#define __FORTIFY_FREE_ARG_PACK() va_end (__FORTIFY_ARG_PACK)
-+#define __FORTIFY_ARG_PACK_OK 1
-+#elif defined(__va_arg_pack)
-+#define __FORTIFY_ARG_PACK __va_arg_pack ()
-+#define __FORTIFY_INIT_ARG_PACK(va_arg)
-+#define __FORTIFY_CALL_VA_ALIAS(fn, ...) __##fn##_alias (__VA_ARGS__)
-+#define __FORTIFY_CALL_VA_CHK(fn, ...) __##fn##_chk (__VA_ARGS__)
-+#define __FORTIFY_CALL_VA_BUILTIN(fn, ...) __builtin___##fn##_chk (__VA_ARGS__)
-+#define __FORTIFY_FREE_ARG_PACK()
-+#define __FORTIFY_ARG_PACK_OK 1
-+#endif
-+
- /* It is possible to compile containing GCC extensions even if GCC is
-    run in pedantic mode if the uses are carefully marked using the
-    `__extension__' keyword.  But this is not generally available before
-diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
-index b8a8211d83..895d87832e 100644
---- a/posix/bits/unistd.h
-+++ b/posix/bits/unistd.h
-@@ -24,25 +24,19 @@ extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
- 			   size_t __buflen) __wur;
- extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
- 					  size_t __nbytes), read) __wur;
--extern ssize_t __REDIRECT (__read_chk_warn,
--			   (int __fd, void *__buf, size_t __nbytes,
--			    size_t __buflen), __read_chk)
--     __wur __warnattr ("read called with bigger length than size of "
--		       "the destination buffer");
- 
--__fortify_function __wur ssize_t
--read (int __fd, void *__buf, size_t __nbytes)
-+__fortify_potential_overload __wur ssize_t
-+read (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__read_warn, __nbytes, __buf,
-+					"read called with bigger length than "
-+					"size of the destination buffer")
- {
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__nbytes))
--	return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
--
--      if (__nbytes > __bos0 (__buf))
--	return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
-+    return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
-   return __read_alias (__fd, __buf, __nbytes);
- }
-+__FORTIFY_FUNCTION_END
- 
- #ifdef __USE_UNIX98
- extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
-@@ -55,67 +49,49 @@ extern ssize_t __REDIRECT (__pread_alias,
- extern ssize_t __REDIRECT (__pread64_alias,
- 			   (int __fd, void *__buf, size_t __nbytes,
- 			    __off64_t __offset), pread64) __wur;
--extern ssize_t __REDIRECT (__pread_chk_warn,
--			   (int __fd, void *__buf, size_t __nbytes,
--			    __off_t __offset, size_t __bufsize), __pread_chk)
--     __wur __warnattr ("pread called with bigger length than size of "
--		       "the destination buffer");
--extern ssize_t __REDIRECT (__pread64_chk_warn,
--			   (int __fd, void *__buf, size_t __nbytes,
--			    __off64_t __offset, size_t __bufsize),
--			    __pread64_chk)
--     __wur __warnattr ("pread64 called with bigger length than size of "
--		       "the destination buffer");
- 
- # ifndef __USE_FILE_OFFSET64
--__fortify_function __wur ssize_t
--pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
--{
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__nbytes))
--	return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
--
--      if ( __nbytes > __bos0 (__buf))
--	return __pread_chk_warn (__fd, __buf, __nbytes, __offset,
--				 __bos0 (__buf));
--    }
--  return __pread_alias (__fd, __buf, __nbytes, __offset);
--}
-+#  define __fo_pread_chk __pread_chk
-+#  define __fo_pread_alias __pread_alias
-+#  define __fo_off_t __off_t
- # else
--__fortify_function __wur ssize_t
--pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
--{
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__nbytes))
--	return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
--
--      if ( __nbytes > __bos0 (__buf))
--	return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
--				   __bos0 (__buf));
--    }
--
--  return __pread64_alias (__fd, __buf, __nbytes, __offset);
--}
-+#  define __fo_pread_chk __pread64_chk
-+#  define __fo_pread_alias __pread64_alias
-+#  define __fo_off_t __off64_t
- # endif
- 
--# ifdef __USE_LARGEFILE64
--__fortify_function __wur ssize_t
--pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
-+__fortify_potential_overload __wur ssize_t
-+pread (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes,
-+       __fo_off_t __offset)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread_chk_warn, __nbytes, __buf,
-+					"pread called with bigger length than "
-+					"size of the destination buffer")
- {
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__nbytes))
--	return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
-+  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
-+    return __fo_pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
-+  return __fo_pread_alias (__fd, __buf, __nbytes, __offset);
-+}
-+__FORTIFY_FUNCTION_END
- 
--      if ( __nbytes > __bos0 (__buf))
--	return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
--				   __bos0 (__buf));
--    }
-+#undef __fo_pread_chk
-+#undef __fo_pread_alias
-+#undef __fo_off_t
- 
-+# ifdef __USE_LARGEFILE64
-+__fortify_potential_overload __wur ssize_t
-+pread64 (int __fd, void *const __clang_pass_object_size0 __buf,
-+	  size_t __nbytes, __off64_t __offset)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread64_warn, __nbytes, __buf,
-+					"pread64 called with bigger length "
-+					"than size of the destination buffer")
-+{
-+  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
-+    return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
-   return __pread64_alias (__fd, __buf, __nbytes, __offset);
- }
-+__FORTIFY_FUNCTION_END
- # endif
- #endif
- 
-@@ -128,27 +104,21 @@ extern ssize_t __REDIRECT_NTH (__readlink_alias,
- 			       (const char *__restrict __path,
- 				char *__restrict __buf, size_t __len), readlink)
-      __nonnull ((1, 2)) __wur;
--extern ssize_t __REDIRECT_NTH (__readlink_chk_warn,
--			       (const char *__restrict __path,
--				char *__restrict __buf, size_t __len,
--				size_t __buflen), __readlink_chk)
--     __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length "
--					  "than size of destination buffer");
- 
--__fortify_function __nonnull ((1, 2)) __wur ssize_t
--__NTH (readlink (const char *__restrict __path, char *__restrict __buf,
-+__fortify_potential_overload __nonnull ((1, 2)) __wur ssize_t
-+__NTH (readlink (const char *__restrict __path,
-+		 char *__restrict const __clang_pass_object_size __buf,
- 		 size_t __len))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__readlink_warn, __len, __buf,
-+				       "readlink called with bigger length "
-+				       "than size of destination buffer")
- {
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __readlink_chk (__path, __buf, __len, __bos (__buf));
--
--      if ( __len > __bos (__buf))
--	return __readlink_chk_warn (__path, __buf, __len, __bos (__buf));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __readlink_chk (__path, __buf, __len, __bos (__buf));
-   return __readlink_alias (__path, __buf, __len);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- #ifdef __USE_ATFILE
-@@ -161,119 +131,104 @@ extern ssize_t __REDIRECT_NTH (__readlinkat_alias,
- 				char *__restrict __buf, size_t __len),
- 			       readlinkat)
-      __nonnull ((2, 3)) __wur;
--extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn,
--			       (int __fd, const char *__restrict __path,
--				char *__restrict __buf, size_t __len,
--				size_t __buflen), __readlinkat_chk)
--     __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger "
--					  "length than size of destination "
--					  "buffer");
--
--__fortify_function __nonnull ((2, 3)) __wur ssize_t
--__NTH (readlinkat (int __fd, const char *__restrict __path,
--		   char *__restrict __buf, size_t __len))
-+
-+__fortify_potential_overload __nonnull ((2, 3)) __wur ssize_t
-+__NTH (readlinkat (int __fd,
-+		   const char *__restrict __path,
-+		   char *__restrict const __clang_pass_object_size __buf,
-+		   size_t __len))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__readlinkat_warn, __len, __buf,
-+				       "readlinkat called with bigger length "
-+				       "than size of destination buffer")
- {
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf));
--
--      if (__len > __bos (__buf))
--	return __readlinkat_chk_warn (__fd, __path, __buf, __len,
--				      __bos (__buf));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf));
-   return __readlinkat_alias (__fd, __path, __buf, __len);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
-      __THROW __wur;
- extern char *__REDIRECT_NTH (__getcwd_alias,
- 			     (char *__buf, size_t __size), getcwd) __wur;
--extern char *__REDIRECT_NTH (__getcwd_chk_warn,
--			     (char *__buf, size_t __size, size_t __buflen),
--			     __getcwd_chk)
--     __wur __warnattr ("getcwd caller with bigger length than size of "
--		       "destination buffer");
--
--__fortify_function __wur char *
--__NTH (getcwd (char *__buf, size_t __size))
--{
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__size))
--	return __getcwd_chk (__buf, __size, __bos (__buf));
- 
--      if (__size > __bos (__buf))
--	return __getcwd_chk_warn (__buf, __size, __bos (__buf));
--    }
-+__fortify_potential_overload __wur char *
-+__NTH (getcwd (char *const __clang_pass_object_size __buf, size_t __size))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getcwd_warn, __size, __buf,
-+				       "getcwd called with bigger length than "
-+				       "size of destination buffer")
-+{
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __getcwd_chk (__buf, __size, __bos (__buf));
-   return __getcwd_alias (__buf, __size);
- }
-+__FORTIFY_FUNCTION_END
- 
- #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
-+# define __warn_getwd_use_something_else \
-+  "please use getcwd instead, as getwd doesn't specify buffer size"
-+
- extern char *__getwd_chk (char *__buf, size_t buflen)
-      __THROW __nonnull ((1)) __wur;
- extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd)
--     __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd "
--				       "doesn't specify buffer size");
-+     __nonnull ((1)) __wur __warnattr (__warn_getwd_use_something_else);
- 
--__fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char *
--__NTH (getwd (char *__buf))
-+extern char *__REDIRECT (__getwd_alias, (char *__str), getwd) __wur;
-+
-+__fortify_potential_overload __nonnull ((1)) __attribute_deprecated__ __wur
-+char *
-+__NTH (getwd (char *const __clang_pass_object_size __buf))
-+     __clang_warning_if (__bos (__buf) == (size_t) -1,
-+			 __warn_getwd_use_something_else)
- {
-   if (__bos (__buf) != (size_t) -1)
-     return __getwd_chk (__buf, __bos (__buf));
-   return __getwd_warn (__buf);
- }
-+# undef __warn_getwd_use_something_else
- #endif
- 
- extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
- 			     size_t __buflen) __THROW;
- extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf,
- 						size_t __len), confstr);
--extern size_t __REDIRECT_NTH (__confstr_chk_warn,
--			      (int __name, char *__buf, size_t __len,
--			       size_t __buflen), __confstr_chk)
--     __warnattr ("confstr called with bigger length than size of destination "
--		 "buffer");
--
--__fortify_function size_t
--__NTH (confstr (int __name, char *__buf, size_t __len))
--{
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __confstr_chk (__name, __buf, __len, __bos (__buf));
- 
--      if (__bos (__buf) < __len)
--	return __confstr_chk_warn (__name, __buf, __len, __bos (__buf));
--    }
-+__fortify_potential_overload size_t
-+__NTH (confstr (int __name, char *const __clang_pass_object_size __buf,
-+		size_t __len))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__confstr_warn, __len, __buf,
-+				       "confstr called with bigger length than "
-+				       "size of destination buffer")
-+{
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __confstr_chk (__name, __buf, __len, __bos (__buf));
-   return __confstr_alias (__name, __buf, __len);
- }
--
-+__FORTIFY_FUNCTION_END
- 
- extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen)
-      __THROW __wur;
- extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]),
- 			   getgroups) __wur;
--extern int __REDIRECT_NTH (__getgroups_chk_warn,
--			   (int __size, __gid_t __list[], size_t __listlen),
--			   __getgroups_chk)
--     __wur __warnattr ("getgroups called with bigger group count than what "
--		       "can fit into destination buffer");
--
--__fortify_function int
--__NTH (getgroups (int __size, __gid_t __list[]))
-+
-+__fortify_potential_overload int
-+__NTH (getgroups (int __size, __gid_t *const __clang_pass_object_size __list))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getgroups_warn,
-+				       __size * sizeof (__gid_t), __list,
-+				       "getgroups called with bigger group "
-+				       "count than what can fit into "
-+				       "destination buffer")
- {
--  if (__bos (__list) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__size) || __size < 0)
--	return __getgroups_chk (__size, __list, __bos (__list));
--
--      if (__size * sizeof (__gid_t) > __bos (__list))
--	return __getgroups_chk_warn (__size, __list, __bos (__list));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__list) != (size_t) -1)
-+    return __getgroups_chk (__size, __list, __bos (__list));
-   return __getgroups_alias (__size, __list);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
-@@ -287,19 +242,19 @@ extern int __REDIRECT_NTH (__ttyname_r_chk_warn,
-      __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than "
- 				 "size of destination buffer");
- 
--__fortify_function int
--__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen))
-+__fortify_potential_overload int
-+__NTH (ttyname_r (int __fd, char *const __clang_pass_object_size __buf,
-+		  size_t __buflen))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ttyname_r_warn, __buflen, __buf,
-+				       "ttyname_r called with bigger buflen "
-+				       "than size of destination buffer")
- {
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__buflen))
--	return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
--
--      if (__buflen > __bos (__buf))
--	return __ttyname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf));
--    }
--  return __ttyname_r_alias (__fd, __buf, __buflen);
--}
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
-+   return __ttyname_r_alias (__fd, __buf, __buflen);
-+ }
-+__FORTIFY_FUNCTION_END
- 
- 
- #ifdef __USE_POSIX199506
-@@ -307,25 +262,19 @@ extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
-      __nonnull ((1));
- extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen),
- 		       getlogin_r) __nonnull ((1));
--extern int __REDIRECT (__getlogin_r_chk_warn,
--		       (char *__buf, size_t __buflen, size_t __nreal),
--		       __getlogin_r_chk)
--     __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than "
--				 "size of destination buffer");
- 
--__fortify_function int
--getlogin_r (char *__buf, size_t __buflen)
-+__fortify_potential_overload int
-+getlogin_r (char *const __clang_pass_object_size __buf, size_t __buflen)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getlogin_r_warn, __buflen, __buf,
-+				       "getlogin_r called with bigger buflen "
-+				       "than size of destination buffer")
- {
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__buflen))
--	return __getlogin_r_chk (__buf, __buflen, __bos (__buf));
--
--      if (__buflen > __bos (__buf))
--	return __getlogin_r_chk_warn (__buf, __buflen, __bos (__buf));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __getlogin_r_chk (__buf, __buflen, __bos (__buf));
-   return __getlogin_r_alias (__buf, __buflen);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- 
-@@ -334,25 +283,20 @@ extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
-      __THROW __nonnull ((1));
- extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
- 			   gethostname) __nonnull ((1));
--extern int __REDIRECT_NTH (__gethostname_chk_warn,
--			   (char *__buf, size_t __buflen, size_t __nreal),
--			   __gethostname_chk)
--     __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than "
--				 "size of destination buffer");
- 
--__fortify_function int
--__NTH (gethostname (char *__buf, size_t __buflen))
-+__fortify_potential_overload int
-+__NTH (gethostname (char *const __clang_pass_object_size __buf,
-+		    size_t __buflen))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__gethostname_warn, __buflen, __buf,
-+				       "gethostname called with bigger buflen "
-+				       "than size of destination buffer")
- {
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__buflen))
--	return __gethostname_chk (__buf, __buflen, __bos (__buf));
--
--      if (__buflen > __bos (__buf))
--	return __gethostname_chk_warn (__buf, __buflen, __bos (__buf));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __gethostname_chk (__buf, __buflen, __bos (__buf));
-   return __gethostname_alias (__buf, __buflen);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- 
-@@ -362,24 +306,18 @@ extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
- extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf,
- 						   size_t __buflen),
- 			   getdomainname) __nonnull ((1)) __wur;
--extern int __REDIRECT_NTH (__getdomainname_chk_warn,
--			   (char *__buf, size_t __buflen, size_t __nreal),
--			   __getdomainname_chk)
--     __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger "
--				       "buflen than size of destination "
--				       "buffer");
--
--__fortify_function int
--__NTH (getdomainname (char *__buf, size_t __buflen))
--{
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__buflen))
--	return __getdomainname_chk (__buf, __buflen, __bos (__buf));
- 
--      if (__buflen > __bos (__buf))
--	return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf));
--    }
-+__fortify_potential_overload int
-+__NTH (getdomainname (char *const __clang_pass_object_size __buf,
-+		      size_t __buflen))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getdomainname_warn, __buflen, __buf,
-+				       "getdomainname called with bigger "
-+				       "buflen than size of destination buffer")
-+{
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __getdomainname_chk (__buf, __buflen, __bos (__buf));
-   return __getdomainname_alias (__buf, __buflen);
- }
-+__FORTIFY_FUNCTION_END
- #endif
-diff --git a/rt/bits/mqueue2.h b/rt/bits/mqueue2.h
-index 354f0d53bf..388b63a4f8 100644
---- a/rt/bits/mqueue2.h
-+++ b/rt/bits/mqueue2.h
-@@ -29,10 +29,47 @@ extern mqd_t __mq_open_2 (const char *__name, int __oflag)
- extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name,
- 					       int __oflag, ...), mq_open)
-      __nonnull ((1));
-+
-+#define __warn_mq_open_wrong_number_of_args "mq_open can be called either " \
-+  "with 2 or 4 arguments"
-+#define __warn_mq_open_missing_mode_and_attr "mq_open with O_CREAT in " \
-+  "second argument needs 4 arguments"
-+#ifdef __use_clang_fortify
-+__fortify_overload __clang_error (__warn_mq_open_wrong_number_of_args) mqd_t
-+__NTH (mq_open (const char *const __clang_pass_object_size __name, int __oflag,
-+		int __mode))
-+{
-+  return __mq_open_alias (__name, __oflag, __mode);
-+}
-+
-+__fortify_overload __clang_error (__warn_mq_open_wrong_number_of_args)
-+mqd_t
-+__NTH (mq_open (const char *const __clang_pass_object_size __name, int __oflag,
-+		int __mode, struct mq_attr *__attr, ...))
-+{
-+  return __mq_open_alias (__name, __oflag, __mode, __attr);
-+}
-+
-+__fortify_overload __clang_prefer_this_overload mqd_t
-+__NTH (mq_open (const char *const __clang_pass_object_size __name,
-+		int __oflag))
-+     __clang_error_if ((__oflag & O_CREAT),
-+                       __warn_mq_open_missing_mode_and_attr)
-+{
-+  return __mq_open_alias (__name, __oflag);
-+}
-+
-+__fortify_overload __clang_prefer_this_overload mqd_t
-+__NTH (mq_open (const char *const __clang_pass_object_size __name, int __oflag,
-+		int __mode, struct mq_attr *__attr))
-+{
-+  return __mq_open_alias (__name, __oflag, __mode, __attr);
-+}
-+#else
- __errordecl (__mq_open_wrong_number_of_args,
--	     "mq_open can be called either with 2 or 4 arguments");
-+  __warn_mq_open_wrong_number_of_args);
- __errordecl (__mq_open_missing_mode_and_attr,
--	     "mq_open with O_CREAT in second argument needs 4 arguments");
-+  __warn_mq_open_missing_mode_and_attr);
- 
- __fortify_function mqd_t
- __NTH (mq_open (const char *__name, int __oflag, ...))
-@@ -55,3 +92,6 @@ __NTH (mq_open (const char *__name, int __oflag, ...))
- 
-   return __mq_open_alias (__name, __oflag, __va_arg_pack ());
- }
-+#endif
-+#undef __warn_mq_open_wrong_number_of_args
-+#undef __warn_mq_open_missing_mode_and_attr
-diff --git a/rt/mqueue.h b/rt/mqueue.h
-index a2a2aa1771..5a2976d1be 100644
---- a/rt/mqueue.h
-+++ b/rt/mqueue.h
-@@ -89,7 +89,7 @@ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
- 
- /* Define some inlines helping to catch common problems.  */
- #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
--    && defined __va_arg_pack_len
-+    && (defined __va_arg_pack_len || defined __use_clang_fortify)
- # include <bits/mqueue2.h>
- #endif
- 
-diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h
-index c0421ce244..12d2e75f57 100644
---- a/socket/bits/socket2.h
-+++ b/socket/bits/socket2.h
-@@ -24,25 +24,20 @@ extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
- 			   int __flags);
- extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
- 					  int __flags), recv);
--extern ssize_t __REDIRECT (__recv_chk_warn,
--			   (int __fd, void *__buf, size_t __n, size_t __buflen,
--			    int __flags), __recv_chk)
--     __warnattr ("recv called with bigger length than size of destination "
--		 "buffer");
- 
--__fortify_function ssize_t
--recv (int __fd, void *__buf, size_t __n, int __flags)
-+__fortify_potential_overload ssize_t
-+recv (int __fd, void *const __clang_pass_object_size0 __buf, size_t __n,
-+      int __flags)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__recv_warn, __n, __buf,
-+					"recv called with bigger length than "
-+					"size of destination buffer")
- {
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
--
--      if (__n > __bos0 (__buf))
--	return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags);
--    }
-+  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
-+    return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
-   return __recv_alias (__fd, __buf, __n, __flags);
- }
-+__FORTIFY_FUNCTION_END
- 
- extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
- 			       size_t __buflen, int __flags,
-@@ -52,26 +47,19 @@ extern ssize_t __REDIRECT (__recvfrom_alias,
- 			   (int __fd, void *__restrict __buf, size_t __n,
- 			    int __flags, __SOCKADDR_ARG __addr,
- 			    socklen_t *__restrict __addr_len), recvfrom);
--extern ssize_t __REDIRECT (__recvfrom_chk_warn,
--			   (int __fd, void *__restrict __buf, size_t __n,
--			    size_t __buflen, int __flags,
--			    __SOCKADDR_ARG __addr,
--			    socklen_t *__restrict __addr_len), __recvfrom_chk)
--     __warnattr ("recvfrom called with bigger length than size of "
--		 "destination buffer");
- 
--__fortify_function ssize_t
--recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
--	  __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
-+__fortify_potential_overload ssize_t
-+recvfrom (int __fd, void *__restrict const __clang_pass_object_size0 __buf,
-+	  size_t __n, int __flags, __SOCKADDR_ARG __addr,
-+	  socklen_t *__restrict __addr_len)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__recvfrom_warn, __n, __buf,
-+					"recvfrom called with bigger length "
-+					"than size of destination buffer")
- {
--  if (__bos0 (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags,
--			       __addr, __addr_len);
--      if (__n > __bos0 (__buf))
--	return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags,
--				    __addr, __addr_len);
--    }
-+  if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
-+    return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags, __addr,
-+			   __addr_len);
-   return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
- }
-+__FORTIFY_FUNCTION_END
-diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h
-index bfdee75073..a15f965b12 100644
---- a/stdlib/bits/stdlib.h
-+++ b/stdlib/bits/stdlib.h
-@@ -26,27 +26,27 @@ extern char *__realpath_chk (const char *__restrict __name,
- extern char *__REDIRECT_NTH (__realpath_alias,
- 			     (const char *__restrict __name,
- 			      char *__restrict __resolved), realpath) __wur;
--extern char *__REDIRECT_NTH (__realpath_chk_warn,
--			     (const char *__restrict __name,
--			      char *__restrict __resolved,
--			      size_t __resolvedlen), __realpath_chk) __wur
--     __warnattr ("second argument of realpath must be either NULL or at "
--		 "least PATH_MAX bytes long buffer");
- 
--__fortify_function __wur char *
--__NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
-+__fortify_potential_overload __wur char *
-+__NTH (realpath (const char *__restrict __name,
-+		 char *__restrict const __clang_pass_object_size __resolved))
-+__FORTIFY_PRECONDITIONS
-+#if defined _LIBC_LIMITS_H_ && defined PATH_MAX
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__realpath_warn, PATH_MAX, __resolved,
-+				       "second argument of realpath must be "
-+				       "either NULL or at least PATH_MAX "
-+				       "bytes long buffer")
-+#endif
- {
--  if (__bos (__resolved) != (size_t) -1)
--    {
-+  if (
- #if defined _LIBC_LIMITS_H_ && defined PATH_MAX
--      if (__bos (__resolved) < PATH_MAX)
--	return __realpath_chk_warn (__name, __resolved, __bos (__resolved));
-+      __FORTIFY_CALL_CHK &&
- #endif
--      return __realpath_chk (__name, __resolved, __bos (__resolved));
--    }
--
-+      __bos (__resolved) != (size_t) -1)
-+    return __realpath_chk (__name, __resolved, __bos (__resolved));
-   return __realpath_alias (__name, __resolved);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
-@@ -54,33 +54,28 @@ extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
- extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf,
- 					       size_t __buflen), ptsname_r)
-      __nonnull ((2));
--extern int __REDIRECT_NTH (__ptsname_r_chk_warn,
--			   (int __fd, char *__buf, size_t __buflen,
--			    size_t __nreal), __ptsname_r_chk)
--     __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than "
--				 "size of buf");
--
--__fortify_function int
--__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen))
-+
-+__fortify_potential_overload int
-+__NTH (ptsname_r (int __fd, char *const __clang_pass_object_size __buf,
-+		  size_t __buflen))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ptsname_r_warn, __buflen, __buf,
-+				       "ptsname_r called with buflen "
-+				       "bigger than size of buf")
- {
--  if (__bos (__buf) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__buflen))
--	return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf));
--      if (__buflen > __bos (__buf))
--	return __ptsname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
-+    return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf));
-   return __ptsname_r_alias (__fd, __buf, __buflen);
- }
--
-+__FORTIFY_FUNCTION_END
- 
- extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
-   __THROW __wur;
- extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar),
- 			   wctomb) __wur;
- 
--__fortify_function __wur int
--__NTH (wctomb (char *__s, wchar_t __wchar))
-+__fortify_potential_overload __wur int
-+__NTH (wctomb (char *const __clang_pass_object_size __s, wchar_t __wchar))
- {
-   /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
-      But this would only disturb the namespace.  So we define our own
-@@ -102,29 +97,22 @@ extern size_t __REDIRECT_NTH (__mbstowcs_alias,
- 			      (wchar_t *__restrict __dst,
- 			       const char *__restrict __src,
- 			       size_t __len), mbstowcs);
--extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn,
--			      (wchar_t *__restrict __dst,
--			       const char *__restrict __src,
--			       size_t __len, size_t __dstlen), __mbstowcs_chk)
--     __warnattr ("mbstowcs called with dst buffer smaller than len "
--		 "* sizeof (wchar_t)");
- 
--__fortify_function size_t
--__NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src,
--		 size_t __len))
-+__fortify_potential_overload size_t
-+__NTH (mbstowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
-+		 const char *__restrict __src, size_t __len))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbstowcs_warn, __len, __dst,
-+					sizeof (wchar_t),
-+					"mbstowcs called with dst buffer "
-+					"smaller than len * sizeof (wchar_t)")
- {
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __mbstowcs_chk (__dst, __src, __len,
--			       __bos (__dst) / sizeof (wchar_t));
--
--      if (__len > __bos (__dst) / sizeof (wchar_t))
--	return __mbstowcs_chk_warn (__dst, __src, __len,
--				     __bos (__dst) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
-+    return __mbstowcs_chk (__dst, __src, __len,
-+			   __bos (__dst) / sizeof (wchar_t));
-   return __mbstowcs_alias (__dst, __src, __len);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern size_t __wcstombs_chk (char *__restrict __dst,
-@@ -134,22 +122,17 @@ extern size_t __REDIRECT_NTH (__wcstombs_alias,
- 			      (char *__restrict __dst,
- 			       const wchar_t *__restrict __src,
- 			       size_t __len), wcstombs);
--extern size_t __REDIRECT_NTH (__wcstombs_chk_warn,
--			      (char *__restrict __dst,
--			       const wchar_t *__restrict __src,
--			       size_t __len, size_t __dstlen), __wcstombs_chk)
--     __warnattr ("wcstombs called with dst buffer smaller than len");
- 
--__fortify_function size_t
--__NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src,
--		 size_t __len))
-+__fortify_potential_overload size_t
-+__NTH (wcstombs (char *__restrict const __clang_pass_object_size __dst,
-+		 const wchar_t *__restrict __src, size_t __len))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcstombs_warn, __len, __dst,
-+				       "wcstombs called with dst buffer "
-+				       "smaller than len")
- {
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __wcstombs_chk (__dst, __src, __len, __bos (__dst));
--      if (__len > __bos (__dst))
--	return __wcstombs_chk_warn (__dst, __src, __len, __bos (__dst));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
-+    return __wcstombs_chk (__dst, __src, __len, __bos (__dst));
-   return __wcstombs_alias (__dst, __src, __len);
- }
-+__FORTIFY_FUNCTION_END
-diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h
-index e4d07cb50c..f73528ba7e 100644
---- a/string/bits/string_fortified.h
-+++ b/string/bits/string_fortified.h
-@@ -22,45 +22,82 @@
- # error "Never use <bits/string_fortified.h> directly; include <string.h> instead."
- #endif
- 
--#if !__GNUC_PREREQ (5,0)
--__warndecl (__warn_memset_zero_len,
--	    "memset used with constant zero length parameter; this could be due to transposed parameters");
--#endif
--
--__fortify_function void *
--__NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
--	       size_t __len))
-+#define __warn_len_too_large \
-+  "function called with bigger length than the destination buffer"
-+/* Repeat bodies here to reduce 'note's if we detect a problem.  */
-+#define __size_too_small(bos, dest, len) \
-+  (bos (dest) != (size_t) -1 && bos (dest) < len)
-+#define __warn_if_dest_too_small(dest, len) \
-+  __clang_warning_if (__size_too_small (__bos, dest, len), \
-+					__warn_len_too_large)
-+#define __warn_if_dest_too_small0(dest, len) \
-+  __clang_warning_if (__size_too_small (__bos0, dest, len), \
-+					__warn_len_too_large)
-+
-+#define __warn_input_str_too_large \
-+  "destination buffer will always be overflown by source"
-+#define __warn_if_src_too_large(dest, src) \
-+  __clang_warning_if (__size_too_small (__bos, dest, __builtin_strlen (src) + 1), \
-+		      __warn_input_str_too_large)
-+
-+__fortify_potential_overload void *
-+__NTH (memcpy (void *__restrict const __clang_pass_object_size0 __dest,
-+	       const void *__restrict __src, size_t __len))
-+     __warn_if_dest_too_small0 (__dest, __len)
- {
--  return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
-+  size_t __bos_dst = __bos0 (__dest);
-+  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
-+				   && __bos_dst >= __len))
-+    return __builtin_memcpy (__dest, __src, __len);
-+  return __builtin___memcpy_chk (__dest, __src, __len, __bos_dst);
- }
- 
--__fortify_function void *
--__NTH (memmove (void *__dest, const void *__src, size_t __len))
-+__fortify_potential_overload void *
-+__NTH (memmove (void *const __clang_pass_object_size0 __dest,
-+		const void *__src, size_t __len))
-+     __warn_if_dest_too_small0 (__dest, __len)
- {
--  return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
-+  size_t __bos_dst = __bos0 (__dest);
-+  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
-+				   && __bos_dst >= __len))
-+    return __builtin_memmove (__dest, __src, __len);
-+  return __builtin___memmove_chk (__dest, __src, __len, __bos_dst);
- }
- 
- #ifdef __USE_GNU
--__fortify_function void *
--__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src,
--		size_t __len))
-+__fortify_potential_overload void *
-+__NTH (mempcpy (void *__restrict const __clang_pass_object_size0 __dest,
-+		const void *__restrict __src, size_t __len))
-+     __warn_if_dest_too_small0 (__dest, __len)
- {
--  return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest));
-+  size_t __bos_dst = __bos0 (__dest);
-+  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
-+				   && __bos_dst >= __len))
-+    return __builtin_mempcpy (__dest, __src, __len);
-+  return __builtin___mempcpy_chk (__dest, __src, __len, __bos_dst);
- }
- #endif
- 
--
- /* The first two tests here help to catch a somewhat common problem
-    where the second and third parameter are transposed.  This is
-    especially problematic if the intended fill value is zero.  In this
-    case no work is done at all.  We detect these problems by referring
-    non-existing functions.  */
--__fortify_function void *
--__NTH (memset (void *__dest, int __ch, size_t __len))
-+#define __warn_memset_zero_len_msg \
-+  "memset used with constant zero length parameter; this could be due to " \
-+  "transposed parameters"
-+#if !__GNUC_PREREQ (5,0)
-+__warndecl (__warn_memset_zero_len, __warn_memset_zero_len_msg);
-+#endif
-+__fortify_potential_overload void *
-+__NTH (memset (void *const __clang_pass_object_size0 __dest, int __ch,
-+	       size_t __len))
-+     __warn_if_dest_too_small0 (__dest, __len)
-+     __clang_warning_if (__len == 0 && __ch != 0, __warn_memset_zero_len_msg)
- {
-   /* GCC-5.0 and newer implements these checks in the compiler, so we don't
-      need them here.  */
--#if !__GNUC_PREREQ (5,0)
-+#if !__GNUC_PREREQ (5,0) && !defined __use_clang_fortify
-   if (__builtin_constant_p (__len) && __len == 0
-       && (!__builtin_constant_p (__ch) || __ch != 0))
-     {
-@@ -68,8 +105,13 @@ __NTH (memset (void *__dest, int __ch, size_t __len))
-       return __dest;
-     }
- #endif
--  return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
-+  size_t __bos_dst = __bos0 (__dest);
-+  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
-+				   && __bos_dst >= __len))
-+    return __builtin_memset (__dest, __ch, __len);
-+  return __builtin___memset_chk (__dest, __ch, __len, __bos_dst);
- }
-+#undef __warn_memset_zero_len_msg
- 
- #ifdef __USE_MISC
- # include <bits/strings_fortified.h>
-@@ -84,24 +126,30 @@ __NTH (explicit_bzero (void *__dest, size_t __len))
- }
- #endif
- 
--__fortify_function char *
--__NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
-+__fortify_potential_overload char *
-+__NTH (strcpy (char *__restrict const __clang_pass_object_size __dest,
-+	       const char *__restrict __src))
-+     __warn_if_src_too_large (__dest, __src)
- {
-   return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
- }
- 
- #ifdef __USE_GNU
--__fortify_function char *
--__NTH (stpcpy (char *__restrict __dest, const char *__restrict __src))
-+__fortify_potential_overload char *
-+__NTH (stpcpy (char *__restrict const __clang_pass_object_size __dest,
-+	       const char *__restrict __src))
-+     __warn_if_src_too_large (__dest, __src)
- {
-   return __builtin___stpcpy_chk (__dest, __src, __bos (__dest));
- }
- #endif
- 
--
--__fortify_function char *
--__NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
--		size_t __len))
-+__fortify_potential_overload char *
-+__NTH (strncpy (char *__restrict const __clang_pass_object_size __dest,
-+		const char *__restrict __src, size_t __len))
-+/* clang: Don't warn when __builtin_strlen (__src) < __bos (__dest),
-+   but __len > __bos (__dest).  The user should fix their code instead.  */
-+     __warn_if_dest_too_small (__dest, __len)
- {
-   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
- }
-@@ -112,28 +160,36 @@ extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
- extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src,
- 					       size_t __n), stpncpy);
- 
--__fortify_function char *
--__NTH (stpncpy (char *__dest, const char *__src, size_t __n))
-+__fortify_potential_overload char *
-+__NTH (stpncpy (char *const __clang_pass_object_size __dest, const char *__src,
-+		size_t __n))
-+     __warn_if_dest_too_small (__dest, __n)
- {
--  if (__bos (__dest) != (size_t) -1
--      && (!__builtin_constant_p (__n) || __n > __bos (__dest)))
-+  if (__bos (__dest) != (size_t) -1)
-     return __stpncpy_chk (__dest, __src, __n, __bos (__dest));
-   return __stpncpy_alias (__dest, __src, __n);
- }
- 
--
--__fortify_function char *
--__NTH (strcat (char *__restrict __dest, const char *__restrict __src))
-+__fortify_potential_overload char *
-+__NTH (strcat (char *__restrict const __clang_pass_object_size __dest,
-+	       const char *__restrict __src))
-+     __warn_if_src_too_large (__dest, __src)
- {
-   return __builtin___strcat_chk (__dest, __src, __bos (__dest));
- }
- 
--
--__fortify_function char *
--__NTH (strncat (char *__restrict __dest, const char *__restrict __src,
--		size_t __len))
-+__fortify_potential_overload char *
-+__NTH (strncat (char *__restrict const __clang_pass_object_size __dest,
-+		const char *__restrict __src, size_t __len))
-+     __warn_if_src_too_large (__dest, __src)
- {
-   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
- }
- 
-+#undef __warn_len_too_large
-+#undef __size_too_small
-+#undef __warn_if_dest_too_small
-+#undef __warn_if_dest_too_small0
-+#undef __warn_input_str_too_large
-+#undef __warn_if_src_too_large
- #endif /* bits/string_fortified.h */
-diff --git a/string/bits/strings_fortified.h b/string/bits/strings_fortified.h
-index d4091f4f69..4d0cd02612 100644
---- a/string/bits/strings_fortified.h
-+++ b/string/bits/strings_fortified.h
-@@ -19,16 +19,40 @@
- #ifndef __STRINGS_FORTIFIED
- # define __STRINGS_FORTIFIED 1
- 
--__fortify_function void
--__NTH (bcopy (const void *__src, void *__dest, size_t __len))
-+#define __strings_warn_len_too_large \
-+  "function called with bigger length than the destination buffer"
-+
-+#define __strings_size_too_small(dest, len) \
-+  (__bos0 (dest) != (size_t) -1 && __bos0 (dest) < len)
-+
-+__fortify_potential_overload void
-+__NTH (bcopy (const void *__src, void *const __clang_pass_object_size0 __dest,
-+	      size_t __len))
-+     __clang_warning_if (__strings_size_too_small (__dest, __len),
-+			 __strings_warn_len_too_large)
- {
--  (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
-+  size_t __bos_dst = __bos0 (__dest);
-+  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
-+				   && __bos_dst >= __len))
-+    (void) __builtin_memmove (__dest, __src, __len);
-+  else
-+    (void) __builtin___memmove_chk (__dest, __src, __len, __bos_dst);
- }
- 
--__fortify_function void
--__NTH (bzero (void *__dest, size_t __len))
-+__fortify_potential_overload void
-+__NTH (bzero (void *const __clang_pass_object_size0 __dest, size_t __len))
-+     __clang_warning_if (__strings_size_too_small (__dest, __len),
-+			 __strings_warn_len_too_large)
- {
--  (void) __builtin___memset_chk (__dest, '\0', __len, __bos0 (__dest));
-+  size_t __bos_dst = __bos0 (__dest);
-+  if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
-+				   && __bos_dst >= __len))
-+    (void) __builtin_memset (__dest, '\0', __len);
-+  else
-+    (void) __builtin___memset_chk (__dest, '\0', __len, __bos_dst);
- }
- 
-+
-+#undef __strings_size_too_small
-+#undef __strings_warn_len_too_large
- #endif
-diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
-index 86e8e23e76..1b0718119a 100644
---- a/wcsmbs/bits/wchar2.h
-+++ b/wcsmbs/bits/wchar2.h
-@@ -20,7 +20,6 @@
- # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead."
- #endif
- 
--
- extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1,
- 			       const wchar_t *__restrict __s2, size_t __n,
- 			       size_t __ns1) __THROW;
-@@ -28,57 +27,42 @@ extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias,
- 				(wchar_t *__restrict __s1,
- 				 const wchar_t *__restrict __s2, size_t __n),
- 				wmemcpy);
--extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn,
--				(wchar_t *__restrict __s1,
--				 const wchar_t *__restrict __s2, size_t __n,
--				 size_t __ns1), __wmemcpy_chk)
--     __warnattr ("wmemcpy called with length bigger than size of destination "
--		 "buffer");
- 
--__fortify_function wchar_t *
--__NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
--		size_t __n))
-+__fortify_potential_overload wchar_t *
-+__NTH (wmemcpy (wchar_t *__restrict const __clang_pass_object_size0 __s1,
-+	      const wchar_t *__restrict __s2, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemcpy_warn, __n, __s1,
-+					 sizeof (wchar_t),
-+					 "wmemcpy called with length bigger "
-+					 "than size of destination buffer")
- {
--  if (__bos0 (__s1) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wmemcpy_chk (__s1, __s2, __n,
--			      __bos0 (__s1) / sizeof (wchar_t));
--
--      if (__n > __bos0 (__s1) / sizeof (wchar_t))
--	return __wmemcpy_chk_warn (__s1, __s2, __n,
--				   __bos0 (__s1) / sizeof (wchar_t));
--    }
--  return __wmemcpy_alias (__s1, __s2, __n);
-+  if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1)
-+    return __wmemcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t));
-+  return __wmemcpy_alias(__s1, __s2, __n);
- }
--
-+__FORTIFY_FUNCTION_END
- 
- extern wchar_t *__wmemmove_chk (wchar_t *__s1, const wchar_t *__s2,
- 				size_t __n, size_t __ns1) __THROW;
- extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1,
- 						   const wchar_t *__s2,
- 						   size_t __n), wmemmove);
--extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn,
--				(wchar_t *__s1, const wchar_t *__s2,
--				 size_t __n, size_t __ns1), __wmemmove_chk)
--     __warnattr ("wmemmove called with length bigger than size of destination "
--		 "buffer");
--
--__fortify_function wchar_t *
--__NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n))
-+
-+__fortify_potential_overload wchar_t *
-+__NTH (wmemmove (wchar_t *const __clang_pass_object_size0 __s1,
-+		 const wchar_t *__s2, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemmove_warn, __n, __s1,
-+					 sizeof (wchar_t),
-+					 "wmemmove called with length bigger "
-+					 "than size of destination buffer")
- {
--  if (__bos0 (__s1) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wmemmove_chk (__s1, __s2, __n,
--			       __bos0 (__s1) / sizeof (wchar_t));
--
--      if (__n > __bos0 (__s1) / sizeof (wchar_t))
--	return __wmemmove_chk_warn (__s1, __s2, __n,
--				    __bos0 (__s1) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t) -1)
-+    return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t));
-   return __wmemmove_alias (__s1, __s2, __n);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- #ifdef __USE_GNU
-@@ -89,29 +73,21 @@ extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias,
- 				(wchar_t *__restrict __s1,
- 				 const wchar_t *__restrict __s2,
- 				 size_t __n), wmempcpy);
--extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn,
--				(wchar_t *__restrict __s1,
--				 const wchar_t *__restrict __s2, size_t __n,
--				 size_t __ns1), __wmempcpy_chk)
--     __warnattr ("wmempcpy called with length bigger than size of destination "
--		 "buffer");
--
--__fortify_function wchar_t *
--__NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
--		 size_t __n))
-+
-+__fortify_potential_overload wchar_t *
-+__NTH(wmempcpy(wchar_t *__restrict const __clang_pass_object_size0 __s1,
-+               const wchar_t *__restrict __s2, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmempcpy_warn, __n, __s1,
-+					 sizeof (wchar_t),
-+					 "wmempcpy called with length bigger "
-+					 "than size of destination buffer")
- {
--  if (__bos0 (__s1) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wmempcpy_chk (__s1, __s2, __n,
--			       __bos0 (__s1) / sizeof (wchar_t));
--
--      if (__n > __bos0 (__s1) / sizeof (wchar_t))
--	return __wmempcpy_chk_warn (__s1, __s2, __n,
--				    __bos0 (__s1) / sizeof (wchar_t));
--    }
--  return __wmempcpy_alias (__s1, __s2, __n);
-+  if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1)
-+    return __wmempcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t));
-+  return __wmempcpy_alias(__s1, __s2, __n);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- 
-@@ -119,26 +95,21 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n,
- 			       size_t __ns) __THROW;
- extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
- 						  size_t __n), wmemset);
--extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn,
--				(wchar_t *__s, wchar_t __c, size_t __n,
--				 size_t __ns), __wmemset_chk)
--     __warnattr ("wmemset called with length bigger than size of destination "
--		 "buffer");
--
--__fortify_function wchar_t *
--__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n))
-+
-+__fortify_potential_overload wchar_t *
-+__NTH (wmemset (wchar_t *const __clang_pass_object_size0 __s, wchar_t __c,
-+		size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemset_warn, __n, __s,
-+					 sizeof (wchar_t),
-+					 "wmemset called with length bigger "
-+					 "than size of destination buffer")
- {
--  if (__bos0 (__s) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
--
--      if (__n > __bos0 (__s) / sizeof (wchar_t))
--	return __wmemset_chk_warn (__s, __c, __n,
--				   __bos0 (__s) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos0 (__s) != (size_t) -1)
-+    return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
-   return __wmemset_alias (__s, __c, __n);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest,
-@@ -148,8 +119,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias,
- 				(wchar_t *__restrict __dest,
- 				 const wchar_t *__restrict __src), wcscpy);
- 
--__fortify_function wchar_t *
--__NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
-+__fortify_potential_overload wchar_t *
-+__NTH (wcscpy (wchar_t *__restrict const __clang_pass_object_size __dest,
-+	       const wchar_t *__restrict __src))
- {
-   if (__bos (__dest) != (size_t) -1)
-     return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
-@@ -164,8 +136,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias,
- 				(wchar_t *__restrict __dest,
- 				 const wchar_t *__restrict __src), wcpcpy);
- 
--__fortify_function wchar_t *
--__NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
-+__fortify_potential_overload wchar_t *
-+__NTH (wcpcpy (wchar_t *__restrict const __clang_pass_object_size __dest,
-+	       const wchar_t *__restrict __src))
- {
-   if (__bos (__dest) != (size_t) -1)
-     return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
-@@ -180,28 +153,22 @@ extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias,
- 				(wchar_t *__restrict __dest,
- 				 const wchar_t *__restrict __src,
- 				 size_t __n), wcsncpy);
--extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn,
--				(wchar_t *__restrict __dest,
--				 const wchar_t *__restrict __src,
--				 size_t __n, size_t __destlen), __wcsncpy_chk)
--     __warnattr ("wcsncpy called with length bigger than size of destination "
--		 "buffer");
- 
--__fortify_function wchar_t *
--__NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
--		size_t __n))
-+__fortify_potential_overload wchar_t *
-+__NTH (wcsncpy (wchar_t *__restrict const __clang_pass_object_size __dest,
-+		const wchar_t *__restrict __src, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__wcsncpy_warn, __n, __dest,
-+					sizeof (wchar_t),
-+					"wcsncpy called with length bigger "
-+					"than size of destination buffer")
- {
--  if (__bos (__dest) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wcsncpy_chk (__dest, __src, __n,
--			      __bos (__dest) / sizeof (wchar_t));
--      if (__n > __bos (__dest) / sizeof (wchar_t))
--	return __wcsncpy_chk_warn (__dest, __src, __n,
--				   __bos (__dest) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dest) != (size_t) -1)
-+    return __wcsncpy_chk (__dest, __src, __n,
-+			  __bos (__dest) / sizeof (wchar_t));
-   return __wcsncpy_alias (__dest, __src, __n);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest,
-@@ -211,29 +178,22 @@ extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias,
- 				(wchar_t *__restrict __dest,
- 				 const wchar_t *__restrict __src,
- 				 size_t __n), wcpncpy);
--extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn,
--				(wchar_t *__restrict __dest,
--				 const wchar_t *__restrict __src,
--				 size_t __n, size_t __destlen), __wcpncpy_chk)
--     __warnattr ("wcpncpy called with length bigger than size of destination "
--		 "buffer");
- 
--__fortify_function wchar_t *
--__NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
--		size_t __n))
-+__fortify_potential_overload wchar_t *
-+__NTH (wcpncpy (wchar_t *__restrict const __clang_pass_object_size __dest,
-+		const wchar_t *__restrict __src, size_t __n))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__wcpncpy_warn, __n, __dest,
-+					sizeof (wchar_t),
-+					"wcpncpy called with length bigger "
-+					"than size of destination buffer")
- {
--  if (__bos (__dest) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n))
--	return __wcpncpy_chk (__dest, __src, __n,
--			      __bos (__dest) / sizeof (wchar_t));
--      if (__n > __bos (__dest) / sizeof (wchar_t))
--	return __wcpncpy_chk_warn (__dest, __src, __n,
--				   __bos (__dest) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dest) != (size_t) -1)
-+    return __wcpncpy_chk (__dest, __src, __n,
-+			  __bos (__dest) / sizeof (wchar_t));
-   return __wcpncpy_alias (__dest, __src, __n);
- }
--
-+__FORTIFY_FUNCTION_END
- 
- extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest,
- 			      const wchar_t *__restrict __src,
-@@ -242,8 +202,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias,
- 				(wchar_t *__restrict __dest,
- 				 const wchar_t *__restrict __src), wcscat);
- 
--__fortify_function wchar_t *
--__NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
-+__fortify_potential_overload wchar_t *
-+__NTH (wcscat (wchar_t *__restrict const __clang_pass_object_size __dest,
-+	       const wchar_t *__restrict __src))
- {
-   if (__bos (__dest) != (size_t) -1)
-     return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
-@@ -259,9 +220,9 @@ extern wchar_t *__REDIRECT_NTH (__wcsncat_alias,
- 				 const wchar_t *__restrict __src,
- 				 size_t __n), wcsncat);
- 
--__fortify_function wchar_t *
--__NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
--		size_t __n))
-+__fortify_potential_overload wchar_t *
-+__NTH (wcsncat (wchar_t *__restrict const __clang_pass_object_size __dest,
-+		const wchar_t *__restrict __src, size_t __n))
- {
-   if (__bos (__dest) != (size_t) -1)
-     return __wcsncat_chk (__dest, __src, __n,
-@@ -280,16 +241,34 @@ extern int __REDIRECT_NTH_LDBL (__swprintf_alias,
- 				 const wchar_t *__restrict __fmt, ...),
- 				swprintf);
- 
--#ifdef __va_arg_pack
--__fortify_function int
--__NTH (swprintf (wchar_t *__restrict __s, size_t __n,
--		 const wchar_t *__restrict __fmt, ...))
-+extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
-+			    int __flag, size_t __s_len,
-+			    const wchar_t *__restrict __format,
-+			    __gnuc_va_list __arg)
-+     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
-+
-+extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
-+				(wchar_t *__restrict __s, size_t __n,
-+				 const wchar_t *__restrict __fmt,
-+				 __gnuc_va_list __ap), vswprintf);
-+
-+#ifdef __FORTIFY_ARG_PACK_OK
-+__fortify_potential_overload int
-+__NTH (swprintf (wchar_t *__restrict const __clang_pass_object_size __s,
-+		 size_t __n, const wchar_t *__restrict __fmt, ...))
- {
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __result;
-   if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
--    return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
--			   __bos (__s) / sizeof (wchar_t),
--			   __fmt, __va_arg_pack ());
--  return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
-+    __result = __FORTIFY_CALL_VA_CHK(swprintf, __s, __n,
-+				     __USE_FORTIFY_LEVEL - 1,
-+				     __bos (__s) / sizeof (wchar_t), __fmt,
-+				     __FORTIFY_ARG_PACK);
-+  else
-+    __result = __FORTIFY_CALL_VA_ALIAS(swprintf, __s, __n, __fmt,
-+				       __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __result;
- }
- #elif !defined __cplusplus
- /* XXX We might want to have support in gcc for swprintf.  */
-@@ -300,20 +279,10 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n,
-    : swprintf (s, n, __VA_ARGS__))
- #endif
- 
--extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
--			    int __flag, size_t __s_len,
--			    const wchar_t *__restrict __format,
--			    __gnuc_va_list __arg)
--     __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
--
--extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
--				(wchar_t *__restrict __s, size_t __n,
--				 const wchar_t *__restrict __fmt,
--				 __gnuc_va_list __ap), vswprintf);
--
--__fortify_function int
--__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
--		  const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
-+__fortify_potential_overload int
-+__NTH (vswprintf (wchar_t *__restrict const __clang_pass_object_size __s,
-+		  size_t __n, const wchar_t *__restrict __fmt,
-+		  __gnuc_va_list __ap))
- {
-   if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
-     return __vswprintf_chk (__s, __n,  __USE_FORTIFY_LEVEL - 1,
-@@ -334,18 +303,27 @@ extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
- extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
- 			   __gnuc_va_list __ap);
- 
--# ifdef __va_arg_pack
--__fortify_function int
--wprintf (const wchar_t *__restrict __fmt, ...)
-+
-+#ifdef __FORTIFY_ARG_PACK_OK
-+__fortify_potential_overload int
-+wprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt, ...)
- {
--  return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __r = __FORTIFY_CALL_VA_CHK (wprintf, __USE_FORTIFY_LEVEL - 1, __fmt,
-+				   __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __r;
- }
- 
--__fortify_function int
--fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
-+__fortify_potential_overload int
-+fwprintf (__FILE *__restrict const __clang_pass_object_size __stream,
-+	  const wchar_t *__restrict __fmt, ...)
- {
--  return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
--			 __va_arg_pack ());
-+  __FORTIFY_INIT_ARG_PACK(__fmt);
-+  int __r = __FORTIFY_CALL_VA_CHK (fwprintf, __stream, __USE_FORTIFY_LEVEL - 1,
-+				   __fmt, __FORTIFY_ARG_PACK);
-+  __FORTIFY_FREE_ARG_PACK();
-+  return __r;
- }
- # elif !defined __cplusplus
- #  define wprintf(...) \
-@@ -354,14 +332,15 @@ fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
-   __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
- # endif
- 
--__fortify_function int
--vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
-+__fortify_potential_overload int
-+vwprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt,
-+	  __gnuc_va_list __ap)
- {
-   return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
- }
- 
--__fortify_function int
--vfwprintf (__FILE *__restrict __stream,
-+__fortify_potential_overload int
-+vfwprintf (__FILE *__restrict const __clang_pass_object_size __stream,
- 	   const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
- {
-   return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-@@ -374,27 +353,21 @@ extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n,
- extern wchar_t *__REDIRECT (__fgetws_alias,
- 			    (wchar_t *__restrict __s, int __n,
- 			     __FILE *__restrict __stream), fgetws) __wur;
--extern wchar_t *__REDIRECT (__fgetws_chk_warn,
--			    (wchar_t *__restrict __s, size_t __size, int __n,
--			     __FILE *__restrict __stream), __fgetws_chk)
--     __wur __warnattr ("fgetws called with bigger size than length "
--		       "of destination buffer");
--
--__fortify_function __wur wchar_t *
--fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
--{
--  if (__bos (__s) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n) || __n <= 0)
--	return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t),
--			     __n, __stream);
- 
--      if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
--	return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
--				  __n, __stream);
--    }
-+__fortify_potential_overload __wur wchar_t *
-+fgetws (wchar_t *__restrict const __clang_pass_object_size __s, int __n,
-+	__FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__fgetws_warn, __n, __s,
-+					sizeof (wchar_t),
-+					"fgetws called with length bigger "
-+					"than size of destination buffer")
-+{
-+  if (__FORTIFY_CALL_CHK && __bos (__s) != (size_t) -1)
-+    return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream);
-   return __fgetws_alias (__s, __n, __stream);
- }
-+__FORTIFY_FUNCTION_END
- 
- #ifdef __USE_GNU
- extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
-@@ -404,28 +377,23 @@ extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
- 			    (wchar_t *__restrict __s, int __n,
- 			     __FILE *__restrict __stream), fgetws_unlocked)
-   __wur;
--extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn,
--			    (wchar_t *__restrict __s, size_t __size, int __n,
--			     __FILE *__restrict __stream),
--			    __fgetws_unlocked_chk)
--     __wur __warnattr ("fgetws_unlocked called with bigger size than length "
--		       "of destination buffer");
--
--__fortify_function __wur wchar_t *
--fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
-+
-+__fortify_potential_overload __wur wchar_t *
-+fgetws_unlocked (wchar_t *__restrict const __clang_pass_object_size __s,
-+		 int __n, __FILE *__restrict __stream)
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_IF (__fgetws_unlocked_warn,
-+			   __n > 0
-+			    && __bos_static_lt2 (__n, __s, sizeof (wchar_t)),
-+			   "fgetws_unlocked called with bigger size than "
-+			   "length of destination buffer")
- {
-   if (__bos (__s) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__n) || __n <= 0)
--	return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t),
--				      __n, __stream);
--
--      if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
--	return __fgetws_unlocked_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
--					   __n, __stream);
--    }
-+    return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t),
-+				  __n, __stream);
-   return __fgetws_unlocked_alias (__s, __n, __stream);
- }
-+__FORTIFY_FUNCTION_END
- #endif
- 
- 
-@@ -436,9 +404,9 @@ extern size_t __REDIRECT_NTH (__wcrtomb_alias,
- 			      (char *__restrict __s, wchar_t __wchar,
- 			       mbstate_t *__restrict __ps), wcrtomb) __wur;
- 
--__fortify_function __wur size_t
--__NTH (wcrtomb (char *__restrict __s, wchar_t __wchar,
--		mbstate_t *__restrict __ps))
-+__fortify_potential_overload __wur size_t
-+__NTH (wcrtomb (char *__restrict const __clang_pass_object_size __s,
-+		wchar_t __wchar, mbstate_t *__restrict __ps))
- {
-   /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
-      But this would only disturb the namespace.  So we define our own
-@@ -462,30 +430,23 @@ extern size_t __REDIRECT_NTH (__mbsrtowcs_alias,
- 			       const char **__restrict __src,
- 			       size_t __len, mbstate_t *__restrict __ps),
- 			      mbsrtowcs);
--extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn,
--			      (wchar_t *__restrict __dst,
--			       const char **__restrict __src,
--			       size_t __len, mbstate_t *__restrict __ps,
--			       size_t __dstlen), __mbsrtowcs_chk)
--     __warnattr ("mbsrtowcs called with dst buffer smaller than len "
--		 "* sizeof (wchar_t)");
- 
--__fortify_function size_t
--__NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
--		  size_t __len, mbstate_t *__restrict __ps))
-+__fortify_potential_overload size_t
-+__NTH (mbsrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
-+		  const char **__restrict __src, size_t __len,
-+		  mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbsrtowcs_warn, __len, __dst,
-+					sizeof (wchar_t),
-+					"mbsrtowcs called with dst buffer "
-+					"smaller than len * sizeof (wchar_t)")
- {
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __mbsrtowcs_chk (__dst, __src, __len, __ps,
--				__bos (__dst) / sizeof (wchar_t));
--
--      if (__len > __bos (__dst) / sizeof (wchar_t))
--	return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps,
--				     __bos (__dst) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
-+    return __mbsrtowcs_chk (__dst, __src, __len, __ps,
-+			    __bos (__dst) / sizeof (wchar_t));
-   return __mbsrtowcs_alias (__dst, __src, __len, __ps);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern size_t __wcsrtombs_chk (char *__restrict __dst,
-@@ -497,27 +458,21 @@ extern size_t __REDIRECT_NTH (__wcsrtombs_alias,
- 			       const wchar_t **__restrict __src,
- 			       size_t __len, mbstate_t *__restrict __ps),
- 			      wcsrtombs);
--extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn,
--			      (char *__restrict __dst,
--			       const wchar_t **__restrict __src,
--			       size_t __len, mbstate_t *__restrict __ps,
--			       size_t __dstlen), __wcsrtombs_chk)
--    __warnattr ("wcsrtombs called with dst buffer smaller than len");
- 
--__fortify_function size_t
--__NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
--		  size_t __len, mbstate_t *__restrict __ps))
-+__fortify_potential_overload size_t
-+__NTH (wcsrtombs (char *__restrict const __clang_pass_object_size __dst,
-+		  const wchar_t **__restrict __src, size_t __len,
-+		  mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsrtombs_warn, __len, __dst,
-+				       "wcsrtombs called with dst buffer "
-+				       "smaller than len")
- {
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
--
--      if (__len > __bos (__dst))
--	return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
-+    return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
-   return __wcsrtombs_alias (__dst, __src, __len, __ps);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- #ifdef __USE_GNU
-@@ -530,30 +485,23 @@ extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias,
- 			       const char **__restrict __src, size_t __nmc,
- 			       size_t __len, mbstate_t *__restrict __ps),
- 			      mbsnrtowcs);
--extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn,
--			      (wchar_t *__restrict __dst,
--			       const char **__restrict __src, size_t __nmc,
--			       size_t __len, mbstate_t *__restrict __ps,
--			       size_t __dstlen), __mbsnrtowcs_chk)
--     __warnattr ("mbsnrtowcs called with dst buffer smaller than len "
--		 "* sizeof (wchar_t)");
- 
--__fortify_function size_t
--__NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
--		   size_t __nmc, size_t __len, mbstate_t *__restrict __ps))
-+__fortify_potential_overload size_t
-+__NTH (mbsnrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
-+		   const char **__restrict __src, size_t __nmc, size_t __len,
-+		   mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__mbsnrtowcs_warn,
-+				       sizeof (wchar_t) * __len, __dst,
-+				       "mbsnrtowcs called with dst buffer "
-+				       "smaller than len * sizeof (wchar_t)")
- {
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps,
--				 __bos (__dst) / sizeof (wchar_t));
--
--      if (__len > __bos (__dst) / sizeof (wchar_t))
--	return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps,
--				      __bos (__dst) / sizeof (wchar_t));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
-+    return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps,
-+			     __bos (__dst) / sizeof (wchar_t));
-   return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps);
- }
-+__FORTIFY_FUNCTION_END
- 
- 
- extern size_t __wcsnrtombs_chk (char *__restrict __dst,
-@@ -566,28 +514,19 @@ extern size_t __REDIRECT_NTH (__wcsnrtombs_alias,
- 			       const wchar_t **__restrict __src,
- 			       size_t __nwc, size_t __len,
- 			       mbstate_t *__restrict __ps), wcsnrtombs);
--extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn,
--			      (char *__restrict __dst,
--			       const wchar_t **__restrict __src,
--			       size_t __nwc, size_t __len,
--			       mbstate_t *__restrict __ps,
--			       size_t __dstlen), __wcsnrtombs_chk)
--     __warnattr ("wcsnrtombs called with dst buffer smaller than len");
- 
--__fortify_function size_t
--__NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
--		   size_t __nwc, size_t __len, mbstate_t *__restrict __ps))
-+__fortify_potential_overload size_t
-+__NTH (wcsnrtombs (char *__restrict const __clang_pass_object_size __dst,
-+		   const wchar_t **__restrict __src, size_t __nwc, size_t __len,
-+		   mbstate_t *__restrict __ps))
-+__FORTIFY_PRECONDITIONS
-+     __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsnrtombs_warn, __len, __dst,
-+				       "wcsnrtombs called with dst buffer "
-+				       "smaller than len")
- {
--  if (__bos (__dst) != (size_t) -1)
--    {
--      if (!__builtin_constant_p (__len))
--	return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps,
--				 __bos (__dst));
--
--      if (__len > __bos (__dst))
--	return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps,
--				      __bos (__dst));
--    }
-+  if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
-+    return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst));
-   return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps);
- }
-+__FORTIFY_FUNCTION_END
- #endif
diff --git a/meta/recipes-core/glibc/glibc_2.31.bb b/meta/recipes-core/glibc/glibc_2.31.bb
index 3dec43e537..9f299a7bc3 100644
--- a/meta/recipes-core/glibc/glibc_2.31.bb
+++ b/meta/recipes-core/glibc/glibc_2.31.bb
@@ -40,7 +40,6 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0027-intl-Emit-no-lines-in-bison-generated-files.patch \
            file://0028-inject-file-assembly-directives.patch \
            file://0029-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
-           file://0030-Refactor-FORTIFY-in-glibc.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 08/13] gettext: Drop overloadable attibute for getcwd declaration
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (6 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 07/13] glibc: Drop fortify refactoring patch Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 09/13] riscv32: Bump oldest kernel to 5.4 Khem Raj
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../gettext/gettext-0.20.1/overloadable.patch | 22 -------------------
 meta/recipes-core/gettext/gettext_0.20.1.bb   |  2 --
 2 files changed, 24 deletions(-)
 delete mode 100644 meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch

diff --git a/meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch b/meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch
deleted file mode 100644
index 1b41cb464e..0000000000
--- a/meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Use overloadable attribute to aid clang
-
-Fixes
-dcigettext.c:147:7: error: redeclaration of 'getcwd' must have the 'overloadable' attribute
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
---- a/gettext-runtime/intl/dcigettext.c
-+++ b/gettext-runtime/intl/dcigettext.c
-@@ -144,7 +144,11 @@ char *getwd ();
- #  if VMS
- #   define getcwd(buf, max) (getcwd) (buf, max, 0)
- #  else
--char *getcwd ();
-+char 
-+#ifdef __clang__
-+__attribute__((overloadable))
-+#endif
-+*getcwd ();
- #  endif
- # endif
- # ifndef HAVE_STPCPY
diff --git a/meta/recipes-core/gettext/gettext_0.20.1.bb b/meta/recipes-core/gettext/gettext_0.20.1.bb
index 3b576f45e9..214803f767 100644
--- a/meta/recipes-core/gettext/gettext_0.20.1.bb
+++ b/meta/recipes-core/gettext/gettext_0.20.1.bb
@@ -25,9 +25,7 @@ SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
            file://serial-tests-config.patch \
            file://0001-msgmerge-Fix-behaviour-of-for-msgfmt-on-PO-files-wit.patch \
            file://0001-tests-autopoint-3-unset-MAKEFLAGS.patch \
-           file://overloadable.patch \
            "
-
 SRC_URI[md5sum] = "bb5b0c0caa028105f3ca1905ddc306e2"
 SRC_URI[sha256sum] = "66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c"
 
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 09/13] riscv32: Bump oldest kernel to 5.4
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (7 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 08/13] gettext: Drop overloadable attibute for getcwd declaration Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 10/13] go.bbclass: Disable PIE on riscv Khem Raj
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

rv32 port has bumped its minimum kernel requirement to 5.4
as the userspace ABI is still in flux until glibc port is not
upstreamed.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 2da7c5849a..b6aa9f33e9 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -431,7 +431,7 @@ OLDEST_KERNEL = "3.2.0"
 OLDEST_KERNEL_aarch64 = "3.14"
 OLDEST_KERNEL_nios2 = "3.19"
 OLDEST_KERNEL_powerpc64le = "3.10.0"
-OLDEST_KERNEL_riscv32 = "4.15"
+OLDEST_KERNEL_riscv32 = "5.4"
 OLDEST_KERNEL_riscv64 = "4.15"
 
 # SDK_OLDEST_KERNEL can't be set using overrides since there are
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/13] go.bbclass: Disable PIE on riscv
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (8 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 09/13] riscv32: Bump oldest kernel to 5.4 Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 11/13] go-dep: Fix bolt for riscv64 Khem Raj
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Its not _yet_ supported for riscv

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/go.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index e40e55689d..369652dbbd 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -147,7 +147,7 @@ INSANE_SKIP_${PN} += "ldflags"
 # doesn't support -buildmode=pie, so skip the QA checking for mips and its
 # variants.
 python() {
-    if 'mips' in d.getVar('TARGET_ARCH'):
+    if 'mips' in d.getVar('TARGET_ARCH') or 'riscv' in d.getVar('TARGET_ARCH'):
         d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
     else:
         d.appendVar('GOBUILDFLAGS', ' -buildmode=pie')
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 11/13] go-dep: Fix bolt for riscv64
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (9 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 10/13] go.bbclass: Disable PIE on riscv Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 12/13] Disable CGO on riscv64 Khem Raj
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...bolt_riscv64-Add-support-for-riscv64.patch | 33 +++++++++++++++++++
 meta/recipes-devtools/go/go-dep_0.5.4.bb      |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch

diff --git a/meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch b/meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch
new file mode 100644
index 0000000000..4d97d48243
--- /dev/null
+++ b/meta/recipes-devtools/go/go-dep/0001-bolt_riscv64-Add-support-for-riscv64.patch
@@ -0,0 +1,33 @@
+From 5e051669d117d7cd9b24cea3494959eec396ec1e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 25 Jan 2020 22:37:25 -0800
+Subject: [PATCH] /bolt_riscv64: Add support for riscv64
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ vendor/github.com/boltdb/bolt/bolt_riscv64.go | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+ create mode 100644 vendor/github.com/boltdb/bolt/bolt_riscv64.go
+
+diff --git a/vendor/github.com/boltdb/bolt/bolt_riscv64.go b/vendor/github.com/boltdb/bolt/bolt_riscv64.go
+new file mode 100644
+index 00000000..3d6b88d4
+--- /dev/null
++++ b/vendor/github.com/boltdb/bolt/bolt_riscv64.go
+@@ -0,0 +1,12 @@
++// +build riscv64
++
++package bolt
++
++// maxMapSize represents the largest mmap size supported by Bolt.
++const maxMapSize = 0xFFFFFFFFFFFF // 256TB
++
++// maxAllocSize is the size used when creating array pointers.
++const maxAllocSize = 0x7FFFFFFF
++
++// Are unaligned load/stores broken on this arch?
++var brokenUnaligned = false
+-- 
+2.25.0
+
diff --git a/meta/recipes-devtools/go/go-dep_0.5.4.bb b/meta/recipes-devtools/go/go-dep_0.5.4.bb
index ead87870e2..615cb289e5 100644
--- a/meta/recipes-devtools/go/go-dep_0.5.4.bb
+++ b/meta/recipes-devtools/go/go-dep_0.5.4.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=1bad315647751fab0007812f
 GO_IMPORT = "github.com/golang/dep"
 SRC_URI = "git://${GO_IMPORT} \
            file://0001-Add-support-for-mips-mips64.patch;patchdir=src/github.com/golang/dep \
+           file://0001-bolt_riscv64-Add-support-for-riscv64.patch;patchdir=src/github.com/golang/dep \
           "
 
 SRCREV = "1f7c19e5f52f49ffb9f956f64c010be14683468b"
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 12/13] Disable CGO on riscv64
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (10 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 11/13] go-dep: Fix bolt for riscv64 Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:27 ` [PATCH 13/13] go: Disable PIE on RISCV Khem Raj
  2020-01-26 19:33 ` ✗ patchtest: failure for glibc/musl/go updates Patchwork
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Its not supported yet

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/go.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 369652dbbd..c99689ac59 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -53,6 +53,7 @@ GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
 export GOTOOLDIR
 
 export CGO_ENABLED ?= "1"
+export CGO_ENABLED_riscv64 = "0"
 export CGO_CFLAGS ?= "${CFLAGS}"
 export CGO_CPPFLAGS ?= "${CPPFLAGS}"
 export CGO_CXXFLAGS ?= "${CXXFLAGS}"
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 13/13] go: Disable PIE on RISCV
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (11 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 12/13] Disable CGO on riscv64 Khem Raj
@ 2020-01-26 19:27 ` Khem Raj
  2020-01-26 19:33 ` ✗ patchtest: failure for glibc/musl/go updates Patchwork
  13 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-26 19:27 UTC (permalink / raw)
  To: openembedded-core

Its not supported yet

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/go/go_1.13.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/go/go_1.13.bb b/meta/recipes-devtools/go/go_1.13.bb
index 483e2e2cb7..5d40cf9d04 100644
--- a/meta/recipes-devtools/go/go_1.13.bb
+++ b/meta/recipes-devtools/go/go_1.13.bb
@@ -3,11 +3,11 @@ require go-target.inc
 
 export GOBUILDMODE=""
 
-# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
-# doesn't support -buildmode=pie, so skip the QA checking for mips and its
+# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips/riscv
+# doesn't support -buildmode=pie, so skip the QA checking for mips/riscv and its
 # variants.
 python() {
-    if 'mips' in d.getVar('TARGET_ARCH',True):
+    if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True):
         d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel")
     else:
         d.setVar('GOBUILDMODE', 'pie')
-- 
2.25.0



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* ✗ patchtest: failure for glibc/musl/go updates
  2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
                   ` (12 preceding siblings ...)
  2020-01-26 19:27 ` [PATCH 13/13] go: Disable PIE on RISCV Khem Raj
@ 2020-01-26 19:33 ` Patchwork
  13 siblings, 0 replies; 23+ messages in thread
From: Patchwork @ 2020-01-26 19:33 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

== Series Details ==

Series: glibc/musl/go updates
Revision: 1
URL   : https://patchwork.openembedded.org/series/22298/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Patch            [12/13] Disable CGO on riscv64
 Issue             Shortlog does not follow expected format [test_shortlog_format] 
  Suggested fix    Commit shortlog (first line of commit message) should follow the format "<target>: <summary>"



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 07/13] glibc: Drop fortify refactoring patch
  2020-01-26 19:27 ` [PATCH 07/13] glibc: Drop fortify refactoring patch Khem Raj
@ 2020-01-26 23:26   ` Adrian Bunk
  2020-01-26 23:28     ` Adrian Bunk
  0 siblings, 1 reply; 23+ messages in thread
From: Adrian Bunk @ 2020-01-26 23:26 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On Sun, Jan 26, 2020 at 11:27:44AM -0800, Khem Raj wrote:
> This helps clang to do a better job with fortify on but it is better
> suited for clang layer
>...

The patch is simply wrong.

Are you submitting a patch removing the workaround for it in gettext
or should I submit this?

cu
Adrian


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 07/13] glibc: Drop fortify refactoring patch
  2020-01-26 23:26   ` Adrian Bunk
@ 2020-01-26 23:28     ` Adrian Bunk
  0 siblings, 0 replies; 23+ messages in thread
From: Adrian Bunk @ 2020-01-26 23:28 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On Mon, Jan 27, 2020 at 01:26:17AM +0200, Adrian Bunk wrote:
>...
> Are you submitting a patch removing the workaround for it in gettext
> or should I submit this?

Sorry, I should have checked the whole patch series first.

cu
Adrian


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-26 19:27 ` [PATCH 06/13] glibc: Update to final 2.31 release Khem Raj
@ 2020-01-28 11:02   ` Martin Jansa
  2020-01-28 16:05     ` Khem Raj
  0 siblings, 1 reply; 23+ messages in thread
From: Martin Jansa @ 2020-01-28 11:02 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On Sun, Jan 26, 2020 at 11:27:43AM -0800, Khem Raj wrote:
> Drop ppc 8xx clear cache optimization, which we have been carrying
> through eglibc days, it has been redone in glibc now
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  .../glibc/cross-localedef-native_2.31.bb      |   9 +-
>  meta/recipes-core/glibc/glibc-version.inc     |   2 +-

...

> diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
> index dca1916e80..c2cfb7e2f1 100644
> --- a/meta/recipes-core/glibc/glibc-version.inc
> +++ b/meta/recipes-core/glibc/glibc-version.inc
> @@ -1,6 +1,6 @@
>  SRCBRANCH ?= "master"
>  PV = "2.30.9000"

Should this be 2.31 if the SRCREV is the final version?

> -SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
> +SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
>  SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
>  
>  GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 201 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-28 11:02   ` Martin Jansa
@ 2020-01-28 16:05     ` Khem Raj
  2020-01-28 17:47       ` Alexander Kanavin
  0 siblings, 1 reply; 23+ messages in thread
From: Khem Raj @ 2020-01-28 16:05 UTC (permalink / raw)
  To: Martin Jansa; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

On Tue, Jan 28, 2020 at 3:02 AM Martin Jansa <martin.jansa@gmail.com> wrote:

> On Sun, Jan 26, 2020 at 11:27:43AM -0800, Khem Raj wrote:
> > Drop ppc 8xx clear cache optimization, which we have been carrying
> > through eglibc days, it has been redone in glibc now
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  .../glibc/cross-localedef-native_2.31.bb      |   9 +-
> >  meta/recipes-core/glibc/glibc-version.inc     |   2 +-
>
> ...
>
> > diff --git a/meta/recipes-core/glibc/glibc-version.inc
> b/meta/recipes-core/glibc/glibc-version.inc
> > index dca1916e80..c2cfb7e2f1 100644
> > --- a/meta/recipes-core/glibc/glibc-version.inc
> > +++ b/meta/recipes-core/glibc/glibc-version.inc
> > @@ -1,6 +1,6 @@
> >  SRCBRANCH ?= "master"
> >  PV = "2.30.9000"
>
> Should this be 2.31 if the SRCREV is the final version?


Yes


>
> > -SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
> > +SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
> >  SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
> >
> >  GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
> ...
>

[-- Attachment #2: Type: text/html, Size: 2016 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-28 16:05     ` Khem Raj
@ 2020-01-28 17:47       ` Alexander Kanavin
  2020-01-28 18:44         ` Khem Raj
  0 siblings, 1 reply; 23+ messages in thread
From: Alexander Kanavin @ 2020-01-28 17:47 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]

But 2.31 hasn't yet been released or tagged?

http://sourceware.org/git/?p=glibc.git


Alex

On Tue, 28 Jan 2020 at 17:06, Khem Raj <raj.khem@gmail.com> wrote:

>
>
> On Tue, Jan 28, 2020 at 3:02 AM Martin Jansa <martin.jansa@gmail.com>
> wrote:
>
>> On Sun, Jan 26, 2020 at 11:27:43AM -0800, Khem Raj wrote:
>> > Drop ppc 8xx clear cache optimization, which we have been carrying
>> > through eglibc days, it has been redone in glibc now
>> >
>> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> > ---
>> >  .../glibc/cross-localedef-native_2.31.bb      |   9 +-
>> >  meta/recipes-core/glibc/glibc-version.inc     |   2 +-
>>
>> ...
>>
>> > diff --git a/meta/recipes-core/glibc/glibc-version.inc
>> b/meta/recipes-core/glibc/glibc-version.inc
>> > index dca1916e80..c2cfb7e2f1 100644
>> > --- a/meta/recipes-core/glibc/glibc-version.inc
>> > +++ b/meta/recipes-core/glibc/glibc-version.inc
>> > @@ -1,6 +1,6 @@
>> >  SRCBRANCH ?= "master"
>> >  PV = "2.30.9000"
>>
>> Should this be 2.31 if the SRCREV is the final version?
>
>
> Yes
>
>
>>
>> > -SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
>> > +SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
>> >  SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
>> >
>> >  GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
>> ...
>>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 3047 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-28 17:47       ` Alexander Kanavin
@ 2020-01-28 18:44         ` Khem Raj
  2020-01-28 19:00           ` Alexander Kanavin
  0 siblings, 1 reply; 23+ messages in thread
From: Khem Raj @ 2020-01-28 18:44 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

On Tue, Jan 28, 2020 at 9:48 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> But 2.31 hasn't yet been released or tagged?
>

No, it will be released first week of February, given how much work is
required for upgrading
some of these core pieces, getting some early testing and reporting
any regressions and addressing
them while time is left in release works well for OE as well as
upstream components. So I usually
do pre-release updates for glibc and gcc for these reasons.

> http://sourceware.org/git/?p=glibc.git
>
>
> Alex
>
> On Tue, 28 Jan 2020 at 17:06, Khem Raj <raj.khem@gmail.com> wrote:
>>
>>
>>
>> On Tue, Jan 28, 2020 at 3:02 AM Martin Jansa <martin.jansa@gmail.com> wrote:
>>>
>>> On Sun, Jan 26, 2020 at 11:27:43AM -0800, Khem Raj wrote:
>>> > Drop ppc 8xx clear cache optimization, which we have been carrying
>>> > through eglibc days, it has been redone in glibc now
>>> >
>>> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>> > ---
>>> >  .../glibc/cross-localedef-native_2.31.bb      |   9 +-
>>> >  meta/recipes-core/glibc/glibc-version.inc     |   2 +-
>>>
>>> ...
>>>
>>> > diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
>>> > index dca1916e80..c2cfb7e2f1 100644
>>> > --- a/meta/recipes-core/glibc/glibc-version.inc
>>> > +++ b/meta/recipes-core/glibc/glibc-version.inc
>>> > @@ -1,6 +1,6 @@
>>> >  SRCBRANCH ?= "master"
>>> >  PV = "2.30.9000"
>>>
>>> Should this be 2.31 if the SRCREV is the final version?
>>
>>
>> Yes
>>
>>>
>>>
>>> > -SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
>>> > +SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
>>> >  SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
>>> >
>>> >  GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
>>> ...
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-28 18:44         ` Khem Raj
@ 2020-01-28 19:00           ` Alexander Kanavin
  2020-01-28 19:03             ` Khem Raj
  0 siblings, 1 reply; 23+ messages in thread
From: Alexander Kanavin @ 2020-01-28 19:00 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]

Sure, and testing prior to actual releases is very beneficial and
appreciated. I only wanted to make sure we don't tag something as 2.31
final when it's still a pre-release.

Alex

On Tue, 28 Jan 2020 at 19:45, Khem Raj <raj.khem@gmail.com> wrote:

> On Tue, Jan 28, 2020 at 9:48 AM Alexander Kanavin
> <alex.kanavin@gmail.com> wrote:
> >
> > But 2.31 hasn't yet been released or tagged?
> >
>
> No, it will be released first week of February, given how much work is
> required for upgrading
> some of these core pieces, getting some early testing and reporting
> any regressions and addressing
> them while time is left in release works well for OE as well as
> upstream components. So I usually
> do pre-release updates for glibc and gcc for these reasons.
>
> > http://sourceware.org/git/?p=glibc.git
> >
> >
> > Alex
> >
> > On Tue, 28 Jan 2020 at 17:06, Khem Raj <raj.khem@gmail.com> wrote:
> >>
> >>
> >>
> >> On Tue, Jan 28, 2020 at 3:02 AM Martin Jansa <martin.jansa@gmail.com>
> wrote:
> >>>
> >>> On Sun, Jan 26, 2020 at 11:27:43AM -0800, Khem Raj wrote:
> >>> > Drop ppc 8xx clear cache optimization, which we have been carrying
> >>> > through eglibc days, it has been redone in glibc now
> >>> >
> >>> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >>> > ---
> >>> >  .../glibc/cross-localedef-native_2.31.bb      |   9 +-
> >>> >  meta/recipes-core/glibc/glibc-version.inc     |   2 +-
> >>>
> >>> ...
> >>>
> >>> > diff --git a/meta/recipes-core/glibc/glibc-version.inc
> b/meta/recipes-core/glibc/glibc-version.inc
> >>> > index dca1916e80..c2cfb7e2f1 100644
> >>> > --- a/meta/recipes-core/glibc/glibc-version.inc
> >>> > +++ b/meta/recipes-core/glibc/glibc-version.inc
> >>> > @@ -1,6 +1,6 @@
> >>> >  SRCBRANCH ?= "master"
> >>> >  PV = "2.30.9000"
> >>>
> >>> Should this be 2.31 if the SRCREV is the final version?
> >>
> >>
> >> Yes
> >>
> >>>
> >>>
> >>> > -SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
> >>> > +SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
> >>> >  SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
> >>> >
> >>> >  GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
> >>> ...
> >>
> >> --
> >> _______________________________________________
> >> Openembedded-core mailing list
> >> Openembedded-core@lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 4102 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/13] glibc: Update to final 2.31 release
  2020-01-28 19:00           ` Alexander Kanavin
@ 2020-01-28 19:03             ` Khem Raj
  0 siblings, 0 replies; 23+ messages in thread
From: Khem Raj @ 2020-01-28 19:03 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core

On Tue, Jan 28, 2020 at 11:00 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> Sure, and testing prior to actual releases is very beneficial and appreciated. I only wanted to make sure we don't tag something as 2.31 final when it's still a pre-release.
>

yes we wont :)

> Alex
>
> On Tue, 28 Jan 2020 at 19:45, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> On Tue, Jan 28, 2020 at 9:48 AM Alexander Kanavin
>> <alex.kanavin@gmail.com> wrote:
>> >
>> > But 2.31 hasn't yet been released or tagged?
>> >
>>
>> No, it will be released first week of February, given how much work is
>> required for upgrading
>> some of these core pieces, getting some early testing and reporting
>> any regressions and addressing
>> them while time is left in release works well for OE as well as
>> upstream components. So I usually
>> do pre-release updates for glibc and gcc for these reasons.
>>
>> > http://sourceware.org/git/?p=glibc.git
>> >
>> >
>> > Alex
>> >
>> > On Tue, 28 Jan 2020 at 17:06, Khem Raj <raj.khem@gmail.com> wrote:
>> >>
>> >>
>> >>
>> >> On Tue, Jan 28, 2020 at 3:02 AM Martin Jansa <martin.jansa@gmail.com> wrote:
>> >>>
>> >>> On Sun, Jan 26, 2020 at 11:27:43AM -0800, Khem Raj wrote:
>> >>> > Drop ppc 8xx clear cache optimization, which we have been carrying
>> >>> > through eglibc days, it has been redone in glibc now
>> >>> >
>> >>> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> >>> > ---
>> >>> >  .../glibc/cross-localedef-native_2.31.bb      |   9 +-
>> >>> >  meta/recipes-core/glibc/glibc-version.inc     |   2 +-
>> >>>
>> >>> ...
>> >>>
>> >>> > diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
>> >>> > index dca1916e80..c2cfb7e2f1 100644
>> >>> > --- a/meta/recipes-core/glibc/glibc-version.inc
>> >>> > +++ b/meta/recipes-core/glibc/glibc-version.inc
>> >>> > @@ -1,6 +1,6 @@
>> >>> >  SRCBRANCH ?= "master"
>> >>> >  PV = "2.30.9000"
>> >>>
>> >>> Should this be 2.31 if the SRCREV is the final version?
>> >>
>> >>
>> >> Yes
>> >>
>> >>>
>> >>>
>> >>> > -SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
>> >>> > +SRCREV_glibc ?= "352bb99754ae7c83ff1b974f9c52244e974c9410"
>> >>> >  SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
>> >>> >
>> >>> >  GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
>> >>> ...
>> >>
>> >> --
>> >> _______________________________________________
>> >> Openembedded-core mailing list
>> >> Openembedded-core@lists.openembedded.org
>> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-01-28 19:03 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-26 19:27 [PATCH 00/13] glibc/musl/go updates Khem Raj
2020-01-26 19:27 ` [PATCH 01/13] libucontext: Add recipe Khem Raj
2020-01-26 19:27 ` [PATCH 02/13] nss: Pass NSS_USE_ARM_HW_CRYPTO as define in CFLAGS Khem Raj
2020-01-26 19:27 ` [PATCH 03/13] ruby: Remove __has_include and __has_include_next from preprocessed header file Khem Raj
2020-01-26 19:27 ` [PATCH 04/13] perf: Pass LDSHARED and CCLD via EXTRA_OEMAKE Khem Raj
2020-01-26 19:27 ` [PATCH 05/13] Musl: Update to latest master Khem Raj
2020-01-26 19:27 ` [PATCH 06/13] glibc: Update to final 2.31 release Khem Raj
2020-01-28 11:02   ` Martin Jansa
2020-01-28 16:05     ` Khem Raj
2020-01-28 17:47       ` Alexander Kanavin
2020-01-28 18:44         ` Khem Raj
2020-01-28 19:00           ` Alexander Kanavin
2020-01-28 19:03             ` Khem Raj
2020-01-26 19:27 ` [PATCH 07/13] glibc: Drop fortify refactoring patch Khem Raj
2020-01-26 23:26   ` Adrian Bunk
2020-01-26 23:28     ` Adrian Bunk
2020-01-26 19:27 ` [PATCH 08/13] gettext: Drop overloadable attibute for getcwd declaration Khem Raj
2020-01-26 19:27 ` [PATCH 09/13] riscv32: Bump oldest kernel to 5.4 Khem Raj
2020-01-26 19:27 ` [PATCH 10/13] go.bbclass: Disable PIE on riscv Khem Raj
2020-01-26 19:27 ` [PATCH 11/13] go-dep: Fix bolt for riscv64 Khem Raj
2020-01-26 19:27 ` [PATCH 12/13] Disable CGO on riscv64 Khem Raj
2020-01-26 19:27 ` [PATCH 13/13] go: Disable PIE on RISCV Khem Raj
2020-01-26 19:33 ` ✗ patchtest: failure for glibc/musl/go updates Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.