bitbake.conf: Use -Og in DEBUG_OPTIMIZATION
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
@@ -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
@@ -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
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
@@ -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
@@ -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
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:
Quoted 46 lines
Signed-off-by Khem Raj <[email protected]>--- 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@@ -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@@ -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
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:
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@@ -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@@ -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-coreSignature · 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]
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:
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@@ -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@@ -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]
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
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@@ -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@@ -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]
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:
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@@ -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@@ -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]
Re: [PATCH 2/2] glibc: Disable Werror when building with debug options
In reply to Andre McCurdyQuoted 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
Quoted 46 lines
Signed-off-by Khem Raj <[email protected]>--- 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@@ -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@@ -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