summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native_2.31.bb (renamed from meta/recipes-core/glibc/cross-localedef-native_2.30.bb)29
-rw-r--r--meta/recipes-core/glibc/glibc-common.inc4
-rw-r--r--meta/recipes-core/glibc/glibc-locale_2.31.bb (renamed from meta/recipes-core/glibc/glibc-locale_2.30.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace_2.31.bb (renamed from meta/recipes-core/glibc/glibc-mtrace_2.30.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-scripts_2.31.bb (renamed from meta/recipes-core/glibc/glibc-scripts_2.30.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-testsuite_2.31.bb (renamed from meta/recipes-core/glibc/glibc-testsuite_2.30.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-version.inc6
-rw-r--r--meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch (renamed from meta/recipes-core/glibc/glibc/0029-Add-hardlink-resolver-from-util-linux.patch)4
-rw-r--r--meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-to-build.patch (renamed from meta/recipes-core/glibc/glibc/0031-Add-hardlink-resolver-to-build.patch)13
-rw-r--r--meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch (renamed from meta/recipes-core/glibc/glibc/0030-hardlink-fix-ups-to-make-it-compile.patch)4
-rw-r--r--meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch (renamed from meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch)14
-rw-r--r--meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch (renamed from meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch)12
-rw-r--r--meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch (renamed from meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch)26
-rw-r--r--meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch (renamed from meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch (renamed from meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Make-relocatable-install-for-locales.patch)17
-rw-r--r--meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch (renamed from meta/recipes-core/glibc/glibc/0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch)7
-rw-r--r--meta/recipes-core/glibc/glibc/0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch (renamed from meta/recipes-core/glibc/glibc/0007-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch)10
-rw-r--r--meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch (renamed from meta/recipes-core/glibc/glibc/0008-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch)7
-rw-r--r--meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch (renamed from meta/recipes-core/glibc/glibc/0009-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch (renamed from meta/recipes-core/glibc/glibc/0010-Quote-from-bug-1443-which-explains-what-the-patch-do.patch)10
-rw-r--r--meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch (renamed from meta/recipes-core/glibc/glibc/0011-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch (renamed from meta/recipes-core/glibc/glibc/0012-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch (renamed from meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch)7
-rw-r--r--meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch (renamed from meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0017-yes-within-the-path-sets-wrong-config-variables.patch (renamed from meta/recipes-core/glibc/glibc/0015-yes-within-the-path-sets-wrong-config-variables.patch)11
-rw-r--r--meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch (renamed from meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch (renamed from meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch)7
-rw-r--r--meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch (renamed from meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch)7
-rw-r--r--meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch (renamed from meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch)15
-rw-r--r--meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch (renamed from meta/recipes-core/glibc/glibc/0020-eglibc-Clear-cache-lines-on-ppc8xx.patch)11
-rw-r--r--meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch (renamed from meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch (renamed from meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch)62
-rw-r--r--meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch (renamed from meta/recipes-core/glibc/glibc/0023-Define-DUMMY_LOCALE_T-if-not-defined.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch (renamed from meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch)10
-rw-r--r--meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch (renamed from meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch (renamed from meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch (renamed from meta/recipes-core/glibc/glibc/0027-inject-file-assembly-directives.patch)43
-rw-r--r--meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch (renamed from meta/recipes-core/glibc/glibc/0028-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch)9
-rw-r--r--meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch2780
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2019-19126.patch32
-rw-r--r--meta/recipes-core/glibc/glibc_2.31.bb (renamed from meta/recipes-core/glibc/glibc_2.30.bb)58
41 files changed, 2980 insertions, 325 deletions
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.30.bb b/meta/recipes-core/glibc/cross-localedef-native_2.31.bb
index 99c3d30397..a267a591d4 100644
--- a/meta/recipes-core/glibc/cross-localedef-native_2.30.bb
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.31.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
3SECTION = "libs" 3SECTION = "libs"
4LICENSE = "LGPL-2.1" 4LICENSE = "LGPL-2.1"
5 5
6LIC_FILES_CHKSUM = "file://LICENSES;md5=cfc0ed77a9f62fa62eded042ebe31d72 \ 6LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
7 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 7 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
8 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ 8 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
9 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" 9 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
@@ -21,18 +21,21 @@ FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:"
21 21
22SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ 22SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
23 git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \ 23 git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \
24 file://0016-timezone-re-written-tzselect-as-posix-sh.patch \ 24 \
25 file://0017-Remove-bash-dependency-for-nscd-init-script.patch \ 25 file://0001-localedef-Add-hardlink-resolver-to-build.patch;patchdir=localedef \
26 file://0018-eglibc-Cross-building-and-testing-instructions.patch \ 26 \
27 file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \ 27 file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
28 file://0020-eglibc-Clear-cache-lines-on-ppc8xx.patch \ 28 file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
29 file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ 29 \
30 file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ 30 file://0018-timezone-re-written-tzselect-as-posix-sh.patch \
31 file://0023-Define-DUMMY_LOCALE_T-if-not-defined.patch \ 31 file://0019-Remove-bash-dependency-for-nscd-init-script.patch \
32 file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ 32 file://0020-eglibc-Cross-building-and-testing-instructions.patch \
33 file://0029-Add-hardlink-resolver-from-util-linux.patch \ 33 file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \
34 file://0030-hardlink-fix-ups-to-make-it-compile.patch \ 34 file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
35 file://0031-Add-hardlink-resolver-to-build.patch \ 35 file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
36 file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
37 file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
38 file://0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
36" 39"
37# Makes for a rather long rev (22 characters), but... 40# Makes for a rather long rev (22 characters), but...
38# 41#
diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc
index fa46fd89f1..27534d999f 100644
--- a/meta/recipes-core/glibc/glibc-common.inc
+++ b/meta/recipes-core/glibc/glibc-common.inc
@@ -4,7 +4,7 @@ HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
4SECTION = "libs" 4SECTION = "libs"
5LICENSE = "GPLv2 & LGPLv2.1" 5LICENSE = "GPLv2 & LGPLv2.1"
6 6
7LIC_FILES_CHKSUM ?= "file://LICENSES;md5=cfc0ed77a9f62fa62eded042ebe31d72 \ 7LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
8 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 8 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
9 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ 9 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
10 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" 10 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
@@ -22,4 +22,4 @@ ARM_INSTRUCTION_SET_armv6 = "arm"
22# 22#
23COMPATIBLE_HOST_libc-musl_class-target = "null" 23COMPATIBLE_HOST_libc-musl_class-target = "null"
24 24
25PV = "2.30" 25PV = "2.30.9000"
diff --git a/meta/recipes-core/glibc/glibc-locale_2.30.bb b/meta/recipes-core/glibc/glibc-locale_2.31.bb
index f7702e0358..f7702e0358 100644
--- a/meta/recipes-core/glibc/glibc-locale_2.30.bb
+++ b/meta/recipes-core/glibc/glibc-locale_2.31.bb
diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.30.bb b/meta/recipes-core/glibc/glibc-mtrace_2.31.bb
index 0b69bad46a..0b69bad46a 100644
--- a/meta/recipes-core/glibc/glibc-mtrace_2.30.bb
+++ b/meta/recipes-core/glibc/glibc-mtrace_2.31.bb
diff --git a/meta/recipes-core/glibc/glibc-scripts_2.30.bb b/meta/recipes-core/glibc/glibc-scripts_2.31.bb
index 5a89bd8022..5a89bd8022 100644
--- a/meta/recipes-core/glibc/glibc-scripts_2.30.bb
+++ b/meta/recipes-core/glibc/glibc-scripts_2.31.bb
diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.30.bb b/meta/recipes-core/glibc/glibc-testsuite_2.31.bb
index 657fd4dbc1..657fd4dbc1 100644
--- a/meta/recipes-core/glibc/glibc-testsuite_2.30.bb
+++ b/meta/recipes-core/glibc/glibc-testsuite_2.31.bb
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
index c18c583399..dca1916e80 100644
--- a/meta/recipes-core/glibc/glibc-version.inc
+++ b/meta/recipes-core/glibc/glibc-version.inc
@@ -1,6 +1,6 @@
1SRCBRANCH ?= "release/2.30/master" 1SRCBRANCH ?= "master"
2PV = "2.30" 2PV = "2.30.9000"
3SRCREV_glibc ?= "be9a328c93834648e0bec106a1f86357d1a8c7e1" 3SRCREV_glibc ?= "def9c08c94da60bfb746644d56cffbe7a9de3477"
4SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655" 4SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
5 5
6GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" 6GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
diff --git a/meta/recipes-core/glibc/glibc/0029-Add-hardlink-resolver-from-util-linux.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
index b7fb0321c4..9b75f2a62f 100644
--- a/meta/recipes-core/glibc/glibc/0029-Add-hardlink-resolver-from-util-linux.patch
+++ b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
@@ -1,7 +1,7 @@
1From 9e5e5297d9a5ef66b3920313356bf7f25955dff3 Mon Sep 17 00:00:00 2001 1From 169720859cf8f9133882a13f588b15f44b7b8ae6 Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com> 2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Sat, 7 Dec 2019 09:59:22 -0800 3Date: Sat, 7 Dec 2019 09:59:22 -0800
4Subject: [PATCH] Add hardlink resolver from util-linux 4Subject: [PATCH] localedef: Add hardlink resolver from util-linux
5 5
6The hard link resolver that is built into localedef cannot be run in 6The hard link resolver that is built into localedef cannot be run in
7parallel. It will search sibling directories (which are be processed 7parallel. It will search sibling directories (which are be processed
diff --git a/meta/recipes-core/glibc/glibc/0031-Add-hardlink-resolver-to-build.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-to-build.patch
index e87a3bfb6f..d6652981a8 100644
--- a/meta/recipes-core/glibc/glibc/0031-Add-hardlink-resolver-to-build.patch
+++ b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-to-build.patch
@@ -1,7 +1,7 @@
1From 1ef58f566e6ed575f7caee35308025e2b0f4101c Mon Sep 17 00:00:00 2001 1From 56ae260ac24ade94e2e0e77c81751312372d253f Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com> 2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Sat, 7 Dec 2019 09:56:23 -0800 3Date: Sat, 7 Dec 2019 09:56:23 -0800
4Subject: [PATCH] Add hardlink resolver to build 4Subject: [PATCH] localedef: Add hardlink resolver to build
5 5
6The sourcecode for this is imported from util-linux and is kept with 6The sourcecode for this is imported from util-linux and is kept with
7glibc sources 7glibc sources
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 Makefile.in | 8 +++++++- 13 Makefile.in | 8 +++++++-
14 1 file changed, 7 insertions(+), 1 deletion(-) 14 1 file changed, 7 insertions(+), 1 deletion(-)
15 15
16diff --git a/localedef/Makefile.in b/localedef/Makefile.in 16diff --git a/Makefile.in b/Makefile.in
17index 77fbded..a87e5b2 100644 17index 77fbded..a87e5b2 100644
18--- a/localedef/Makefile.in 18--- a/Makefile.in
19+++ b/localedef/Makefile.in 19+++ b/Makefile.in
20@@ -40,6 +40,8 @@ WARNFLAGS = -Wall -Wno-format 20@@ -40,6 +40,8 @@ WARNFLAGS = -Wall -Wno-format
21 FULLCC = $(CC) $(CPPFLAGS) $(CFLAGS) \ 21 FULLCC = $(CC) $(CPPFLAGS) $(CFLAGS) \
22 $(DEFINES) $(INCLUDES) $(WARNFLAGS) 22 $(DEFINES) $(INCLUDES) $(WARNFLAGS)
@@ -50,6 +50,3 @@ index 77fbded..a87e5b2 100644
50 charmap.o: glibc/locale/programs/charmap.c 50 charmap.o: glibc/locale/programs/charmap.c
51 charmap-dir.o: glibc/locale/programs/charmap-dir.c 51 charmap-dir.o: glibc/locale/programs/charmap-dir.c
52 ld-address.o: glibc/locale/programs/ld-address.c 52 ld-address.o: glibc/locale/programs/ld-address.c
53--
542.24.0
55
diff --git a/meta/recipes-core/glibc/glibc/0030-hardlink-fix-ups-to-make-it-compile.patch b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
index 1a5f6b6825..029292fe36 100644
--- a/meta/recipes-core/glibc/glibc/0030-hardlink-fix-ups-to-make-it-compile.patch
+++ b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
@@ -1,7 +1,7 @@
1From d08f436635cb9d627ebae4512105708d28fc36fe Mon Sep 17 00:00:00 2001 1From 9b966b758d0c96ef6654251689318614ef10becc Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com> 2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Sat, 7 Dec 2019 10:01:37 -0800 3Date: Sat, 7 Dec 2019 10:01:37 -0800
4Subject: [PATCH] hardlink: fix-ups to make it compile 4Subject: [PATCH] localedef: fix-ups hardlink to make it compile
5 5
6Upstream-Status: Pending 6Upstream-Status: Pending
7Signed-off-by: Jason Wessel <jason.wessel@windriver.com> 7Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
diff --git a/meta/recipes-core/glibc/glibc/0001-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 d86d1d8dc7..e1c3512e4e 100644
--- a/meta/recipes-core/glibc/glibc/0001-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,8 +1,7 @@
1From f6984c923b41155979764bfa3f44609572be5414 Mon Sep 17 00:00:00 2001 1From 14ddf13b7fc2e39a1ae657ceb3963e35731e95d0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:48:24 +0000 3Date: Wed, 18 Mar 2015 01:48:24 +0000
4Subject: [PATCH 01/28] nativesdk-glibc: Look for host system ld.so.cache as 4Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
5 well
6 5
7Upstream-Status: Inappropriate [embedded specific] 6Upstream-Status: Inappropriate [embedded specific]
8 7
@@ -31,10 +30,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
31 1 file changed, 8 insertions(+), 8 deletions(-) 30 1 file changed, 8 insertions(+), 8 deletions(-)
32 31
33diff --git a/elf/dl-load.c b/elf/dl-load.c 32diff --git a/elf/dl-load.c b/elf/dl-load.c
34index 5abeb867f1..981bd5b4af 100644 33index a6b80f9395..3226f2e531 100644
35--- a/elf/dl-load.c 34--- a/elf/dl-load.c
36+++ b/elf/dl-load.c 35+++ b/elf/dl-load.c
37@@ -2080,6 +2080,14 @@ _dl_map_object (struct link_map *loader, const char *name, 36@@ -2073,6 +2073,14 @@ _dl_map_object (struct link_map *loader, const char *name,
38 } 37 }
39 } 38 }
40 39
@@ -49,7 +48,7 @@ index 5abeb867f1..981bd5b4af 100644
49 #ifdef USE_LDCONFIG 48 #ifdef USE_LDCONFIG
50 if (fd == -1 49 if (fd == -1
51 && (__glibc_likely ((mode & __RTLD_SECURE) == 0) 50 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
52@@ -2138,14 +2146,6 @@ _dl_map_object (struct link_map *loader, const char *name, 51@@ -2131,14 +2139,6 @@ _dl_map_object (struct link_map *loader, const char *name,
53 } 52 }
54 #endif 53 #endif
55 54
@@ -64,6 +63,3 @@ index 5abeb867f1..981bd5b4af 100644
64 /* Add another newline when we are tracing the library loading. */ 63 /* Add another newline when we are tracing the library loading. */
65 if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) 64 if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
66 _dl_debug_printf ("\n"); 65 _dl_debug_printf ("\n");
67--
682.22.0
69
diff --git a/meta/recipes-core/glibc/glibc/0002-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 63531082a4..523b6da897 100644
--- a/meta/recipes-core/glibc/glibc/0002-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,8 +1,7 @@
1From b91c323d809039bf9b8c445418579a8b5fe61aea Mon Sep 17 00:00:00 2001 1From 3ac58bf1028841cc0a8fa7f258cbf21466740360 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:50:00 +0000 3Date: Wed, 18 Mar 2015 01:50:00 +0000
4Subject: [PATCH 02/28] nativesdk-glibc: Fix buffer overrun with a relocated 4Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK
5 SDK
6 5
7When ld-linux-*.so.2 is relocated to a path that is longer than the 6When ld-linux-*.so.2 is relocated to a path that is longer than the
8original fixed location, the dynamic loader will crash in open_path 7original fixed location, the dynamic loader will crash in open_path
@@ -22,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
22 1 file changed, 12 insertions(+) 21 1 file changed, 12 insertions(+)
23 22
24diff --git a/elf/dl-load.c b/elf/dl-load.c 23diff --git a/elf/dl-load.c b/elf/dl-load.c
25index 981bd5b4af..c7a0fa58cb 100644 24index 3226f2e531..7cb8a86fab 100644
26--- a/elf/dl-load.c 25--- a/elf/dl-load.c
27+++ b/elf/dl-load.c 26+++ b/elf/dl-load.c
28@@ -1780,7 +1780,19 @@ open_path (const char *name, size_t namelen, int mode, 27@@ -1773,7 +1773,19 @@ open_path (const char *name, size_t namelen, int mode,
29 given on the command line when rtld is run directly. */ 28 given on the command line when rtld is run directly. */
30 return -1; 29 return -1;
31 30
@@ -45,6 +44,3 @@ index 981bd5b4af..c7a0fa58cb 100644
45 do 44 do
46 { 45 {
47 struct r_search_path_elem *this_dir = *dirs; 46 struct r_search_path_elem *this_dir = *dirs;
48--
492.22.0
50
diff --git a/meta/recipes-core/glibc/glibc/0003-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 48f5a78716..4d88d9b413 100644
--- a/meta/recipes-core/glibc/glibc/0003-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,8 +1,7 @@
1From 3aceb84e2bc0f796204fe059beede91179b1bc6e Mon Sep 17 00:00:00 2001 1From 702d68cbdf405e086f72e2a062127cbea43045ec Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:51:38 +0000 3Date: Wed, 18 Mar 2015 01:51:38 +0000
4Subject: [PATCH 03/28] nativesdk-glibc: Raise the size of arrays containing dl 4Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
5 paths
6 5
7This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings 6This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
8and lengths as well as ld.so.cache path in the dynamic loader to specific 7and lengths as well as ld.so.cache path in the dynamic loader to specific
@@ -26,7 +25,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
26 7 files changed, 14 insertions(+), 10 deletions(-) 25 7 files changed, 14 insertions(+), 10 deletions(-)
27 26
28diff --git a/elf/dl-cache.c b/elf/dl-cache.c 27diff --git a/elf/dl-cache.c b/elf/dl-cache.c
29index d8d1e2344e..d2247bfc4f 100644 28index 3eedd9afcf..efdfe5cae7 100644
30--- a/elf/dl-cache.c 29--- a/elf/dl-cache.c
31+++ b/elf/dl-cache.c 30+++ b/elf/dl-cache.c
32@@ -133,6 +133,10 @@ do \ 31@@ -133,6 +133,10 @@ do \
@@ -41,7 +40,7 @@ index d8d1e2344e..d2247bfc4f 100644
41 _dl_cache_libcmp (const char *p1, const char *p2) 40 _dl_cache_libcmp (const char *p1, const char *p2)
42 { 41 {
43diff --git a/elf/dl-load.c b/elf/dl-load.c 42diff --git a/elf/dl-load.c b/elf/dl-load.c
44index c7a0fa58cb..4b87505d45 100644 43index 7cb8a86fab..e32d4aa936 100644
45--- a/elf/dl-load.c 44--- a/elf/dl-load.c
46+++ b/elf/dl-load.c 45+++ b/elf/dl-load.c
47@@ -110,8 +110,8 @@ static size_t max_capstrlen attribute_relro; 46@@ -110,8 +110,8 @@ static size_t max_capstrlen attribute_relro;
@@ -56,7 +55,7 @@ index c7a0fa58cb..4b87505d45 100644
56 SYSTEM_DIRS_LEN 55 SYSTEM_DIRS_LEN
57 }; 56 };
58diff --git a/elf/interp.c b/elf/interp.c 57diff --git a/elf/interp.c b/elf/interp.c
59index 243829f5f7..0e74241703 100644 58index 331cc1df48..885b2d9476 100644
60--- a/elf/interp.c 59--- a/elf/interp.c
61+++ b/elf/interp.c 60+++ b/elf/interp.c
62@@ -18,5 +18,5 @@ 61@@ -18,5 +18,5 @@
@@ -67,7 +66,7 @@ index 243829f5f7..0e74241703 100644
67+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) 66+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
68 = RUNTIME_LINKER; 67 = RUNTIME_LINKER;
69diff --git a/elf/ldconfig.c b/elf/ldconfig.c 68diff --git a/elf/ldconfig.c b/elf/ldconfig.c
70index 3bc9e61891..6a23096435 100644 69index 681ed78496..8833ed0a6b 100644
71--- a/elf/ldconfig.c 70--- a/elf/ldconfig.c
72+++ b/elf/ldconfig.c 71+++ b/elf/ldconfig.c
73@@ -168,6 +168,9 @@ static struct argp argp = 72@@ -168,6 +168,9 @@ static struct argp argp =
@@ -81,10 +80,10 @@ index 3bc9e61891..6a23096435 100644
81 a platform. */ 80 a platform. */
82 static int 81 static int
83diff --git a/elf/rtld.c b/elf/rtld.c 82diff --git a/elf/rtld.c b/elf/rtld.c
84index c9490ff694..3962373ebb 100644 83index 553cfbd1b7..39347c2c03 100644
85--- a/elf/rtld.c 84--- a/elf/rtld.c
86+++ b/elf/rtld.c 85+++ b/elf/rtld.c
87@@ -173,6 +173,7 @@ dso_name_valid_for_suid (const char *p) 86@@ -175,6 +175,7 @@ dso_name_valid_for_suid (const char *p)
88 } 87 }
89 return *p != '\0'; 88 return *p != '\0';
90 } 89 }
@@ -92,7 +91,7 @@ index c9490ff694..3962373ebb 100644
92 91
93 /* LD_AUDIT variable contents. Must be processed before the 92 /* LD_AUDIT variable contents. Must be processed before the
94 audit_list below. */ 93 audit_list below. */
95@@ -1220,13 +1221,13 @@ of this helper program; chances are you did not intend to run this program.\n\ 94@@ -1222,13 +1223,13 @@ of this helper program; chances are you did not intend to run this program.\n\
96 --list list all dependencies and how they are resolved\n\ 95 --list list all dependencies and how they are resolved\n\
97 --verify verify that given object really is a dynamically linked\n\ 96 --verify verify that given object really is a dynamically linked\n\
98 object we can handle\n\ 97 object we can handle\n\
@@ -109,7 +108,7 @@ index c9490ff694..3962373ebb 100644
109 ++_dl_skip_args; 108 ++_dl_skip_args;
110 --_dl_argc; 109 --_dl_argc;
111diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c 110diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
112index ae8937cba0..f321ee419e 100644 111index 735bd1f2d5..25100ba666 100644
113--- a/iconv/gconv_conf.c 112--- a/iconv/gconv_conf.c
114+++ b/iconv/gconv_conf.c 113+++ b/iconv/gconv_conf.c
115@@ -36,7 +36,7 @@ 114@@ -36,7 +36,7 @@
@@ -122,7 +121,7 @@ index ae8937cba0..f321ee419e 100644
122 /* Type to represent search path. */ 121 /* Type to represent search path. */
123 struct path_elem 122 struct path_elem
124diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h 123diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
125index bc8b40331d..b0fdd2144b 100644 124index 6b310e9e15..3877311df4 100644
126--- a/sysdeps/generic/dl-cache.h 125--- a/sysdeps/generic/dl-cache.h
127+++ b/sysdeps/generic/dl-cache.h 126+++ b/sysdeps/generic/dl-cache.h
128@@ -27,10 +27,6 @@ 127@@ -27,10 +27,6 @@
@@ -136,6 +135,3 @@ index bc8b40331d..b0fdd2144b 100644
136 #ifndef add_system_dir 135 #ifndef add_system_dir
137 # define add_system_dir(dir) add_dir (dir) 136 # define add_system_dir(dir) add_dir (dir)
138 #endif 137 #endif
139--
1402.22.0
141
diff --git a/meta/recipes-core/glibc/glibc/0004-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 a43f294345..0d070a93b9 100644
--- a/meta/recipes-core/glibc/glibc/0004-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,7 +1,7 @@
1From e41e042149eac349e09fa629fcac4c64e574322c Mon Sep 17 00:00:00 2001 1From f9993e652bd4a0f03402d0c527cf24b83d0ff7ea Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 14:35:35 -0800 3Date: Thu, 31 Dec 2015 14:35:35 -0800
4Subject: [PATCH 04/28] nativesdk-glibc: Allow 64 bit atomics for x86 4Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
5 5
6The fix consist of allowing 64bit atomic ops for x86. 6The fix consist of allowing 64bit atomic ops for x86.
7This should be safe for i586 and newer CPUs. 7This should be safe for i586 and newer CPUs.
@@ -17,7 +17,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 1 file changed, 1 insertion(+), 2 deletions(-) 17 1 file changed, 1 insertion(+), 2 deletions(-)
18 18
19diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h 19diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
20index aa60ca4cd6..3e42e00183 100644 20index bb49648374..aa08d3c0a7 100644
21--- a/sysdeps/x86/atomic-machine.h 21--- a/sysdeps/x86/atomic-machine.h
22+++ b/sysdeps/x86/atomic-machine.h 22+++ b/sysdeps/x86/atomic-machine.h
23@@ -58,15 +58,14 @@ typedef uintmax_t uatomic_max_t; 23@@ -58,15 +58,14 @@ typedef uintmax_t uatomic_max_t;
@@ -37,6 +37,3 @@ index aa60ca4cd6..3e42e00183 100644
37 # define SP_REG "esp" 37 # define SP_REG "esp"
38 # define SEG_REG "gs" 38 # define SEG_REG "gs"
39 # define BR_CONSTRAINT "r" 39 # define BR_CONSTRAINT "r"
40--
412.22.0
42
diff --git a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
index 3aad603ada..66abcce3ce 100644
--- a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Make-relocatable-install-for-locales.patch
+++ b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
@@ -1,7 +1,7 @@
1From 50ab0b0c116f4ae3d975ec1b15ed4595fd9147f6 Mon Sep 17 00:00:00 2001 1From ee9d5e423e4a709ae5a62abfb476863b3b57378f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Aug 2018 09:55:12 -0700 3Date: Fri, 3 Aug 2018 09:55:12 -0700
4Subject: [PATCH 05/28] nativesdk-glibc: Make relocatable install for locales 4Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
5 5
6The glibc locale path is hard-coded to the install prefix, but in SDKs we need 6The glibc locale path is hard-coded to the install prefix, but in SDKs we need
7to be able to relocate the binaries. Expand the strings to 4K and put them in a 7to be able to relocate the binaries. Expand the strings to 4K and put them in a
@@ -18,7 +18,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
18 3 files changed, 4 insertions(+), 4 deletions(-) 18 3 files changed, 4 insertions(+), 4 deletions(-)
19 19
20diff --git a/locale/findlocale.c b/locale/findlocale.c 20diff --git a/locale/findlocale.c b/locale/findlocale.c
21index 9af605bd64..b2b0a3f93b 100644 21index 9cd3b71a6d..84272310e0 100644
22--- a/locale/findlocale.c 22--- a/locale/findlocale.c
23+++ b/locale/findlocale.c 23+++ b/locale/findlocale.c
24@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden = 24@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
@@ -30,7 +30,7 @@ index 9af605bd64..b2b0a3f93b 100644
30 30
31 /* Checks if the name is actually present, that is, not NULL and not 31 /* Checks if the name is actually present, that is, not NULL and not
32 empty. */ 32 empty. */
33@@ -167,7 +167,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, 33@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
34 34
35 /* Nothing in the archive. Set the default path to search below. */ 35 /* Nothing in the archive. Set the default path to search below. */
36 locale_path = _nl_default_locale_path; 36 locale_path = _nl_default_locale_path;
@@ -40,7 +40,7 @@ index 9af605bd64..b2b0a3f93b 100644
40 else 40 else
41 /* We really have to load some data. First see whether the name is 41 /* We really have to load some data. First see whether the name is
42diff --git a/locale/loadarchive.c b/locale/loadarchive.c 42diff --git a/locale/loadarchive.c b/locale/loadarchive.c
43index 803c1cf2a4..9023f475b8 100644 43index ba0fe45648..9737fd4cda 100644
44--- a/locale/loadarchive.c 44--- a/locale/loadarchive.c
45+++ b/locale/loadarchive.c 45+++ b/locale/loadarchive.c
46@@ -42,7 +42,7 @@ 46@@ -42,7 +42,7 @@
@@ -53,10 +53,10 @@ index 803c1cf2a4..9023f475b8 100644
53 /* Size of initial mapping window, optimal if large enough to 53 /* Size of initial mapping window, optimal if large enough to
54 cover the header plus the initial locale. */ 54 cover the header plus the initial locale. */
55diff --git a/locale/localeinfo.h b/locale/localeinfo.h 55diff --git a/locale/localeinfo.h b/locale/localeinfo.h
56index 7c1cc3eecb..53cb8bfc59 100644 56index 1bfe22aa7f..fdc283c69a 100644
57--- a/locale/localeinfo.h 57--- a/locale/localeinfo.h
58+++ b/locale/localeinfo.h 58+++ b/locale/localeinfo.h
59@@ -325,7 +325,7 @@ _nl_lookup_word (locale_t l, int category, int item) 59@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int category, int item)
60 } 60 }
61 61
62 /* Default search path if no LOCPATH environment variable. */ 62 /* Default search path if no LOCPATH environment variable. */
@@ -65,6 +65,3 @@ index 7c1cc3eecb..53cb8bfc59 100644
65 65
66 /* Load the locale data for CATEGORY from the file specified by *NAME. 66 /* Load the locale data for CATEGORY from the file specified by *NAME.
67 If *NAME is "", use environment variables as specified by POSIX, and 67 If *NAME is "", use environment variables as specified by POSIX, and
68--
692.22.0
70
diff --git a/meta/recipes-core/glibc/glibc/0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
index 5e1c591432..4f3ed38065 100644
--- a/meta/recipes-core/glibc/glibc/0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
+++ b/meta/recipes-core/glibc/glibc/0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
@@ -1,7 +1,7 @@
1From 7cccf5cec09f2a42cc3fe5d82ce21b7309330b33 Mon Sep 17 00:00:00 2001 1From 2cc7b79157ce17144791dda1a2e3a6dc4902c736 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:01:50 +0000 3Date: Wed, 18 Mar 2015 00:01:50 +0000
4Subject: [PATCH 06/28] fsl e500/e5500/e6500/603e fsqrt implementation 4Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation
5 5
6Upstream-Status: Pending 6Upstream-Status: Pending
7Signed-off-by: Edmar Wienskoski <edmar@freescale.com> 7Signed-off-by: Edmar Wienskoski <edmar@freescale.com>
@@ -1579,6 +1579,3 @@ index 0000000000..04ff8cc181
1579+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies 1579+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
1580@@ -0,0 +1 @@ 1580@@ -0,0 +1 @@
1581+powerpc/powerpc64/e6500/fpu 1581+powerpc/powerpc64/e6500/fpu
1582--
15832.22.0
1584
diff --git a/meta/recipes-core/glibc/glibc/0007-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 ae6fb268a5..6e4259f4ff 100644
--- a/meta/recipes-core/glibc/glibc/0007-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,8 +1,7 @@
1From dc715f6c70d01e9c3b31c1825fa5bc447967c847 Mon Sep 17 00:00:00 2001 1From e6ff3960d9e4ed6a9a4be70732313127f0e6d0e0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:11:22 +0000 3Date: Wed, 18 Mar 2015 00:11:22 +0000
4Subject: [PATCH 07/28] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known 4Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
5 names
6 5
7This bolts in a hook for OE to pass its own version of interpreter 6This bolts in a hook for OE to pass its own version of interpreter
8names into glibc especially for multilib case, where it differs from any 7names into glibc especially for multilib case, where it differs from any
@@ -17,7 +16,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 1 file changed, 1 insertion(+) 16 1 file changed, 1 insertion(+)
18 17
19diff --git a/elf/readlib.c b/elf/readlib.c 18diff --git a/elf/readlib.c b/elf/readlib.c
20index c9743e6692..6307f918fc 100644 19index 994a4426a1..baabf099b1 100644
21--- a/elf/readlib.c 20--- a/elf/readlib.c
22+++ b/elf/readlib.c 21+++ b/elf/readlib.c
23@@ -51,6 +51,7 @@ static struct known_names interpreters[] = 22@@ -51,6 +51,7 @@ static struct known_names interpreters[] =
@@ -28,6 +27,3 @@ index c9743e6692..6307f918fc 100644
28 }; 27 };
29 28
30 static struct known_names known_libs[] = 29 static struct known_names known_libs[] =
31--
322.22.0
33
diff --git a/meta/recipes-core/glibc/glibc/0008-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 8bed20306e..91da344089 100644
--- a/meta/recipes-core/glibc/glibc/0008-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,7 +1,7 @@
1From 42a01c55786a9472934e12e0bf0c40983579b607 Mon Sep 17 00:00:00 2001 1From ad055d58bd99b80e41face63bf20db3f04afa4e3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:15:07 +0000 3Date: Wed, 18 Mar 2015 00:15:07 +0000
4Subject: [PATCH 08/28] ppc/sqrt: Fix undefined reference to `__sqrt_finite' 4Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
5 5
6on ppc fixes the errors like below 6on ppc fixes the errors like below
7| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite' 7| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
@@ -203,6 +203,3 @@ index 26fa067abf..9d175122a8 100644
203 return f_washf (b); 203 return f_washf (b);
204 } 204 }
205+strong_alias (__ieee754_sqrtf, __sqrtf_finite) 205+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
206--
2072.22.0
208
diff --git a/meta/recipes-core/glibc/glibc/0009-__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 8a5d6d8b7f..6a5a44af9d 100644
--- a/meta/recipes-core/glibc/glibc/0009-__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,8 +1,8 @@
1From a0fcb9135bc8c2b9d8a161d166b6f9d56d7af245 Mon Sep 17 00:00:00 2001 1From ac4450bc74dc0754a3724f1bebb2290c4dc29d72 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:16:38 +0000 3Date: Wed, 18 Mar 2015 00:16:38 +0000
4Subject: [PATCH 09/28] __ieee754_sqrt{,f} are now inline functions and call 4Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
5 out __slow versions 5 __slow versions
6 6
7Upstream-Status: Pending 7Upstream-Status: Pending
8 8
@@ -382,6 +382,3 @@ index 9d175122a8..10de1f0cc3 100644
382+} 382+}
383+ 383+
384 strong_alias (__ieee754_sqrtf, __sqrtf_finite) 384 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
385--
3862.22.0
387
diff --git a/meta/recipes-core/glibc/glibc/0010-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 a140a15479..e8eaa4d90b 100644
--- a/meta/recipes-core/glibc/glibc/0010-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,8 +1,7 @@
1From 9c1f2229c48c37b38628c485ef16e01f6780160c Mon Sep 17 00:00:00 2001 1From 0c73e17d5ea7c88247c1bfbb03511b0ccb6ba6b4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:20:09 +0000 3Date: Wed, 18 Mar 2015 00:20:09 +0000
4Subject: [PATCH 10/28] Quote from bug 1443 which explains what the patch does 4Subject: [PATCH] Quote from bug 1443 which explains what the patch does :
5 :
6 5
7 We build some random program and link it with -lust. When we run it, 6 We build some random program and link it with -lust. When we run it,
8 it dies with a SIGSEGV before reaching main(). 7 it dies with a SIGSEGV before reaching main().
@@ -45,7 +44,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
45 1 file changed, 1 insertion(+), 1 deletion(-) 44 1 file changed, 1 insertion(+), 1 deletion(-)
46 45
47diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h 46diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
48index 7a2f9d9b78..36a1dd1888 100644 47index 90856779b1..a29bb86c56 100644
49--- a/sysdeps/arm/dl-machine.h 48--- a/sysdeps/arm/dl-machine.h
50+++ b/sysdeps/arm/dl-machine.h 49+++ b/sysdeps/arm/dl-machine.h
51@@ -510,7 +510,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, 50@@ -510,7 +510,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
@@ -57,6 +56,3 @@ index 7a2f9d9b78..36a1dd1888 100644
57 break; 56 break;
58 57
59 case R_ARM_TLS_TPOFF32: 58 case R_ARM_TLS_TPOFF32:
60--
612.22.0
62
diff --git a/meta/recipes-core/glibc/glibc/0011-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 cb99092eef..3b3611f448 100644
--- a/meta/recipes-core/glibc/glibc/0011-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,7 +1,7 @@
1From 171d2afb930917b0cfbe9df770774da1c92dd185 Mon Sep 17 00:00:00 2001 1From 6a1ebbab0643fb2169314bcf1a0850b0f06dd27e Mon Sep 17 00:00:00 2001
2From: Ting Liu <b28495@freescale.com> 2From: Ting Liu <b28495@freescale.com>
3Date: Wed, 19 Dec 2012 04:39:57 -0600 3Date: Wed, 19 Dec 2012 04:39:57 -0600
4Subject: [PATCH 11/28] eglibc: run libm-err-tab.pl with specific dirs in ${S} 4Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S}
5 5
6libm-err-tab.pl will parse all the files named "libm-test-ulps" 6libm-err-tab.pl will parse all the files named "libm-test-ulps"
7in the given dir recursively. To avoid parsing the one in 7in the given dir recursively. To avoid parsing the one in
@@ -18,7 +18,7 @@ Signed-off-by: Ting Liu <b28495@freescale.com>
18 1 file changed, 2 insertions(+), 1 deletion(-) 18 1 file changed, 2 insertions(+), 1 deletion(-)
19 19
20diff --git a/manual/Makefile b/manual/Makefile 20diff --git a/manual/Makefile b/manual/Makefile
21index 4f76ee85d2..04b8c8c320 100644 21index c61e11dcd7..5d859e6f84 100644
22--- a/manual/Makefile 22--- a/manual/Makefile
23+++ b/manual/Makefile 23+++ b/manual/Makefile
24@@ -103,7 +103,8 @@ $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \ 24@@ -103,7 +103,8 @@ $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \
@@ -31,6 +31,3 @@ index 4f76ee85d2..04b8c8c320 100644
31 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi 31 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
32 touch $@ 32 touch $@
33 33
34--
352.22.0
36
diff --git a/meta/recipes-core/glibc/glibc/0012-__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 e233fbe542..b35de40eea 100644
--- a/meta/recipes-core/glibc/glibc/0012-__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,8 +1,8 @@
1From 376be7b96152ef501c8cf95ed6dc52c0318bd26a Mon Sep 17 00:00:00 2001 1From 106aee1de5c95fc9e02f10c05537dcc39f8478f4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:24:46 +0000 3Date: Wed, 18 Mar 2015 00:24:46 +0000
4Subject: [PATCH 12/28] __ieee754_sqrt{,f} are now inline functions and call 4Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
5 out __slow versions 5 __slow versions
6 6
7Upstream-Status: Pending 7Upstream-Status: Pending
8 8
@@ -56,6 +56,3 @@ index 812653558f..10de1f0cc3 100644
56 float b; 56 float b;
57 #endif 57 #endif
58 { 58 {
59--
602.22.0
61
diff --git a/meta/recipes-core/glibc/glibc/0013-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 9ba52e6e10..5669341916 100644
--- a/meta/recipes-core/glibc/glibc/0013-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,7 +1,7 @@
1From 1ba4e9577437632856d719cbd5d63b5a76cbb4c4 Mon Sep 17 00:00:00 2001 1From 6c07d094556606ce7c1dc08f4dd3bc6af483364f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:27:10 +0000 3Date: Wed, 18 Mar 2015 00:27:10 +0000
4Subject: [PATCH 13/28] sysdeps/gnu/configure.ac: handle correctly 4Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly
5 $libc_cv_rootsbindir 5 $libc_cv_rootsbindir
6 6
7Upstream-Status:Pending 7Upstream-Status:Pending
@@ -37,6 +37,3 @@ index 634fe4de2a..3db1697f4f 100644
37+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin 37+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
38 ;; 38 ;;
39 esac 39 esac
40--
412.22.0
42
diff --git a/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch b/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch
index 0a602bb38c..3e5bba5a59 100644
--- a/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch
+++ b/meta/recipes-core/glibc/glibc/0016-Add-unused-attribute.patch
@@ -1,7 +1,7 @@
1From b84999dcf642b07e6c14e6ff507be14743349949 Mon Sep 17 00:00:00 2001 1From 8a8c81ba4e652dddb730d3dad2fecab1ee65fd9c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:28:41 +0000 3Date: Wed, 18 Mar 2015 00:28:41 +0000
4Subject: [PATCH 14/28] Add unused attribute 4Subject: [PATCH] Add unused attribute
5 5
6Helps in avoiding gcc warning when header is is included in 6Helps in avoiding gcc warning when header is is included in
7a source file which does not use both functions 7a source file which does not use both functions
@@ -17,7 +17,7 @@ Upstream-Status: Pending
17 1 file changed, 1 insertion(+), 1 deletion(-) 17 1 file changed, 1 insertion(+), 1 deletion(-)
18 18
19diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h 19diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h
20index 91e0ad3141..2e9549fe49 100644 20index 348acc089b..fa92465d89 100644
21--- a/iconv/gconv_charset.h 21--- a/iconv/gconv_charset.h
22+++ b/iconv/gconv_charset.h 22+++ b/iconv/gconv_charset.h
23@@ -21,7 +21,7 @@ 23@@ -21,7 +21,7 @@
@@ -29,6 +29,3 @@ index 91e0ad3141..2e9549fe49 100644
29 strip (char *wp, const char *s) 29 strip (char *wp, const char *s)
30 { 30 {
31 int slash_count = 0; 31 int slash_count = 0;
32--
332.22.0
34
diff --git a/meta/recipes-core/glibc/glibc/0015-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 dd6562a631..0b626bdfac 100644
--- a/meta/recipes-core/glibc/glibc/0015-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,7 +1,7 @@
1From 7c57f84bef4aaffe4204a7a354411ab3ea7e5273 Mon Sep 17 00:00:00 2001 1From 601b2d11b6ddd974f0e1685f70e0d368e706d976 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:31:06 +0000 3Date: Wed, 18 Mar 2015 00:31:06 +0000
4Subject: [PATCH 15/28] 'yes' within the path sets wrong config variables 4Subject: [PATCH] 'yes' within the path sets wrong config variables
5 5
6It seems that the 'AC_EGREP_CPP(yes...' example is quite popular 6It seems that the 'AC_EGREP_CPP(yes...' example is quite popular
7but being such a short word to grep it is likely to produce 7but being such a short word to grep it is likely to produce
@@ -165,7 +165,7 @@ index f05f43802b..dc8639902d 100644
165 ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)]) 165 ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)])
166 if test $libc_cv_nios2_be = yes; then 166 if test $libc_cv_nios2_be = yes; then
167diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure 167diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
168index 1ee7f41a36..77e38bebde 100644 168index 25f98e0c7b..e95bfae359 100644
169--- a/sysdeps/unix/sysv/linux/mips/configure 169--- a/sysdeps/unix/sysv/linux/mips/configure
170+++ b/sysdeps/unix/sysv/linux/mips/configure 170+++ b/sysdeps/unix/sysv/linux/mips/configure
171@@ -414,11 +414,11 @@ else 171@@ -414,11 +414,11 @@ else
@@ -183,7 +183,7 @@ index 1ee7f41a36..77e38bebde 100644
183 else 183 else
184 libc_cv_mips_nan2008=no 184 libc_cv_mips_nan2008=no
185diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac 185diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac
186index 9147aa4582..7898e24738 100644 186index 3db1b32b08..f8cd375ebc 100644
187--- a/sysdeps/unix/sysv/linux/mips/configure.ac 187--- a/sysdeps/unix/sysv/linux/mips/configure.ac
188+++ b/sysdeps/unix/sysv/linux/mips/configure.ac 188+++ b/sysdeps/unix/sysv/linux/mips/configure.ac
189@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE( 189@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE(
@@ -258,6 +258,3 @@ index f9cba6e15d..b21f72f1e4 100644
258 #endif 258 #endif
259 ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)]) 259 ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)])
260 if test $libc_cv_ppc64_def_call_elf = no; then 260 if test $libc_cv_ppc64_def_call_elf = no; then
261--
2622.22.0
263
diff --git a/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch
index 4d1cf31973..f18c7a1107 100644
--- a/meta/recipes-core/glibc/glibc/0016-timezone-re-written-tzselect-as-posix-sh.patch
+++ b/meta/recipes-core/glibc/glibc/0018-timezone-re-written-tzselect-as-posix-sh.patch
@@ -1,7 +1,7 @@
1From a74f31ea9edf105f1a6dc26497aa2a12ae736660 Mon Sep 17 00:00:00 2001 1From 8678c584bca244fe9a3f8926eabb6b6c7e9784f1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:33:03 +0000 3Date: Wed, 18 Mar 2015 00:33:03 +0000
4Subject: [PATCH 16/28] timezone: re-written tzselect as posix sh 4Subject: [PATCH] timezone: re-written tzselect as posix sh
5 5
6To avoid the bash dependency. 6To avoid the bash dependency.
7 7
@@ -15,7 +15,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 2 files changed, 2 insertions(+), 2 deletions(-) 15 2 files changed, 2 insertions(+), 2 deletions(-)
16 16
17diff --git a/timezone/Makefile b/timezone/Makefile 17diff --git a/timezone/Makefile b/timezone/Makefile
18index 493deca790..36e559e16c 100644 18index 75f38df527..74e1ab7ff7 100644
19--- a/timezone/Makefile 19--- a/timezone/Makefile
20+++ b/timezone/Makefile 20+++ b/timezone/Makefile
21@@ -122,7 +122,7 @@ $(testdata)/XT%: testdata/XT% 21@@ -122,7 +122,7 @@ $(testdata)/XT%: testdata/XT%
@@ -40,6 +40,3 @@ index 18fce27e24..70745f9d36 100755
40 40
41 # Output one argument as-is to standard output. 41 # Output one argument as-is to standard output.
42 # Safer than 'echo', which can mishandle '\' or leading '-'. 42 # Safer than 'echo', which can mishandle '\' or leading '-'.
43--
442.22.0
45
diff --git a/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch
index e4f8a135d3..82026694de 100644
--- a/meta/recipes-core/glibc/glibc/0017-Remove-bash-dependency-for-nscd-init-script.patch
+++ b/meta/recipes-core/glibc/glibc/0019-Remove-bash-dependency-for-nscd-init-script.patch
@@ -1,7 +1,7 @@
1From 95882b9864ff20e476d15c6825c83728eb99597f Mon Sep 17 00:00:00 2001 1From a78f21f2f9b9246cd12b310833313328e8f646ed Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 14:33:02 -0800 3Date: Thu, 31 Dec 2015 14:33:02 -0800
4Subject: [PATCH 17/28] Remove bash dependency for nscd init script 4Subject: [PATCH] Remove bash dependency for nscd init script
5 5
6The nscd init script uses #! /bin/bash but only really uses one bashism 6The nscd init script uses #! /bin/bash but only really uses one bashism
7(translated strings), so remove them and switch the shell to #!/bin/sh. 7(translated strings), so remove them and switch the shell to #!/bin/sh.
@@ -70,6 +70,3 @@ index a882da7d8b..b02986ec15 100644
70 RETVAL=1 70 RETVAL=1
71 ;; 71 ;;
72 esac 72 esac
73--
742.22.0
75
diff --git a/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch
index b5efc43042..f8f3efe582 100644
--- a/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch
+++ b/meta/recipes-core/glibc/glibc/0020-eglibc-Cross-building-and-testing-instructions.patch
@@ -1,7 +1,7 @@
1From 6b603d25cc5723ba631dfc60b544774db1147d81 Mon Sep 17 00:00:00 2001 1From 7c48f61b0c5ef6274df4b03609991d383adc5df0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:42:58 +0000 3Date: Wed, 18 Mar 2015 00:42:58 +0000
4Subject: [PATCH 18/28] eglibc: Cross building and testing instructions 4Subject: [PATCH] eglibc: Cross building and testing instructions
5 5
6Ported from eglibc 6Ported from eglibc
7Upstream-Status: Pending 7Upstream-Status: Pending
@@ -614,6 +614,3 @@ index 0000000000..b67b468466
614+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we 614+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we
615+ simply place copies of these libraries in the top GLIBC build 615+ simply place copies of these libraries in the top GLIBC build
616+ directory. 616+ directory.
617--
6182.22.0
619
diff --git a/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch
index 0333db2814..02e5def339 100644
--- a/meta/recipes-core/glibc/glibc/0019-eglibc-Help-bootstrap-cross-toolchain.patch
+++ b/meta/recipes-core/glibc/glibc/0021-eglibc-Help-bootstrap-cross-toolchain.patch
@@ -1,7 +1,7 @@
1From 2864aaae984d945445f3f79869c703e0b791df88 Mon Sep 17 00:00:00 2001 1From 86a6e94e86664976b305c24e5a52093fe962240a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:49:28 +0000 3Date: Wed, 18 Mar 2015 00:49:28 +0000
4Subject: [PATCH 19/28] eglibc: Help bootstrap cross toolchain 4Subject: [PATCH] eglibc: Help bootstrap cross toolchain
5 5
6Taken from EGLIBC, r1484 + r1525 6Taken from EGLIBC, r1484 + r1525
7 7
@@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
29 create mode 100644 include/stubs-bootstrap.h 29 create mode 100644 include/stubs-bootstrap.h
30 30
31diff --git a/Makefile b/Makefile 31diff --git a/Makefile b/Makefile
32index 9fbf705200..64bfd455bc 100644 32index 8f0a93aceb..8eba23a868 100644
33--- a/Makefile 33--- a/Makefile
34+++ b/Makefile 34+++ b/Makefile
35@@ -70,9 +70,18 @@ subdir-dirs = include 35@@ -79,9 +79,18 @@ subdir-dirs = include
36 vpath %.h $(subdir-dirs) 36 vpath %.h $(subdir-dirs)
37 37
38 # What to install. 38 # What to install.
@@ -52,7 +52,7 @@ index 9fbf705200..64bfd455bc 100644
52 ifeq (yes,$(build-shared)) 52 ifeq (yes,$(build-shared))
53 headers += gnu/lib-names.h 53 headers += gnu/lib-names.h
54 endif 54 endif
55@@ -196,6 +205,16 @@ others: $(common-objpfx)testrun.sh 55@@ -407,6 +416,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
56 56
57 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) 57 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
58 58
@@ -69,7 +69,7 @@ index 9fbf705200..64bfd455bc 100644
69 ifndef abi-variants 69 ifndef abi-variants
70 installed-stubs = $(inst_includedir)/gnu/stubs.h 70 installed-stubs = $(inst_includedir)/gnu/stubs.h
71 else 71 else
72@@ -222,6 +241,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) 72@@ -433,6 +452,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
73 73
74 install-others-nosubdir: $(installed-stubs) 74 install-others-nosubdir: $(installed-stubs)
75 endif 75 endif
@@ -95,6 +95,3 @@ index 0000000000..1d2b669aff
95+ difficult headers. The <gnu/stubs.h> header depends, via the 95+ difficult headers. The <gnu/stubs.h> header depends, via the
96+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but 96+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
97+ an empty stubs.h like this will do fine for GCC. */ 97+ an empty stubs.h like this will do fine for GCC. */
98--
992.22.0
100
diff --git a/meta/recipes-core/glibc/glibc/0020-eglibc-Clear-cache-lines-on-ppc8xx.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
index 965ad6578e..913aea9563 100644
--- a/meta/recipes-core/glibc/glibc/0020-eglibc-Clear-cache-lines-on-ppc8xx.patch
+++ b/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
@@ -1,7 +1,7 @@
1From e2667086bf984de4d3f1226b9467761cd5a4c39f Mon Sep 17 00:00:00 2001 1From b397d653670dd02d8310e1d6f0f19a8da90ebafa Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 15:15:09 -0800 3Date: Thu, 31 Dec 2015 15:15:09 -0800
4Subject: [PATCH 20/28] eglibc: Clear cache lines on ppc8xx 4Subject: [PATCH] eglibc: Clear cache lines on ppc8xx
5 5
62007-06-13 Nathan Sidwell <nathan@codesourcery.com> 62007-06-13 Nathan Sidwell <nathan@codesourcery.com>
7 Mark Shinwell <shinwell@codesourcery.com> 7 Mark Shinwell <shinwell@codesourcery.com>
@@ -21,7 +21,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
21 2 files changed, 28 insertions(+), 2 deletions(-) 21 2 files changed, 28 insertions(+), 2 deletions(-)
22 22
23diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 23diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
24index b04ecc4a4c..75bda97241 100644 24index 5d65bc6303..c786f9aa7e 100644
25--- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 25--- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
26+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 26+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
27@@ -24,9 +24,21 @@ int __cache_line_size attribute_hidden; 27@@ -24,9 +24,21 @@ int __cache_line_size attribute_hidden;
@@ -48,7 +48,7 @@ index b04ecc4a4c..75bda97241 100644
48 break; 48 break;
49 49
50diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c 50diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
51index 4fd5f70700..1a21e4675c 100644 51index 93f8659fa6..9bb07b36be 100644
52--- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c 52--- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
53+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c 53+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
54@@ -73,11 +73,25 @@ __libc_start_main (int argc, char **argv, 54@@ -73,11 +73,25 @@ __libc_start_main (int argc, char **argv,
@@ -78,6 +78,3 @@ index 4fd5f70700..1a21e4675c 100644
78 __cache_line_size = av->a_un.a_val; 78 __cache_line_size = av->a_un.a_val;
79 break; 79 break;
80 #ifndef SHARED 80 #ifndef SHARED
81--
822.22.0
83
diff --git a/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch
index 76551cf559..cc8ddeea6f 100644
--- a/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch
+++ b/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch
@@ -1,7 +1,7 @@
1From b7290e54a1bda7a0212131655bc27926fc22de22 Mon Sep 17 00:00:00 2001 1From 02b69fc14ae1d6309e4e17081842b1f89bd40338 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:55:53 +0000 3Date: Wed, 18 Mar 2015 00:55:53 +0000
4Subject: [PATCH 21/28] eglibc: Resolve __fpscr_values on SH4 4Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
5 5
62010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> 62010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 Andrew Stubbs <ams@codesourcery.com> 7 Andrew Stubbs <ams@codesourcery.com>
@@ -33,7 +33,7 @@ index e0938c4165..ca1d7da339 100644
33 # a* 33 # a*
34 alphasort64; 34 alphasort64;
35diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S 35diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
36index 6ce36d6dd5..425811cc77 100644 36index 85ff3f900e..7743b8d57a 100644
37--- a/sysdeps/unix/sysv/linux/sh/sysdep.S 37--- a/sysdeps/unix/sysv/linux/sh/sysdep.S
38+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S 38+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
39@@ -30,3 +30,14 @@ ENTRY (__syscall_error) 39@@ -30,3 +30,14 @@ ENTRY (__syscall_error)
@@ -51,6 +51,3 @@ index 6ce36d6dd5..425811cc77 100644
51+ .long 0x80000 51+ .long 0x80000
52+weak_alias (___fpscr_values, __fpscr_values) 52+weak_alias (___fpscr_values, __fpscr_values)
53+ 53+
54--
552.22.0
56
diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
index c46021a478..72278a6822 100644
--- a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch
+++ b/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-cross-locale-generation-support.patch
@@ -1,14 +1,14 @@
1From be382b4e0c6de52573f7e037f2d4ff9b1b5bbb6b Mon Sep 17 00:00:00 2001 1From 42fc64ee872491667749499db50e3c51d6a4bfb3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:33:49 +0000 3Date: Wed, 18 Mar 2015 01:33:49 +0000
4Subject: [PATCH 22/28] eglibc: Forward port cross locale generation support 4Subject: [PATCH] eglibc: Forward port cross locale generation support
5 5
6Upstream-Status: Pending 6Upstream-Status: Pending
7 7
8Signed-off-by: Khem Raj <raj.khem@gmail.com> 8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9--- 9---
10 locale/Makefile | 3 +- 10 locale/Makefile | 3 +-
11 locale/catnames.c | 48 ++++++++++++++++++++++++++++ 11 locale/catnames.c | 46 +++++++++++++++++++++++++++
12 locale/localeinfo.h | 2 +- 12 locale/localeinfo.h | 2 +-
13 locale/programs/charmap-dir.c | 6 ++++ 13 locale/programs/charmap-dir.c | 6 ++++
14 locale/programs/ld-collate.c | 17 +++++----- 14 locale/programs/ld-collate.c | 17 +++++-----
@@ -18,12 +18,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
18 locale/programs/localedef.c | 8 +++++ 18 locale/programs/localedef.c | 8 +++++
19 locale/programs/locfile.c | 5 ++- 19 locale/programs/locfile.c | 5 ++-
20 locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- 20 locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++--
21 locale/setlocale.c | 30 ------------------ 21 locale/setlocale.c | 29 -----------------
22 12 files changed, 169 insertions(+), 69 deletions(-) 22 12 files changed, 167 insertions(+), 68 deletions(-)
23 create mode 100644 locale/catnames.c 23 create mode 100644 locale/catnames.c
24 24
25diff --git a/locale/Makefile b/locale/Makefile 25diff --git a/locale/Makefile b/locale/Makefile
26index d78cf9b83a..e166f5252e 100644 26index c9694e236e..ba7105fad6 100644
27--- a/locale/Makefile 27--- a/locale/Makefile
28+++ b/locale/Makefile 28+++ b/locale/Makefile
29@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ 29@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \
@@ -38,10 +38,10 @@ index d78cf9b83a..e166f5252e 100644
38 address telephone measurement identification collate 38 address telephone measurement identification collate
39diff --git a/locale/catnames.c b/locale/catnames.c 39diff --git a/locale/catnames.c b/locale/catnames.c
40new file mode 100644 40new file mode 100644
41index 0000000000..9fad357db1 41index 0000000000..538f3f5edb
42--- /dev/null 42--- /dev/null
43+++ b/locale/catnames.c 43+++ b/locale/catnames.c
44@@ -0,0 +1,48 @@ 44@@ -0,0 +1,46 @@
45+/* Copyright (C) 2006 Free Software Foundation, Inc. 45+/* Copyright (C) 2006 Free Software Foundation, Inc.
46+ This file is part of the GNU C Library. 46+ This file is part of the GNU C Library.
47+ 47+
@@ -63,20 +63,18 @@ index 0000000000..9fad357db1
63+#include "localeinfo.h" 63+#include "localeinfo.h"
64+ 64+
65+/* Define an array of category names (also the environment variable names). */ 65+/* Define an array of category names (also the environment variable names). */
66+const union catnamestr_t _nl_category_names attribute_hidden = 66+const struct catnamestr_t _nl_category_names attribute_hidden =
67+ { 67+ {
68+ {
69+#define DEFINE_CATEGORY(category, category_name, items, a) \ 68+#define DEFINE_CATEGORY(category, category_name, items, a) \
70+ category_name, 69+ category_name,
71+#include "categories.def" 70+#include "categories.def"
72+#undef DEFINE_CATEGORY 71+#undef DEFINE_CATEGORY
73+ }
74+ }; 72+ };
75+ 73+
76+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = 74+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
77+ { 75+ {
78+#define DEFINE_CATEGORY(category, category_name, items, a) \ 76+#define DEFINE_CATEGORY(category, category_name, items, a) \
79+ [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)), 77+ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)),
80+#include "categories.def" 78+#include "categories.def"
81+#undef DEFINE_CATEGORY 79+#undef DEFINE_CATEGORY
82+ }; 80+ };
@@ -91,10 +89,10 @@ index 0000000000..9fad357db1
91+ [LC_ALL] = sizeof ("LC_ALL") - 1 89+ [LC_ALL] = sizeof ("LC_ALL") - 1
92+ }; 90+ };
93diff --git a/locale/localeinfo.h b/locale/localeinfo.h 91diff --git a/locale/localeinfo.h b/locale/localeinfo.h
94index 53cb8bfc59..92c466200c 100644 92index fdc283c69a..4eeed35f90 100644
95--- a/locale/localeinfo.h 93--- a/locale/localeinfo.h
96+++ b/locale/localeinfo.h 94+++ b/locale/localeinfo.h
97@@ -224,7 +224,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) 95@@ -230,7 +230,7 @@ __libc_tsd_define (extern, locale_t, LOCALE)
98 unused. We can manage this playing some tricks with weak references. 96 unused. We can manage this playing some tricks with weak references.
99 But with thread-local locale settings, it becomes quite ungainly unless 97 But with thread-local locale settings, it becomes quite ungainly unless
100 we can use __thread variables. So only in that case do we attempt this. */ 98 we can use __thread variables. So only in that case do we attempt this. */
@@ -104,7 +102,7 @@ index 53cb8bfc59..92c466200c 100644
104 # define NL_CURRENT_INDIRECT 1 102 # define NL_CURRENT_INDIRECT 1
105 #endif 103 #endif
106diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c 104diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
107index 94c122df68..80e53e12c8 100644 105index 1a526a240d..0fb2daf936 100644
108--- a/locale/programs/charmap-dir.c 106--- a/locale/programs/charmap-dir.c
109+++ b/locale/programs/charmap-dir.c 107+++ b/locale/programs/charmap-dir.c
110@@ -18,7 +18,9 @@ 108@@ -18,7 +18,9 @@
@@ -150,7 +148,7 @@ index 94c122df68..80e53e12c8 100644
150 return NULL; 148 return NULL;
151 } 149 }
152diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c 150diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
153index 6baab6cfb0..b12a2fceab 100644 151index feb1a11258..5a8e522470 100644
154--- a/locale/programs/ld-collate.c 152--- a/locale/programs/ld-collate.c
155+++ b/locale/programs/ld-collate.c 153+++ b/locale/programs/ld-collate.c
156@@ -349,7 +349,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen, 154@@ -349,7 +349,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
@@ -199,7 +197,7 @@ index 6baab6cfb0..b12a2fceab 100644
199 == runp->wcnext->wcs[runp->nwcs - 1] + 1)); 197 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
200 198
201diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c 199diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
202index cfc9c43fd5..6572cc199c 100644 200index 3328093d0e..d58fb0f4b7 100644
203--- a/locale/programs/ld-ctype.c 201--- a/locale/programs/ld-ctype.c
204+++ b/locale/programs/ld-ctype.c 202+++ b/locale/programs/ld-ctype.c
205@@ -915,7 +915,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, 203@@ -915,7 +915,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
@@ -281,7 +279,7 @@ index cfc9c43fd5..6572cc199c 100644
281 srunp = srunp->next; 279 srunp = srunp->next;
282 } 280 }
283diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c 281diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
284index 8e9849fdba..028d3efa9f 100644 282index f7db873adb..fec3773c9d 100644
285--- a/locale/programs/ld-time.c 283--- a/locale/programs/ld-time.c
286+++ b/locale/programs/ld-time.c 284+++ b/locale/programs/ld-time.c
287@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME"); 285@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME");
@@ -350,7 +348,7 @@ index 8e9849fdba..028d3efa9f 100644
350 348
351 349
352diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c 350diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
353index ed3a9731d0..3178ea057a 100644 351index 7ebd933801..5753750756 100644
354--- a/locale/programs/linereader.c 352--- a/locale/programs/linereader.c
355+++ b/locale/programs/linereader.c 353+++ b/locale/programs/linereader.c
356@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, 354@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
@@ -363,7 +361,7 @@ index ed3a9731d0..3178ea057a 100644
363 size_t bufmax = 56; 361 size_t bufmax = 56;
364 362
365diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c 363diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
366index b7bcef8248..efeced1e0f 100644 364index dbbb0145c0..097a8b6193 100644
367--- a/locale/programs/localedef.c 365--- a/locale/programs/localedef.c
368+++ b/locale/programs/localedef.c 366+++ b/locale/programs/localedef.c
369@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; 367@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
@@ -409,7 +407,7 @@ index b7bcef8248..efeced1e0f 100644
409 force_output = 1; 407 force_output = 1;
410 break; 408 break;
411diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c 409diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
412index e4ba48e968..e7b0efe887 100644 410index eb2f4634da..d387147323 100644
413--- a/locale/programs/locfile.c 411--- a/locale/programs/locfile.c
414+++ b/locale/programs/locfile.c 412+++ b/locale/programs/locfile.c
415@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, 413@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
@@ -432,7 +430,7 @@ index e4ba48e968..e7b0efe887 100644
432 430
433 /* Record that FILE's next element is the 32-bit integer VALUE. */ 431 /* Record that FILE's next element is the 32-bit integer VALUE. */
434diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h 432diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
435index c063fc097d..4e7465e55a 100644 433index 7ea10038b4..0888c09762 100644
436--- a/locale/programs/locfile.h 434--- a/locale/programs/locfile.h
437+++ b/locale/programs/locfile.h 435+++ b/locale/programs/locfile.h
438@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions, 436@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions,
@@ -521,28 +519,27 @@ index c063fc097d..4e7465e55a 100644
521+ 519+
522 #endif /* locfile.h */ 520 #endif /* locfile.h */
523diff --git a/locale/setlocale.c b/locale/setlocale.c 521diff --git a/locale/setlocale.c b/locale/setlocale.c
524index 9bd35454b9..2a67dc6589 100644 522index 030f1727bd..096d8ed895 100644
525--- a/locale/setlocale.c 523--- a/locale/setlocale.c
526+++ b/locale/setlocale.c 524+++ b/locale/setlocale.c
527@@ -64,36 +64,6 @@ static char *const _nl_current_used[] = 525@@ -63,35 +63,6 @@ static char *const _nl_current_used[] =
528 #endif
529 526
527 #endif
530 528
529-
531-/* Define an array of category names (also the environment variable names). */ 530-/* Define an array of category names (also the environment variable names). */
532-const union catnamestr_t _nl_category_names attribute_hidden = 531-const struct catnamestr_t _nl_category_names attribute_hidden =
533- { 532- {
534- {
535-#define DEFINE_CATEGORY(category, category_name, items, a) \ 533-#define DEFINE_CATEGORY(category, category_name, items, a) \
536- category_name, 534- category_name,
537-#include "categories.def" 535-#include "categories.def"
538-#undef DEFINE_CATEGORY 536-#undef DEFINE_CATEGORY
539- }
540- }; 537- };
541- 538-
542-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = 539-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
543- { 540- {
544-#define DEFINE_CATEGORY(category, category_name, items, a) \ 541-#define DEFINE_CATEGORY(category, category_name, items, a) \
545- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)), 542- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)),
546-#include "categories.def" 543-#include "categories.def"
547-#undef DEFINE_CATEGORY 544-#undef DEFINE_CATEGORY
548- }; 545- };
@@ -561,6 +558,3 @@ index 9bd35454b9..2a67dc6589 100644
561 #ifdef NL_CURRENT_INDIRECT 558 #ifdef NL_CURRENT_INDIRECT
562 # define WEAK_POSTLOAD(postload) weak_extern (postload) 559 # define WEAK_POSTLOAD(postload) weak_extern (postload)
563 #else 560 #else
564--
5652.22.0
566
diff --git a/meta/recipes-core/glibc/glibc/0023-Define-DUMMY_LOCALE_T-if-not-defined.patch b/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
index 17667da99f..d359518751 100644
--- a/meta/recipes-core/glibc/glibc/0023-Define-DUMMY_LOCALE_T-if-not-defined.patch
+++ b/meta/recipes-core/glibc/glibc/0025-Define-DUMMY_LOCALE_T-if-not-defined.patch
@@ -1,7 +1,7 @@
1From afa8d6faeddeb80aca318b33edf49d9f8ce65761 Mon Sep 17 00:00:00 2001 1From 5e565710aa061ffffd34d8400910c35a8d50a4ec Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 20 Apr 2016 21:11:00 -0700 3Date: Wed, 20 Apr 2016 21:11:00 -0700
4Subject: [PATCH 23/28] Define DUMMY_LOCALE_T if not defined 4Subject: [PATCH] Define DUMMY_LOCALE_T if not defined
5 5
6This is a hack to fix building the locale bits on an older 6This is a hack to fix building the locale bits on an older
7CentOs 5.X machine 7CentOs 5.X machine
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 3 insertions(+) 14 1 file changed, 3 insertions(+)
15 15
16diff --git a/locale/programs/config.h b/locale/programs/config.h 16diff --git a/locale/programs/config.h b/locale/programs/config.h
17index a1e6e0ec3c..7f75528eae 100644 17index d76d9f7e8b..92b56d7df3 100644
18--- a/locale/programs/config.h 18--- a/locale/programs/config.h
19+++ b/locale/programs/config.h 19+++ b/locale/programs/config.h
20@@ -19,6 +19,9 @@ 20@@ -19,6 +19,9 @@
@@ -27,6 +27,3 @@ index a1e6e0ec3c..7f75528eae 100644
27 /* Use the internal textdomain used for libc messages. */ 27 /* Use the internal textdomain used for libc messages. */
28 #define PACKAGE _libc_intl_domainname 28 #define PACKAGE _libc_intl_domainname
29 #ifndef VERSION 29 #ifndef VERSION
30--
312.22.0
32
diff --git a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
index f68e4f4fa6..8df09d82ee 100644
--- a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
+++ b/meta/recipes-core/glibc/glibc/0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
@@ -1,8 +1,7 @@
1From c13e18adb634a6fd59129150ab7f9468f64dc931 Mon Sep 17 00:00:00 2001 1From c5b63c8eafc00e01556edd2acff4c541448924cf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Aug 2018 09:42:06 -0700 3Date: Fri, 3 Aug 2018 09:42:06 -0700
4Subject: [PATCH 24/28] localedef --add-to-archive uses a hard-coded locale 4Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
5 path
6 5
7it doesn't exist in normal use, and there's no way to pass an 6it doesn't exist in normal use, and there's no way to pass an
8alternative filename. 7alternative filename.
@@ -19,7 +18,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 1 file changed, 25 insertions(+), 10 deletions(-) 18 1 file changed, 25 insertions(+), 10 deletions(-)
20 19
21diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c 20diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
22index e6310b18be..f54a76eade 100644 21index dccaf04e3b..ae0b7fe155 100644
23--- a/locale/programs/locarchive.c 22--- a/locale/programs/locarchive.c
24+++ b/locale/programs/locarchive.c 23+++ b/locale/programs/locarchive.c
25@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) 24@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
@@ -79,6 +78,3 @@ index e6310b18be..f54a76eade 100644
79 { 78 {
80 if (readonly) 79 if (readonly)
81 { 80 {
82--
832.22.0
84
diff --git a/meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch b/meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
index 76a9eb2563..55250d8d8e 100644
--- a/meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
+++ b/meta/recipes-core/glibc/glibc/0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
@@ -1,7 +1,7 @@
1From 7c9ebe966bb97dd14de5719905b61311211ae3c8 Mon Sep 17 00:00:00 2001 1From d3349ae8d9b17fecf6ef560b845d04d682db291c Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@windriver.com> 2From: Mark Hatle <mark.hatle@windriver.com>
3Date: Thu, 18 Aug 2016 14:07:58 -0500 3Date: Thu, 18 Aug 2016 14:07:58 -0500
4Subject: [PATCH 25/28] elf/dl-deps.c: Make _dl_build_local_scope breadth first 4Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first
5 5
6According to the ELF specification: 6According to the ELF specification:
7 7
@@ -24,7 +24,7 @@ Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
24 1 file changed, 10 insertions(+), 4 deletions(-) 24 1 file changed, 10 insertions(+), 4 deletions(-)
25 25
26diff --git a/elf/dl-deps.c b/elf/dl-deps.c 26diff --git a/elf/dl-deps.c b/elf/dl-deps.c
27index e12c353158..9234daac05 100644 27index 5103a8a111..54cd80aaff 100644
28--- a/elf/dl-deps.c 28--- a/elf/dl-deps.c
29+++ b/elf/dl-deps.c 29+++ b/elf/dl-deps.c
30@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map) 30@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map)
@@ -51,6 +51,3 @@ index e12c353158..9234daac05 100644
51 return p - list; 51 return p - list;
52 } 52 }
53 53
54--
552.22.0
56
diff --git a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch b/meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch
index 7589e11d57..06d23c988d 100644
--- a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch
+++ b/meta/recipes-core/glibc/glibc/0028-intl-Emit-no-lines-in-bison-generated-files.patch
@@ -1,7 +1,7 @@
1From aa5c758fbb7dbb026df33fc6bdc05548547bdb17 Mon Sep 17 00:00:00 2001 1From 3650ad7f01509138aa72f235e680c9d4f6c09a7d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Aug 2018 09:44:00 -0700 3Date: Fri, 3 Aug 2018 09:44:00 -0700
4Subject: [PATCH 26/28] intl: Emit no lines in bison generated files 4Subject: [PATCH] intl: Emit no lines in bison generated files
5 5
6Improve reproducibility: 6Improve reproducibility:
7Do not put any #line preprocessor commands in bison generated files. 7Do not put any #line preprocessor commands in bison generated files.
@@ -17,7 +17,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 1 file changed, 1 insertion(+), 1 deletion(-) 17 1 file changed, 1 insertion(+), 1 deletion(-)
18 18
19diff --git a/intl/Makefile b/intl/Makefile 19diff --git a/intl/Makefile b/intl/Makefile
20index 9eea8d57e3..627dce4cf1 100644 20index ce3072420f..58457840d9 100644
21--- a/intl/Makefile 21--- a/intl/Makefile
22+++ b/intl/Makefile 22+++ b/intl/Makefile
23@@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out 23@@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
@@ -29,6 +29,3 @@ index 9eea8d57e3..627dce4cf1 100644
29 29
30 $(inst_localedir)/locale.alias: locale.alias $(+force) 30 $(inst_localedir)/locale.alias: locale.alias $(+force)
31 $(do-install) 31 $(do-install)
32--
332.22.0
34
diff --git a/meta/recipes-core/glibc/glibc/0027-inject-file-assembly-directives.patch b/meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch
index dc205a833f..62e615786d 100644
--- a/meta/recipes-core/glibc/glibc/0027-inject-file-assembly-directives.patch
+++ b/meta/recipes-core/glibc/glibc/0029-inject-file-assembly-directives.patch
@@ -1,7 +1,7 @@
1From fecd98040a2ae1bc5943a40a1623d76a696e0785 Mon Sep 17 00:00:00 2001 1From a9be0c7c67e67d870e2c5e0ece4f6ac76e5c0fe2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 29 Nov 2018 17:29:35 -0800 3Date: Thu, 29 Nov 2018 17:29:35 -0800
4Subject: [PATCH 27/28] inject file assembly directives 4Subject: [PATCH] inject file assembly directives
5 5
6Currently, non-IA builds are not reproducibile since build paths are 6Currently, non-IA builds are not reproducibile since build paths are
7being injected into the debug symbols. These are coming from the use of 7being injected into the debug symbols. These are coming from the use of
@@ -48,7 +48,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
48 20 files changed, 40 insertions(+) 48 20 files changed, 40 insertions(+)
49 49
50diff --git a/csu/abi-note.S b/csu/abi-note.S 50diff --git a/csu/abi-note.S b/csu/abi-note.S
51index fa1f014a88..098731362a 100644 51index 2b4b5f8824..964843016c 100644
52--- a/csu/abi-note.S 52--- a/csu/abi-note.S
53+++ b/csu/abi-note.S 53+++ b/csu/abi-note.S
54@@ -56,6 +56,8 @@ offset length contents 54@@ -56,6 +56,8 @@ offset length contents
@@ -61,7 +61,7 @@ index fa1f014a88..098731362a 100644
61 name begins with `.note' and creates a PT_NOTE program header entry 61 name begins with `.note' and creates a PT_NOTE program header entry
62 pointing at it. */ 62 pointing at it. */
63diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S 63diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S
64index d4e7dfcf5c..e0218df30c 100644 64index 1728eac37a..76a8ab590b 100644
65--- a/sysdeps/aarch64/crti.S 65--- a/sysdeps/aarch64/crti.S
66+++ b/sysdeps/aarch64/crti.S 66+++ b/sysdeps/aarch64/crti.S
67@@ -50,6 +50,8 @@ 67@@ -50,6 +50,8 @@
@@ -74,7 +74,7 @@ index d4e7dfcf5c..e0218df30c 100644
74 weak_extern (PREINIT_FUNCTION) 74 weak_extern (PREINIT_FUNCTION)
75 #else 75 #else
76diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S 76diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S
77index 363f752460..2fb06fba62 100644 77index c3e97cc449..fc2e5c2df8 100644
78--- a/sysdeps/aarch64/crtn.S 78--- a/sysdeps/aarch64/crtn.S
79+++ b/sysdeps/aarch64/crtn.S 79+++ b/sysdeps/aarch64/crtn.S
80@@ -37,6 +37,8 @@ 80@@ -37,6 +37,8 @@
@@ -87,7 +87,7 @@ index 363f752460..2fb06fba62 100644
87 ldp x29, x30, [sp], 16 87 ldp x29, x30, [sp], 16
88 RET 88 RET
89diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S 89diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
90index 4abe6b82a3..8c44b2ff8a 100644 90index 557ad1d505..194a8531da 100644
91--- a/sysdeps/aarch64/dl-tlsdesc.S 91--- a/sysdeps/aarch64/dl-tlsdesc.S
92+++ b/sysdeps/aarch64/dl-tlsdesc.S 92+++ b/sysdeps/aarch64/dl-tlsdesc.S
93@@ -22,6 +22,8 @@ 93@@ -22,6 +22,8 @@
@@ -100,7 +100,7 @@ index 4abe6b82a3..8c44b2ff8a 100644
100 #define SAVE_Q_REGISTERS \ 100 #define SAVE_Q_REGISTERS \
101 stp q0, q1, [sp, #-32*NSAVEDQREGPAIRS]!; \ 101 stp q0, q1, [sp, #-32*NSAVEDQREGPAIRS]!; \
102diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S 102diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
103index 19b117e8f9..38c78b5409 100644 103index 94e965c096..ba18742f3e 100644
104--- a/sysdeps/aarch64/dl-trampoline.S 104--- a/sysdeps/aarch64/dl-trampoline.S
105+++ b/sysdeps/aarch64/dl-trampoline.S 105+++ b/sysdeps/aarch64/dl-trampoline.S
106@@ -21,6 +21,8 @@ 106@@ -21,6 +21,8 @@
@@ -113,7 +113,7 @@ index 19b117e8f9..38c78b5409 100644
113 #define ip0l PTR_REG (16) 113 #define ip0l PTR_REG (16)
114 #define ip1 x17 114 #define ip1 x17
115diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S 115diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
116index f5e9b9c223..ae3e22a6a5 100644 116index d96cf57e2d..07a523978a 100644
117--- a/sysdeps/aarch64/start.S 117--- a/sysdeps/aarch64/start.S
118+++ b/sysdeps/aarch64/start.S 118+++ b/sysdeps/aarch64/start.S
119@@ -18,6 +18,8 @@ 119@@ -18,6 +18,8 @@
@@ -136,7 +136,7 @@ index 07bd4c4619..7213b16f27 100644
136 alignment in any callee. */ 136 alignment in any callee. */
137 .eabi_attribute 25, 1 137 .eabi_attribute 25, 1
138diff --git a/sysdeps/arm/crti.S b/sysdeps/arm/crti.S 138diff --git a/sysdeps/arm/crti.S b/sysdeps/arm/crti.S
139index 26dbba66a3..dd84ecd566 100644 139index 8169783267..f56e0c85a6 100644
140--- a/sysdeps/arm/crti.S 140--- a/sysdeps/arm/crti.S
141+++ b/sysdeps/arm/crti.S 141+++ b/sysdeps/arm/crti.S
142@@ -57,6 +57,8 @@ 142@@ -57,6 +57,8 @@
@@ -149,7 +149,7 @@ index 26dbba66a3..dd84ecd566 100644
149 .p2align 2 149 .p2align 2
150 .type call_weak_fn, %function 150 .type call_weak_fn, %function
151diff --git a/sysdeps/arm/crtn.S b/sysdeps/arm/crtn.S 151diff --git a/sysdeps/arm/crtn.S b/sysdeps/arm/crtn.S
152index 8f91c8d88b..a87fe49e07 100644 152index d60f9f05de..1e10ec439f 100644
153--- a/sysdeps/arm/crtn.S 153--- a/sysdeps/arm/crtn.S
154+++ b/sysdeps/arm/crtn.S 154+++ b/sysdeps/arm/crtn.S
155@@ -37,6 +37,8 @@ 155@@ -37,6 +37,8 @@
@@ -162,7 +162,7 @@ index 8f91c8d88b..a87fe49e07 100644
162 corresponding to the prologues in crti.S. */ 162 corresponding to the prologues in crti.S. */
163 163
164diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S 164diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S
165index a929340b42..b724c9776d 100644 165index 8415e47607..29c2cb8128 100644
166--- a/sysdeps/arm/dl-tlsdesc.S 166--- a/sysdeps/arm/dl-tlsdesc.S
167+++ b/sysdeps/arm/dl-tlsdesc.S 167+++ b/sysdeps/arm/dl-tlsdesc.S
168@@ -21,6 +21,8 @@ 168@@ -21,6 +21,8 @@
@@ -175,7 +175,7 @@ index a929340b42..b724c9776d 100644
175 @ emit debug information with cfi 175 @ emit debug information with cfi
176 @ use arm-specific pseudos for unwinding itself 176 @ use arm-specific pseudos for unwinding itself
177diff --git a/sysdeps/arm/dl-trampoline.S b/sysdeps/arm/dl-trampoline.S 177diff --git a/sysdeps/arm/dl-trampoline.S b/sysdeps/arm/dl-trampoline.S
178index 325cfcd2ce..4bfdcbce51 100644 178index a20baf555e..2dd3bef04e 100644
179--- a/sysdeps/arm/dl-trampoline.S 179--- a/sysdeps/arm/dl-trampoline.S
180+++ b/sysdeps/arm/dl-trampoline.S 180+++ b/sysdeps/arm/dl-trampoline.S
181@@ -21,6 +21,8 @@ 181@@ -21,6 +21,8 @@
@@ -188,7 +188,7 @@ index 325cfcd2ce..4bfdcbce51 100644
188 .globl _dl_runtime_resolve 188 .globl _dl_runtime_resolve
189 .type _dl_runtime_resolve, #function 189 .type _dl_runtime_resolve, #function
190diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S 190diff --git a/sysdeps/arm/start.S b/sysdeps/arm/start.S
191index a05f8a4651..2f4374fcaa 100644 191index 2ff56179d2..c118046ec6 100644
192--- a/sysdeps/arm/start.S 192--- a/sysdeps/arm/start.S
193+++ b/sysdeps/arm/start.S 193+++ b/sysdeps/arm/start.S
194@@ -57,6 +57,8 @@ 194@@ -57,6 +57,8 @@
@@ -201,7 +201,7 @@ index a05f8a4651..2f4374fcaa 100644
201 alignment in any callee. */ 201 alignment in any callee. */
202 .eabi_attribute 25, 1 202 .eabi_attribute 25, 1
203diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S 203diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S
204index 8638e5b545..93f6564aec 100644 204index fabc8080df..83c6b91d7d 100644
205--- a/sysdeps/mips/start.S 205--- a/sysdeps/mips/start.S
206+++ b/sysdeps/mips/start.S 206+++ b/sysdeps/mips/start.S
207@@ -38,6 +38,8 @@ 207@@ -38,6 +38,8 @@
@@ -214,7 +214,7 @@ index 8638e5b545..93f6564aec 100644
214 #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. 214 #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
215 #endif 215 #endif
216diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S 216diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S
217index 99a10d643a..e47fc0d245 100644 217index c15242d3bc..6ca27715a4 100644
218--- a/sysdeps/powerpc/powerpc32/dl-start.S 218--- a/sysdeps/powerpc/powerpc32/dl-start.S
219+++ b/sysdeps/powerpc/powerpc32/dl-start.S 219+++ b/sysdeps/powerpc/powerpc32/dl-start.S
220@@ -18,6 +18,8 @@ 220@@ -18,6 +18,8 @@
@@ -227,7 +227,7 @@ index 99a10d643a..e47fc0d245 100644
227 The C function `_dl_start' is the real entry point; 227 The C function `_dl_start' is the real entry point;
228 its return value is the user program's entry point. */ 228 its return value is the user program's entry point. */
229diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S 229diff --git a/sysdeps/powerpc/powerpc32/start.S b/sysdeps/powerpc/powerpc32/start.S
230index 172fb5a56b..ef1471b861 100644 230index b7b9a133a2..8df714f81a 100644
231--- a/sysdeps/powerpc/powerpc32/start.S 231--- a/sysdeps/powerpc/powerpc32/start.S
232+++ b/sysdeps/powerpc/powerpc32/start.S 232+++ b/sysdeps/powerpc/powerpc32/start.S
233@@ -35,6 +35,8 @@ 233@@ -35,6 +35,8 @@
@@ -240,7 +240,7 @@ index 172fb5a56b..ef1471b861 100644
240 before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ 240 before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */
241 #undef cfi_startproc 241 #undef cfi_startproc
242diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S 242diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S
243index 55fae68ad6..0cb608fe0f 100644 243index 94bf771e83..cffb99500a 100644
244--- a/sysdeps/powerpc/powerpc64/start.S 244--- a/sysdeps/powerpc/powerpc64/start.S
245+++ b/sysdeps/powerpc/powerpc64/start.S 245+++ b/sysdeps/powerpc/powerpc64/start.S
246@@ -35,6 +35,8 @@ 246@@ -35,6 +35,8 @@
@@ -253,7 +253,7 @@ index 55fae68ad6..0cb608fe0f 100644
253 before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */ 253 before crtbegin.o, the file defining __EH_FRAME_BEGIN__. */
254 #undef cfi_startproc 254 #undef cfi_startproc
255diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S 255diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S
256index 30a29b9fb0..07892b383f 100644 256index 12e1131fe7..767e0d043b 100644
257--- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S 257--- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S
258+++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S 258+++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S
259@@ -18,6 +18,8 @@ 259@@ -18,6 +18,8 @@
@@ -266,7 +266,7 @@ index 30a29b9fb0..07892b383f 100644
266 ENTRY (__read_tp) 266 ENTRY (__read_tp)
267 mrs x0, tpidr_el0 267 mrs x0, tpidr_el0
268diff --git a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S 268diff --git a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S
269index f64c4ffe8a..2da315ab08 100644 269index 3b0d611039..4a7e476c37 100644
270--- a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S 270--- a/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S
271+++ b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S 271+++ b/sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S
272@@ -39,6 +39,8 @@ 272@@ -39,6 +39,8 @@
@@ -279,7 +279,7 @@ index f64c4ffe8a..2da315ab08 100644
279 ENTRY (__aeabi_read_tp) 279 ENTRY (__aeabi_read_tp)
280 #ifdef ARCH_HAS_HARD_TP 280 #ifdef ARCH_HAS_HARD_TP
281diff --git a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S 281diff --git a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S
282index 0b6237ac55..8cda491c28 100644 282index fb5e0c7d97..bd07bdb38b 100644
283--- a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S 283--- a/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S
284+++ b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S 284+++ b/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S
285@@ -27,6 +27,8 @@ 285@@ -27,6 +27,8 @@
@@ -299,6 +299,3 @@ index eeb96544e3..da182b28f8 100644
299+ .file "dl-brk.S" 299+ .file "dl-brk.S"
300+ 300+
301 #include <brk.S> 301 #include <brk.S>
302--
3032.22.0
304
diff --git a/meta/recipes-core/glibc/glibc/0028-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
index 6c49066fd1..195b1b0081 100644
--- a/meta/recipes-core/glibc/glibc/0028-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
+++ b/meta/recipes-core/glibc/glibc/0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
@@ -1,7 +1,7 @@
1From d934788e3221c28c9a1892235cbe4cfd1b28ced0 Mon Sep 17 00:00:00 2001 1From eaa1e89df6d760c3719e7060662c60b41ab6e87b Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@gmail.com> 2From: Martin Jansa <martin.jansa@gmail.com>
3Date: Mon, 17 Dec 2018 21:36:18 +0000 3Date: Mon, 17 Dec 2018 21:36:18 +0000
4Subject: [PATCH 28/28] locale: prevent maybe-uninitialized errors with -Os [BZ 4Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
5 #19444] 5 #19444]
6 6
7Fixes following error when building for aarch64 with -Os: 7Fixes following error when building for aarch64 with -Os:
@@ -33,7 +33,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
33 1 file changed, 7 insertions(+) 33 1 file changed, 7 insertions(+)
34 34
35diff --git a/locale/weight.h b/locale/weight.h 35diff --git a/locale/weight.h b/locale/weight.h
36index 7ca81498b2..d608ca70bb 100644 36index e071253f85..2889c395f1 100644
37--- a/locale/weight.h 37--- a/locale/weight.h
38+++ b/locale/weight.h 38+++ b/locale/weight.h
39@@ -28,7 +28,14 @@ findidx (const int32_t *table, 39@@ -28,7 +28,14 @@ findidx (const int32_t *table,
@@ -51,6 +51,3 @@ index 7ca81498b2..d608ca70bb 100644
51 const unsigned char *cp; 51 const unsigned char *cp;
52 const unsigned char *usrc; 52 const unsigned char *usrc;
53 53
54--
552.22.0
56
diff --git a/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch b/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch
new file mode 100644
index 0000000000..fe10218c31
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0031-Refactor-FORTIFY-in-glibc.patch
@@ -0,0 +1,2780 @@
1From 4a6f67ae2438c5e7f9cd627d5cf4a7148b9ad18d Mon Sep 17 00:00:00 2001
2From: George Burgess IV <gbiv@google.com>
3Date: Sat, 11 Jan 2020 10:33:19 -0800
4Subject: [PATCH] Refactor FORTIFY in glibc
5
6Upstream-Status: Submitted [https://sourceware.org/ml/libc-alpha/2017-09/msg00434.html]
7
8Signed-off-by: George Burgess IV <gbiv@google.com>
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 io/bits/fcntl2.h | 125 ++++++--
12 io/bits/poll2.h | 54 ++--
13 io/fcntl.h | 2 +-
14 libio/bits/stdio2.h | 303 +++++++++++---------
15 misc/bits/syslog.h | 38 ++-
16 misc/sys/cdefs.h | 164 ++++++++++-
17 posix/bits/unistd.h | 366 ++++++++++--------------
18 rt/bits/mqueue2.h | 44 ++-
19 rt/mqueue.h | 2 +-
20 socket/bits/socket2.h | 56 ++--
21 stdlib/bits/stdlib.h | 117 ++++----
22 string/bits/string_fortified.h | 136 ++++++---
23 string/bits/strings_fortified.h | 36 ++-
24 wcsmbs/bits/wchar2.h | 487 ++++++++++++++------------------
25 14 files changed, 1093 insertions(+), 837 deletions(-)
26
27--- a/io/bits/fcntl2.h
28+++ b/io/bits/fcntl2.h
29@@ -32,10 +32,28 @@ extern int __REDIRECT (__open_2, (const
30 extern int __REDIRECT (__open_alias, (const char *__path, int __oflag, ...),
31 open64) __nonnull ((1));
32 #endif
33-__errordecl (__open_too_many_args,
34- "open can be called either with 2 or 3 arguments, not more");
35-__errordecl (__open_missing_mode,
36- "open with O_CREAT or O_TMPFILE in second argument needs 3 arguments");
37+
38+#define __warn_open_too_many_args \
39+ "open can be called either with 2 or 3 arguments, not more"
40+#define __warn_open_missing_mode \
41+ "open with O_CREAT in second argument needs 3 arguments"
42+#ifdef __use_clang_fortify
43+__fortify_overload __clang_prefer_this_overload int
44+open (const char *const __clang_pass_object_size __path, int __oflag)
45+ __clang_error_if (__OPEN_NEEDS_MODE (__oflag), __warn_open_missing_mode)
46+{
47+ return __open_2 (__path, __oflag);
48+}
49+
50+__fortify_overload int
51+open (const char *const __clang_pass_object_size __path, int __oflag,
52+ mode_t __mode)
53+{
54+ return __open_alias (__path, __oflag, __mode);
55+}
56+#else
57+__errordecl (__open_too_many_args, __warn_open_too_many_args);
58+__errordecl (__open_missing_mode, __warn_open_missing_mode);
59
60 __fortify_function int
61 open (const char *__path, int __oflag, ...)
62@@ -58,16 +76,37 @@ open (const char *__path, int __oflag, .
63
64 return __open_alias (__path, __oflag, __va_arg_pack ());
65 }
66+#endif
67+#undef __warn_open_too_many_args
68+#undef __warn_open_missing_mode
69
70
71 #ifdef __USE_LARGEFILE64
72 extern int __open64_2 (const char *__path, int __oflag) __nonnull ((1));
73 extern int __REDIRECT (__open64_alias, (const char *__path, int __oflag,
74 ...), open64) __nonnull ((1));
75-__errordecl (__open64_too_many_args,
76- "open64 can be called either with 2 or 3 arguments, not more");
77-__errordecl (__open64_missing_mode,
78- "open64 with O_CREAT or O_TMPFILE in second argument needs 3 arguments");
79+
80+# define __warn_open64_too_many_args \
81+ "open64 can be called either with 2 or 3 arguments, not more"
82+# define __warn_open64_missing_mode \
83+ "open64 with O_CREAT in second argument needs 3 arguments"
84+# ifdef __use_clang_fortify
85+__fortify_overload __clang_prefer_this_overload int
86+open64 (const char *const __clang_pass_object_size __path, int __oflag)
87+ __clang_error_if (__OPEN_NEEDS_MODE (__oflag), __warn_open64_missing_mode)
88+{
89+ return __open64_2 (__path, __oflag);
90+}
91+
92+__fortify_overload __clang_prefer_this_overload int
93+open64 (const char *const __clang_pass_object_size __path, int __oflag,
94+ int __mode)
95+{
96+ return __open64_alias (__path, __oflag, __mode);
97+}
98+# else
99+__errordecl (__open64_too_many_args, __warn_open64_too_many_args);
100+__errordecl (__open64_missing_mode, __warn_open64_missing_mode);
101
102 __fortify_function int
103 open64 (const char *__path, int __oflag, ...)
104@@ -90,6 +129,9 @@ open64 (const char *__path, int __oflag,
105
106 return __open64_alias (__path, __oflag, __va_arg_pack ());
107 }
108+# endif
109+# undef __warn_open64_too_many_args
110+# undef __warn_open64_missing_mode
111 #endif
112
113
114@@ -108,10 +150,32 @@ extern int __REDIRECT (__openat_alias, (
115 int __oflag, ...), openat64)
116 __nonnull ((2));
117 # endif
118-__errordecl (__openat_too_many_args,
119- "openat can be called either with 3 or 4 arguments, not more");
120-__errordecl (__openat_missing_mode,
121- "openat with O_CREAT or O_TMPFILE in third argument needs 4 arguments");
122+
123+# define __warn_openat_too_many_args "openat can be called either with 3 or " \
124+ "4 arguments, not more"
125+# define __warn_openat_missing_mode "openat with O_CREAT in third argument " \
126+ "needs 4 arguments"
127+# ifdef __use_clang_fortify
128+__fortify_error_function __clang_error (__warn_openat_too_many_args) int
129+openat (int __fd, const char *__path, int __oflag, int __mode, ...);
130+
131+__fortify_overload __clang_prefer_this_overload int
132+openat (int __fd, const char *const __clang_pass_object_size __path,
133+ int __oflag)
134+ __clang_error_if (__OPEN_NEEDS_MODE (__oflag), __warn_openat_missing_mode)
135+{
136+ return __openat_2 (__fd, __path, __oflag);
137+}
138+
139+__fortify_overload __clang_prefer_this_overload int
140+openat (int __fd, const char *const __clang_pass_object_size __path,
141+ int __oflag, int __mode)
142+{
143+ return __openat_alias (__fd, __path, __oflag, __mode);
144+}
145+# else
146+__errordecl (__openat_too_many_args, __warn_openat_too_many_args);
147+__errordecl (__openat_missing_mode, __warn_openat_missing_mode);
148
149 __fortify_function int
150 openat (int __fd, const char *__path, int __oflag, ...)
151@@ -134,6 +198,9 @@ openat (int __fd, const char *__path, in
152
153 return __openat_alias (__fd, __path, __oflag, __va_arg_pack ());
154 }
155+# endif
156+# undef __warn_openat_too_many_args
157+# undef __warn_openat_missing_mode
158
159
160 # ifdef __USE_LARGEFILE64
161@@ -142,11 +209,34 @@ extern int __openat64_2 (int __fd, const
162 extern int __REDIRECT (__openat64_alias, (int __fd, const char *__path,
163 int __oflag, ...), openat64)
164 __nonnull ((2));
165-__errordecl (__openat64_too_many_args,
166- "openat64 can be called either with 3 or 4 arguments, not more");
167-__errordecl (__openat64_missing_mode,
168- "openat64 with O_CREAT or O_TMPFILE in third argument needs 4 arguments");
169
170+# define __warn_openat64_too_many_args "openat64 can be called either with " \
171+ "3 or 4 arguments, not more"
172+# define __warn_openat64_missing_mode "openat64 with O_CREAT in third " \
173+ "argument needs 4 arguments"
174+
175+# ifdef __use_clang_fortify
176+__fortify_error_function __clang_error (__warn_openat64_too_many_args) int
177+openat64 (int __fd, const char *__path, int __oflag, int __mode, ...);
178+
179+__fortify_overload __clang_prefer_this_overload int
180+openat64 (int __fd, const char *const __clang_pass_object_size __path,
181+ int __oflag)
182+ __clang_error_if (__OPEN_NEEDS_MODE (__oflag),
183+ __warn_openat64_missing_mode)
184+{
185+ return __openat64_2 (__fd, __path, __oflag);
186+}
187+
188+__fortify_overload __clang_prefer_this_overload int
189+openat64 (int __fd, const char *const __clang_pass_object_size __path,
190+ int __oflag, int __mode)
191+{
192+ return __openat64_alias (__fd, __path, __oflag, __mode);
193+}
194+# else
195+__errordecl (__openat64_too_many_args, __warn_openat64_too_many_args);
196+__errordecl (__openat64_missing_mode, __warn_openat64_missing_mode);
197 __fortify_function int
198 openat64 (int __fd, const char *__path, int __oflag, ...)
199 {
200@@ -168,5 +258,8 @@ openat64 (int __fd, const char *__path,
201
202 return __openat64_alias (__fd, __path, __oflag, __va_arg_pack ());
203 }
204+# endif
205+# undef __warn_openat64_too_many_args
206+# undef __warn_openat64_missing_mode
207 # endif
208 #endif
209--- a/io/bits/poll2.h
210+++ b/io/bits/poll2.h
211@@ -27,25 +27,20 @@ extern int __REDIRECT (__poll_alias, (st
212 int __timeout), poll);
213 extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout,
214 __SIZE_TYPE__ __fdslen);
215-extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds,
216- int __timeout, __SIZE_TYPE__ __fdslen),
217- __poll_chk)
218- __warnattr ("poll called with fds buffer too small file nfds entries");
219
220-__fortify_function int
221-poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
222+__fortify_potential_overload int
223+poll (struct pollfd *const __clang_pass_object_size __fds, nfds_t __nfds,
224+ int __timeout)
225+__FORTIFY_PRECONDITIONS
226+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__poll_warn, __nfds, __fds,
227+ sizeof (*__fds),
228+ "poll called with fds buffer too small")
229 {
230- if (__bos (__fds) != (__SIZE_TYPE__) -1)
231- {
232- if (! __builtin_constant_p (__nfds))
233- return __poll_chk (__fds, __nfds, __timeout, __bos (__fds));
234- else if (__bos (__fds) / sizeof (*__fds) < __nfds)
235- return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds));
236- }
237-
238+ if (__FORTIFY_CALL_CHK && __bos (__fds) != (__SIZE_TYPE__) -1)
239+ return __poll_chk (__fds, __nfds, __timeout, __bos (__fds));
240 return __poll_alias (__fds, __nfds, __timeout);
241 }
242-
243+__FORTIFY_FUNCTION_END
244
245 #ifdef __USE_GNU
246 extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
247@@ -54,28 +49,21 @@ extern int __REDIRECT (__ppoll_alias, (s
248 extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds,
249 const struct timespec *__timeout,
250 const __sigset_t *__ss, __SIZE_TYPE__ __fdslen);
251-extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds,
252- const struct timespec *__timeout,
253- const __sigset_t *__ss,
254- __SIZE_TYPE__ __fdslen),
255- __ppoll_chk)
256- __warnattr ("ppoll called with fds buffer too small file nfds entries");
257
258-__fortify_function int
259-ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout,
260- const __sigset_t *__ss)
261+__fortify_potential_overload int
262+ppoll (struct pollfd *const __clang_pass_object_size __fds, nfds_t __nfds,
263+ const struct timespec *__timeout, const __sigset_t *__ss)
264+__FORTIFY_PRECONDITIONS
265+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__ppoll_warn, __nfds, __fds,
266+ sizeof (*__fds),
267+ "ppoll called with fds buffer too "
268+ "small file nfds entries")
269 {
270- if (__bos (__fds) != (__SIZE_TYPE__) -1)
271- {
272- if (! __builtin_constant_p (__nfds))
273- return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds));
274- else if (__bos (__fds) / sizeof (*__fds) < __nfds)
275- return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss,
276- __bos (__fds));
277- }
278-
279+ if (__FORTIFY_CALL_CHK && __bos (__fds) != (__SIZE_TYPE__) -1)
280+ return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds));
281 return __ppoll_alias (__fds, __nfds, __timeout, __ss);
282 }
283+__FORTIFY_FUNCTION_END
284 #endif
285
286 __END_DECLS
287--- a/io/fcntl.h
288+++ b/io/fcntl.h
289@@ -325,7 +325,7 @@ extern int posix_fallocate64 (int __fd,
290
291 /* Define some inlines helping to catch common problems. */
292 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
293- && defined __va_arg_pack_len
294+ && (defined __va_arg_pack_len || defined __use_clang_fortify)
295 # include <bits/fcntl2.h>
296 #endif
297
298--- a/libio/bits/stdio2.h
299+++ b/libio/bits/stdio2.h
300@@ -29,12 +29,23 @@ extern int __vsprintf_chk (char *__restr
301 const char *__restrict __format,
302 __gnuc_va_list __ap) __THROW;
303
304-#ifdef __va_arg_pack
305-__fortify_function int
306-__NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
307-{
308- return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
309- __bos (__s), __fmt, __va_arg_pack ());
310+#define __mul_may_overflow(size, n) \
311+ ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2)))
312+
313+#ifdef __FORTIFY_ARG_PACK_OK
314+/* clang doesn't have __va_arg_pack, so we need to defer to the va_arg versions
315+ of these functions. */
316+__fortify_potential_overload int
317+__NTH (sprintf (char *__restrict const __clang_pass_object_size __s,
318+ const char *__restrict __fmt, ...))
319+{
320+ __FORTIFY_INIT_ARG_PACK(__fmt);
321+ int __result = __FORTIFY_CALL_VA_BUILTIN (sprintf, __s,
322+ __USE_FORTIFY_LEVEL - 1,
323+ __bos (__s), __fmt,
324+ __FORTIFY_ARG_PACK);
325+ __FORTIFY_FREE_ARG_PACK();
326+ return __result;
327 }
328 #elif !defined __cplusplus
329 # define sprintf(str, ...) \
330@@ -42,9 +53,9 @@ __NTH (sprintf (char *__restrict __s, co
331 __VA_ARGS__)
332 #endif
333
334-__fortify_function int
335-__NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt,
336- __gnuc_va_list __ap))
337+__fortify_potential_overload int
338+__NTH (vsprintf (char *__restrict const __clang_pass_object_size __s,
339+ const char *__restrict __fmt, __gnuc_va_list __ap))
340 {
341 return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
342 __bos (__s), __fmt, __ap);
343@@ -59,13 +70,21 @@ extern int __vsnprintf_chk (char *__rest
344 size_t __slen, const char *__restrict __format,
345 __gnuc_va_list __ap) __THROW;
346
347-# ifdef __va_arg_pack
348-__fortify_function int
349-__NTH (snprintf (char *__restrict __s, size_t __n,
350- const char *__restrict __fmt, ...))
351-{
352- return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
353- __bos (__s), __fmt, __va_arg_pack ());
354+# ifdef __FORTIFY_ARG_PACK_OK
355+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 4))) int
356+__NTH (snprintf (char *__restrict const __clang_pass_object_size __s,
357+ size_t __n, const char *__restrict __fmt, ...))
358+ /* GCC's builtin will catch this, so we just need to cover clang here. */
359+ __clang_warning_if (__bos_static_lt (__n, __s),
360+ "call to snprintf may overflow the destination buffer")
361+{
362+ __FORTIFY_INIT_ARG_PACK(__fmt);
363+ int __result = __FORTIFY_CALL_VA_BUILTIN (snprintf, __s, __n,
364+ __USE_FORTIFY_LEVEL - 1,
365+ __bos (__s), __fmt,
366+ __FORTIFY_ARG_PACK);
367+ __FORTIFY_FREE_ARG_PACK();
368+ return __result;
369 }
370 # elif !defined __cplusplus
371 # define snprintf(str, len, ...) \
372@@ -73,9 +92,12 @@ __NTH (snprintf (char *__restrict __s, s
373 __VA_ARGS__)
374 # endif
375
376-__fortify_function int
377-__NTH (vsnprintf (char *__restrict __s, size_t __n,
378- const char *__restrict __fmt, __gnuc_va_list __ap))
379+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 3, 0))) int
380+__NTH (vsnprintf (char *__restrict const __clang_pass_object_size __s,
381+ size_t __n, const char *__restrict __fmt, __gnuc_va_list __ap))
382+ __clang_warning_if (__bos_static_lt (__n, __s),
383+ "call to vsnprintf may overflow the destination "
384+ "buffer")
385 {
386 return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
387 __bos (__s), __fmt, __ap);
388@@ -93,18 +115,27 @@ extern int __vfprintf_chk (FILE *__restr
389 extern int __vprintf_chk (int __flag, const char *__restrict __format,
390 __gnuc_va_list __ap);
391
392-# ifdef __va_arg_pack
393-__fortify_function int
394-fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
395-{
396- return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
397- __va_arg_pack ());
398-}
399-
400-__fortify_function int
401-printf (const char *__restrict __fmt, ...)
402-{
403- return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
404+# ifdef __FORTIFY_ARG_PACK_OK
405+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
406+fprintf (FILE *__restrict const __clang_pass_object_size __stream,
407+ const char *__restrict __fmt, ...)
408+{
409+ __FORTIFY_INIT_ARG_PACK(__fmt);
410+ int __result = __FORTIFY_CALL_VA_CHK (fprintf, __stream,
411+ __USE_FORTIFY_LEVEL - 1, __fmt,
412+ __FORTIFY_ARG_PACK);
413+ __FORTIFY_FREE_ARG_PACK();
414+ return __result;
415+}
416+
417+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 2))) int
418+printf (const char *__restrict const __clang_pass_object_size __fmt, ...)
419+{
420+ __FORTIFY_INIT_ARG_PACK(__fmt);
421+ int __result = __FORTIFY_CALL_VA_CHK (printf, __USE_FORTIFY_LEVEL - 1, __fmt,
422+ __FORTIFY_ARG_PACK);
423+ __FORTIFY_FREE_ARG_PACK();
424+ return __result;
425 }
426 # elif !defined __cplusplus
427 # define printf(...) \
428@@ -113,8 +144,9 @@ printf (const char *__restrict __fmt, ..
429 __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
430 # endif
431
432-__fortify_function int
433-vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
434+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 1, 0))) int
435+vprintf (const char *__restrict const __clang_pass_object_size __fmt,
436+ __gnuc_va_list __ap)
437 {
438 #ifdef __USE_EXTERN_INLINES
439 return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
440@@ -122,9 +154,8 @@ vprintf (const char *__restrict __fmt, _
441 return __vprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
442 #endif
443 }
444-
445-__fortify_function int
446-vfprintf (FILE *__restrict __stream,
447+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) int
448+vfprintf (FILE *__restrict const __clang_pass_object_size __stream,
449 const char *__restrict __fmt, __gnuc_va_list __ap)
450 {
451 return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
452@@ -137,20 +168,26 @@ extern int __vdprintf_chk (int __fd, int
453 const char *__restrict __fmt, __gnuc_va_list __arg)
454 __attribute__ ((__format__ (__printf__, 3, 0)));
455
456-# ifdef __va_arg_pack
457-__fortify_function int
458-dprintf (int __fd, const char *__restrict __fmt, ...)
459-{
460- return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
461- __va_arg_pack ());
462+# ifdef __FORTIFY_ARG_PACK_OK
463+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
464+dprintf (int __fd, const char *__restrict const __clang_pass_object_size __fmt,
465+ ...)
466+{
467+ __FORTIFY_INIT_ARG_PACK(__fmt);
468+ int __result = __FORTIFY_CALL_VA_CHK (dprintf, __fd, __USE_FORTIFY_LEVEL - 1,
469+ __fmt, __FORTIFY_ARG_PACK);
470+ __FORTIFY_FREE_ARG_PACK();
471+ return __result;
472 }
473 # elif !defined __cplusplus
474 # define dprintf(fd, ...) \
475 __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
476 # endif
477
478-__fortify_function int
479-vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
480+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) int
481+vdprintf (int __fd,
482+ const char *__restrict const __clang_pass_object_size __fmt,
483+ __gnuc_va_list __ap)
484 {
485 return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
486 }
487@@ -174,28 +211,49 @@ extern int __obstack_vprintf_chk (struct
488 __gnuc_va_list __args)
489 __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
490
491-# ifdef __va_arg_pack
492-__fortify_function int
493-__NTH (asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...))
494-{
495- return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
496- __va_arg_pack ());
497-}
498-
499-__fortify_function int
500-__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt,
501- ...))
502+# ifdef __FORTIFY_ARG_PACK_OK
503+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3)))
504+__wur int
505+__NTH (asprintf (char **__restrict const __clang_pass_object_size __ptr,
506+ const char *__restrict __fmt, ...))
507 {
508- return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
509- __va_arg_pack ());
510-}
511-
512-__fortify_function int
513-__NTH (obstack_printf (struct obstack *__restrict __obstack,
514+ __FORTIFY_INIT_ARG_PACK(__fmt);
515+ int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr,
516+ __USE_FORTIFY_LEVEL - 1, __fmt,
517+ __FORTIFY_ARG_PACK);
518+ __FORTIFY_FREE_ARG_PACK();
519+ return __result;
520+}
521+
522+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3)))
523+__wur int
524+__NTH (__asprintf (char **__restrict const __clang_pass_object_size __ptr,
525+ const char *__restrict __fmt, ...))
526+{
527+ __FORTIFY_INIT_ARG_PACK(__fmt);
528+ int __result = __FORTIFY_CALL_VA_CHK (asprintf, __ptr,
529+ __USE_FORTIFY_LEVEL - 1, __fmt,
530+ __FORTIFY_ARG_PACK);
531+ __FORTIFY_FREE_ARG_PACK();
532+ return __result;
533+}
534+
535+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 3))) int
536+__NTH (obstack_printf (struct obstack *
537+ __restrict const __clang_pass_object_size __obstack,
538 const char *__restrict __fmt, ...))
539 {
540- return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
541- __va_arg_pack ());
542+ __FORTIFY_INIT_ARG_PACK(__fmt);
543+ int __result =
544+# ifdef __use_clang_fortify
545+ __obstack_vprintf_chk
546+# else
547+ __obstack_printf_chk
548+# endif
549+ (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
550+ __FORTIFY_ARG_PACK);
551+ __FORTIFY_FREE_ARG_PACK();
552+ return __result;
553 }
554 # elif !defined __cplusplus
555 # define asprintf(ptr, ...) \
556@@ -206,15 +264,17 @@ __NTH (obstack_printf (struct obstack *_
557 __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
558 # endif
559
560-__fortify_function int
561-__NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt,
562- __gnuc_va_list __ap))
563+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0)))
564+__wur int
565+__NTH (vasprintf (char **__restrict const __clang_pass_object_size __ptr,
566+ const char *__restrict __fmt, __gnuc_va_list __ap))
567 {
568 return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
569 }
570
571-__fortify_function int
572-__NTH (obstack_vprintf (struct obstack *__restrict __obstack,
573+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) int
574+__NTH (obstack_vprintf (struct obstack *
575+ __restrict const __clang_pass_object_size __obstack,
576 const char *__restrict __fmt, __gnuc_va_list __ap))
577 {
578 return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
579@@ -227,17 +287,20 @@ __NTH (obstack_vprintf (struct obstack *
580
581 #if __GLIBC_USE (DEPRECATED_GETS)
582 extern char *__gets_chk (char *__str, size_t) __wur;
583-extern char *__REDIRECT (__gets_warn, (char *__str), gets)
584- __wur __warnattr ("please use fgets or getline instead, gets can't "
585- "specify buffer size");
586+extern char *__REDIRECT_NTH (__gets_alias, (char *__buf), gets) __wur;
587
588-__fortify_function __wur char *
589-gets (char *__str)
590+__fortify_potential_overload __wur char *
591+gets (char *const __clang_pass_object_size __str)
592+__FORTIFY_PRECONDITIONS
593+ __FORTIFY_WARNING_IF (__gets_warn, __bos (__str) == (size_t) -1,
594+ "please use fgets or getline instead, gets can't "
595+ "specify buffer size")
596 {
597 if (__bos (__str) != (size_t) -1)
598 return __gets_chk (__str, __bos (__str));
599- return __gets_warn (__str);
600+ return __gets_alias (__str);
601 }
602+__FORTIFY_FUNCTION_END
603 #endif
604
605 extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
606@@ -245,25 +308,20 @@ extern char *__fgets_chk (char *__restri
607 extern char *__REDIRECT (__fgets_alias,
608 (char *__restrict __s, int __n,
609 FILE *__restrict __stream), fgets) __wur;
610-extern char *__REDIRECT (__fgets_chk_warn,
611- (char *__restrict __s, size_t __size, int __n,
612- FILE *__restrict __stream), __fgets_chk)
613- __wur __warnattr ("fgets called with bigger size than length "
614- "of destination buffer");
615
616-__fortify_function __wur char *
617-fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
618+__fortify_potential_overload __wur char *
619+fgets (char *__restrict const __clang_pass_object_size __s, int __n,
620+ FILE *__restrict __stream)
621+__FORTIFY_PRECONDITIONS
622+ __FORTIFY_WARNING_IF (__fgets_warn, __bos_static_lt (__n, __s) && __n > 0,
623+ "fgets called with bigger size than length of "
624+ "destination buffer")
625 {
626 if (__bos (__s) != (size_t) -1)
627- {
628- if (!__builtin_constant_p (__n) || __n <= 0)
629- return __fgets_chk (__s, __bos (__s), __n, __stream);
630-
631- if ((size_t) __n > __bos (__s))
632- return __fgets_chk_warn (__s, __bos (__s), __n, __stream);
633- }
634+ return __fgets_chk (__s, __bos (__s), __n, __stream);
635 return __fgets_alias (__s, __n, __stream);
636 }
637+__FORTIFY_FUNCTION_END
638
639 extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen,
640 size_t __size, size_t __n,
641@@ -272,30 +330,21 @@ extern size_t __REDIRECT (__fread_alias,
642 (void *__restrict __ptr, size_t __size,
643 size_t __n, FILE *__restrict __stream),
644 fread) __wur;
645-extern size_t __REDIRECT (__fread_chk_warn,
646- (void *__restrict __ptr, size_t __ptrlen,
647- size_t __size, size_t __n,
648- FILE *__restrict __stream),
649- __fread_chk)
650- __wur __warnattr ("fread called with bigger size * nmemb than length "
651- "of destination buffer");
652
653-__fortify_function __wur size_t
654-fread (void *__restrict __ptr, size_t __size, size_t __n,
655- FILE *__restrict __stream)
656+__fortify_potential_overload __wur size_t
657+fread (void *__restrict const __clang_pass_object_size0 __ptr, size_t __size,
658+ size_t __n, FILE *__restrict __stream)
659+__FORTIFY_PRECONDITIONS
660+ __FORTIFY_WARNING_IF (__fread_warn, __bos0_static_lt (__size * __n, __ptr)
661+ && !__mul_may_overflow (__size, __n),
662+ "fread called with bigger size * nmemb than length "
663+ "of destination buffer")
664 {
665 if (__bos0 (__ptr) != (size_t) -1)
666- {
667- if (!__builtin_constant_p (__size)
668- || !__builtin_constant_p (__n)
669- || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
670- return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
671-
672- if (__size * __n > __bos0 (__ptr))
673- return __fread_chk_warn (__ptr, __bos0 (__ptr), __size, __n, __stream);
674- }
675+ return __fread_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
676 return __fread_alias (__ptr, __size, __n, __stream);
677 }
678+__FORTIFY_FUNCTION_END
679
680 #ifdef __USE_GNU
681 extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
682@@ -303,25 +352,21 @@ extern char *__fgets_unlocked_chk (char
683 extern char *__REDIRECT (__fgets_unlocked_alias,
684 (char *__restrict __s, int __n,
685 FILE *__restrict __stream), fgets_unlocked) __wur;
686-extern char *__REDIRECT (__fgets_unlocked_chk_warn,
687- (char *__restrict __s, size_t __size, int __n,
688- FILE *__restrict __stream), __fgets_unlocked_chk)
689- __wur __warnattr ("fgets_unlocked called with bigger size than length "
690- "of destination buffer");
691
692-__fortify_function __wur char *
693-fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
694+__fortify_potential_overload __wur char *
695+fgets_unlocked (char *__restrict const __clang_pass_object_size __s, int __n,
696+ FILE *__restrict __stream)
697+__FORTIFY_PRECONDITIONS
698+ __FORTIFY_WARNING_IF (__fgets_unlocked_warn,
699+ __bos_static_lt (__n, __s) && __n > 0,
700+ "fgets_unlocked called with bigger size than length "
701+ "of destination buffer")
702 {
703 if (__bos (__s) != (size_t) -1)
704- {
705- if (!__builtin_constant_p (__n) || __n <= 0)
706- return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream);
707-
708- if ((size_t) __n > __bos (__s))
709- return __fgets_unlocked_chk_warn (__s, __bos (__s), __n, __stream);
710- }
711+ return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream);
712 return __fgets_unlocked_alias (__s, __n, __stream);
713 }
714+__FORTIFY_FUNCTION_END
715 #endif
716
717 #ifdef __USE_MISC
718@@ -333,30 +378,19 @@ extern size_t __REDIRECT (__fread_unlock
719 (void *__restrict __ptr, size_t __size,
720 size_t __n, FILE *__restrict __stream),
721 fread_unlocked) __wur;
722-extern size_t __REDIRECT (__fread_unlocked_chk_warn,
723- (void *__restrict __ptr, size_t __ptrlen,
724- size_t __size, size_t __n,
725- FILE *__restrict __stream),
726- __fread_unlocked_chk)
727- __wur __warnattr ("fread_unlocked called with bigger size * nmemb than "
728- "length of destination buffer");
729
730-__fortify_function __wur size_t
731-fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n,
732- FILE *__restrict __stream)
733+__fortify_potential_overload __wur size_t
734+fread_unlocked (void *__restrict const __clang_pass_object_size0 __ptr,
735+ size_t __size, size_t __n, FILE *__restrict __stream)
736+__FORTIFY_PRECONDITIONS
737+ __FORTIFY_WARNING_IF (__fread_unlocked_warn,
738+ __bos0_static_lt (__size * __n, __ptr)
739+ && !__mul_may_overflow(__size, __n),
740+ "fread_unlocked called with bigger size * n than "
741+ "length of destination buffer")
742 {
743 if (__bos0 (__ptr) != (size_t) -1)
744- {
745- if (!__builtin_constant_p (__size)
746- || !__builtin_constant_p (__n)
747- || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
748- return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n,
749- __stream);
750-
751- if (__size * __n > __bos0 (__ptr))
752- return __fread_unlocked_chk_warn (__ptr, __bos0 (__ptr), __size, __n,
753- __stream);
754- }
755+ return __fread_unlocked_chk (__ptr, __bos0 (__ptr), __size, __n, __stream);
756
757 # ifdef __USE_EXTERN_INLINES
758 if (__builtin_constant_p (__size)
759@@ -381,6 +415,7 @@ fread_unlocked (void *__restrict __ptr,
760 # endif
761 return __fread_unlocked_alias (__ptr, __size, __n, __stream);
762 }
763+__FORTIFY_FUNCTION_END
764 #endif
765-
766+#undef __mul_may_overflow
767 #endif /* bits/stdio2.h. */
768--- a/misc/bits/syslog.h
769+++ b/misc/bits/syslog.h
770@@ -20,11 +20,34 @@
771 # error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead."
772 #endif
773
774+#ifdef __USE_MISC
775+extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
776+ __gnuc_va_list __ap)
777+ __attribute__ ((__format__ (__printf__, 3, 0)));
778+
779+__fortify_potential_overload __attribute__ ((__format__ (__printf__, 2, 0))) void
780+vsyslog (int __pri, const char *const __clang_pass_object_size __fmt,
781+ __gnuc_va_list __ap)
782+{
783+ __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
784+}
785+#endif
786
787 extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...)
788 __attribute__ ((__format__ (__printf__, 3, 4)));
789
790-#ifdef __va_arg_pack
791+#if defined __use_clang_fortify && __USE_MISC
792+/* clang doesn't support __va_arg_pack, so this is only possible if we have
793+ vsyslog. */
794+__fortify_overload __attribute__ ((__format__ (__printf__, 2, 3))) void
795+syslog (int __pri, const char *const __clang_pass_object_size __fmt, ...)
796+{
797+ __gnuc_va_list __ap;
798+ va_start (__ap, __fmt);
799+ __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
800+ va_end (__ap);
801+}
802+#elif defined __va_arg_pack
803 __fortify_function void
804 syslog (int __pri, const char *__fmt, ...)
805 {
806@@ -34,16 +57,3 @@ syslog (int __pri, const char *__fmt, ..
807 # define syslog(pri, ...) \
808 __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
809 #endif
810-
811-
812-#ifdef __USE_MISC
813-extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
814- __gnuc_va_list __ap)
815- __attribute__ ((__format__ (__printf__, 3, 0)));
816-
817-__fortify_function void
818-vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
819-{
820- __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
821-}
822-#endif
823--- a/misc/sys/cdefs.h
824+++ b/misc/sys/cdefs.h
825@@ -118,11 +118,150 @@
826 # define __END_DECLS
827 #endif
828
829+#if defined __clang__ && defined __has_extension
830+# define __clang_has_extension(x) __has_extension (x)
831+#else
832+# define __clang_has_extension(x) 0
833+#endif
834
835 /* Fortify support. */
836-#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
837+#define __fortify_function __extern_always_inline __attribute_artificial__
838+#if defined __clang__ && __USE_FORTIFY_LEVEL > 0 \
839+ && !defined _CLANG_FORTIFY_DISABLE \
840+ && __clang_has_extension(overloadable_unmarked)
841+# define __use_clang_fortify 1
842+/* Clang-style FORTIFY creates a different symbol for each FORTIFY'ed function,
843+ whereas GCC-style doesn't. Thus, GCC can assume that the FORTIFY'ed
844+ function is always available externally, but clang can't. */
845+# define __attribute_overloadable__ __attribute__ ((__overloadable__))
846+# define __attribute_transparent_overload__ \
847+ __attribute__ ((__overloadable__("transparent")))
848+# define __fortify_overload static __always_inline __attribute_overloadable__
849+/* For FORTIFY functions that exist only as decls. */
850+# define __fortify_error_function static __attribute_overloadable__
851+# define __clang_pass_object_size_n(n) __attribute__ ((pass_object_size (n)))
852+# define __clang_warning(what) __attribute__ ((deprecated(what)))
853+# define __clang_prefer_this_overload __attribute__ ((enable_if (1, "")))
854+# define __clang_warning_if(c, m) \
855+ __attribute__ ((__diagnose_if__ ((c), (m), "warning")))
856+# define __clang_error(what) __attribute__ ((unavailable(what)))
857+# define __clang_error_if(c, m) \
858+ __attribute__ ((__diagnose_if__ ((c), (m), "error")))
859+# define __fortify_potential_overload __fortify_overload
860+#else
861+# define __fortify_potential_overload __fortify_function
862+/* Some functions/decls can be shared between clang and non-clang FORTIFY.
863+ Turning these into nops makes that possible. */
864+# define __clang_pass_object_size_n(n)
865+# define __attribute_overloadable__
866+# define __bos_n(ptr, n) __builtin_object_size (ptr, n)
867+# define __clang_warning_if(c, m)
868+# define __clang_error_if(c, m)
869+#endif
870+
871+#define __bos_level (__USE_FORTIFY_LEVEL > 1)
872+#define __bos(ptr) __builtin_object_size (ptr, __bos_level)
873 #define __bos0(ptr) __builtin_object_size (ptr, 0)
874
875+#define __clang_pass_object_size0 __clang_pass_object_size_n (0)
876+#define __clang_pass_object_size __clang_pass_object_size_n (__bos_level)
877+
878+/* Some of these macros are awkwardly written, and more repetitive than they'd
879+ ideally need to be. This is because both clang and gcc will emit 'note's
880+ about where these warnings originate from. For every macro that's expanded,
881+ the user sees a note that ultimately doesn't matter to them... */
882+#ifdef __use_clang_fortify
883+# define __FORTIFY_PRECONDITIONS
884+# define __FORTIFY_FUNCTION_END
885+# define __FORTIFY_WARNING_IF(_, c, msg) __clang_warning_if(c, msg)
886+/* __builtin_constant_p isn't needed: this is only used in constructs that
887+ must be fully evaluated at compile-time. */
888+# define __bos_static_lt_impl(bos_val, n, s) \
889+ ((bos_val) != -1ULL && (n) > (bos_val) / (s))
890+# define __FORTIFY_CALL_CHK 1
891+
892+# define __FORTIFY_BOSN_ARGS(bos_fn, n, buf, div, complaint) \
893+ (__bos_static_lt_impl (bos_fn (buf), n, div)), (complaint), "warning"
894+
895+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT2(fn_name, n, buf, div, complaint) \
896+ __attribute__ ((__diagnose_if__ \
897+ (__FORTIFY_BOSN_ARGS (__bos0, n, buf, div, complaint))))
898+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT(fn_name, n, buf, complaint) \
899+ __attribute__ ((__diagnose_if__ \
900+ (__FORTIFY_BOSN_ARGS (__bos0, n, buf, 1, complaint))))
901+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT2(fn_name, n, buf, div, complaint) \
902+ __attribute__ ((__diagnose_if__ \
903+ (__FORTIFY_BOSN_ARGS (__bos, n, buf, div, complaint))))
904+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT(fn_name, n, buf, complaint) \
905+ __attribute__ ((__diagnose_if__ \
906+ (__FORTIFY_BOSN_ARGS (__bos, n, buf, 1, complaint))))
907+#else
908+# define __FORTIFY_PRECONDITIONS {
909+# define __FORTIFY_FUNCTION_END }
910+/* __chk_fail was chosen arbitrarily. The function should never be called
911+ anyway; it just exists to be reachable after optimizations. */
912+# define __FORTIFY_DECLARE_WARNING_FUNCTION(name, msg) \
913+ __attribute ((__warning__(msg))) \
914+ extern void __REDIRECT_NTH (name, (void), __chk_fail)
915+
916+# define __FORTIFY_WARNING_IF_BEGIN(fn_name, cond, complaint, if_cond_true) \
917+ { \
918+ if (cond) { \
919+ if_cond_true; \
920+ __FORTIFY_DECLARE_WARNING_FUNCTION (fn_name, complaint); \
921+ volatile char __t = 0; \
922+ if (__glibc_unlikely (__t)) \
923+ {
924+
925+# define __FORTIFY_WARNING_IF_END \
926+ } \
927+ } \
928+ }
929+
930+# define __FORTIFY_WARNING_IF(err_fn, cond, complaint) \
931+ __FORTIFY_WARNING_IF_BEGIN (err_fn, cond, complaint, (void)0) \
932+ err_fn (); \
933+ __FORTIFY_WARNING_IF_END
934+
935+# define __bos_static_lt_impl(bos_val, n, s) \
936+ (__builtin_constant_p (n) && (bos_val) != -1ULL && (n) > (bos_val) / (s))
937+
938+#define __FORTIFY_BOS_WARNING_BEGIN(fn_name, bos_fn, n, buf, div, complaint) \
939+ char __need_dynamic_check = !__builtin_constant_p (n); \
940+ __FORTIFY_WARNING_IF_BEGIN (fn_name, \
941+ __bos_static_lt_impl (bos_fn (buf), n, div), \
942+ complaint, (__need_dynamic_check = 1))
943+
944+/* Duplicate this so that the fn_name call happens with the smallest possible
945+ macro "call stack". This minimizes diagnostics about expanding macros. */
946+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT2(err_fn, n, buf, div, complaint) \
947+ __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos0, n, buf, div, complaint) \
948+ err_fn (); \
949+ __FORTIFY_WARNING_IF_END
950+
951+#define __FORTIFY_WARNING_ONLY_IF_BOS0_LT(err_fn, n, buf, complaint) \
952+ __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos0, n, buf, 1, complaint) \
953+ err_fn (); \
954+ __FORTIFY_WARNING_IF_END
955+
956+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT2(err_fn, n, buf, div, complaint) \
957+ __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos, n, buf, div, complaint) \
958+ err_fn (); \
959+ __FORTIFY_WARNING_IF_END
960+
961+#define __FORTIFY_WARNING_ONLY_IF_BOS_LT(err_fn, n, buf, complaint) \
962+ __FORTIFY_BOS_WARNING_BEGIN (err_fn, __bos, n, buf, 1, complaint) \
963+ err_fn (); \
964+ __FORTIFY_WARNING_IF_END
965+
966+# define __FORTIFY_CALL_CHK (__need_dynamic_check)
967+#endif
968+
969+#define __bos_static_lt2(n, e, s) __bos_static_lt_impl (__bos (e), n, s)
970+#define __bos_static_lt(n, e) __bos_static_lt2 (n, e, 1)
971+#define __bos0_static_lt2(n, e, s) __bos_static_lt_impl (__bos0 (e), n, s)
972+#define __bos0_static_lt(n, e) __bos0_static_lt2 (n, e, 1)
973+
974 #if __GNUC_PREREQ (4,3)
975 # define __warndecl(name, msg) \
976 extern void name (void) __attribute__((__warning__ (msg)))
977@@ -363,6 +502,29 @@
978 # define __va_arg_pack_len() __builtin_va_arg_pack_len ()
979 #endif
980
981+#if defined(__use_clang_fortify)
982+/* clang doesn't support __va_arg_pack, so we need to call the v* version of
983+ FORTIFY'ed functions. */
984+#define __FORTIFY_ARG_PACK __fortify_ap
985+#define __FORTIFY_INIT_ARG_PACK(va_arg) \
986+ __gnuc_va_list __FORTIFY_ARG_PACK; \
987+ va_start (__FORTIFY_ARG_PACK, va_arg)
988+#define __FORTIFY_CALL_VA_ALIAS(fn, ...) __v##fn##_alias (__VA_ARGS__)
989+#define __FORTIFY_CALL_VA_CHK(fn, ...) __v##fn##_chk (__VA_ARGS__)
990+#define __FORTIFY_CALL_VA_BUILTIN(fn, ...) \
991+ __builtin___v##fn##_chk (__VA_ARGS__)
992+#define __FORTIFY_FREE_ARG_PACK() va_end (__FORTIFY_ARG_PACK)
993+#define __FORTIFY_ARG_PACK_OK 1
994+#elif defined(__va_arg_pack)
995+#define __FORTIFY_ARG_PACK __va_arg_pack ()
996+#define __FORTIFY_INIT_ARG_PACK(va_arg)
997+#define __FORTIFY_CALL_VA_ALIAS(fn, ...) __##fn##_alias (__VA_ARGS__)
998+#define __FORTIFY_CALL_VA_CHK(fn, ...) __##fn##_chk (__VA_ARGS__)
999+#define __FORTIFY_CALL_VA_BUILTIN(fn, ...) __builtin___##fn##_chk (__VA_ARGS__)
1000+#define __FORTIFY_FREE_ARG_PACK()
1001+#define __FORTIFY_ARG_PACK_OK 1
1002+#endif
1003+
1004 /* It is possible to compile containing GCC extensions even if GCC is
1005 run in pedantic mode if the uses are carefully marked using the
1006 `__extension__' keyword. But this is not generally available before
1007--- a/posix/bits/unistd.h
1008+++ b/posix/bits/unistd.h
1009@@ -24,25 +24,19 @@ extern ssize_t __read_chk (int __fd, voi
1010 size_t __buflen) __wur;
1011 extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
1012 size_t __nbytes), read) __wur;
1013-extern ssize_t __REDIRECT (__read_chk_warn,
1014- (int __fd, void *__buf, size_t __nbytes,
1015- size_t __buflen), __read_chk)
1016- __wur __warnattr ("read called with bigger length than size of "
1017- "the destination buffer");
1018-
1019-__fortify_function __wur ssize_t
1020-read (int __fd, void *__buf, size_t __nbytes)
1021-{
1022- if (__bos0 (__buf) != (size_t) -1)
1023- {
1024- if (!__builtin_constant_p (__nbytes))
1025- return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
1026-
1027- if (__nbytes > __bos0 (__buf))
1028- return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf));
1029- }
1030+
1031+__fortify_potential_overload __wur ssize_t
1032+read (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes)
1033+__FORTIFY_PRECONDITIONS
1034+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__read_warn, __nbytes, __buf,
1035+ "read called with bigger length than "
1036+ "size of the destination buffer")
1037+{
1038+ if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
1039+ return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
1040 return __read_alias (__fd, __buf, __nbytes);
1041 }
1042+__FORTIFY_FUNCTION_END
1043
1044 #ifdef __USE_UNIX98
1045 extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
1046@@ -55,67 +49,49 @@ extern ssize_t __REDIRECT (__pread_alias
1047 extern ssize_t __REDIRECT (__pread64_alias,
1048 (int __fd, void *__buf, size_t __nbytes,
1049 __off64_t __offset), pread64) __wur;
1050-extern ssize_t __REDIRECT (__pread_chk_warn,
1051- (int __fd, void *__buf, size_t __nbytes,
1052- __off_t __offset, size_t __bufsize), __pread_chk)
1053- __wur __warnattr ("pread called with bigger length than size of "
1054- "the destination buffer");
1055-extern ssize_t __REDIRECT (__pread64_chk_warn,
1056- (int __fd, void *__buf, size_t __nbytes,
1057- __off64_t __offset, size_t __bufsize),
1058- __pread64_chk)
1059- __wur __warnattr ("pread64 called with bigger length than size of "
1060- "the destination buffer");
1061
1062 # ifndef __USE_FILE_OFFSET64
1063-__fortify_function __wur ssize_t
1064-pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
1065-{
1066- if (__bos0 (__buf) != (size_t) -1)
1067- {
1068- if (!__builtin_constant_p (__nbytes))
1069- return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
1070-
1071- if ( __nbytes > __bos0 (__buf))
1072- return __pread_chk_warn (__fd, __buf, __nbytes, __offset,
1073- __bos0 (__buf));
1074- }
1075- return __pread_alias (__fd, __buf, __nbytes, __offset);
1076-}
1077+# define __fo_pread_chk __pread_chk
1078+# define __fo_pread_alias __pread_alias
1079+# define __fo_off_t __off_t
1080 # else
1081-__fortify_function __wur ssize_t
1082-pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
1083-{
1084- if (__bos0 (__buf) != (size_t) -1)
1085- {
1086- if (!__builtin_constant_p (__nbytes))
1087- return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
1088-
1089- if ( __nbytes > __bos0 (__buf))
1090- return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
1091- __bos0 (__buf));
1092- }
1093-
1094- return __pread64_alias (__fd, __buf, __nbytes, __offset);
1095-}
1096+# define __fo_pread_chk __pread64_chk
1097+# define __fo_pread_alias __pread64_alias
1098+# define __fo_off_t __off64_t
1099 # endif
1100
1101+__fortify_potential_overload __wur ssize_t
1102+pread (int __fd, void *const __clang_pass_object_size0 __buf, size_t __nbytes,
1103+ __fo_off_t __offset)
1104+__FORTIFY_PRECONDITIONS
1105+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread_chk_warn, __nbytes, __buf,
1106+ "pread called with bigger length than "
1107+ "size of the destination buffer")
1108+{
1109+ if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
1110+ return __fo_pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
1111+ return __fo_pread_alias (__fd, __buf, __nbytes, __offset);
1112+}
1113+__FORTIFY_FUNCTION_END
1114+
1115+#undef __fo_pread_chk
1116+#undef __fo_pread_alias
1117+#undef __fo_off_t
1118+
1119 # ifdef __USE_LARGEFILE64
1120-__fortify_function __wur ssize_t
1121-pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
1122+__fortify_potential_overload __wur ssize_t
1123+pread64 (int __fd, void *const __clang_pass_object_size0 __buf,
1124+ size_t __nbytes, __off64_t __offset)
1125+__FORTIFY_PRECONDITIONS
1126+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__pread64_warn, __nbytes, __buf,
1127+ "pread64 called with bigger length "
1128+ "than size of the destination buffer")
1129 {
1130- if (__bos0 (__buf) != (size_t) -1)
1131- {
1132- if (!__builtin_constant_p (__nbytes))
1133- return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
1134-
1135- if ( __nbytes > __bos0 (__buf))
1136- return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
1137- __bos0 (__buf));
1138- }
1139-
1140+ if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
1141+ return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
1142 return __pread64_alias (__fd, __buf, __nbytes, __offset);
1143 }
1144+__FORTIFY_FUNCTION_END
1145 # endif
1146 #endif
1147
1148@@ -128,27 +104,21 @@ extern ssize_t __REDIRECT_NTH (__readlin
1149 (const char *__restrict __path,
1150 char *__restrict __buf, size_t __len), readlink)
1151 __nonnull ((1, 2)) __wur;
1152-extern ssize_t __REDIRECT_NTH (__readlink_chk_warn,
1153- (const char *__restrict __path,
1154- char *__restrict __buf, size_t __len,
1155- size_t __buflen), __readlink_chk)
1156- __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length "
1157- "than size of destination buffer");
1158
1159-__fortify_function __nonnull ((1, 2)) __wur ssize_t
1160-__NTH (readlink (const char *__restrict __path, char *__restrict __buf,
1161+__fortify_potential_overload __nonnull ((1, 2)) __wur ssize_t
1162+__NTH (readlink (const char *__restrict __path,
1163+ char *__restrict const __clang_pass_object_size __buf,
1164 size_t __len))
1165+__FORTIFY_PRECONDITIONS
1166+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__readlink_warn, __len, __buf,
1167+ "readlink called with bigger length "
1168+ "than size of destination buffer")
1169 {
1170- if (__bos (__buf) != (size_t) -1)
1171- {
1172- if (!__builtin_constant_p (__len))
1173- return __readlink_chk (__path, __buf, __len, __bos (__buf));
1174-
1175- if ( __len > __bos (__buf))
1176- return __readlink_chk_warn (__path, __buf, __len, __bos (__buf));
1177- }
1178+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1179+ return __readlink_chk (__path, __buf, __len, __bos (__buf));
1180 return __readlink_alias (__path, __buf, __len);
1181 }
1182+__FORTIFY_FUNCTION_END
1183 #endif
1184
1185 #ifdef __USE_ATFILE
1186@@ -161,119 +131,104 @@ extern ssize_t __REDIRECT_NTH (__readlin
1187 char *__restrict __buf, size_t __len),
1188 readlinkat)
1189 __nonnull ((2, 3)) __wur;
1190-extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn,
1191- (int __fd, const char *__restrict __path,
1192- char *__restrict __buf, size_t __len,
1193- size_t __buflen), __readlinkat_chk)
1194- __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger "
1195- "length than size of destination "
1196- "buffer");
1197-
1198-__fortify_function __nonnull ((2, 3)) __wur ssize_t
1199-__NTH (readlinkat (int __fd, const char *__restrict __path,
1200- char *__restrict __buf, size_t __len))
1201+
1202+__fortify_potential_overload __nonnull ((2, 3)) __wur ssize_t
1203+__NTH (readlinkat (int __fd,
1204+ const char *__restrict __path,
1205+ char *__restrict const __clang_pass_object_size __buf,
1206+ size_t __len))
1207+__FORTIFY_PRECONDITIONS
1208+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__readlinkat_warn, __len, __buf,
1209+ "readlinkat called with bigger length "
1210+ "than size of destination buffer")
1211 {
1212- if (__bos (__buf) != (size_t) -1)
1213- {
1214- if (!__builtin_constant_p (__len))
1215- return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf));
1216-
1217- if (__len > __bos (__buf))
1218- return __readlinkat_chk_warn (__fd, __path, __buf, __len,
1219- __bos (__buf));
1220- }
1221+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1222+ return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf));
1223 return __readlinkat_alias (__fd, __path, __buf, __len);
1224 }
1225+__FORTIFY_FUNCTION_END
1226 #endif
1227
1228 extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
1229 __THROW __wur;
1230 extern char *__REDIRECT_NTH (__getcwd_alias,
1231 (char *__buf, size_t __size), getcwd) __wur;
1232-extern char *__REDIRECT_NTH (__getcwd_chk_warn,
1233- (char *__buf, size_t __size, size_t __buflen),
1234- __getcwd_chk)
1235- __wur __warnattr ("getcwd caller with bigger length than size of "
1236- "destination buffer");
1237
1238-__fortify_function __wur char *
1239-__NTH (getcwd (char *__buf, size_t __size))
1240+__fortify_potential_overload __wur char *
1241+__NTH (getcwd (char *const __clang_pass_object_size __buf, size_t __size))
1242+__FORTIFY_PRECONDITIONS
1243+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getcwd_warn, __size, __buf,
1244+ "getcwd called with bigger length than "
1245+ "size of destination buffer")
1246 {
1247- if (__bos (__buf) != (size_t) -1)
1248- {
1249- if (!__builtin_constant_p (__size))
1250- return __getcwd_chk (__buf, __size, __bos (__buf));
1251-
1252- if (__size > __bos (__buf))
1253- return __getcwd_chk_warn (__buf, __size, __bos (__buf));
1254- }
1255+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1256+ return __getcwd_chk (__buf, __size, __bos (__buf));
1257 return __getcwd_alias (__buf, __size);
1258 }
1259+__FORTIFY_FUNCTION_END
1260
1261 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
1262+# define __warn_getwd_use_something_else \
1263+ "please use getcwd instead, as getwd doesn't specify buffer size"
1264+
1265 extern char *__getwd_chk (char *__buf, size_t buflen)
1266 __THROW __nonnull ((1)) __wur;
1267 extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd)
1268- __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd "
1269- "doesn't specify buffer size");
1270+ __nonnull ((1)) __wur __warnattr (__warn_getwd_use_something_else);
1271+
1272+extern char *__REDIRECT (__getwd_alias, (char *__str), getwd) __wur;
1273
1274-__fortify_function __nonnull ((1)) __attribute_deprecated__ __wur char *
1275-__NTH (getwd (char *__buf))
1276+__fortify_potential_overload __nonnull ((1)) __attribute_deprecated__ __wur
1277+char *
1278+__NTH (getwd (char *const __clang_pass_object_size __buf))
1279+ __clang_warning_if (__bos (__buf) == (size_t) -1,
1280+ __warn_getwd_use_something_else)
1281 {
1282 if (__bos (__buf) != (size_t) -1)
1283 return __getwd_chk (__buf, __bos (__buf));
1284 return __getwd_warn (__buf);
1285 }
1286+# undef __warn_getwd_use_something_else
1287 #endif
1288
1289 extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
1290 size_t __buflen) __THROW;
1291 extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf,
1292 size_t __len), confstr);
1293-extern size_t __REDIRECT_NTH (__confstr_chk_warn,
1294- (int __name, char *__buf, size_t __len,
1295- size_t __buflen), __confstr_chk)
1296- __warnattr ("confstr called with bigger length than size of destination "
1297- "buffer");
1298
1299-__fortify_function size_t
1300-__NTH (confstr (int __name, char *__buf, size_t __len))
1301+__fortify_potential_overload size_t
1302+__NTH (confstr (int __name, char *const __clang_pass_object_size __buf,
1303+ size_t __len))
1304+__FORTIFY_PRECONDITIONS
1305+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__confstr_warn, __len, __buf,
1306+ "confstr called with bigger length than "
1307+ "size of destination buffer")
1308 {
1309- if (__bos (__buf) != (size_t) -1)
1310- {
1311- if (!__builtin_constant_p (__len))
1312- return __confstr_chk (__name, __buf, __len, __bos (__buf));
1313-
1314- if (__bos (__buf) < __len)
1315- return __confstr_chk_warn (__name, __buf, __len, __bos (__buf));
1316- }
1317+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1318+ return __confstr_chk (__name, __buf, __len, __bos (__buf));
1319 return __confstr_alias (__name, __buf, __len);
1320 }
1321-
1322+__FORTIFY_FUNCTION_END
1323
1324 extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen)
1325 __THROW __wur;
1326 extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]),
1327 getgroups) __wur;
1328-extern int __REDIRECT_NTH (__getgroups_chk_warn,
1329- (int __size, __gid_t __list[], size_t __listlen),
1330- __getgroups_chk)
1331- __wur __warnattr ("getgroups called with bigger group count than what "
1332- "can fit into destination buffer");
1333-
1334-__fortify_function int
1335-__NTH (getgroups (int __size, __gid_t __list[]))
1336-{
1337- if (__bos (__list) != (size_t) -1)
1338- {
1339- if (!__builtin_constant_p (__size) || __size < 0)
1340- return __getgroups_chk (__size, __list, __bos (__list));
1341-
1342- if (__size * sizeof (__gid_t) > __bos (__list))
1343- return __getgroups_chk_warn (__size, __list, __bos (__list));
1344- }
1345+
1346+__fortify_potential_overload int
1347+__NTH (getgroups (int __size, __gid_t *const __clang_pass_object_size __list))
1348+__FORTIFY_PRECONDITIONS
1349+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getgroups_warn,
1350+ __size * sizeof (__gid_t), __list,
1351+ "getgroups called with bigger group "
1352+ "count than what can fit into "
1353+ "destination buffer")
1354+{
1355+ if (__FORTIFY_CALL_CHK && __bos (__list) != (size_t) -1)
1356+ return __getgroups_chk (__size, __list, __bos (__list));
1357 return __getgroups_alias (__size, __list);
1358 }
1359+__FORTIFY_FUNCTION_END
1360
1361
1362 extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
1363@@ -287,19 +242,19 @@ extern int __REDIRECT_NTH (__ttyname_r_c
1364 __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than "
1365 "size of destination buffer");
1366
1367-__fortify_function int
1368-__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen))
1369-{
1370- if (__bos (__buf) != (size_t) -1)
1371- {
1372- if (!__builtin_constant_p (__buflen))
1373- return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
1374-
1375- if (__buflen > __bos (__buf))
1376- return __ttyname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf));
1377- }
1378- return __ttyname_r_alias (__fd, __buf, __buflen);
1379-}
1380+__fortify_potential_overload int
1381+__NTH (ttyname_r (int __fd, char *const __clang_pass_object_size __buf,
1382+ size_t __buflen))
1383+__FORTIFY_PRECONDITIONS
1384+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ttyname_r_warn, __buflen, __buf,
1385+ "ttyname_r called with bigger buflen "
1386+ "than size of destination buffer")
1387+{
1388+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1389+ return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
1390+ return __ttyname_r_alias (__fd, __buf, __buflen);
1391+ }
1392+__FORTIFY_FUNCTION_END
1393
1394
1395 #ifdef __USE_POSIX199506
1396@@ -307,25 +262,19 @@ extern int __getlogin_r_chk (char *__buf
1397 __nonnull ((1));
1398 extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen),
1399 getlogin_r) __nonnull ((1));
1400-extern int __REDIRECT (__getlogin_r_chk_warn,
1401- (char *__buf, size_t __buflen, size_t __nreal),
1402- __getlogin_r_chk)
1403- __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than "
1404- "size of destination buffer");
1405
1406-__fortify_function int
1407-getlogin_r (char *__buf, size_t __buflen)
1408+__fortify_potential_overload int
1409+getlogin_r (char *const __clang_pass_object_size __buf, size_t __buflen)
1410+__FORTIFY_PRECONDITIONS
1411+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getlogin_r_warn, __buflen, __buf,
1412+ "getlogin_r called with bigger buflen "
1413+ "than size of destination buffer")
1414 {
1415- if (__bos (__buf) != (size_t) -1)
1416- {
1417- if (!__builtin_constant_p (__buflen))
1418- return __getlogin_r_chk (__buf, __buflen, __bos (__buf));
1419-
1420- if (__buflen > __bos (__buf))
1421- return __getlogin_r_chk_warn (__buf, __buflen, __bos (__buf));
1422- }
1423+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1424+ return __getlogin_r_chk (__buf, __buflen, __bos (__buf));
1425 return __getlogin_r_alias (__buf, __buflen);
1426 }
1427+__FORTIFY_FUNCTION_END
1428 #endif
1429
1430
1431@@ -334,25 +283,20 @@ extern int __gethostname_chk (char *__bu
1432 __THROW __nonnull ((1));
1433 extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
1434 gethostname) __nonnull ((1));
1435-extern int __REDIRECT_NTH (__gethostname_chk_warn,
1436- (char *__buf, size_t __buflen, size_t __nreal),
1437- __gethostname_chk)
1438- __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than "
1439- "size of destination buffer");
1440
1441-__fortify_function int
1442-__NTH (gethostname (char *__buf, size_t __buflen))
1443+__fortify_potential_overload int
1444+__NTH (gethostname (char *const __clang_pass_object_size __buf,
1445+ size_t __buflen))
1446+__FORTIFY_PRECONDITIONS
1447+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__gethostname_warn, __buflen, __buf,
1448+ "gethostname called with bigger buflen "
1449+ "than size of destination buffer")
1450 {
1451- if (__bos (__buf) != (size_t) -1)
1452- {
1453- if (!__builtin_constant_p (__buflen))
1454- return __gethostname_chk (__buf, __buflen, __bos (__buf));
1455-
1456- if (__buflen > __bos (__buf))
1457- return __gethostname_chk_warn (__buf, __buflen, __bos (__buf));
1458- }
1459+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1460+ return __gethostname_chk (__buf, __buflen, __bos (__buf));
1461 return __gethostname_alias (__buf, __buflen);
1462 }
1463+__FORTIFY_FUNCTION_END
1464 #endif
1465
1466
1467@@ -362,24 +306,18 @@ extern int __getdomainname_chk (char *__
1468 extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf,
1469 size_t __buflen),
1470 getdomainname) __nonnull ((1)) __wur;
1471-extern int __REDIRECT_NTH (__getdomainname_chk_warn,
1472- (char *__buf, size_t __buflen, size_t __nreal),
1473- __getdomainname_chk)
1474- __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger "
1475- "buflen than size of destination "
1476- "buffer");
1477
1478-__fortify_function int
1479-__NTH (getdomainname (char *__buf, size_t __buflen))
1480+__fortify_potential_overload int
1481+__NTH (getdomainname (char *const __clang_pass_object_size __buf,
1482+ size_t __buflen))
1483+__FORTIFY_PRECONDITIONS
1484+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__getdomainname_warn, __buflen, __buf,
1485+ "getdomainname called with bigger "
1486+ "buflen than size of destination buffer")
1487 {
1488- if (__bos (__buf) != (size_t) -1)
1489- {
1490- if (!__builtin_constant_p (__buflen))
1491- return __getdomainname_chk (__buf, __buflen, __bos (__buf));
1492-
1493- if (__buflen > __bos (__buf))
1494- return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf));
1495- }
1496+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1497+ return __getdomainname_chk (__buf, __buflen, __bos (__buf));
1498 return __getdomainname_alias (__buf, __buflen);
1499 }
1500+__FORTIFY_FUNCTION_END
1501 #endif
1502--- a/rt/bits/mqueue2.h
1503+++ b/rt/bits/mqueue2.h
1504@@ -29,10 +29,47 @@ extern mqd_t __mq_open_2 (const char *__
1505 extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name,
1506 int __oflag, ...), mq_open)
1507 __nonnull ((1));
1508+
1509+#define __warn_mq_open_wrong_number_of_args "mq_open can be called either " \
1510+ "with 2 or 4 arguments"
1511+#define __warn_mq_open_missing_mode_and_attr "mq_open with O_CREAT in " \
1512+ "second argument needs 4 arguments"
1513+#ifdef __use_clang_fortify
1514+__fortify_overload __clang_error (__warn_mq_open_wrong_number_of_args) mqd_t
1515+__NTH (mq_open (const char *const __clang_pass_object_size __name, int __oflag,
1516+ int __mode))
1517+{
1518+ return __mq_open_alias (__name, __oflag, __mode);
1519+}
1520+
1521+__fortify_overload __clang_error (__warn_mq_open_wrong_number_of_args)
1522+mqd_t
1523+__NTH (mq_open (const char *const __clang_pass_object_size __name, int __oflag,
1524+ int __mode, struct mq_attr *__attr, ...))
1525+{
1526+ return __mq_open_alias (__name, __oflag, __mode, __attr);
1527+}
1528+
1529+__fortify_overload __clang_prefer_this_overload mqd_t
1530+__NTH (mq_open (const char *const __clang_pass_object_size __name,
1531+ int __oflag))
1532+ __clang_error_if ((__oflag & O_CREAT),
1533+ __warn_mq_open_missing_mode_and_attr)
1534+{
1535+ return __mq_open_alias (__name, __oflag);
1536+}
1537+
1538+__fortify_overload __clang_prefer_this_overload mqd_t
1539+__NTH (mq_open (const char *const __clang_pass_object_size __name, int __oflag,
1540+ int __mode, struct mq_attr *__attr))
1541+{
1542+ return __mq_open_alias (__name, __oflag, __mode, __attr);
1543+}
1544+#else
1545 __errordecl (__mq_open_wrong_number_of_args,
1546- "mq_open can be called either with 2 or 4 arguments");
1547+ __warn_mq_open_wrong_number_of_args);
1548 __errordecl (__mq_open_missing_mode_and_attr,
1549- "mq_open with O_CREAT in second argument needs 4 arguments");
1550+ __warn_mq_open_missing_mode_and_attr);
1551
1552 __fortify_function mqd_t
1553 __NTH (mq_open (const char *__name, int __oflag, ...))
1554@@ -55,3 +92,6 @@ __NTH (mq_open (const char *__name, int
1555
1556 return __mq_open_alias (__name, __oflag, __va_arg_pack ());
1557 }
1558+#endif
1559+#undef __warn_mq_open_wrong_number_of_args
1560+#undef __warn_mq_open_missing_mode_and_attr
1561--- a/rt/mqueue.h
1562+++ b/rt/mqueue.h
1563@@ -89,7 +89,7 @@ extern int mq_timedsend (mqd_t __mqdes,
1564
1565 /* Define some inlines helping to catch common problems. */
1566 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
1567- && defined __va_arg_pack_len
1568+ && (defined __va_arg_pack_len || defined __use_clang_fortify)
1569 # include <bits/mqueue2.h>
1570 #endif
1571
1572--- a/socket/bits/socket2.h
1573+++ b/socket/bits/socket2.h
1574@@ -24,25 +24,20 @@ extern ssize_t __recv_chk (int __fd, voi
1575 int __flags);
1576 extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
1577 int __flags), recv);
1578-extern ssize_t __REDIRECT (__recv_chk_warn,
1579- (int __fd, void *__buf, size_t __n, size_t __buflen,
1580- int __flags), __recv_chk)
1581- __warnattr ("recv called with bigger length than size of destination "
1582- "buffer");
1583
1584-__fortify_function ssize_t
1585-recv (int __fd, void *__buf, size_t __n, int __flags)
1586+__fortify_potential_overload ssize_t
1587+recv (int __fd, void *const __clang_pass_object_size0 __buf, size_t __n,
1588+ int __flags)
1589+__FORTIFY_PRECONDITIONS
1590+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__recv_warn, __n, __buf,
1591+ "recv called with bigger length than "
1592+ "size of destination buffer")
1593 {
1594- if (__bos0 (__buf) != (size_t) -1)
1595- {
1596- if (!__builtin_constant_p (__n))
1597- return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
1598-
1599- if (__n > __bos0 (__buf))
1600- return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags);
1601- }
1602+ if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
1603+ return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
1604 return __recv_alias (__fd, __buf, __n, __flags);
1605 }
1606+__FORTIFY_FUNCTION_END
1607
1608 extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
1609 size_t __buflen, int __flags,
1610@@ -52,26 +47,19 @@ extern ssize_t __REDIRECT (__recvfrom_al
1611 (int __fd, void *__restrict __buf, size_t __n,
1612 int __flags, __SOCKADDR_ARG __addr,
1613 socklen_t *__restrict __addr_len), recvfrom);
1614-extern ssize_t __REDIRECT (__recvfrom_chk_warn,
1615- (int __fd, void *__restrict __buf, size_t __n,
1616- size_t __buflen, int __flags,
1617- __SOCKADDR_ARG __addr,
1618- socklen_t *__restrict __addr_len), __recvfrom_chk)
1619- __warnattr ("recvfrom called with bigger length than size of "
1620- "destination buffer");
1621
1622-__fortify_function ssize_t
1623-recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
1624- __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
1625+__fortify_potential_overload ssize_t
1626+recvfrom (int __fd, void *__restrict const __clang_pass_object_size0 __buf,
1627+ size_t __n, int __flags, __SOCKADDR_ARG __addr,
1628+ socklen_t *__restrict __addr_len)
1629+__FORTIFY_PRECONDITIONS
1630+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT (__recvfrom_warn, __n, __buf,
1631+ "recvfrom called with bigger length "
1632+ "than size of destination buffer")
1633 {
1634- if (__bos0 (__buf) != (size_t) -1)
1635- {
1636- if (!__builtin_constant_p (__n))
1637- return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags,
1638- __addr, __addr_len);
1639- if (__n > __bos0 (__buf))
1640- return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags,
1641- __addr, __addr_len);
1642- }
1643+ if (__FORTIFY_CALL_CHK && __bos0 (__buf) != (size_t) -1)
1644+ return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags, __addr,
1645+ __addr_len);
1646 return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
1647 }
1648+__FORTIFY_FUNCTION_END
1649--- a/stdlib/bits/stdlib.h
1650+++ b/stdlib/bits/stdlib.h
1651@@ -26,27 +26,27 @@ extern char *__realpath_chk (const char
1652 extern char *__REDIRECT_NTH (__realpath_alias,
1653 (const char *__restrict __name,
1654 char *__restrict __resolved), realpath) __wur;
1655-extern char *__REDIRECT_NTH (__realpath_chk_warn,
1656- (const char *__restrict __name,
1657- char *__restrict __resolved,
1658- size_t __resolvedlen), __realpath_chk) __wur
1659- __warnattr ("second argument of realpath must be either NULL or at "
1660- "least PATH_MAX bytes long buffer");
1661
1662-__fortify_function __wur char *
1663-__NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
1664+__fortify_potential_overload __wur char *
1665+__NTH (realpath (const char *__restrict __name,
1666+ char *__restrict const __clang_pass_object_size __resolved))
1667+__FORTIFY_PRECONDITIONS
1668+#if defined _LIBC_LIMITS_H_ && defined PATH_MAX
1669+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__realpath_warn, PATH_MAX, __resolved,
1670+ "second argument of realpath must be "
1671+ "either NULL or at least PATH_MAX "
1672+ "bytes long buffer")
1673+#endif
1674 {
1675- if (__bos (__resolved) != (size_t) -1)
1676- {
1677+ if (
1678 #if defined _LIBC_LIMITS_H_ && defined PATH_MAX
1679- if (__bos (__resolved) < PATH_MAX)
1680- return __realpath_chk_warn (__name, __resolved, __bos (__resolved));
1681+ __FORTIFY_CALL_CHK &&
1682 #endif
1683- return __realpath_chk (__name, __resolved, __bos (__resolved));
1684- }
1685-
1686+ __bos (__resolved) != (size_t) -1)
1687+ return __realpath_chk (__name, __resolved, __bos (__resolved));
1688 return __realpath_alias (__name, __resolved);
1689 }
1690+__FORTIFY_FUNCTION_END
1691
1692
1693 extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
1694@@ -54,33 +54,28 @@ extern int __ptsname_r_chk (int __fd, ch
1695 extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf,
1696 size_t __buflen), ptsname_r)
1697 __nonnull ((2));
1698-extern int __REDIRECT_NTH (__ptsname_r_chk_warn,
1699- (int __fd, char *__buf, size_t __buflen,
1700- size_t __nreal), __ptsname_r_chk)
1701- __nonnull ((2)) __warnattr ("ptsname_r called with buflen bigger than "
1702- "size of buf");
1703
1704-__fortify_function int
1705-__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen))
1706+__fortify_potential_overload int
1707+__NTH (ptsname_r (int __fd, char *const __clang_pass_object_size __buf,
1708+ size_t __buflen))
1709+__FORTIFY_PRECONDITIONS
1710+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__ptsname_r_warn, __buflen, __buf,
1711+ "ptsname_r called with buflen "
1712+ "bigger than size of buf")
1713 {
1714- if (__bos (__buf) != (size_t) -1)
1715- {
1716- if (!__builtin_constant_p (__buflen))
1717- return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf));
1718- if (__buflen > __bos (__buf))
1719- return __ptsname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf));
1720- }
1721+ if (__FORTIFY_CALL_CHK && __bos (__buf) != (size_t) -1)
1722+ return __ptsname_r_chk (__fd, __buf, __buflen, __bos (__buf));
1723 return __ptsname_r_alias (__fd, __buf, __buflen);
1724 }
1725-
1726+__FORTIFY_FUNCTION_END
1727
1728 extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
1729 __THROW __wur;
1730 extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar),
1731 wctomb) __wur;
1732
1733-__fortify_function __wur int
1734-__NTH (wctomb (char *__s, wchar_t __wchar))
1735+__fortify_potential_overload __wur int
1736+__NTH (wctomb (char *const __clang_pass_object_size __s, wchar_t __wchar))
1737 {
1738 /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
1739 But this would only disturb the namespace. So we define our own
1740@@ -102,29 +97,22 @@ extern size_t __REDIRECT_NTH (__mbstowcs
1741 (wchar_t *__restrict __dst,
1742 const char *__restrict __src,
1743 size_t __len), mbstowcs);
1744-extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn,
1745- (wchar_t *__restrict __dst,
1746- const char *__restrict __src,
1747- size_t __len, size_t __dstlen), __mbstowcs_chk)
1748- __warnattr ("mbstowcs called with dst buffer smaller than len "
1749- "* sizeof (wchar_t)");
1750-
1751-__fortify_function size_t
1752-__NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src,
1753- size_t __len))
1754+
1755+__fortify_potential_overload size_t
1756+__NTH (mbstowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
1757+ const char *__restrict __src, size_t __len))
1758+__FORTIFY_PRECONDITIONS
1759+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbstowcs_warn, __len, __dst,
1760+ sizeof (wchar_t),
1761+ "mbstowcs called with dst buffer "
1762+ "smaller than len * sizeof (wchar_t)")
1763 {
1764- if (__bos (__dst) != (size_t) -1)
1765- {
1766- if (!__builtin_constant_p (__len))
1767- return __mbstowcs_chk (__dst, __src, __len,
1768- __bos (__dst) / sizeof (wchar_t));
1769-
1770- if (__len > __bos (__dst) / sizeof (wchar_t))
1771- return __mbstowcs_chk_warn (__dst, __src, __len,
1772- __bos (__dst) / sizeof (wchar_t));
1773- }
1774+ if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
1775+ return __mbstowcs_chk (__dst, __src, __len,
1776+ __bos (__dst) / sizeof (wchar_t));
1777 return __mbstowcs_alias (__dst, __src, __len);
1778 }
1779+__FORTIFY_FUNCTION_END
1780
1781
1782 extern size_t __wcstombs_chk (char *__restrict __dst,
1783@@ -134,22 +122,17 @@ extern size_t __REDIRECT_NTH (__wcstombs
1784 (char *__restrict __dst,
1785 const wchar_t *__restrict __src,
1786 size_t __len), wcstombs);
1787-extern size_t __REDIRECT_NTH (__wcstombs_chk_warn,
1788- (char *__restrict __dst,
1789- const wchar_t *__restrict __src,
1790- size_t __len, size_t __dstlen), __wcstombs_chk)
1791- __warnattr ("wcstombs called with dst buffer smaller than len");
1792
1793-__fortify_function size_t
1794-__NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src,
1795- size_t __len))
1796+__fortify_potential_overload size_t
1797+__NTH (wcstombs (char *__restrict const __clang_pass_object_size __dst,
1798+ const wchar_t *__restrict __src, size_t __len))
1799+__FORTIFY_PRECONDITIONS
1800+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcstombs_warn, __len, __dst,
1801+ "wcstombs called with dst buffer "
1802+ "smaller than len")
1803 {
1804- if (__bos (__dst) != (size_t) -1)
1805- {
1806- if (!__builtin_constant_p (__len))
1807- return __wcstombs_chk (__dst, __src, __len, __bos (__dst));
1808- if (__len > __bos (__dst))
1809- return __wcstombs_chk_warn (__dst, __src, __len, __bos (__dst));
1810- }
1811+ if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
1812+ return __wcstombs_chk (__dst, __src, __len, __bos (__dst));
1813 return __wcstombs_alias (__dst, __src, __len);
1814 }
1815+__FORTIFY_FUNCTION_END
1816--- a/string/bits/string_fortified.h
1817+++ b/string/bits/string_fortified.h
1818@@ -22,45 +22,82 @@
1819 # error "Never use <bits/string_fortified.h> directly; include <string.h> instead."
1820 #endif
1821
1822-#if !__GNUC_PREREQ (5,0)
1823-__warndecl (__warn_memset_zero_len,
1824- "memset used with constant zero length parameter; this could be due to transposed parameters");
1825-#endif
1826-
1827-__fortify_function void *
1828-__NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
1829- size_t __len))
1830-{
1831- return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
1832-}
1833-
1834-__fortify_function void *
1835-__NTH (memmove (void *__dest, const void *__src, size_t __len))
1836-{
1837- return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
1838+#define __warn_len_too_large \
1839+ "function called with bigger length than the destination buffer"
1840+/* Repeat bodies here to reduce 'note's if we detect a problem. */
1841+#define __size_too_small(bos, dest, len) \
1842+ (bos (dest) != (size_t) -1 && bos (dest) < len)
1843+#define __warn_if_dest_too_small(dest, len) \
1844+ __clang_warning_if (__size_too_small (__bos, dest, len), \
1845+ __warn_len_too_large)
1846+#define __warn_if_dest_too_small0(dest, len) \
1847+ __clang_warning_if (__size_too_small (__bos0, dest, len), \
1848+ __warn_len_too_large)
1849+
1850+#define __warn_input_str_too_large \
1851+ "destination buffer will always be overflown by source"
1852+#define __warn_if_src_too_large(dest, src) \
1853+ __clang_warning_if (__size_too_small (__bos, dest, __builtin_strlen (src) + 1), \
1854+ __warn_input_str_too_large)
1855+
1856+__fortify_potential_overload void *
1857+__NTH (memcpy (void *__restrict const __clang_pass_object_size0 __dest,
1858+ const void *__restrict __src, size_t __len))
1859+ __warn_if_dest_too_small0 (__dest, __len)
1860+{
1861+ size_t __bos_dst = __bos0 (__dest);
1862+ if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
1863+ && __bos_dst >= __len))
1864+ return __builtin_memcpy (__dest, __src, __len);
1865+ return __builtin___memcpy_chk (__dest, __src, __len, __bos_dst);
1866+}
1867+
1868+__fortify_potential_overload void *
1869+__NTH (memmove (void *const __clang_pass_object_size0 __dest,
1870+ const void *__src, size_t __len))
1871+ __warn_if_dest_too_small0 (__dest, __len)
1872+{
1873+ size_t __bos_dst = __bos0 (__dest);
1874+ if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
1875+ && __bos_dst >= __len))
1876+ return __builtin_memmove (__dest, __src, __len);
1877+ return __builtin___memmove_chk (__dest, __src, __len, __bos_dst);
1878 }
1879
1880 #ifdef __USE_GNU
1881-__fortify_function void *
1882-__NTH (mempcpy (void *__restrict __dest, const void *__restrict __src,
1883- size_t __len))
1884-{
1885- return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest));
1886+__fortify_potential_overload void *
1887+__NTH (mempcpy (void *__restrict const __clang_pass_object_size0 __dest,
1888+ const void *__restrict __src, size_t __len))
1889+ __warn_if_dest_too_small0 (__dest, __len)
1890+{
1891+ size_t __bos_dst = __bos0 (__dest);
1892+ if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
1893+ && __bos_dst >= __len))
1894+ return __builtin_mempcpy (__dest, __src, __len);
1895+ return __builtin___mempcpy_chk (__dest, __src, __len, __bos_dst);
1896 }
1897 #endif
1898
1899-
1900 /* The first two tests here help to catch a somewhat common problem
1901 where the second and third parameter are transposed. This is
1902 especially problematic if the intended fill value is zero. In this
1903 case no work is done at all. We detect these problems by referring
1904 non-existing functions. */
1905-__fortify_function void *
1906-__NTH (memset (void *__dest, int __ch, size_t __len))
1907+#define __warn_memset_zero_len_msg \
1908+ "memset used with constant zero length parameter; this could be due to " \
1909+ "transposed parameters"
1910+#if !__GNUC_PREREQ (5,0)
1911+__warndecl (__warn_memset_zero_len, __warn_memset_zero_len_msg);
1912+#endif
1913+__fortify_potential_overload void *
1914+__NTH (memset (void *const __clang_pass_object_size0 __dest, int __ch,
1915+ size_t __len))
1916+ __warn_if_dest_too_small0 (__dest, __len)
1917+ __clang_warning_if (__len == 0 && __ch != 0, __warn_memset_zero_len_msg)
1918 {
1919 /* GCC-5.0 and newer implements these checks in the compiler, so we don't
1920 need them here. */
1921-#if !__GNUC_PREREQ (5,0)
1922+#if !__GNUC_PREREQ (5,0) && !defined __use_clang_fortify
1923 if (__builtin_constant_p (__len) && __len == 0
1924 && (!__builtin_constant_p (__ch) || __ch != 0))
1925 {
1926@@ -68,8 +105,13 @@ __NTH (memset (void *__dest, int __ch, s
1927 return __dest;
1928 }
1929 #endif
1930- return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
1931+ size_t __bos_dst = __bos0 (__dest);
1932+ if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
1933+ && __bos_dst >= __len))
1934+ return __builtin_memset (__dest, __ch, __len);
1935+ return __builtin___memset_chk (__dest, __ch, __len, __bos_dst);
1936 }
1937+#undef __warn_memset_zero_len_msg
1938
1939 #ifdef __USE_MISC
1940 # include <bits/strings_fortified.h>
1941@@ -84,24 +126,30 @@ __NTH (explicit_bzero (void *__dest, siz
1942 }
1943 #endif
1944
1945-__fortify_function char *
1946-__NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
1947+__fortify_potential_overload char *
1948+__NTH (strcpy (char *__restrict const __clang_pass_object_size __dest,
1949+ const char *__restrict __src))
1950+ __warn_if_src_too_large (__dest, __src)
1951 {
1952 return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
1953 }
1954
1955 #ifdef __USE_GNU
1956-__fortify_function char *
1957-__NTH (stpcpy (char *__restrict __dest, const char *__restrict __src))
1958+__fortify_potential_overload char *
1959+__NTH (stpcpy (char *__restrict const __clang_pass_object_size __dest,
1960+ const char *__restrict __src))
1961+ __warn_if_src_too_large (__dest, __src)
1962 {
1963 return __builtin___stpcpy_chk (__dest, __src, __bos (__dest));
1964 }
1965 #endif
1966
1967-
1968-__fortify_function char *
1969-__NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
1970- size_t __len))
1971+__fortify_potential_overload char *
1972+__NTH (strncpy (char *__restrict const __clang_pass_object_size __dest,
1973+ const char *__restrict __src, size_t __len))
1974+/* clang: Don't warn when __builtin_strlen (__src) < __bos (__dest),
1975+ but __len > __bos (__dest). The user should fix their code instead. */
1976+ __warn_if_dest_too_small (__dest, __len)
1977 {
1978 return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
1979 }
1980@@ -112,28 +160,36 @@ extern char *__stpncpy_chk (char *__dest
1981 extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src,
1982 size_t __n), stpncpy);
1983
1984-__fortify_function char *
1985-__NTH (stpncpy (char *__dest, const char *__src, size_t __n))
1986+__fortify_potential_overload char *
1987+__NTH (stpncpy (char *const __clang_pass_object_size __dest, const char *__src,
1988+ size_t __n))
1989+ __warn_if_dest_too_small (__dest, __n)
1990 {
1991- if (__bos (__dest) != (size_t) -1
1992- && (!__builtin_constant_p (__n) || __n > __bos (__dest)))
1993+ if (__bos (__dest) != (size_t) -1)
1994 return __stpncpy_chk (__dest, __src, __n, __bos (__dest));
1995 return __stpncpy_alias (__dest, __src, __n);
1996 }
1997
1998-
1999-__fortify_function char *
2000-__NTH (strcat (char *__restrict __dest, const char *__restrict __src))
2001+__fortify_potential_overload char *
2002+__NTH (strcat (char *__restrict const __clang_pass_object_size __dest,
2003+ const char *__restrict __src))
2004+ __warn_if_src_too_large (__dest, __src)
2005 {
2006 return __builtin___strcat_chk (__dest, __src, __bos (__dest));
2007 }
2008
2009-
2010-__fortify_function char *
2011-__NTH (strncat (char *__restrict __dest, const char *__restrict __src,
2012- size_t __len))
2013+__fortify_potential_overload char *
2014+__NTH (strncat (char *__restrict const __clang_pass_object_size __dest,
2015+ const char *__restrict __src, size_t __len))
2016+ __warn_if_src_too_large (__dest, __src)
2017 {
2018 return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
2019 }
2020
2021+#undef __warn_len_too_large
2022+#undef __size_too_small
2023+#undef __warn_if_dest_too_small
2024+#undef __warn_if_dest_too_small0
2025+#undef __warn_input_str_too_large
2026+#undef __warn_if_src_too_large
2027 #endif /* bits/string_fortified.h */
2028--- a/string/bits/strings_fortified.h
2029+++ b/string/bits/strings_fortified.h
2030@@ -19,16 +19,40 @@
2031 #ifndef __STRINGS_FORTIFIED
2032 # define __STRINGS_FORTIFIED 1
2033
2034-__fortify_function void
2035-__NTH (bcopy (const void *__src, void *__dest, size_t __len))
2036+#define __strings_warn_len_too_large \
2037+ "function called with bigger length than the destination buffer"
2038+
2039+#define __strings_size_too_small(dest, len) \
2040+ (__bos0 (dest) != (size_t) -1 && __bos0 (dest) < len)
2041+
2042+__fortify_potential_overload void
2043+__NTH (bcopy (const void *__src, void *const __clang_pass_object_size0 __dest,
2044+ size_t __len))
2045+ __clang_warning_if (__strings_size_too_small (__dest, __len),
2046+ __strings_warn_len_too_large)
2047 {
2048- (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
2049+ size_t __bos_dst = __bos0 (__dest);
2050+ if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
2051+ && __bos_dst >= __len))
2052+ (void) __builtin_memmove (__dest, __src, __len);
2053+ else
2054+ (void) __builtin___memmove_chk (__dest, __src, __len, __bos_dst);
2055 }
2056
2057-__fortify_function void
2058-__NTH (bzero (void *__dest, size_t __len))
2059+__fortify_potential_overload void
2060+__NTH (bzero (void *const __clang_pass_object_size0 __dest, size_t __len))
2061+ __clang_warning_if (__strings_size_too_small (__dest, __len),
2062+ __strings_warn_len_too_large)
2063 {
2064- (void) __builtin___memset_chk (__dest, '\0', __len, __bos0 (__dest));
2065+ size_t __bos_dst = __bos0 (__dest);
2066+ if (__bos_dst == (size_t) -1 || (__builtin_constant_p (__len)
2067+ && __bos_dst >= __len))
2068+ (void) __builtin_memset (__dest, '\0', __len);
2069+ else
2070+ (void) __builtin___memset_chk (__dest, '\0', __len, __bos_dst);
2071 }
2072
2073+
2074+#undef __strings_size_too_small
2075+#undef __strings_warn_len_too_large
2076 #endif
2077--- a/wcsmbs/bits/wchar2.h
2078+++ b/wcsmbs/bits/wchar2.h
2079@@ -20,7 +20,6 @@
2080 # error "Never include <bits/wchar2.h> directly; use <wchar.h> instead."
2081 #endif
2082
2083-
2084 extern wchar_t *__wmemcpy_chk (wchar_t *__restrict __s1,
2085 const wchar_t *__restrict __s2, size_t __n,
2086 size_t __ns1) __THROW;
2087@@ -28,57 +27,42 @@ extern wchar_t *__REDIRECT_NTH (__wmemcp
2088 (wchar_t *__restrict __s1,
2089 const wchar_t *__restrict __s2, size_t __n),
2090 wmemcpy);
2091-extern wchar_t *__REDIRECT_NTH (__wmemcpy_chk_warn,
2092- (wchar_t *__restrict __s1,
2093- const wchar_t *__restrict __s2, size_t __n,
2094- size_t __ns1), __wmemcpy_chk)
2095- __warnattr ("wmemcpy called with length bigger than size of destination "
2096- "buffer");
2097
2098-__fortify_function wchar_t *
2099-__NTH (wmemcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
2100- size_t __n))
2101-{
2102- if (__bos0 (__s1) != (size_t) -1)
2103- {
2104- if (!__builtin_constant_p (__n))
2105- return __wmemcpy_chk (__s1, __s2, __n,
2106- __bos0 (__s1) / sizeof (wchar_t));
2107-
2108- if (__n > __bos0 (__s1) / sizeof (wchar_t))
2109- return __wmemcpy_chk_warn (__s1, __s2, __n,
2110- __bos0 (__s1) / sizeof (wchar_t));
2111- }
2112- return __wmemcpy_alias (__s1, __s2, __n);
2113+__fortify_potential_overload wchar_t *
2114+__NTH (wmemcpy (wchar_t *__restrict const __clang_pass_object_size0 __s1,
2115+ const wchar_t *__restrict __s2, size_t __n))
2116+__FORTIFY_PRECONDITIONS
2117+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemcpy_warn, __n, __s1,
2118+ sizeof (wchar_t),
2119+ "wmemcpy called with length bigger "
2120+ "than size of destination buffer")
2121+{
2122+ if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1)
2123+ return __wmemcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t));
2124+ return __wmemcpy_alias(__s1, __s2, __n);
2125 }
2126-
2127+__FORTIFY_FUNCTION_END
2128
2129 extern wchar_t *__wmemmove_chk (wchar_t *__s1, const wchar_t *__s2,
2130 size_t __n, size_t __ns1) __THROW;
2131 extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1,
2132 const wchar_t *__s2,
2133 size_t __n), wmemmove);
2134-extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn,
2135- (wchar_t *__s1, const wchar_t *__s2,
2136- size_t __n, size_t __ns1), __wmemmove_chk)
2137- __warnattr ("wmemmove called with length bigger than size of destination "
2138- "buffer");
2139-
2140-__fortify_function wchar_t *
2141-__NTH (wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n))
2142-{
2143- if (__bos0 (__s1) != (size_t) -1)
2144- {
2145- if (!__builtin_constant_p (__n))
2146- return __wmemmove_chk (__s1, __s2, __n,
2147- __bos0 (__s1) / sizeof (wchar_t));
2148-
2149- if (__n > __bos0 (__s1) / sizeof (wchar_t))
2150- return __wmemmove_chk_warn (__s1, __s2, __n,
2151- __bos0 (__s1) / sizeof (wchar_t));
2152- }
2153+
2154+__fortify_potential_overload wchar_t *
2155+__NTH (wmemmove (wchar_t *const __clang_pass_object_size0 __s1,
2156+ const wchar_t *__s2, size_t __n))
2157+__FORTIFY_PRECONDITIONS
2158+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemmove_warn, __n, __s1,
2159+ sizeof (wchar_t),
2160+ "wmemmove called with length bigger "
2161+ "than size of destination buffer")
2162+{
2163+ if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t) -1)
2164+ return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t));
2165 return __wmemmove_alias (__s1, __s2, __n);
2166 }
2167+__FORTIFY_FUNCTION_END
2168
2169
2170 #ifdef __USE_GNU
2171@@ -89,29 +73,21 @@ extern wchar_t *__REDIRECT_NTH (__wmempc
2172 (wchar_t *__restrict __s1,
2173 const wchar_t *__restrict __s2,
2174 size_t __n), wmempcpy);
2175-extern wchar_t *__REDIRECT_NTH (__wmempcpy_chk_warn,
2176- (wchar_t *__restrict __s1,
2177- const wchar_t *__restrict __s2, size_t __n,
2178- size_t __ns1), __wmempcpy_chk)
2179- __warnattr ("wmempcpy called with length bigger than size of destination "
2180- "buffer");
2181-
2182-__fortify_function wchar_t *
2183-__NTH (wmempcpy (wchar_t *__restrict __s1, const wchar_t *__restrict __s2,
2184- size_t __n))
2185-{
2186- if (__bos0 (__s1) != (size_t) -1)
2187- {
2188- if (!__builtin_constant_p (__n))
2189- return __wmempcpy_chk (__s1, __s2, __n,
2190- __bos0 (__s1) / sizeof (wchar_t));
2191-
2192- if (__n > __bos0 (__s1) / sizeof (wchar_t))
2193- return __wmempcpy_chk_warn (__s1, __s2, __n,
2194- __bos0 (__s1) / sizeof (wchar_t));
2195- }
2196- return __wmempcpy_alias (__s1, __s2, __n);
2197+
2198+__fortify_potential_overload wchar_t *
2199+__NTH(wmempcpy(wchar_t *__restrict const __clang_pass_object_size0 __s1,
2200+ const wchar_t *__restrict __s2, size_t __n))
2201+__FORTIFY_PRECONDITIONS
2202+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmempcpy_warn, __n, __s1,
2203+ sizeof (wchar_t),
2204+ "wmempcpy called with length bigger "
2205+ "than size of destination buffer")
2206+{
2207+ if (__FORTIFY_CALL_CHK && __bos0 (__s1) != (size_t)-1)
2208+ return __wmempcpy_chk(__s1, __s2, __n, __bos0(__s1) / sizeof (wchar_t));
2209+ return __wmempcpy_alias(__s1, __s2, __n);
2210 }
2211+__FORTIFY_FUNCTION_END
2212 #endif
2213
2214
2215@@ -119,26 +95,21 @@ extern wchar_t *__wmemset_chk (wchar_t *
2216 size_t __ns) __THROW;
2217 extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c,
2218 size_t __n), wmemset);
2219-extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn,
2220- (wchar_t *__s, wchar_t __c, size_t __n,
2221- size_t __ns), __wmemset_chk)
2222- __warnattr ("wmemset called with length bigger than size of destination "
2223- "buffer");
2224-
2225-__fortify_function wchar_t *
2226-__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n))
2227-{
2228- if (__bos0 (__s) != (size_t) -1)
2229- {
2230- if (!__builtin_constant_p (__n))
2231- return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
2232-
2233- if (__n > __bos0 (__s) / sizeof (wchar_t))
2234- return __wmemset_chk_warn (__s, __c, __n,
2235- __bos0 (__s) / sizeof (wchar_t));
2236- }
2237+
2238+__fortify_potential_overload wchar_t *
2239+__NTH (wmemset (wchar_t *const __clang_pass_object_size0 __s, wchar_t __c,
2240+ size_t __n))
2241+__FORTIFY_PRECONDITIONS
2242+ __FORTIFY_WARNING_ONLY_IF_BOS0_LT2 (__wmemset_warn, __n, __s,
2243+ sizeof (wchar_t),
2244+ "wmemset called with length bigger "
2245+ "than size of destination buffer")
2246+{
2247+ if (__FORTIFY_CALL_CHK && __bos0 (__s) != (size_t) -1)
2248+ return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t));
2249 return __wmemset_alias (__s, __c, __n);
2250 }
2251+__FORTIFY_FUNCTION_END
2252
2253
2254 extern wchar_t *__wcscpy_chk (wchar_t *__restrict __dest,
2255@@ -148,8 +119,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy
2256 (wchar_t *__restrict __dest,
2257 const wchar_t *__restrict __src), wcscpy);
2258
2259-__fortify_function wchar_t *
2260-__NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
2261+__fortify_potential_overload wchar_t *
2262+__NTH (wcscpy (wchar_t *__restrict const __clang_pass_object_size __dest,
2263+ const wchar_t *__restrict __src))
2264 {
2265 if (__bos (__dest) != (size_t) -1)
2266 return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
2267@@ -164,8 +136,9 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy
2268 (wchar_t *__restrict __dest,
2269 const wchar_t *__restrict __src), wcpcpy);
2270
2271-__fortify_function wchar_t *
2272-__NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
2273+__fortify_potential_overload wchar_t *
2274+__NTH (wcpcpy (wchar_t *__restrict const __clang_pass_object_size __dest,
2275+ const wchar_t *__restrict __src))
2276 {
2277 if (__bos (__dest) != (size_t) -1)
2278 return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
2279@@ -180,28 +153,22 @@ extern wchar_t *__REDIRECT_NTH (__wcsncp
2280 (wchar_t *__restrict __dest,
2281 const wchar_t *__restrict __src,
2282 size_t __n), wcsncpy);
2283-extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn,
2284- (wchar_t *__restrict __dest,
2285- const wchar_t *__restrict __src,
2286- size_t __n, size_t __destlen), __wcsncpy_chk)
2287- __warnattr ("wcsncpy called with length bigger than size of destination "
2288- "buffer");
2289
2290-__fortify_function wchar_t *
2291-__NTH (wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
2292- size_t __n))
2293+__fortify_potential_overload wchar_t *
2294+__NTH (wcsncpy (wchar_t *__restrict const __clang_pass_object_size __dest,
2295+ const wchar_t *__restrict __src, size_t __n))
2296+__FORTIFY_PRECONDITIONS
2297+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__wcsncpy_warn, __n, __dest,
2298+ sizeof (wchar_t),
2299+ "wcsncpy called with length bigger "
2300+ "than size of destination buffer")
2301 {
2302- if (__bos (__dest) != (size_t) -1)
2303- {
2304- if (!__builtin_constant_p (__n))
2305- return __wcsncpy_chk (__dest, __src, __n,
2306- __bos (__dest) / sizeof (wchar_t));
2307- if (__n > __bos (__dest) / sizeof (wchar_t))
2308- return __wcsncpy_chk_warn (__dest, __src, __n,
2309- __bos (__dest) / sizeof (wchar_t));
2310- }
2311+ if (__FORTIFY_CALL_CHK && __bos (__dest) != (size_t) -1)
2312+ return __wcsncpy_chk (__dest, __src, __n,
2313+ __bos (__dest) / sizeof (wchar_t));
2314 return __wcsncpy_alias (__dest, __src, __n);
2315 }
2316+__FORTIFY_FUNCTION_END
2317
2318
2319 extern wchar_t *__wcpncpy_chk (wchar_t *__restrict __dest,
2320@@ -211,29 +178,22 @@ extern wchar_t *__REDIRECT_NTH (__wcpncp
2321 (wchar_t *__restrict __dest,
2322 const wchar_t *__restrict __src,
2323 size_t __n), wcpncpy);
2324-extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn,
2325- (wchar_t *__restrict __dest,
2326- const wchar_t *__restrict __src,
2327- size_t __n, size_t __destlen), __wcpncpy_chk)
2328- __warnattr ("wcpncpy called with length bigger than size of destination "
2329- "buffer");
2330
2331-__fortify_function wchar_t *
2332-__NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
2333- size_t __n))
2334+__fortify_potential_overload wchar_t *
2335+__NTH (wcpncpy (wchar_t *__restrict const __clang_pass_object_size __dest,
2336+ const wchar_t *__restrict __src, size_t __n))
2337+__FORTIFY_PRECONDITIONS
2338+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__wcpncpy_warn, __n, __dest,
2339+ sizeof (wchar_t),
2340+ "wcpncpy called with length bigger "
2341+ "than size of destination buffer")
2342 {
2343- if (__bos (__dest) != (size_t) -1)
2344- {
2345- if (!__builtin_constant_p (__n))
2346- return __wcpncpy_chk (__dest, __src, __n,
2347- __bos (__dest) / sizeof (wchar_t));
2348- if (__n > __bos (__dest) / sizeof (wchar_t))
2349- return __wcpncpy_chk_warn (__dest, __src, __n,
2350- __bos (__dest) / sizeof (wchar_t));
2351- }
2352+ if (__FORTIFY_CALL_CHK && __bos (__dest) != (size_t) -1)
2353+ return __wcpncpy_chk (__dest, __src, __n,
2354+ __bos (__dest) / sizeof (wchar_t));
2355 return __wcpncpy_alias (__dest, __src, __n);
2356 }
2357-
2358+__FORTIFY_FUNCTION_END
2359
2360 extern wchar_t *__wcscat_chk (wchar_t *__restrict __dest,
2361 const wchar_t *__restrict __src,
2362@@ -242,8 +202,9 @@ extern wchar_t *__REDIRECT_NTH (__wcscat
2363 (wchar_t *__restrict __dest,
2364 const wchar_t *__restrict __src), wcscat);
2365
2366-__fortify_function wchar_t *
2367-__NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src))
2368+__fortify_potential_overload wchar_t *
2369+__NTH (wcscat (wchar_t *__restrict const __clang_pass_object_size __dest,
2370+ const wchar_t *__restrict __src))
2371 {
2372 if (__bos (__dest) != (size_t) -1)
2373 return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
2374@@ -259,9 +220,9 @@ extern wchar_t *__REDIRECT_NTH (__wcsnca
2375 const wchar_t *__restrict __src,
2376 size_t __n), wcsncat);
2377
2378-__fortify_function wchar_t *
2379-__NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src,
2380- size_t __n))
2381+__fortify_potential_overload wchar_t *
2382+__NTH (wcsncat (wchar_t *__restrict const __clang_pass_object_size __dest,
2383+ const wchar_t *__restrict __src, size_t __n))
2384 {
2385 if (__bos (__dest) != (size_t) -1)
2386 return __wcsncat_chk (__dest, __src, __n,
2387@@ -280,16 +241,34 @@ extern int __REDIRECT_NTH_LDBL (__swprin
2388 const wchar_t *__restrict __fmt, ...),
2389 swprintf);
2390
2391-#ifdef __va_arg_pack
2392-__fortify_function int
2393-__NTH (swprintf (wchar_t *__restrict __s, size_t __n,
2394- const wchar_t *__restrict __fmt, ...))
2395+extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
2396+ int __flag, size_t __s_len,
2397+ const wchar_t *__restrict __format,
2398+ __gnuc_va_list __arg)
2399+ __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
2400+
2401+extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
2402+ (wchar_t *__restrict __s, size_t __n,
2403+ const wchar_t *__restrict __fmt,
2404+ __gnuc_va_list __ap), vswprintf);
2405+
2406+#ifdef __FORTIFY_ARG_PACK_OK
2407+__fortify_potential_overload int
2408+__NTH (swprintf (wchar_t *__restrict const __clang_pass_object_size __s,
2409+ size_t __n, const wchar_t *__restrict __fmt, ...))
2410 {
2411+ __FORTIFY_INIT_ARG_PACK(__fmt);
2412+ int __result;
2413 if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
2414- return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
2415- __bos (__s) / sizeof (wchar_t),
2416- __fmt, __va_arg_pack ());
2417- return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ());
2418+ __result = __FORTIFY_CALL_VA_CHK(swprintf, __s, __n,
2419+ __USE_FORTIFY_LEVEL - 1,
2420+ __bos (__s) / sizeof (wchar_t), __fmt,
2421+ __FORTIFY_ARG_PACK);
2422+ else
2423+ __result = __FORTIFY_CALL_VA_ALIAS(swprintf, __s, __n, __fmt,
2424+ __FORTIFY_ARG_PACK);
2425+ __FORTIFY_FREE_ARG_PACK();
2426+ return __result;
2427 }
2428 #elif !defined __cplusplus
2429 /* XXX We might want to have support in gcc for swprintf. */
2430@@ -300,20 +279,10 @@ __NTH (swprintf (wchar_t *__restrict __s
2431 : swprintf (s, n, __VA_ARGS__))
2432 #endif
2433
2434-extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
2435- int __flag, size_t __s_len,
2436- const wchar_t *__restrict __format,
2437- __gnuc_va_list __arg)
2438- __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
2439-
2440-extern int __REDIRECT_NTH_LDBL (__vswprintf_alias,
2441- (wchar_t *__restrict __s, size_t __n,
2442- const wchar_t *__restrict __fmt,
2443- __gnuc_va_list __ap), vswprintf);
2444-
2445-__fortify_function int
2446-__NTH (vswprintf (wchar_t *__restrict __s, size_t __n,
2447- const wchar_t *__restrict __fmt, __gnuc_va_list __ap))
2448+__fortify_potential_overload int
2449+__NTH (vswprintf (wchar_t *__restrict const __clang_pass_object_size __s,
2450+ size_t __n, const wchar_t *__restrict __fmt,
2451+ __gnuc_va_list __ap))
2452 {
2453 if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1)
2454 return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
2455@@ -334,18 +303,27 @@ extern int __vfwprintf_chk (__FILE *__re
2456 extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format,
2457 __gnuc_va_list __ap);
2458
2459-# ifdef __va_arg_pack
2460-__fortify_function int
2461-wprintf (const wchar_t *__restrict __fmt, ...)
2462-{
2463- return __wprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
2464-}
2465
2466-__fortify_function int
2467-fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...)
2468-{
2469- return __fwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
2470- __va_arg_pack ());
2471+#ifdef __FORTIFY_ARG_PACK_OK
2472+__fortify_potential_overload int
2473+wprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt, ...)
2474+{
2475+ __FORTIFY_INIT_ARG_PACK(__fmt);
2476+ int __r = __FORTIFY_CALL_VA_CHK (wprintf, __USE_FORTIFY_LEVEL - 1, __fmt,
2477+ __FORTIFY_ARG_PACK);
2478+ __FORTIFY_FREE_ARG_PACK();
2479+ return __r;
2480+}
2481+
2482+__fortify_potential_overload int
2483+fwprintf (__FILE *__restrict const __clang_pass_object_size __stream,
2484+ const wchar_t *__restrict __fmt, ...)
2485+{
2486+ __FORTIFY_INIT_ARG_PACK(__fmt);
2487+ int __r = __FORTIFY_CALL_VA_CHK (fwprintf, __stream, __USE_FORTIFY_LEVEL - 1,
2488+ __fmt, __FORTIFY_ARG_PACK);
2489+ __FORTIFY_FREE_ARG_PACK();
2490+ return __r;
2491 }
2492 # elif !defined __cplusplus
2493 # define wprintf(...) \
2494@@ -354,14 +332,15 @@ fwprintf (__FILE *__restrict __stream, c
2495 __fwprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
2496 # endif
2497
2498-__fortify_function int
2499-vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
2500+__fortify_potential_overload int
2501+vwprintf (const wchar_t *__restrict const __clang_pass_object_size __fmt,
2502+ __gnuc_va_list __ap)
2503 {
2504 return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap);
2505 }
2506
2507-__fortify_function int
2508-vfwprintf (__FILE *__restrict __stream,
2509+__fortify_potential_overload int
2510+vfwprintf (__FILE *__restrict const __clang_pass_object_size __stream,
2511 const wchar_t *__restrict __fmt, __gnuc_va_list __ap)
2512 {
2513 return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
2514@@ -374,27 +353,21 @@ extern wchar_t *__fgetws_chk (wchar_t *_
2515 extern wchar_t *__REDIRECT (__fgetws_alias,
2516 (wchar_t *__restrict __s, int __n,
2517 __FILE *__restrict __stream), fgetws) __wur;
2518-extern wchar_t *__REDIRECT (__fgetws_chk_warn,
2519- (wchar_t *__restrict __s, size_t __size, int __n,
2520- __FILE *__restrict __stream), __fgetws_chk)
2521- __wur __warnattr ("fgetws called with bigger size than length "
2522- "of destination buffer");
2523
2524-__fortify_function __wur wchar_t *
2525-fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
2526+__fortify_potential_overload __wur wchar_t *
2527+fgetws (wchar_t *__restrict const __clang_pass_object_size __s, int __n,
2528+ __FILE *__restrict __stream)
2529+__FORTIFY_PRECONDITIONS
2530+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__fgetws_warn, __n, __s,
2531+ sizeof (wchar_t),
2532+ "fgetws called with length bigger "
2533+ "than size of destination buffer")
2534 {
2535- if (__bos (__s) != (size_t) -1)
2536- {
2537- if (!__builtin_constant_p (__n) || __n <= 0)
2538- return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t),
2539- __n, __stream);
2540-
2541- if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
2542- return __fgetws_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
2543- __n, __stream);
2544- }
2545+ if (__FORTIFY_CALL_CHK && __bos (__s) != (size_t) -1)
2546+ return __fgetws_chk (__s, __bos (__s) / sizeof (wchar_t), __n, __stream);
2547 return __fgetws_alias (__s, __n, __stream);
2548 }
2549+__FORTIFY_FUNCTION_END
2550
2551 #ifdef __USE_GNU
2552 extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
2553@@ -404,28 +377,23 @@ extern wchar_t *__REDIRECT (__fgetws_unl
2554 (wchar_t *__restrict __s, int __n,
2555 __FILE *__restrict __stream), fgetws_unlocked)
2556 __wur;
2557-extern wchar_t *__REDIRECT (__fgetws_unlocked_chk_warn,
2558- (wchar_t *__restrict __s, size_t __size, int __n,
2559- __FILE *__restrict __stream),
2560- __fgetws_unlocked_chk)
2561- __wur __warnattr ("fgetws_unlocked called with bigger size than length "
2562- "of destination buffer");
2563
2564-__fortify_function __wur wchar_t *
2565-fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
2566+__fortify_potential_overload __wur wchar_t *
2567+fgetws_unlocked (wchar_t *__restrict const __clang_pass_object_size __s,
2568+ int __n, __FILE *__restrict __stream)
2569+__FORTIFY_PRECONDITIONS
2570+ __FORTIFY_WARNING_IF (__fgetws_unlocked_warn,
2571+ __n > 0
2572+ && __bos_static_lt2 (__n, __s, sizeof (wchar_t)),
2573+ "fgetws_unlocked called with bigger size than "
2574+ "length of destination buffer")
2575 {
2576 if (__bos (__s) != (size_t) -1)
2577- {
2578- if (!__builtin_constant_p (__n) || __n <= 0)
2579- return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t),
2580- __n, __stream);
2581-
2582- if ((size_t) __n > __bos (__s) / sizeof (wchar_t))
2583- return __fgetws_unlocked_chk_warn (__s, __bos (__s) / sizeof (wchar_t),
2584- __n, __stream);
2585- }
2586+ return __fgetws_unlocked_chk (__s, __bos (__s) / sizeof (wchar_t),
2587+ __n, __stream);
2588 return __fgetws_unlocked_alias (__s, __n, __stream);
2589 }
2590+__FORTIFY_FUNCTION_END
2591 #endif
2592
2593
2594@@ -436,9 +404,9 @@ extern size_t __REDIRECT_NTH (__wcrtomb_
2595 (char *__restrict __s, wchar_t __wchar,
2596 mbstate_t *__restrict __ps), wcrtomb) __wur;
2597
2598-__fortify_function __wur size_t
2599-__NTH (wcrtomb (char *__restrict __s, wchar_t __wchar,
2600- mbstate_t *__restrict __ps))
2601+__fortify_potential_overload __wur size_t
2602+__NTH (wcrtomb (char *__restrict const __clang_pass_object_size __s,
2603+ wchar_t __wchar, mbstate_t *__restrict __ps))
2604 {
2605 /* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
2606 But this would only disturb the namespace. So we define our own
2607@@ -462,30 +430,23 @@ extern size_t __REDIRECT_NTH (__mbsrtowc
2608 const char **__restrict __src,
2609 size_t __len, mbstate_t *__restrict __ps),
2610 mbsrtowcs);
2611-extern size_t __REDIRECT_NTH (__mbsrtowcs_chk_warn,
2612- (wchar_t *__restrict __dst,
2613- const char **__restrict __src,
2614- size_t __len, mbstate_t *__restrict __ps,
2615- size_t __dstlen), __mbsrtowcs_chk)
2616- __warnattr ("mbsrtowcs called with dst buffer smaller than len "
2617- "* sizeof (wchar_t)");
2618-
2619-__fortify_function size_t
2620-__NTH (mbsrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
2621- size_t __len, mbstate_t *__restrict __ps))
2622-{
2623- if (__bos (__dst) != (size_t) -1)
2624- {
2625- if (!__builtin_constant_p (__len))
2626- return __mbsrtowcs_chk (__dst, __src, __len, __ps,
2627- __bos (__dst) / sizeof (wchar_t));
2628-
2629- if (__len > __bos (__dst) / sizeof (wchar_t))
2630- return __mbsrtowcs_chk_warn (__dst, __src, __len, __ps,
2631- __bos (__dst) / sizeof (wchar_t));
2632- }
2633+
2634+__fortify_potential_overload size_t
2635+__NTH (mbsrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
2636+ const char **__restrict __src, size_t __len,
2637+ mbstate_t *__restrict __ps))
2638+__FORTIFY_PRECONDITIONS
2639+ __FORTIFY_WARNING_ONLY_IF_BOS_LT2 (__mbsrtowcs_warn, __len, __dst,
2640+ sizeof (wchar_t),
2641+ "mbsrtowcs called with dst buffer "
2642+ "smaller than len * sizeof (wchar_t)")
2643+{
2644+ if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
2645+ return __mbsrtowcs_chk (__dst, __src, __len, __ps,
2646+ __bos (__dst) / sizeof (wchar_t));
2647 return __mbsrtowcs_alias (__dst, __src, __len, __ps);
2648 }
2649+__FORTIFY_FUNCTION_END
2650
2651
2652 extern size_t __wcsrtombs_chk (char *__restrict __dst,
2653@@ -497,27 +458,21 @@ extern size_t __REDIRECT_NTH (__wcsrtomb
2654 const wchar_t **__restrict __src,
2655 size_t __len, mbstate_t *__restrict __ps),
2656 wcsrtombs);
2657-extern size_t __REDIRECT_NTH (__wcsrtombs_chk_warn,
2658- (char *__restrict __dst,
2659- const wchar_t **__restrict __src,
2660- size_t __len, mbstate_t *__restrict __ps,
2661- size_t __dstlen), __wcsrtombs_chk)
2662- __warnattr ("wcsrtombs called with dst buffer smaller than len");
2663
2664-__fortify_function size_t
2665-__NTH (wcsrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
2666- size_t __len, mbstate_t *__restrict __ps))
2667-{
2668- if (__bos (__dst) != (size_t) -1)
2669- {
2670- if (!__builtin_constant_p (__len))
2671- return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
2672-
2673- if (__len > __bos (__dst))
2674- return __wcsrtombs_chk_warn (__dst, __src, __len, __ps, __bos (__dst));
2675- }
2676+__fortify_potential_overload size_t
2677+__NTH (wcsrtombs (char *__restrict const __clang_pass_object_size __dst,
2678+ const wchar_t **__restrict __src, size_t __len,
2679+ mbstate_t *__restrict __ps))
2680+__FORTIFY_PRECONDITIONS
2681+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsrtombs_warn, __len, __dst,
2682+ "wcsrtombs called with dst buffer "
2683+ "smaller than len")
2684+{
2685+ if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
2686+ return __wcsrtombs_chk (__dst, __src, __len, __ps, __bos (__dst));
2687 return __wcsrtombs_alias (__dst, __src, __len, __ps);
2688 }
2689+__FORTIFY_FUNCTION_END
2690
2691
2692 #ifdef __USE_GNU
2693@@ -530,30 +485,23 @@ extern size_t __REDIRECT_NTH (__mbsnrtow
2694 const char **__restrict __src, size_t __nmc,
2695 size_t __len, mbstate_t *__restrict __ps),
2696 mbsnrtowcs);
2697-extern size_t __REDIRECT_NTH (__mbsnrtowcs_chk_warn,
2698- (wchar_t *__restrict __dst,
2699- const char **__restrict __src, size_t __nmc,
2700- size_t __len, mbstate_t *__restrict __ps,
2701- size_t __dstlen), __mbsnrtowcs_chk)
2702- __warnattr ("mbsnrtowcs called with dst buffer smaller than len "
2703- "* sizeof (wchar_t)");
2704-
2705-__fortify_function size_t
2706-__NTH (mbsnrtowcs (wchar_t *__restrict __dst, const char **__restrict __src,
2707- size_t __nmc, size_t __len, mbstate_t *__restrict __ps))
2708-{
2709- if (__bos (__dst) != (size_t) -1)
2710- {
2711- if (!__builtin_constant_p (__len))
2712- return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps,
2713- __bos (__dst) / sizeof (wchar_t));
2714-
2715- if (__len > __bos (__dst) / sizeof (wchar_t))
2716- return __mbsnrtowcs_chk_warn (__dst, __src, __nmc, __len, __ps,
2717- __bos (__dst) / sizeof (wchar_t));
2718- }
2719+
2720+__fortify_potential_overload size_t
2721+__NTH (mbsnrtowcs (wchar_t *__restrict const __clang_pass_object_size __dst,
2722+ const char **__restrict __src, size_t __nmc, size_t __len,
2723+ mbstate_t *__restrict __ps))
2724+__FORTIFY_PRECONDITIONS
2725+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__mbsnrtowcs_warn,
2726+ sizeof (wchar_t) * __len, __dst,
2727+ "mbsnrtowcs called with dst buffer "
2728+ "smaller than len * sizeof (wchar_t)")
2729+{
2730+ if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
2731+ return __mbsnrtowcs_chk (__dst, __src, __nmc, __len, __ps,
2732+ __bos (__dst) / sizeof (wchar_t));
2733 return __mbsnrtowcs_alias (__dst, __src, __nmc, __len, __ps);
2734 }
2735+__FORTIFY_FUNCTION_END
2736
2737
2738 extern size_t __wcsnrtombs_chk (char *__restrict __dst,
2739@@ -566,28 +514,19 @@ extern size_t __REDIRECT_NTH (__wcsnrtom
2740 const wchar_t **__restrict __src,
2741 size_t __nwc, size_t __len,
2742 mbstate_t *__restrict __ps), wcsnrtombs);
2743-extern size_t __REDIRECT_NTH (__wcsnrtombs_chk_warn,
2744- (char *__restrict __dst,
2745- const wchar_t **__restrict __src,
2746- size_t __nwc, size_t __len,
2747- mbstate_t *__restrict __ps,
2748- size_t __dstlen), __wcsnrtombs_chk)
2749- __warnattr ("wcsnrtombs called with dst buffer smaller than len");
2750-
2751-__fortify_function size_t
2752-__NTH (wcsnrtombs (char *__restrict __dst, const wchar_t **__restrict __src,
2753- size_t __nwc, size_t __len, mbstate_t *__restrict __ps))
2754-{
2755- if (__bos (__dst) != (size_t) -1)
2756- {
2757- if (!__builtin_constant_p (__len))
2758- return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps,
2759- __bos (__dst));
2760-
2761- if (__len > __bos (__dst))
2762- return __wcsnrtombs_chk_warn (__dst, __src, __nwc, __len, __ps,
2763- __bos (__dst));
2764- }
2765+
2766+__fortify_potential_overload size_t
2767+__NTH (wcsnrtombs (char *__restrict const __clang_pass_object_size __dst,
2768+ const wchar_t **__restrict __src, size_t __nwc, size_t __len,
2769+ mbstate_t *__restrict __ps))
2770+__FORTIFY_PRECONDITIONS
2771+ __FORTIFY_WARNING_ONLY_IF_BOS_LT (__wcsnrtombs_warn, __len, __dst,
2772+ "wcsnrtombs called with dst buffer "
2773+ "smaller than len")
2774+{
2775+ if (__FORTIFY_CALL_CHK && __bos (__dst) != (size_t) -1)
2776+ return __wcsnrtombs_chk (__dst, __src, __nwc, __len, __ps, __bos (__dst));
2777 return __wcsnrtombs_alias (__dst, __src, __nwc, __len, __ps);
2778 }
2779+__FORTIFY_FUNCTION_END
2780 #endif
diff --git a/meta/recipes-core/glibc/glibc/CVE-2019-19126.patch b/meta/recipes-core/glibc/glibc/CVE-2019-19126.patch
deleted file mode 100644
index aead04c485..0000000000
--- a/meta/recipes-core/glibc/glibc/CVE-2019-19126.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 37c90e117310728a4ad1eb998c0bbe7d79c4a398 Mon Sep 17 00:00:00 2001
2From: =?utf8?q?Marcin=20Ko=C5=9Bcielnicki?= <mwk@0x04.net>
3Date: Thu, 21 Nov 2019 00:20:15 +0100
4Subject: [PATCH] rtld: Check __libc_enable_secure before honoring
5 LD_PREFER_MAP_32BIT_EXEC (CVE-2019-19126) [BZ #25204]
6
7The problem was introduced in glibc 2.23, in commit
8b9eb92ab05204df772eb4929eccd018637c9f3e9
9("Add Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT").
10
11(cherry picked from commit d5dfad4326fc683c813df1e37bbf5cf920591c8e)
12
13Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=37c90e117310728a4ad1eb998c0bbe7d79c4a398]
14CVE: CVE-2019-19126
15Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
16---
17diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
18index 975cbe2..df2cdfd 100644
19--- a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
20+++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
21@@ -31,7 +31,8 @@
22 environment variable, LD_PREFER_MAP_32BIT_EXEC. */
23 #define EXTRA_LD_ENVVARS \
24 case 21: \
25- if (memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
26+ if (!__libc_enable_secure \
27+ && memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
28 GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
29 |= bit_arch_Prefer_MAP_32BIT_EXEC; \
30 break;
31--
322.9.3
diff --git a/meta/recipes-core/glibc/glibc_2.30.bb b/meta/recipes-core/glibc/glibc_2.31.bb
index 7913bc2812..b8c570db52 100644
--- a/meta/recipes-core/glibc/glibc_2.30.bb
+++ b/meta/recipes-core/glibc/glibc_2.31.bb
@@ -5,11 +5,11 @@ DEPENDS += "gperf-native bison-native make-native"
5 5
6NATIVESDKFIXES ?= "" 6NATIVESDKFIXES ?= ""
7NATIVESDKFIXES_class-nativesdk = "\ 7NATIVESDKFIXES_class-nativesdk = "\
8 file://0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \ 8 file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
9 file://0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \ 9 file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
10 file://0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \ 10 file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
11 file://0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \ 11 file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
12 file://0005-nativesdk-glibc-Make-relocatable-install-for-locales.patch \ 12 file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
13" 13"
14 14
15SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ 15SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
@@ -18,30 +18,30 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
18 file://makedbs.sh \ 18 file://makedbs.sh \
19 \ 19 \
20 ${NATIVESDKFIXES} \ 20 ${NATIVESDKFIXES} \
21 file://0006-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \ 21 file://0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
22 file://0007-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ 22 file://0009-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
23 file://0008-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \ 23 file://0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
24 file://0009-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ 24 file://0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
25 file://0010-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \ 25 file://0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \
26 file://0011-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \ 26 file://0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
27 file://0012-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \ 27 file://0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
28 file://0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ 28 file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
29 file://0014-Add-unused-attribute.patch \ 29 file://0016-Add-unused-attribute.patch \
30 file://0015-yes-within-the-path-sets-wrong-config-variables.patch \ 30 file://0017-yes-within-the-path-sets-wrong-config-variables.patch \
31 file://0016-timezone-re-written-tzselect-as-posix-sh.patch \ 31 file://0018-timezone-re-written-tzselect-as-posix-sh.patch \
32 file://0017-Remove-bash-dependency-for-nscd-init-script.patch \ 32 file://0019-Remove-bash-dependency-for-nscd-init-script.patch \
33 file://0018-eglibc-Cross-building-and-testing-instructions.patch \ 33 file://0020-eglibc-Cross-building-and-testing-instructions.patch \
34 file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \ 34 file://0021-eglibc-Help-bootstrap-cross-toolchain.patch \
35 file://0020-eglibc-Clear-cache-lines-on-ppc8xx.patch \ 35 file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
36 file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ 36 file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
37 file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ 37 file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
38 file://0023-Define-DUMMY_LOCALE_T-if-not-defined.patch \ 38 file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
39 file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ 39 file://0026-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
40 file://0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \ 40 file://0027-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
41 file://0026-intl-Emit-no-lines-in-bison-generated-files.patch \ 41 file://0028-intl-Emit-no-lines-in-bison-generated-files.patch \
42 file://0027-inject-file-assembly-directives.patch \ 42 file://0029-inject-file-assembly-directives.patch \
43 file://0028-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ 43 file://0030-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
44 file://CVE-2019-19126.patch \ 44 file://0031-Refactor-FORTIFY-in-glibc.patch \
45 " 45 "
46S = "${WORKDIR}/git" 46S = "${WORKDIR}/git"
47B = "${WORKDIR}/build-${TARGET_SYS}" 47B = "${WORKDIR}/build-${TARGET_SYS}"