summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/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-20 05:41:31 -0700
commit19c64533eb3f039ab18be21b436f7cc9d0897916 (patch)
tree1b78fcf94e2ae30bbe0ad8dd8139d0290fa31f99 /meta/recipes-core/glibc
parentf13f1dd286d7a8b1cd8a8f1b926b65859a7d5ea8 (diff)
downloadpoky-19c64533eb3f039ab18be21b436f7cc9d0897916.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 (From OE-Core rev: be3d12c6b1003348f1dabec9d2253f22b42f0387) 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')
-rw-r--r--meta/recipes-core/glibc/glibc.inc12
-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
-rw-r--r--meta/recipes-core/glibc/glibc_2.28.bb2
4 files changed, 169 insertions, 12 deletions
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index 91491a35f0..e673707369 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -6,18 +6,6 @@ STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" 6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
7PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" 7PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
8 8
9python () {
10 opt_effective = "-O"
11 for opt in d.getVar('SELECTED_OPTIMIZATION').split():
12 if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
13 opt_effective = opt
14 if opt_effective == "-O0":
15 bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective))
16 if opt_effective in ("-O", "-O1", "-Os"):
17 bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
18 d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
19}
20
21# siteconfig.bbclass runs configure which needs a working compiler 9# siteconfig.bbclass runs configure which needs a working compiler
22# For the compiler to work we need a working libc yet libc isn't 10# For the compiler to work we need a working libc yet libc isn't
23# in the sysroots directory at this point. This means the libc.so 11# in the sysroots directory at this point. This means the libc.so
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 @@
1From c6cc5a6ef46837e341fe271b5ffa6def23810082 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Fri, 14 Sep 2018 23:23:03 +0000
4Subject: [PATCH] sysdeps/ieee754: prevent maybe-uninitialized errors
5
6* with -O included in BUILD_OPTIMIZATION when DEBUG_BUILD
7 is used, nativesdk-glibc fails with:
8../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
9../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
10 b = invsqrtpi * temp / sqrtl (x);
11 ~~~~~~~~~~^~~~~~
12../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_ynl':
13../sysdeps/ieee754/ldbl-96/e_jnl.c:375:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
14 b = invsqrtpi * temp / sqrtl (x);
15 ~~~~~~~~~~^~~~~~
16
17* work around the issue instead of removing -O like we do with
18 SELECTED_OPTIMIZATION
19
20Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html]
21
22Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
23---
24 sysdeps/ieee754/dbl-64/e_jn.c | 2 ++
25 sysdeps/ieee754/ldbl-128/e_jnl.c | 4 ++++
26 sysdeps/ieee754/ldbl-96/e_jnl.c | 4 ++++
27 3 files changed, 10 insertions(+)
28
29diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c
30index 9181b22bb8..74a6b5f149 100644
31--- a/sysdeps/ieee754/dbl-64/e_jn.c
32+++ b/sysdeps/ieee754/dbl-64/e_jn.c
33@@ -108,6 +108,7 @@ __ieee754_jn (int n, double x)
34 case 1: temp = -c + s; break;
35 case 2: temp = -c - s; break;
36 case 3: temp = c - s; break;
37+ default: temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
38 }
39 b = invsqrtpi * temp / sqrt (x);
40 }
41@@ -315,6 +316,7 @@ __ieee754_yn (int n, double x)
42 case 1: temp = -s - c; break;
43 case 2: temp = -s + c; break;
44 case 3: temp = s + c; break;
45+ default: temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
46 }
47 b = invsqrtpi * temp / sqrt (x);
48 }
49diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c
50index 7739eec291..b6a1275464 100644
51--- a/sysdeps/ieee754/ldbl-128/e_jnl.c
52+++ b/sysdeps/ieee754/ldbl-128/e_jnl.c
53@@ -149,6 +149,8 @@ __ieee754_jnl (int n, _Float128 x)
54 case 3:
55 temp = c - s;
56 break;
57+ default:
58+ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
59 }
60 b = invsqrtpi * temp / sqrtl (x);
61 }
62@@ -385,6 +387,8 @@ __ieee754_ynl (int n, _Float128 x)
63 case 3:
64 temp = s + c;
65 break;
66+ default:
67+ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
68 }
69 b = invsqrtpi * temp / sqrtl (x);
70 }
71diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
72index 394921f564..2263b02203 100644
73--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
74+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
75@@ -142,6 +142,8 @@ __ieee754_jnl (int n, long double x)
76 case 3:
77 temp = c - s;
78 break;
79+ default:
80+ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
81 }
82 b = invsqrtpi * temp / sqrtl (x);
83 }
84@@ -371,6 +373,8 @@ __ieee754_ynl (int n, long double x)
85 case 3:
86 temp = s + c;
87 break;
88+ default:
89+ temp = 0; // just to prevent error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
90 }
91 b = invsqrtpi * temp / sqrtl (x);
92 }
93--
942.17.1
95
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 @@
1From 0efa7fd1c800277d5323d05cb245c0536fe9ce22 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Sun, 16 Sep 2018 12:39:22 +0000
4Subject: [PATCH] soft-fp: ignore maybe-uninitialized
5
6* with -O it fails with:
7
8In file included from ../soft-fp/soft-fp.h:318,
9 from ../sysdeps/ieee754/soft-fp/s_fdiv.c:28:
10../sysdeps/ieee754/soft-fp/s_fdiv.c: In function '__fdiv':
11../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
12 X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \
13 ^~
14../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f1' was declared here
15 FP_DECL_D (R);
16 ^
17../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2'
18 _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
19 ^
20../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'
21 # define FP_DECL_D(X) _FP_DECL (2, X)
22 ^~~~~~~~
23../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'
24 FP_DECL_D (R);
25 ^~~~~~~~~
26../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
27 : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
28 ^~
29../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f0' was declared here
30 FP_DECL_D (R);
31 ^
32../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2'
33 _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
34 ^
35../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'
36 # define FP_DECL_D(X) _FP_DECL (2, X)
37 ^~~~~~~~
38../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'
39 FP_DECL_D (R);
40 ^~~~~~~~~
41
42Upstream-Status: Submitted [https://www.sourceware.org/ml/libc-alpha/2018-09/msg00300.html]
43
44Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
45---
46 soft-fp/op-2.h | 3 +++
47 1 file changed, 3 insertions(+)
48
49diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h
50index 6020d663d4..6672337949 100644
51--- a/soft-fp/op-2.h
52+++ b/soft-fp/op-2.h
53@@ -92,6 +92,8 @@
54 X##_f1 = 0; \
55 }))
56
57+#pragma GCC diagnostic push
58+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
59 #define _FP_FRAC_SRS_2(X, N, sz) \
60 (void) (((N) < _FP_W_TYPE_SIZE) \
61 ? ({ \
62@@ -109,6 +111,7 @@
63 | X##_f0) != 0)); \
64 X##_f1 = 0; \
65 }))
66+#pragma GCC diagnostic pop
67
68 #define _FP_FRAC_ADDI_2(X, I) \
69 __FP_FRAC_ADDI_2 (X##_f1, X##_f0, I)
70--
712.17.1
72
diff --git a/meta/recipes-core/glibc/glibc_2.28.bb b/meta/recipes-core/glibc/glibc_2.28.bb
index 0ebbaf9610..df60ba8445 100644
--- a/meta/recipes-core/glibc/glibc_2.28.bb
+++ b/meta/recipes-core/glibc/glibc_2.28.bb
@@ -45,6 +45,8 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
45 file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ 45 file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \
46 file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ 46 file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
47 file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ 47 file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \
48 file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \
49 file://0032-soft-fp-ignore-maybe-uninitialized.patch \
48" 50"
49 51
50NATIVESDKFIXES ?= "" 52NATIVESDKFIXES ?= ""