Skip to contentSkip to conversation

bitbake.conf: Use -Og in DEBUG_OPTIMIZATION

PATCH Superseded Khem Raj 3 participants 8 messages Feb 27, 2019 – Feb 28, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/2 bitbake.conf: Use -Og in DEBUG_OPTIMIZATION

-Og is for optimized debugging experience.
this makes this consistent across different compilers especially gcc and clang, -O in clang is equal to -O2 where as in gcc its similar to -O1 so it was not giving consistent debugging experience across compilers

---
v2: Change documentation to reflect the change and also build host flags

 meta/conf/bitbake.conf       | 4 ++--
 meta/conf/documentation.conf | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
meta/conf/bitbake.conf +2 -2
index 1c5369ec98..85aab98462 100644
@@ -610,10 +610,10 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 
 # Disabled until the option works properly -feliminate-dwarf2-dups
 FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
-DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
+DEBUG_OPTIMIZATION = "-Og -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
 SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
-BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
+BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
 BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
 
 ##################################################################
meta/conf/documentation.conf +1 -1
index 4d2a707563..c2c96ecf1e 100644
@@ -125,7 +125,7 @@ D[doc] = "The destination directory."
 DATE[doc] = "The date the build was started using YMD format."
 DATETIME[doc] = "The date and time the build was started."
 DEBUG_BUILD[doc] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable."
-DEBUG_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling a system for debugging. This variable defaults to '-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe'."
+DEBUG_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling a system for debugging. This variable defaults to '-Og -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe'."
 DEFAULT_PREFERENCE[doc] = "Specifies a weak bias for recipe selection priority."
 DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)."
 DEPLOY_DIR[doc] = "Points to the general area that the OpenEmbedded build system uses to place images, packages, SDKs and other output files that are ready to be used outside of the build system."
Signature · 1 line
2.21.0
author
#1 lore raw

PATCH 2/2 glibc: Disable Werror when building with debug options

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

---
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -0
index bd8aa6d503..9b6fab066b 100644
@@ -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}"
 
Signature · 1 line
2.21.0
#2 lore raw

Re: [PATCH 2/2] glibc: Disable Werror when building with debug options

Quoted 6 lines · Khem Raj

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]

Quoted 8 lines
  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

Quoted 46 lines
---
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -1
index bd8aa6d503..9b6fab066b 100644
@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw

Re: [PATCH 2/2] glibc: Disable Werror when building with debug options

Quoted 13 lines · Andre McCurdy
Quoted 12 lines · Khem Raj

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

Quoted 7 lines
Quoted 2 lines

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.

If this is the only place where it now fails, can we please work around 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/

Quoted 49 lines
Quoted 44 lines
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -1
index bd8aa6d503..9b6fab066b 100644
@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#4 lore raw

Re: [PATCH 2/2] glibc: Disable Werror when building with debug options

Quoted 18 lines · Martin Jansa
Quoted 16 lines · Andre McCurdy
Quoted 14 lines · Khem Raj

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

Quoted 7 lines
Quoted 4 lines

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.

Quoted 1 line

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.

Quoted 58 lines

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/

Quoted 39 lines
Quoted 39 lines
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -1
index bd8aa6d503..9b6fab066b 100644
@@ -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

Quoted 10 lines
Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
Martin 'JaMa' Jansa jabber: [email protected]

#5 lore raw

Re: [PATCH 2/2] glibc: Disable Werror when building with debug options

Quoted 23 lines · Khem Raj
Quoted 21 lines · Martin Jansa
Quoted 19 lines · Andre McCurdy
Quoted 6 lines · Khem Raj

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]

Quoted 8 lines
  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:

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 63 lines
Quoted 1 line

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.

Quoted 58 lines

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/

Quoted 39 lines
Quoted 39 lines
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -1
index bd8aa6d503..9b6fab066b 100644
@@ -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

Quoted 10 lines
Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
Martin 'JaMa' Jansa jabber: [email protected]

author
#6 lore raw

Re: [PATCH 2/2] glibc: Disable Werror when building with debug options

Quoted 27 lines · Andre McCurdy
Quoted 25 lines · Khem Raj
Quoted 23 lines · Martin Jansa
Quoted 20 lines · Andre McCurdy
Quoted 6 lines · Khem Raj

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]

Quoted 8 lines
  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

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

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?

No, it gets stuck in warnings being treated as errors and that can misguide the user.

Quoted 66 lines

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

Quoted 63 lines
Quoted 1 line

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.

Quoted 58 lines

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/

Quoted 39 lines
Quoted 39 lines
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -1
index bd8aa6d503..9b6fab066b 100644
@@ -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

Quoted 10 lines
Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
Martin 'JaMa' Jansa jabber: [email protected]

author
#7 lore raw

Re: [PATCH 2/2] glibc: Disable Werror when building with debug options

In reply to Andre McCurdy
Quoted 11 lines · Andre McCurdy
Quoted 9 lines · Khem Raj

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);
      |          ~~~~~~~~~~~~^~~~
Quoted 8 lines
Quoted 5 lines

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:

Yes I did, and it does not build with -O0 and glibc build system gives

in file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"

      |   ^~~~~

In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"

      |   ^~~~~

In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
75 | # error "glibc cannot be compiled without optimization"

      |   ^~~~~

this is user friendly message, that we can rely on, there is no need to have code in metadata to detect it.

Quoted 49 lines

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

Quoted 46 lines
---
 meta/recipes-core/glibc/glibc.inc     | 9 ---------
 meta/recipes-core/glibc/glibc_2.29.bb | 1 +
 2 files changed, 1 insertion(+), 9 deletions(-)
meta/recipes-core/glibc/glibc.inc +0 -9
index 67af396133..a382a22b73 100644
@@ -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"
meta/recipes-core/glibc/glibc_2.29.bb +1 -1
index bd8aa6d503..9b6fab066b 100644
@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core