<div dir="ltr"><div dir="ltr"><div>I've submitted them now:</div><div><br></div><div dir="ltr"><a href="https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html">https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html</a><br></div><div dir="ltr"><a href="https://www.sourceware.org/ml/libc-alpha/2018-09/msg00300.html">https://www.sourceware.org/ml/libc-alpha/2018-09/msg00300.html</a><br></div><div dir="ltr"><br></div><div>I didn't update the Upstream-Status, because it would cause whole world to rebuild again.</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 19, 2018 at 6:13 AM Khem Raj <<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">please submit upstream as well<br>
On Sun, Sep 16, 2018 at 10:49 PM Martin Jansa <<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a>> wrote:<br>
><br>
> * tested for qemuarm, qemux86 with -O, -O0, -Os, with gcc<br>
> * to build with -O0 I had to remove restriction from systemtap first<br>
><br>
> Signed-off-by: Martin Jansa <<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>><br>
> ---<br>
> meta/recipes-core/glibc/glibc.inc | 12 ---<br>
> ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++<br>
> ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++<br>
> meta/recipes-core/glibc/<a href="http://glibc_2.28.bb" rel="noreferrer" target="_blank">glibc_2.28.bb</a> | 2 +<br>
> 4 files changed, 169 insertions(+), 12 deletions(-)<br>
> create mode 100644 meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch<br>
> create mode 100644 meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch<br>
><br>
> diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc<br>
> index 91491a35f0..e673707369 100644<br>
> --- a/meta/recipes-core/glibc/glibc.inc<br>
> +++ b/meta/recipes-core/glibc/glibc.inc<br>
> @@ -6,18 +6,6 @@ STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"<br>
> STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"<br>
> PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"<br>
><br>
> -python () {<br>
> - opt_effective = "-O"<br>
> - for opt in d.getVar('SELECTED_OPTIMIZATION').split():<br>
> - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):<br>
> - opt_effective = opt<br>
> - if opt_effective == "-O0":<br>
> - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective))<br>
> - if opt_effective in ("-O", "-O1", "-Os"):<br>
> - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))<br>
> - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")<br>
> -}<br>
> -<br>
> # siteconfig.bbclass runs configure which needs a working compiler<br>
> # For the compiler to work we need a working libc yet libc isn't<br>
> # in the sysroots directory at this point. This means the libc.so<br>
> diff --git a/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch b/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch<br>
> new file mode 100644<br>
> index 0000000000..d9d36b8244<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch<br>
> @@ -0,0 +1,95 @@<br>
> +From c6cc5a6ef46837e341fe271b5ffa6def23810082 Mon Sep 17 00:00:00 2001<br>
> +From: Martin Jansa <<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>><br>
> +Date: Fri, 14 Sep 2018 23:23:03 +0000<br>
> +Subject: [PATCH] sysdeps/ieee754: prevent maybe-uninitialized errors<br>
> +<br>
> +* with -O included in BUILD_OPTIMIZATION when DEBUG_BUILD<br>
> + is used, nativesdk-glibc fails with:<br>
> +../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':<br>
> +../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + b = invsqrtpi * temp / sqrtl (x);<br>
> + ~~~~~~~~~~^~~~~~<br>
> +../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_ynl':<br>
> +../sysdeps/ieee754/ldbl-96/e_jnl.c:375:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + b = invsqrtpi * temp / sqrtl (x);<br>
> + ~~~~~~~~~~^~~~~~<br>
> +<br>
> +* work around the issue instead of removing -O like we do with<br>
> + SELECTED_OPTIMIZATION<br>
> +<br>
> +Upstream-Status: Pending<br>
> +<br>
> +Signed-off-by: Martin Jansa <<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>><br>
> +---<br>
> + sysdeps/ieee754/dbl-64/e_jn.c | 2 ++<br>
> + sysdeps/ieee754/ldbl-128/e_jnl.c | 4 ++++<br>
> + sysdeps/ieee754/ldbl-96/e_jnl.c | 4 ++++<br>
> + 3 files changed, 10 insertions(+)<br>
> +<br>
> +diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c<br>
> +index 9181b22bb8..74a6b5f149 100644<br>
> +--- a/sysdeps/ieee754/dbl-64/e_jn.c<br>
> ++++ b/sysdeps/ieee754/dbl-64/e_jn.c<br>
> +@@ -108,6 +108,7 @@ __ieee754_jn (int n, double x)<br>
> + case 1: temp = -c + s; break;<br>
> + case 2: temp = -c - s; break;<br>
> + case 3: temp = c - s; break;<br>
> ++ default: temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + }<br>
> + b = invsqrtpi * temp / sqrt (x);<br>
> + }<br>
> +@@ -315,6 +316,7 @@ __ieee754_yn (int n, double x)<br>
> + case 1: temp = -s - c; break;<br>
> + case 2: temp = -s + c; break;<br>
> + case 3: temp = s + c; break;<br>
> ++ default: temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + }<br>
> + b = invsqrtpi * temp / sqrt (x);<br>
> + }<br>
> +diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c<br>
> +index 7739eec291..b6a1275464 100644<br>
> +--- a/sysdeps/ieee754/ldbl-128/e_jnl.c<br>
> ++++ b/sysdeps/ieee754/ldbl-128/e_jnl.c<br>
> +@@ -149,6 +149,8 @@ __ieee754_jnl (int n, _Float128 x)<br>
> + case 3:<br>
> + temp = c - s;<br>
> + break;<br>
> ++ default:<br>
> ++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + }<br>
> + b = invsqrtpi * temp / sqrtl (x);<br>
> + }<br>
> +@@ -385,6 +387,8 @@ __ieee754_ynl (int n, _Float128 x)<br>
> + case 3:<br>
> + temp = s + c;<br>
> + break;<br>
> ++ default:<br>
> ++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + }<br>
> + b = invsqrtpi * temp / sqrtl (x);<br>
> + }<br>
> +diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c<br>
> +index 394921f564..2263b02203 100644<br>
> +--- a/sysdeps/ieee754/ldbl-96/e_jnl.c<br>
> ++++ b/sysdeps/ieee754/ldbl-96/e_jnl.c<br>
> +@@ -142,6 +142,8 @@ __ieee754_jnl (int n, long double x)<br>
> + case 3:<br>
> + temp = c - s;<br>
> + break;<br>
> ++ default:<br>
> ++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + }<br>
> + b = invsqrtpi * temp / sqrtl (x);<br>
> + }<br>
> +@@ -371,6 +373,8 @@ __ieee754_ynl (int n, long double x)<br>
> + case 3:<br>
> + temp = s + c;<br>
> + break;<br>
> ++ default:<br>
> ++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + }<br>
> + b = invsqrtpi * temp / sqrtl (x);<br>
> + }<br>
> +--<br>
> +2.17.1<br>
> +<br>
> diff --git a/meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch b/meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch<br>
> new file mode 100644<br>
> index 0000000000..d3c9902fbc<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch<br>
> @@ -0,0 +1,72 @@<br>
> +From 0efa7fd1c800277d5323d05cb245c0536fe9ce22 Mon Sep 17 00:00:00 2001<br>
> +From: Martin Jansa <<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>><br>
> +Date: Sun, 16 Sep 2018 12:39:22 +0000<br>
> +Subject: [PATCH] soft-fp: ignore maybe-uninitialized<br>
> +<br>
> +* with -O it fails with:<br>
> +<br>
> +In file included from ../soft-fp/soft-fp.h:318,<br>
> + from ../sysdeps/ieee754/soft-fp/s_fdiv.c:28:<br>
> +../sysdeps/ieee754/soft-fp/s_fdiv.c: In function '__fdiv':<br>
> +../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \<br>
> + ^~<br>
> +../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f1' was declared here<br>
> + FP_DECL_D (R);<br>
> + ^<br>
> +../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2'<br>
> + _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT<br>
> + ^<br>
> +../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'<br>
> + # define FP_DECL_D(X) _FP_DECL (2, X)<br>
> + ^~~~~~~~<br>
> +../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'<br>
> + FP_DECL_D (R);<br>
> + ^~~~~~~~~<br>
> +../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
> + : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \<br>
> + ^~<br>
> +../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f0' was declared here<br>
> + FP_DECL_D (R);<br>
> + ^<br>
> +../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2'<br>
> + _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT<br>
> + ^<br>
> +../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'<br>
> + # define FP_DECL_D(X) _FP_DECL (2, X)<br>
> + ^~~~~~~~<br>
> +../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'<br>
> + FP_DECL_D (R);<br>
> + ^~~~~~~~~<br>
> +<br>
> +Upstream-Status: Pending<br>
> +<br>
> +Signed-off-by: Martin Jansa <<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>><br>
> +---<br>
> + soft-fp/op-2.h | 3 +++<br>
> + 1 file changed, 3 insertions(+)<br>
> +<br>
> +diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h<br>
> +index 6020d663d4..6672337949 100644<br>
> +--- a/soft-fp/op-2.h<br>
> ++++ b/soft-fp/op-2.h<br>
> +@@ -92,6 +92,8 @@<br>
> + X##_f1 = 0; \<br>
> + }))<br>
> +<br>
> ++#pragma GCC diagnostic push<br>
> ++#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"<br>
> + #define _FP_FRAC_SRS_2(X, N, sz) \<br>
> + (void) (((N) < _FP_W_TYPE_SIZE) \<br>
> + ? ({ \<br>
> +@@ -109,6 +111,7 @@<br>
> + | X##_f0) != 0)); \<br>
> + X##_f1 = 0; \<br>
> + }))<br>
> ++#pragma GCC diagnostic pop<br>
> +<br>
> + #define _FP_FRAC_ADDI_2(X, I) \<br>
> + __FP_FRAC_ADDI_2 (X##_f1, X##_f0, I)<br>
> +--<br>
> +2.17.1<br>
> +<br>
> diff --git a/meta/recipes-core/glibc/<a href="http://glibc_2.28.bb" rel="noreferrer" target="_blank">glibc_2.28.bb</a> b/meta/recipes-core/glibc/<a href="http://glibc_2.28.bb" rel="noreferrer" target="_blank">glibc_2.28.bb</a><br>
> index 0ebbaf9610..df60ba8445 100644<br>
> --- a/meta/recipes-core/glibc/<a href="http://glibc_2.28.bb" rel="noreferrer" target="_blank">glibc_2.28.bb</a><br>
> +++ b/meta/recipes-core/glibc/<a href="http://glibc_2.28.bb" rel="noreferrer" target="_blank">glibc_2.28.bb</a><br>
> @@ -45,6 +45,8 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \<br>
> file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \<br>
> file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \<br>
> file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \<br>
> + file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \<br>
> + file://0032-soft-fp-ignore-maybe-uninitialized.patch \<br>
> "<br>
><br>
> NATIVESDKFIXES ?= ""<br>
> --<br>
> 2.17.1<br>
><br>
> --<br>
> _______________________________________________<br>
> Openembedded-core mailing list<br>
> <a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
> <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>