diff mbox series

[4/5] bitbake.conf: Handle S and B separately for debug mapping

Message ID 20220813203501.1111519-4-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit c39b5020b8705d17e3745c41e38d0f99a1ac94cf
Headers show
Series [1/5] gcc: Resolve relative prefix-map filenames | expand

Commit Message

Richard Purdie Aug. 13, 2022, 8:35 p.m. UTC
We don't really need to keep S and B separate for debug source purposes
and there shouldn't be source references in WORKDIR that isn't S and B
either.

Separating these out simplifies the shared-work directory handling for
gcc and should also help fix external source usage. Therefore handle
S and B in DEBUG_PREFIX_MAP separately and clean up other code.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/conf/bitbake.conf                      | 11 +++++++----
 meta/recipes-devtools/gcc/gcc-runtime.inc   | 13 -------------
 meta/recipes-devtools/gcc/libgcc-common.inc |  8 --------
 3 files changed, 7 insertions(+), 25 deletions(-)

Comments

Peter Kjellerstedt Aug. 15, 2022, 4:37 p.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 13 augusti 2022 22:35
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 4/5] bitbake.conf: Handle S and B separately for
> debug mapping
> 
> We don't really need to keep S and B separate for debug source purposes
> and there shouldn't be source references in WORKDIR that isn't S and B
> either.
> 
> Separating these out simplifies the shared-work directory handling for
> gcc and should also help fix external source usage. Therefore handle
> S and B in DEBUG_PREFIX_MAP separately and clean up other code.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/conf/bitbake.conf                      | 11 +++++++----
>  meta/recipes-devtools/gcc/gcc-runtime.inc   | 13 -------------
>  meta/recipes-devtools/gcc/libgcc-common.inc |  8 --------
>  3 files changed, 7 insertions(+), 25 deletions(-)
> 
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index bdfb6784371..dd2df8a5520 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -645,10 +645,13 @@ EXTRA_OEMAKE:prepend:task-install =
> "${PARALLEL_MAKEINST} "
>  # Optimization flags.
>  ##################################################################
>  # Beware: applied last to first
> -DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> -                     -fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> -                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
> -                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> +DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> + -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> + -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> + -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> + -fdebug-prefix-map=${STAGING_DIR_HOST}= \
> + -fmacro-prefix-map=${STAGING_DIR_HOST}= \
> + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
>  "

That should be:

DEBUG_PREFIX_MAP ?= " \
    -fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
    -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
    -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
    -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
    -fdebug-prefix-map=${STAGING_DIR_HOST}= \
    -fmacro-prefix-map=${STAGING_DIR_HOST}= \
    -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
"

to follow common variable indentation.

>  DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
> 

//Peter
Richard Purdie Aug. 15, 2022, 4:56 p.m. UTC | #2
On Mon, 2022-08-15 at 16:37 +0000, Peter Kjellerstedt wrote:
> > -----Original Message-----
> > From: openembedded-core@lists.openembedded.org <openembedded-
> > core@lists.openembedded.org> On Behalf Of Richard Purdie
> > Sent: den 13 augusti 2022 22:35
> > To: openembedded-core@lists.openembedded.org
> > Subject: [OE-core] [PATCH 4/5] bitbake.conf: Handle S and B separately for
> > debug mapping
> > 
> > We don't really need to keep S and B separate for debug source purposes
> > and there shouldn't be source references in WORKDIR that isn't S and B
> > either.
> > 
> > Separating these out simplifies the shared-work directory handling for
> > gcc and should also help fix external source usage. Therefore handle
> > S and B in DEBUG_PREFIX_MAP separately and clean up other code.
> > 
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> >  meta/conf/bitbake.conf                      | 11 +++++++----
> >  meta/recipes-devtools/gcc/gcc-runtime.inc   | 13 -------------
> >  meta/recipes-devtools/gcc/libgcc-common.inc |  8 --------
> >  3 files changed, 7 insertions(+), 25 deletions(-)
> > 
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index bdfb6784371..dd2df8a5520 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -645,10 +645,13 @@ EXTRA_OEMAKE:prepend:task-install =
> > "${PARALLEL_MAKEINST} "
> >  # Optimization flags.
> >  ##################################################################
> >  # Beware: applied last to first
> > -DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> > -                     -fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> > -                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
> > -                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> > +DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> > + -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> > + -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> > + -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
> > + -fdebug-prefix-map=${STAGING_DIR_HOST}= \
> > + -fmacro-prefix-map=${STAGING_DIR_HOST}= \
> > + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> >  "
> 
> That should be:
> 
> DEBUG_PREFIX_MAP ?= " \
>     -fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
>     -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
>     -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
>     -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
>     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
>     -fmacro-prefix-map=${STAGING_DIR_HOST}= \
>     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> "
> 
> to follow common variable indentation.

I should have mentioned this in the commit message but this was
deliberate. It avoids a ton of whitespace in the compiler commandline
which I think overrides the indentation standard give how commonly it
is used.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index bdfb6784371..dd2df8a5520 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -645,10 +645,13 @@  EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
 # Optimization flags.
 ##################################################################
 # Beware: applied last to first
-DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
-                     -fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
-                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
-                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
+ -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
+ -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
+ -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
+ -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+ -fmacro-prefix-map=${STAGING_DIR_HOST}= \
+ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
 "
 DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index 35a3077a4a7..fa5b048dab7 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -50,19 +50,6 @@  RUNTIMETARGET:libc-newlib = "libstdc++-v3"
 # libiberty
 # libgfortran needs separate recipe due to libquadmath dependency
 
-# Relative path to be repaced into debug info
-DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
-
-DEBUG_PREFIX_MAP = " \
-   -ffile-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
-   -ffile-prefix-map=${WORKDIR}/recipe-sysroot-native= \
-   -ffile-prefix-map=${B}=${DEBUGSOURCE} \
-   -ffile-prefix-map=${S}=${DEBUGSOURCE} \
-   -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
-   -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
-   -ffile-prefix-map=${B}/${HOST_SYS}/libstdc++-v3/include=${includedir}/c++/${BINV} \
-   "
-
 do_configure () {
 	export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib"
 	# libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc
index e8139263132..d9084af51ad 100644
--- a/meta/recipes-devtools/gcc/libgcc-common.inc
+++ b/meta/recipes-devtools/gcc/libgcc-common.inc
@@ -4,14 +4,6 @@  require gcc-configure-common.inc
 
 INHIBIT_DEFAULT_DEPS = "1"
 
-DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
-DEBUG_PREFIX_MAP = " \
-   -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
-   -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
-   -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
-   -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
-   "
-
 do_configure () {
 	install -d ${D}${base_libdir} ${D}${libdir}
 	mkdir -p ${B}/${BPN}