[OE-core] [PATCH] bitbake.conf: re-order DEBUG_PREFIX_MAP

Juro Bystricky juro.bystricky at intel.com
Thu Apr 19 18:04:10 UTC 2018


When specifying several -fdebug-prefix-map command line options to
gcc, they are evaluated right to left (last one first).
Normally, the order is irrelevant. However, when we try to map both:

recipe-sysroot-native
recipe-sysroot

the order matters. With the original order most of our debug packages contain
incorrect debug symbols.
Take for example /usr/bin/.debug/setfacl from acl-dbg:

$ strings setfacl | grep native
...
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include
-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include

Reordering the fdebug-prefix-map arguments will give us the correct paths:
/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/include

Note there may be additional an incorrect paths, such as:
/usr/src/debug/glibc/2.27-r0/recipe-sysroot-native/usr/lib/x86_64-poky-linux.gcc-cross-initial-x86_64/gcc/x86_64-poky-linux/7.3.0/include

But that one needs to be fixed in the recipe for glibc.

Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
---
 meta/conf/bitbake.conf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index ec3207c..bc962bb 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -597,9 +597,10 @@ EXTRA_OEMAKE_prepend_task-install = "${PARALLEL_MAKEINST} "
 ##################################################################
 # Optimization flags.
 ##################################################################
+# Beware: applied last to first
 DEBUG_PREFIX_MAP ?= "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
-                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
                      -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
 "
 DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 
-- 
2.7.4




More information about the Openembedded-core mailing list