* [PATCH 1/3] coreutils: update printenv's ALTERNATIVE_LINK_NAME
@ 2018-09-17 5:48 Martin Jansa
2018-09-17 5:48 ` [PATCH 2/3] dummy-sdk-package.inc: work around MACHINE_ARCH SSTATE_MANMACH Martin Jansa
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Martin Jansa @ 2018-09-17 5:48 UTC (permalink / raw)
To: openembedded-core
* use base_bindir like busybox does to prevent conflicting u-a configs
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
meta/recipes-core/coreutils/coreutils_8.30.bb | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/meta/recipes-core/coreutils/coreutils_8.30.bb b/meta/recipes-core/coreutils/coreutils_8.30.bb
index eb1dd2a93a..205ba4a0aa 100644
--- a/meta/recipes-core/coreutils/coreutils_8.30.bb
+++ b/meta/recipes-core/coreutils/coreutils_8.30.bb
@@ -42,12 +42,12 @@ PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,,"
-# [ df mktemp nice base64 gets a special treatment and is not included in this
+# [ df mktemp nice printenv base64 gets a special treatment and is not included in this
bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
env expand expr factor fmt fold groups head hostid id install \
join link logname md5sum mkfifo nl nohup nproc od paste pathchk \
- pinky pr printenv printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
- sha384sum sha512sum shred shuf sort split stdbuf sum tac tail tee test timeout\
+ pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
+ sha384sum sha512sum shred shuf sort split stdbuf sum tac tail tee test timeout \
tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
# hostname gets a special treatment and is not included in this
@@ -77,7 +77,7 @@ do_install_class-native() {
}
do_install_append() {
- for i in df mktemp nice base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
+ for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
install -d ${D}${base_bindir}
[ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
@@ -96,7 +96,7 @@ inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
# Make hostname's priority higher than busybox but lower than net-tools
ALTERNATIVE_PRIORITY[hostname] = "90"
-ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base64 nice mktemp df"
+ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base64 nice printenv mktemp df"
ALTERNATIVE_${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1"
ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
@@ -117,6 +117,9 @@ ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice"
ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}"
ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1"
+ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv"
+ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}"
+
ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/3] dummy-sdk-package.inc: work around MACHINE_ARCH SSTATE_MANMACH 2018-09-17 5:48 [PATCH 1/3] coreutils: update printenv's ALTERNATIVE_LINK_NAME Martin Jansa @ 2018-09-17 5:48 ` Martin Jansa 2018-09-17 5:48 ` [PATCH 3/3] glibc: fix build with -O Martin Jansa ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Martin Jansa @ 2018-09-17 5:48 UTC (permalink / raw) To: openembedded-core * since following change: allarch: only enable allarch when multilib is not used the sstate-diff-machines.sh reports different signature for target-sdk-provides-dummy when multilib is enabled === Comparing signatures for task do_populate_sysroot.sigdata between qemux86 and qemux86copy === ERROR: lib32-target-sdk-provides-dummy different signature for task do_populate_sysroot.sigdata between qemux86 and qemux86copy basehash changed from b0a44b2c7003b6b4aa3a023d9cb9fe82 to 3a59fa25ddb6a95aff079d477ebf3457 Variable SSTATE_MANMACH value changed from 'qemux86' to 'qemux86copy' ERROR: target-sdk-provides-dummy different signature for task do_populate_sysroot.sigdata between qemux86 and qemux86copy basehash changed from 9e44f1deb3d15886ee96db1a3332764c to 6b417d08a5113c9b06d13b3681f5ab4f Variable SSTATE_MANMACH value changed from 'qemux86' to 'qemux86copy' It's using: inherit allarch python() { # Put the package somewhere separate to ensure it's never used except # when we want it # (note that we have to do this in anonymous python here to avoid # allarch.bbclass disabling itself) d.setVar('PACKAGE_ARCH', '${DUMMYARCH}') } and DUMMYARCH = "sdk-provides-dummy-target" The difference as shown with bitbake -e before and after reverting allarch.bbclass commit: before revert: $SSTATE_MANMACH [2 operations] set? oe-core/meta/classes/sstate.bbclass:61 "${SSTATE_PKGARCH}" set sstate.bbclass:100 [__anon_111_oe_core_meta_classes_sstate_bbclass] "machineName" pre-expansion value: "machineName" SSTATE_MANMACH="machineName" $SSTATE_PKGARCH set oe-core/meta/classes/sstate.bbclass:11 "${PACKAGE_ARCH}" SSTATE_PKGARCH="sdk-provides-dummy-target" $PACKAGE_ARCH [3 operations] set oe-core/meta/conf/bitbake.conf:150 [_defaultval] "${TUNE_PKGARCH}" set oe-core/meta/conf/documentation.conf:304 [doc] "The architecture of the resulting package or packages." set dummy-sdk-package.inc:12 [__anon_12_oe_core_meta_recipes_core_meta_dummy_sdk_package_inc] "${DUMMYARCH}" pre-expansion value: "${DUMMYARCH}" PACKAGE_ARCH="sdk-provides-dummy-target" after revert: $SSTATE_MANMACH set? oe-core/meta/classes/sstate.bbclass:61 "${SSTATE_PKGARCH}" SSTATE_MANMACH="allarch" $SSTATE_PKGARCH [2 operations] set oe-core/meta/classes/sstate.bbclass:11 "${PACKAGE_ARCH}" set sstate.bbclass:98 [__anon_111__oe_core_meta_classes_sstate_bbclass] "allarch" pre-expansion value: "allarch" SSTATE_PKGARCH="allarch" $PACKAGE_ARCH [4 operations] set oe-core/meta/conf/bitbake.conf:150 [_defaultval] "${TUNE_PKGARCH}" set oe-core/meta/conf/documentation.conf:304 [doc] "The architecture of the resulting package or packages." set oe-core/meta/classes/allarch.bbclass:5 "all" set dummy-sdk-package.inc:12 [__anon_12_oe_core_meta_recipes_core_meta_dummy_sdk_package_inc] "${DUMMYARCH}" pre-expansion value: "${DUMMYARCH}" PACKAGE_ARCH="sdk-provides-dummy-target" the relevant part of the anonymous python in sstate.bbclass: elif bb.data.inherits_class('allarch', d) and d.getVar("PACKAGE_ARCH") == "all": d.setVar('SSTATE_PKGARCH', "allarch") else: d.setVar('SSTATE_MANMACH', d.expand("${PACKAGE_ARCH}")) So with allarch.bbclass change, the PACKAGE_ARCH isn't set to "all" because multilib is enabled, but that causes sstate.bbclass to set SSTATE_MANMACH to MACHINE instead of SSTATE_PKGARCH allarch, where it got MACHINE is still a bit of mystery to me. Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> --- meta/recipes-core/meta/dummy-sdk-package.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/recipes-core/meta/dummy-sdk-package.inc b/meta/recipes-core/meta/dummy-sdk-package.inc index ed83dd77da..eafcb823ab 100644 --- a/meta/recipes-core/meta/dummy-sdk-package.inc +++ b/meta/recipes-core/meta/dummy-sdk-package.inc @@ -1,6 +1,8 @@ SUMMARY = "Dummy packages which handle excluding packages from the sdk, e.g. ensuring perl is excluded from buildtools" LICENSE = "MIT" +PACKAGE_ARCH = "all" + inherit allarch python() { -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] glibc: fix build with -O 2018-09-17 5:48 [PATCH 1/3] coreutils: update printenv's ALTERNATIVE_LINK_NAME Martin Jansa 2018-09-17 5:48 ` [PATCH 2/3] dummy-sdk-package.inc: work around MACHINE_ARCH SSTATE_MANMACH Martin Jansa @ 2018-09-17 5:48 ` Martin Jansa 2018-09-19 4:12 ` Khem Raj 2018-09-19 10:33 ` ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev2) Patchwork 2018-09-19 11:35 ` ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev3) Patchwork 3 siblings, 1 reply; 10+ messages in thread From: Martin Jansa @ 2018-09-17 5:48 UTC (permalink / raw) To: openembedded-core * 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> --- meta/recipes-core/glibc/glibc.inc | 12 --- ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++ ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++ meta/recipes-core/glibc/glibc_2.28.bb | 2 + 4 files changed, 169 insertions(+), 12 deletions(-) create mode 100644 meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch create mode 100644 meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch 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}" STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" -python () { - opt_effective = "-O" - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): - opt_effective = opt - if opt_effective == "-O0": - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) - if opt_effective in ("-O", "-O1", "-Os"): - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective)) - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error") -} - # siteconfig.bbclass runs configure which needs a working compiler # For the compiler to work we need a working libc yet libc isn't # 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..d9d36b8244 --- /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: Pending + +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..d3c9902fbc --- /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: Pending + +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 + 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 \ file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ + file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ + file://0032-soft-fp-ignore-maybe-uninitialized.patch \ " NATIVESDKFIXES ?= "" -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] glibc: fix build with -O 2018-09-17 5:48 ` [PATCH 3/3] glibc: fix build with -O Martin Jansa @ 2018-09-19 4:12 ` Khem Raj 2018-09-19 10:10 ` Martin Jansa 0 siblings, 1 reply; 10+ messages in thread From: Khem Raj @ 2018-09-19 4:12 UTC (permalink / raw) To: Martin Jansa; +Cc: Patches and discussions about the oe-core layer please submit upstream as well On Sun, Sep 16, 2018 at 10:49 PM Martin Jansa <martin.jansa@gmail.com> wrote: > > * 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> > --- > meta/recipes-core/glibc/glibc.inc | 12 --- > ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++ > ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++ > meta/recipes-core/glibc/glibc_2.28.bb | 2 + > 4 files changed, 169 insertions(+), 12 deletions(-) > create mode 100644 meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch > create mode 100644 meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch > > 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}" > STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" > PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" > > -python () { > - opt_effective = "-O" > - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): > - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): > - opt_effective = opt > - if opt_effective == "-O0": > - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) > - if opt_effective in ("-O", "-O1", "-Os"): > - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective)) > - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error") > -} > - > # siteconfig.bbclass runs configure which needs a working compiler > # For the compiler to work we need a working libc yet libc isn't > # 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..d9d36b8244 > --- /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: Pending > + > +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..d3c9902fbc > --- /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: Pending > + > +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 > + > 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 \ > file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ > file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ > file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ > + file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ > + file://0032-soft-fp-ignore-maybe-uninitialized.patch \ > " > > NATIVESDKFIXES ?= "" > -- > 2.17.1 > > -- > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] glibc: fix build with -O 2018-09-19 4:12 ` Khem Raj @ 2018-09-19 10:10 ` Martin Jansa 2018-09-19 10:12 ` [PATCHv2] " Martin Jansa ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Martin Jansa @ 2018-09-19 10:10 UTC (permalink / raw) To: Khem Raj; +Cc: Patches and discussions about the oe-core layer [-- Attachment #1: Type: text/plain, Size: 11975 bytes --] I've submitted them now: https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html https://www.sourceware.org/ml/libc-alpha/2018-09/msg00300.html I didn't update the Upstream-Status, because it would cause whole world to rebuild again. On Wed, Sep 19, 2018 at 6:13 AM Khem Raj <raj.khem@gmail.com> wrote: > please submit upstream as well > On Sun, Sep 16, 2018 at 10:49 PM Martin Jansa <martin.jansa@gmail.com> > wrote: > > > > * 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> > > --- > > meta/recipes-core/glibc/glibc.inc | 12 --- > > ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++ > > ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++ > > meta/recipes-core/glibc/glibc_2.28.bb | 2 + > > 4 files changed, 169 insertions(+), 12 deletions(-) > > create mode 100644 > meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch > > create mode 100644 > meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch > > > > 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}" > > STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" > > PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" > > > > -python () { > > - opt_effective = "-O" > > - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): > > - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): > > - opt_effective = opt > > - if opt_effective == "-O0": > > - bb.fatal("%s can't be built with %s, try -O1 instead" % > (d.getVar('PN'), opt_effective)) > > - if opt_effective in ("-O", "-O1", "-Os"): > > - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to > SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective)) > > - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error") > > -} > > - > > # siteconfig.bbclass runs configure which needs a working compiler > > # For the compiler to work we need a working libc yet libc isn't > > # 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..d9d36b8244 > > --- /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: Pending > > + > > +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..d3c9902fbc > > --- /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: Pending > > + > > +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 > > + > > 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 \ > > > file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ > > > file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ > > > file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ > > + > file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ > > + file://0032-soft-fp-ignore-maybe-uninitialized.patch \ > > " > > > > NATIVESDKFIXES ?= "" > > -- > > 2.17.1 > > > > -- > > _______________________________________________ > > Openembedded-core mailing list > > Openembedded-core@lists.openembedded.org > > http://lists.openembedded.org/mailman/listinfo/openembedded-core > [-- Attachment #2: Type: text/html, Size: 15647 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCHv2] glibc: fix build with -O 2018-09-19 10:10 ` Martin Jansa @ 2018-09-19 10:12 ` Martin Jansa 2018-09-19 11:25 ` [PATCHv3] " Martin Jansa 2018-09-19 11:26 ` [PATCHv4] " Martin Jansa 2 siblings, 0 replies; 10+ messages in thread From: Martin Jansa @ 2018-09-19 10:12 UTC (permalink / raw) To: openembedded-core * 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> --- meta/recipes-core/glibc/glibc.inc | 12 --- ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++ ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++ meta/recipes-core/glibc/glibc_2.28.bb | 2 + 4 files changed, 169 insertions(+), 12 deletions(-) create mode 100644 meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch create mode 100644 meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch 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}" STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" -python () { - opt_effective = "-O" - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): - opt_effective = opt - if opt_effective == "-O0": - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) - if opt_effective in ("-O", "-O1", "-Os"): - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective)) - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error") -} - # siteconfig.bbclass runs configure which needs a working compiler # For the compiler to work we need a working libc yet libc isn't # 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..f1c5727b6f --- /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..4b40fe3f97 --- /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 + 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 \ file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ + file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ + file://0032-soft-fp-ignore-maybe-uninitialized.patch \ " NATIVESDKFIXES ?= "" -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCHv3] glibc: fix build with -O 2018-09-19 10:10 ` Martin Jansa 2018-09-19 10:12 ` [PATCHv2] " Martin Jansa @ 2018-09-19 11:25 ` Martin Jansa 2018-09-19 11:26 ` [PATCHv4] " Martin Jansa 2 siblings, 0 replies; 10+ messages in thread From: Martin Jansa @ 2018-09-19 11:25 UTC (permalink / raw) To: openembedded-core * 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> --- meta/recipes-core/glibc/glibc.inc | 12 --- ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++ ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++ meta/recipes-core/glibc/glibc_2.28.bb | 2 + 4 files changed, 169 insertions(+), 12 deletions(-) create mode 100644 meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch create mode 100644 meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch 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}" STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" -python () { - opt_effective = "-O" - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): - opt_effective = opt - if opt_effective == "-O0": - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) - if opt_effective in ("-O", "-O1", "-Os"): - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective)) - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error") -} - # siteconfig.bbclass runs configure which needs a working compiler # For the compiler to work we need a working libc yet libc isn't # 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..f1c5727b6f --- /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..4b40fe3f97 --- /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 + 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 \ file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ + file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ + file://0032-soft-fp-ignore-maybe-uninitialized.patch \ " NATIVESDKFIXES ?= "" -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCHv4] glibc: fix build with -O 2018-09-19 10:10 ` Martin Jansa 2018-09-19 10:12 ` [PATCHv2] " Martin Jansa 2018-09-19 11:25 ` [PATCHv3] " Martin Jansa @ 2018-09-19 11:26 ` Martin Jansa 2 siblings, 0 replies; 10+ messages in thread From: Martin Jansa @ 2018-09-19 11:26 UTC (permalink / raw) To: openembedded-core * 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> --- meta/recipes-core/glibc/glibc.inc | 12 --- ...4-prevent-maybe-uninitialized-errors.patch | 95 +++++++++++++++++++ ...2-soft-fp-ignore-maybe-uninitialized.patch | 72 ++++++++++++++ meta/recipes-core/glibc/glibc_2.28.bb | 2 + 4 files changed, 169 insertions(+), 12 deletions(-) create mode 100644 meta/recipes-core/glibc/glibc/0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch create mode 100644 meta/recipes-core/glibc/glibc/0032-soft-fp-ignore-maybe-uninitialized.patch 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}" STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" -python () { - opt_effective = "-O" - for opt in d.getVar('SELECTED_OPTIMIZATION').split(): - if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"): - opt_effective = opt - if opt_effective == "-O0": - bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) - if opt_effective in ("-O", "-O1", "-Os"): - bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective)) - d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error") -} - # siteconfig.bbclass runs configure which needs a working compiler # For the compiler to work we need a working libc yet libc isn't # 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 @@ +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 + 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 \ file://0028-bits-siginfo-consts.h-enum-definition-for-TRAP_HWBKP.patch \ file://0029-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ file://0030-intl-Emit-no-lines-in-bison-generated-files.patch \ + file://0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch \ + file://0032-soft-fp-ignore-maybe-uninitialized.patch \ " NATIVESDKFIXES ?= "" -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev2) 2018-09-17 5:48 [PATCH 1/3] coreutils: update printenv's ALTERNATIVE_LINK_NAME Martin Jansa 2018-09-17 5:48 ` [PATCH 2/3] dummy-sdk-package.inc: work around MACHINE_ARCH SSTATE_MANMACH Martin Jansa 2018-09-17 5:48 ` [PATCH 3/3] glibc: fix build with -O Martin Jansa @ 2018-09-19 10:33 ` Patchwork 2018-09-19 11:35 ` ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev3) Patchwork 3 siblings, 0 replies; 10+ messages in thread From: Patchwork @ 2018-09-19 10:33 UTC (permalink / raw) To: Martin Jansa; +Cc: openembedded-core == Series Details == Series: "coreutils: update printenv's A..." and 2 more (rev2) Revision: 2 URL : https://patchwork.openembedded.org/series/14095/ State : failure == Summary == Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures: * Issue Upstream-Status is Submitted, but it is not mentioned where [test_upstream_status_presence_format] Suggested fix Include where 0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch was submitted Current Upstream-Status: Submitted https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html Standard format Upstream-Status: Submitted [where] If you believe any of these test results are incorrect, please reply to the mailing list (openembedded-core@lists.openembedded.org) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...). --- Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe ^ permalink raw reply [flat|nested] 10+ messages in thread
* ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev3) 2018-09-17 5:48 [PATCH 1/3] coreutils: update printenv's ALTERNATIVE_LINK_NAME Martin Jansa ` (2 preceding siblings ...) 2018-09-19 10:33 ` ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev2) Patchwork @ 2018-09-19 11:35 ` Patchwork 3 siblings, 0 replies; 10+ messages in thread From: Patchwork @ 2018-09-19 11:35 UTC (permalink / raw) To: Martin Jansa; +Cc: openembedded-core == Series Details == Series: "coreutils: update printenv's A..." and 2 more (rev3) Revision: 3 URL : https://patchwork.openembedded.org/series/14095/ State : failure == Summary == Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures: * Issue Upstream-Status is Submitted, but it is not mentioned where [test_upstream_status_presence_format] Suggested fix Include where 0031-sysdeps-ieee754-prevent-maybe-uninitialized-errors.patch was submitted Current Upstream-Status: Submitted https://www.sourceware.org/ml/libc-alpha/2018-09/msg00299.html Standard format Upstream-Status: Submitted [where] If you believe any of these test results are incorrect, please reply to the mailing list (openembedded-core@lists.openembedded.org) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...). --- Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-09-19 11:35 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-09-17 5:48 [PATCH 1/3] coreutils: update printenv's ALTERNATIVE_LINK_NAME Martin Jansa 2018-09-17 5:48 ` [PATCH 2/3] dummy-sdk-package.inc: work around MACHINE_ARCH SSTATE_MANMACH Martin Jansa 2018-09-17 5:48 ` [PATCH 3/3] glibc: fix build with -O Martin Jansa 2018-09-19 4:12 ` Khem Raj 2018-09-19 10:10 ` Martin Jansa 2018-09-19 10:12 ` [PATCHv2] " Martin Jansa 2018-09-19 11:25 ` [PATCHv3] " Martin Jansa 2018-09-19 11:26 ` [PATCHv4] " Martin Jansa 2018-09-19 10:33 ` ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev2) Patchwork 2018-09-19 11:35 ` ✗ patchtest: failure for "coreutils: update printenv's A..." and 2 more (rev3) Patchwork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox