* [PATCH V3 1/5] bitbake.conf: Use -Og in DEBUG_OPTIMIZATION
@ 2019-03-01 3:21 Khem Raj
2019-03-01 3:21 ` [PATCH V2 2/5] glibc: Disable Werror when building with debug options Khem Raj
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Khem Raj @ 2019-03-01 3:21 UTC (permalink / raw)
To: openembedded-core
-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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Change documentation to reflect the change and also build host flags
v3: Rebase
meta/conf/bitbake.conf | 4 ++--
meta/conf/documentation.conf | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 1c5369ec98..85aab98462 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -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"
##################################################################
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 4d2a707563..c2c96ecf1e 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -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."
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH V2 2/5] glibc: Disable Werror when building with debug options
2019-03-01 3:21 [PATCH V3 1/5] bitbake.conf: Use -Og in DEBUG_OPTIMIZATION Khem Raj
@ 2019-03-01 3:21 ` Khem Raj
2019-03-01 3:21 ` [PATCH 3/5] bitbake.conf: Drop -fno-omit-frame-pointer Khem Raj
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2019-03-01 3:21 UTC (permalink / raw)
To: openembedded-core
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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Rebased
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 b550abd877..252fd56c13 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 c3e969d2f8..4577350eae 100644
--- a/meta/recipes-core/glibc/glibc_2.29.bb
+++ b/meta/recipes-core/glibc/glibc_2.29.bb
@@ -85,6 +85,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
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/5] bitbake.conf: Drop -fno-omit-frame-pointer
2019-03-01 3:21 [PATCH V3 1/5] bitbake.conf: Use -Og in DEBUG_OPTIMIZATION Khem Raj
2019-03-01 3:21 ` [PATCH V2 2/5] glibc: Disable Werror when building with debug options Khem Raj
@ 2019-03-01 3:21 ` Khem Raj
2019-03-01 3:21 ` [PATCH 4/5] perf: Set libunwind dir explicitly to point into staging sysroot Khem Raj
2019-03-01 3:21 ` [PATCH 5/5] musl: Fix out of bounds data access in dlopen Khem Raj
3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2019-03-01 3:21 UTC (permalink / raw)
To: openembedded-core
Let -Og decide the best debugging experience
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/bitbake.conf | 4 ++--
meta/conf/documentation.conf | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 85aab98462..f1540a0acf 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -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 = "-Og -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
+DEBUG_OPTIMIZATION = "-Og ${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', '-Og -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', '-O2', d)} -pipe"
BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
##################################################################
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index c2c96ecf1e..550df20b0f 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -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 '-Og -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 ${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."
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/5] perf: Set libunwind dir explicitly to point into staging sysroot
2019-03-01 3:21 [PATCH V3 1/5] bitbake.conf: Use -Og in DEBUG_OPTIMIZATION Khem Raj
2019-03-01 3:21 ` [PATCH V2 2/5] glibc: Disable Werror when building with debug options Khem Raj
2019-03-01 3:21 ` [PATCH 3/5] bitbake.conf: Drop -fno-omit-frame-pointer Khem Raj
@ 2019-03-01 3:21 ` Khem Raj
2019-03-01 3:21 ` [PATCH 5/5] musl: Fix out of bounds data access in dlopen Khem Raj
3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2019-03-01 3:21 UTC (permalink / raw)
To: openembedded-core
This helps it find the unwind library in sysroot always and not
look around and confuse with host
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-kernel/perf/perf.bb | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 515a78b859..9120766858 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -80,6 +80,7 @@ EXTRA_OEMAKE = '\
NO_GTK2=1 \
${PACKAGECONFIG_CONFARGS} \
TMPDIR="${B}" \
+ LIBUNWIND_DIR=${STAGING_EXECPREFIXDIR} \
'
EXTRA_OEMAKE += "\
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 5/5] musl: Fix out of bounds data access in dlopen
2019-03-01 3:21 [PATCH V3 1/5] bitbake.conf: Use -Og in DEBUG_OPTIMIZATION Khem Raj
` (2 preceding siblings ...)
2019-03-01 3:21 ` [PATCH 4/5] perf: Set libunwind dir explicitly to point into staging sysroot Khem Raj
@ 2019-03-01 3:21 ` Khem Raj
3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2019-03-01 3:21 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../musl/musl/out_of_bounds_read.patch | 20 +++++++++++++++++++
meta/recipes-core/musl/musl_git.bb | 1 +
2 files changed, 21 insertions(+)
create mode 100644 meta/recipes-core/musl/musl/out_of_bounds_read.patch
diff --git a/meta/recipes-core/musl/musl/out_of_bounds_read.patch b/meta/recipes-core/musl/musl/out_of_bounds_read.patch
new file mode 100644
index 0000000000..a681cc284e
--- /dev/null
+++ b/meta/recipes-core/musl/musl/out_of_bounds_read.patch
@@ -0,0 +1,20 @@
+Fix out of bounds read
+
+self->dtv hasn't been extended yet
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+diff --git a/ldso/dynlink.c b/ldso/dynlink.c
+index e2c3259f..b23ea0df 100644
+--- a/ldso/dynlink.c
++++ b/ldso/dynlink.c
+@@ -1374,7 +1376,7 @@ static void install_new_tls(void)
+ }
+ /* Install new dtls into the enlarged, uninstalled dtv copies. */
+ for (p=head; ; p=p->next) {
+- if (!p->tls_id || self->dtv[p->tls_id]) continue;
++ if (p->tls_id <= old_cnt) continue;
+ unsigned char *mem = p->new_tls;
+ for (j=0; j<i; j++) {
+ unsigned char *new = mem;
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index f1052278c8..6a72b7d3bc 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -15,6 +15,7 @@ PV = "${BASEVER}+git${SRCPV}"
SRC_URI = "git://git.musl-libc.org/musl \
file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
+ file://out_of_bounds_read.patch \
"
S = "${WORKDIR}/git"
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-01 3:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-01 3:21 [PATCH V3 1/5] bitbake.conf: Use -Og in DEBUG_OPTIMIZATION Khem Raj
2019-03-01 3:21 ` [PATCH V2 2/5] glibc: Disable Werror when building with debug options Khem Raj
2019-03-01 3:21 ` [PATCH 3/5] bitbake.conf: Drop -fno-omit-frame-pointer Khem Raj
2019-03-01 3:21 ` [PATCH 4/5] perf: Set libunwind dir explicitly to point into staging sysroot Khem Raj
2019-03-01 3:21 ` [PATCH 5/5] musl: Fix out of bounds data access in dlopen Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox