[OE-core] [PATCH 2/2] glibc: Disable Werror when building with debug options

Andre McCurdy armccurdy at gmail.com
Thu Feb 28 00:46:39 UTC 2019


On Wed, Feb 27, 2019 at 4:31 PM Khem Raj <raj.khem at gmail.com> wrote:
>
> On Wed, Feb 27, 2019 at 2:32 PM Martin Jansa <martin.jansa at gmail.com> wrote:
> >
> > On Wed, Feb 27, 2019 at 02:01:06PM -0800, Andre McCurdy wrote:
> > > On Wed, Feb 27, 2019 at 12:51 PM Khem Raj <raj.khem at gmail.com> wrote:
> > > >
> > > > Since compiler does not optimize away a lot of stuff we end up with
> > > > Werrors e.g.
> > > >
> > > > ./sysdeps/ieee754/flt-32/s_log1pf.c: In function '__log1pf':
> > > > ../sysdeps/ieee754/flt-32/s_log1pf.c:114:22: error: 'c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > > >   114 |        + (k * ln2_lo + c))) - f);
> > > >       |          ~~~~~~~~~~~~^~~~
> > > >
> > > > which otherwise wont happen, so lets build with warnings-as-errors
> > > > disabled in debug mode
> > > >
> > > > given we disable werror, now we don't have to restrict user to compile
> > > > without -O0
> > >
> > > Did you actually test with -O0? Even if it builds, there may be issues
> > > at runtime:
> > >
> > >   https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
> >
> > Agreed, last time I've tried it still didn't work in runtime with -O0.
> >
>
> intention is not to state that it should be working with -O0, but let
> glibc complain that it can not be compiled with out optimization which
> it does nicely.

Doesn't glibc complain about -O0 regardless of --disable-werror?

If so then I don't see any advantage in specifically passing
--disable-werror in the -O0 case.

> > If this is the only place where it now fails, can we please work around
>
> No, this is just a representative, there are several such warnings in
> tests especially, so disabling werror is only sane here.
>
> > it like in:
> > https://sourceware.org/git/?p=glibc.git;a=commit;h=27c5e756a2a8495d77480a103081a86c1ca9a1e8
> > https://sourceware.org/git/?p=glibc.git;a=commit;h=4a06ceea33ecc220bbfe264d8f1e74de2f04e90d
> > and pending:
> > https://patches-gcc.linaro.org/patch/13529/
> >
> > > >  meta/recipes-core/glibc/glibc.inc     | 9 ---------
> > > >  meta/recipes-core/glibc/glibc_2.29.bb | 1 +
> > > >  2 files changed, 1 insertion(+), 9 deletions(-)
> > > >
> > > > diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
> > > > index 67af396133..a382a22b73 100644
> > > > --- a/meta/recipes-core/glibc/glibc.inc
> > > > +++ b/meta/recipes-core/glibc/glibc.inc
> > > > @@ -2,15 +2,6 @@ require glibc-common.inc
> > > >  require glibc-ld.inc
> > > >  require glibc-testing.inc
> > > >
> > > > -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))
> > > > -}
> > > > -
> > > >  DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc-initial linux-libc-headers"
> > > >
> > > >  PROVIDES = "virtual/libc"
> > > > diff --git a/meta/recipes-core/glibc/glibc_2.29.bb b/meta/recipes-core/glibc/glibc_2.29.bb
> > > > index bd8aa6d503..9b6fab066b 100644
> > > > --- a/meta/recipes-core/glibc/glibc_2.29.bb
> > > > +++ b/meta/recipes-core/glibc/glibc_2.29.bb
> > > > @@ -90,6 +90,7 @@ EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
> > > >                  --disable-crypt \
> > > >                  --with-default-link \
> > > >                  --enable-nscd \
> > > > +                ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \
> > > >                  ${GLIBCPIE} \
> > > >                  ${GLIBC_EXTRA_OECONF}"
> > > >
> > > > --
> > > > 2.21.0
> > > >
> > > > --
> > > > _______________________________________________
> > > > Openembedded-core mailing list
> > > > Openembedded-core at lists.openembedded.org
> > > > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> > > --
> > > _______________________________________________
> > > Openembedded-core mailing list
> > > Openembedded-core at lists.openembedded.org
> > > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >
> > --
> > Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com


More information about the Openembedded-core mailing list