Re: [OE-core] [PATCH 1/2] externalsrc.bbclass: dynamical change of DEBUG_PREFIX_MAP
From: Richard Purdie <hidden>
Date: 2021-06-27 22:04:07
On Wed, 2021-06-23 at 15:06 +0200, Frederic Martinsons wrote:
quoted hunk ↗ jump to hunk
When using external source manager (devtool), the debug symbol generated by the compilation doesn't point to the right directory. This is normally handled by gcc options that are defined in DEBUG_PREFIX_MAP in conf/bitbake.conf. But the path in it are hardcoded and point to WORKDIR which is not overloaded by devtool. This patch takes the parent directory of external source directory and prepend correct path to DEBUG_PREFIX_MAP. Moreover, to avoid wrong path resolution during dwarfsrcfiles step in splitdebuginfo, it make B variable point to the same structure as EXTERNALSRC (if EXTERNALSRC_BUILD is not defined). Signed-off-by: Frederic Martinsons <redacted> --- meta/classes/externalsrc.bbclass | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 3d6b80bee2..de5ef714b4 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass@@ -53,14 +53,26 @@ python () {d.setVar('BB_DONT_CACHE', '1') if externalsrc: + import os import oe.recipeutils import oe.path + pn = d.getVar('PN') + # taken from bitbake.conf + debugsrcdir = "/usr/src/debug/%s/%s%s-%s" % (pn, d.getVar('EXTENDPE'), d.getVar('PV'), d.getVar('PR')) + externalsrc_parentdir = os.path.dirname(externalsrc) + + debug_prefix_map_ext = "-fmacro-prefix-map=%s=%s " % (externalsrc_parentdir, debugsrcdir) + macro_prefix_map_ext = "-fdebug-prefix-map=%s=%s " % (externalsrc_parentdir, debugsrcdir) + d.prependVar('DEBUG_PREFIX_MAP', debug_prefix_map_ext) + d.prependVar('DEBUG_PREFIX_MAP', macro_prefix_map_ext) + d.setVar('S', externalsrc) if externalsrcbuild: d.setVar('B', externalsrcbuild) else: - d.setVar('B', '${WORKDIR}/${BPN}-${PV}/') + builddir = os.path.join(externalsrc_parentdir, "%s-build" % pn) + d.setVar('B', builddir)
I'm ok with adding some prefix mappings however the commit message doesn't really make it clear that you're actually inventing a new build directory here too. We can't just poke around the parent directory of the externalsrc like this since we have no idea what that directory is and we've not been asked to "touch" it. Cheers, Richard