aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2018-09-19 11:26:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-19 06:42:22 -0700
commitbe3d12c6b1003348f1dabec9d2253f22b42f0387 (patch)
treeb06c6a9e1f3f3da1819035209fd54d9b8d8c0ddf /meta/recipes-core/glibc/glibc
parenta85c34d263fcf1542bbedcaf1634302466bb20cf (diff)
downloadopenembedded-core-contrib-be3d12c6b1003348f1dabec9d2253f22b42f0387.tar.gz
glibc: fix build with -O
* tested for qemuarm, qemux86 with -O, -O0, -Os, with gcc * to build with -O0 I had to remove restriction from systemtap first Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glibc/glibc')
-rw-r--r--meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch95
-rw-r--r--meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch72
2 files changed, 167 insertions, 0 deletions
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
new file mode 100644
index 0000000000..b02c4ec94f
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch
@@ -0,0 +1,95 @@
+From c6cc5a6ef46837e341fe271b5ffa6def23810082 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Fri, 14 Sep 2018 23:23:03 +0000
+Subject: [PATCH] sysdeps/ieee754: prevent maybe-uninitialized errors
+
+* with -O included in BUILD_OPTIMIZATION when DEBUG_BUILD
+ is used, nativesdk-glibc fails with:
+../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
+../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ b = invsqrtpi * temp / sqrtl (x);
+ ~~~~~~~~~~^~~~~~
+../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_ynl':
+../sysdeps/ieee754/ldbl-96/e_jnl.c:375:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ b = invsqrtpi * temp / sqrtl (x);
+ ~~~~~~~~~~^~~~~~
+
+* work around the issue instead of removing -O like we do with
+ SELECTED_OPTIMIZATION
+
+Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html]
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ sysdeps/ieee754/dbl-64/e_jn.c | 2 ++
+ sysdeps/ieee754/ldbl-128/e_jnl.c | 4 ++++
+ sysdeps/ieee754/ldbl-96/e_jnl.c | 4 ++++
+ 3 files changed, 10 insertions(+)
+
+diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
+index 9181b22bb8..74a6b5f149 100644
+--- a/sysdeps/ieee754/dbl-64/e_jn.c
++++ b/sysdeps/ieee754/dbl-64/e_jn.c
+@@ -108,6 +108,7 @@ __ieee754_jn (int n, double x)
+ case 1: temp = -c + s; break;
+ case 2: temp = -c - s; break;
+ case 3: temp = c - s; break;
++ default: temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ }
+ b = invsqrtpi * temp / sqrt (x);
+ }
+@@ -315,6 +316,7 @@ __ieee754_yn (int n, double x)
+ case 1: temp = -s - c; break;
+ case 2: temp = -s + c; break;
+ case 3: temp = s + c; break;
++ default: temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ }
+ b = invsqrtpi * temp / sqrt (x);
+ }
+diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c
+index 7739eec291..b6a1275464 100644
+--- a/sysdeps/ieee754/ldbl-128/e_jnl.c
++++ b/sysdeps/ieee754/ldbl-128/e_jnl.c
+@@ -149,6 +149,8 @@ __ieee754_jnl (int n, _Float128 x)
+ case 3:
+ temp = c - s;
+ break;
++ default:
++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ }
+ b = invsqrtpi * temp / sqrtl (x);
+ }
+@@ -385,6 +387,8 @@ __ieee754_ynl (int n, _Float128 x)
+ case 3:
+ temp = s + c;
+ break;
++ default:
++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ }
+ b = invsqrtpi * temp / sqrtl (x);
+ }
+diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
+index 394921f564..2263b02203 100644
+--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
++++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
+@@ -142,6 +142,8 @@ __ieee754_jnl (int n, long double x)
+ case 3:
+ temp = c - s;
+ break;
++ default:
++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ }
+ b = invsqrtpi * temp / sqrtl (x);
+ }
+@@ -371,6 +373,8 @@ __ieee754_ynl (int n, long double x)
+ case 3:
+ temp = s + c;
+ break;
++ default:
++ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ }
+ b = invsqrtpi * temp / sqrtl (x);
+ }
+--
+2.17.1
+
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
new file mode 100644
index 0000000000..4d56e55296
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch
@@ -0,0 +1,72 @@
+From 0efa7fd1c800277d5323d05cb245c0536fe9ce22 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Sun, 16 Sep 2018 12:39:22 +0000
+Subject: [PATCH] soft-fp: ignore maybe-uninitialized
+
+* with -O it fails with:
+
+In file included from ../soft-fp/soft-fp.h:318,
+ from ../sysdeps/ieee754/soft-fp/s_fdiv.c:28:
+../sysdeps/ieee754/soft-fp/s_fdiv.c: In function '__fdiv':
+../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \
+ ^~
+../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f1' was declared here
+ FP_DECL_D (R);
+ ^
+../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2'
+ _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
+ ^
+../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'
+ # define FP_DECL_D(X) _FP_DECL (2, X)
+ ^~~~~~~~
+../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'
+ FP_DECL_D (R);
+ ^~~~~~~~~
+../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
+ ^~
+../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f0' was declared here
+ FP_DECL_D (R);
+ ^
+../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2'
+ _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
+ ^
+../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'
+ # define FP_DECL_D(X) _FP_DECL (2, X)
+ ^~~~~~~~
+../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'
+ FP_DECL_D (R);
+ ^~~~~~~~~
+
+Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00300.html]
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ soft-fp/op-2.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h
+index 6020d663d4..6672337949 100644
+--- a/soft-fp/op-2.h
++++ b/soft-fp/op-2.h
+@@ -92,6 +92,8 @@
+ X##_f1 = 0; \
+ }))
+
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+ #define _FP_FRAC_SRS_2(X, N, sz) \
+ (void) (((N) < _FP_W_TYPE_SIZE) \
+ ? ({ \
+@@ -109,6 +111,7 @@
+ | X##_f0) != 0)); \
+ X##_f1 = 0; \
+ }))
++#pragma GCC diagnostic pop
+
+ #define _FP_FRAC_ADDI_2(X, I) \
+ __FP_FRAC_ADDI_2 (X##_f1, X##_f0, I)
+--
+2.17.1
+