@@ -13,3 +13,6 @@ BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
BUILD_NM = "${BUILD_PREFIX}nm"
BUILD_READELF = "${BUILD_PREFIX}readelf"
+# gcc started to support -fcanon-prefix-map from version 13
+DEBUG_PREFIX_MAP_EXTRA:class-native = \
+ "${@'-fcanon-prefix-map' if bb.utils.vercmp_string_op(oe.utils.get_host_gcc_version(d), '13.0.0', '>=') else ''}"
@@ -30,4 +30,6 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "gcc-crosss
PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "gcc-crosssdk-${SDK_SYS}"
PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "nativesdk-gcc-runtime"
+DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map"
+
TCOVERRIDE = "toolchain-gcc"
@@ -650,7 +650,7 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
##################################################################
TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
# Beware: applied last to first
-DEBUG_PREFIX_MAP ?= "\
+DEBUG_PREFIX_MAP ?= "${DEBUG_PREFIX_MAP_EXTRA} \
-ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
-ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
-ffile-prefix-map=${STAGING_DIR_HOST}= \
This patch adds -fcanon-prefix-map to the list of compile file-prefixes list in case at least gcc 13 is used (it's a gcc-only flag). This flag used to be part of this list in the past, but was removed with [1]. Since then the source file paths are not canonicalized, which makes the system to miss some (and sometimes all) source files to include in the corresponding -src packages. As an example sqlite3 and audiofile (from meta-oe) produces empty src packages, mostly due to the pathes: they frequently use relative paths that don't match up with the absolute path specified in the file-preifx map: `pwd`/../../foo.cpp and ${S}/foo.cpp might refer to the same file, but the first one won't match the prefix-map, so it is omitted. This patch adds this option again with gcc: for class-target it is uses always, and for class-native it is used when the host gcc is at least version 13. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> --- meta/classes/toolchain/gcc-native.bbclass | 3 +++ meta/classes/toolchain/gcc.bbclass | 2 ++ meta/conf/bitbake.conf | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-)