diff mbox series

[PATCHv3,01/11] bitbake.conf: drop ${PE} and ${PR} from -f{file,macro,debug}-prefix-map

Message ID 20231116073650.2710535-1-martin.jansa@gmail.com
State New
Headers show
Series [PATCHv3,01/11] bitbake.conf: drop ${PE} and ${PR} from -f{file,macro,debug}-prefix-map | expand

Commit Message

Martin Jansa Nov. 16, 2023, 7:36 a.m. UTC
* ${EXTENDPE} and ${PR} was already dropped from ${WORKDIR} in:
  https://lists.openembedded.org/g/openembedded-core/message/185818
  adjust -fmacro-prefix-map and -fdebug-prefix-map similarly.
  As we don't depend on PR in WORKDIR maybe we don't need it in
  /usr/src/debug paths as well anymore.

* The interesting side-effect of this is that for DISTROs which still
  use PR (e.g. webOS OSE), the difference in -fdebug-prefix-map causes
  all binaries to be slightly different when rebuilt with different PR
  (due to this path, even when otherwise they are binary reproducible)
  and when the number of digits in PR changes (e.g. from r9 to r10) it
  also results in slightly bigger binaries (and more unnecessary changes
  in buildhistory diffs).

  For example this foo binary, the difference between "new" and "old" is
  extra patch applied in SRC_URI (which doesn't affect the foo binary,
  but was the reason for PR bump).

  And the binary is bigger with r10, identical with r6 and slightly
  different due to debug-prefix-map between r6 and r7:

  $ ls -la 1.0.0-175-*/image/usr/sbin/foo
  -rwxr-xr-x 1 bitbake bitbake 30182460 Nov  8 08:29 1.0.0-175-new-r10/image/usr/sbin/foo
  -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 08:02 1.0.0-175-new-r6/image/usr/sbin/foo
  -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 07:49 1.0.0-175-new-r7/image/usr/sbin/foo
  -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 07:39 1.0.0-175-old-r6/image/usr/sbin/foo

  $ md5sum 1.0.0-175-*/image/usr/sbin/foo
  8e3ab67d596f8cc2f9c6320dab10af01  1.0.0-175-new-r10/image/usr/sbin/foo
  f6ff1e64fe6affb9ba0d8f278cf7ed79  1.0.0-175-new-r6/image/usr/sbin/foo
  6469a0b10aac233911e63c5ea97b03c0  1.0.0-175-new-r7/image/usr/sbin/foo
  f6ff1e64fe6affb9ba0d8f278cf7ed79  1.0.0-175-old-r6/image/usr/sbin/foo

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
v3: added additional fix for perf (and changes in other recipes were moved to separate commits)

 meta/conf/bitbake.conf | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Khem Raj Nov. 16, 2023, 7:44 p.m. UTC | #1
On Wed, Nov 15, 2023 at 11:36 PM Martin Jansa <martin.jansa@gmail.com> wrote:
>
> * ${EXTENDPE} and ${PR} was already dropped from ${WORKDIR} in:
>   https://lists.openembedded.org/g/openembedded-core/message/185818
>   adjust -fmacro-prefix-map and -fdebug-prefix-map similarly.
>   As we don't depend on PR in WORKDIR maybe we don't need it in
>   /usr/src/debug paths as well anymore.
>
> * The interesting side-effect of this is that for DISTROs which still
>   use PR (e.g. webOS OSE), the difference in -fdebug-prefix-map causes
>   all binaries to be slightly different when rebuilt with different PR
>   (due to this path, even when otherwise they are binary reproducible)
>   and when the number of digits in PR changes (e.g. from r9 to r10) it
>   also results in slightly bigger binaries (and more unnecessary changes
>   in buildhistory diffs).
>

these paths are for binary outputs unlike workdir, this change would means we
have same path to install debug info on targets which might not match
to installed
binaries Can you check if these paths are matching while debugging on target ?

>   For example this foo binary, the difference between "new" and "old" is
>   extra patch applied in SRC_URI (which doesn't affect the foo binary,
>   but was the reason for PR bump).
>
>   And the binary is bigger with r10, identical with r6 and slightly
>   different due to debug-prefix-map between r6 and r7:
>
>   $ ls -la 1.0.0-175-*/image/usr/sbin/foo
>   -rwxr-xr-x 1 bitbake bitbake 30182460 Nov  8 08:29 1.0.0-175-new-r10/image/usr/sbin/foo
>   -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 08:02 1.0.0-175-new-r6/image/usr/sbin/foo
>   -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 07:49 1.0.0-175-new-r7/image/usr/sbin/foo
>   -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 07:39 1.0.0-175-old-r6/image/usr/sbin/foo
>
>   $ md5sum 1.0.0-175-*/image/usr/sbin/foo
>   8e3ab67d596f8cc2f9c6320dab10af01  1.0.0-175-new-r10/image/usr/sbin/foo
>   f6ff1e64fe6affb9ba0d8f278cf7ed79  1.0.0-175-new-r6/image/usr/sbin/foo
>   6469a0b10aac233911e63c5ea97b03c0  1.0.0-175-new-r7/image/usr/sbin/foo
>   f6ff1e64fe6affb9ba0d8f278cf7ed79  1.0.0-175-old-r6/image/usr/sbin/foo
>
> Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
> ---
> v3: added additional fix for perf (and changes in other recipes were moved to separate commits)
>
>  meta/conf/bitbake.conf | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 67ff769046..3836a389b8 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -648,10 +648,10 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
>  ##################################################################
>  # Beware: applied last to first
>  DEBUG_PREFIX_MAP ?= "-fcanon-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} \
> + -fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${PV} \
> + -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${PV} \
> + -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${PV} \
> + -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${PV} \
>   -fdebug-prefix-map=${STAGING_DIR_HOST}= \
>   -fmacro-prefix-map=${STAGING_DIR_HOST}= \
>   -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> --
> 2.42.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#190753): https://lists.openembedded.org/g/openembedded-core/message/190753
> Mute This Topic: https://lists.openembedded.org/mt/102623139/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Martin Jansa Nov. 16, 2023, 10:46 p.m. UTC | #2
On Thu, Nov 16, 2023 at 8:44 PM Khem Raj <raj.khem@gmail.com> wrote:

> On Wed, Nov 15, 2023 at 11:36 PM Martin Jansa <martin.jansa@gmail.com>
> wrote:
> >
> > * ${EXTENDPE} and ${PR} was already dropped from ${WORKDIR} in:
> >   https://lists.openembedded.org/g/openembedded-core/message/185818
> >   adjust -fmacro-prefix-map and -fdebug-prefix-map similarly.
> >   As we don't depend on PR in WORKDIR maybe we don't need it in
> >   /usr/src/debug paths as well anymore.
> >
> > * The interesting side-effect of this is that for DISTROs which still
> >   use PR (e.g. webOS OSE), the difference in -fdebug-prefix-map causes
> >   all binaries to be slightly different when rebuilt with different PR
> >   (due to this path, even when otherwise they are binary reproducible)
> >   and when the number of digits in PR changes (e.g. from r9 to r10) it
> >   also results in slightly bigger binaries (and more unnecessary changes
> >   in buildhistory diffs).
> >
>
> these paths are for binary outputs unlike workdir, this change would means
> we
> have same path to install debug info on targets which might not match
> to installed
> binaries Can you check if these paths are matching while debugging on
> target ?
>

I did run the selftest with this included and it doesn't show any new
issues.

In a image built with IMAGE_FEATURES:append = " dev-pkgs dbg-pkgs src-pkgs"
and checked that there are no dirs with ${PR} anymore:
ls usr/src/debug/*/*-r*
and the paths in rootfs-dbg from IMAGE_GEN_DEBUGFS uses the same paths.

I also have 8 commits for meta-oe recipes to adjust for this.

Cheers,



> >   For example this foo binary, the difference between "new" and "old" is
> >   extra patch applied in SRC_URI (which doesn't affect the foo binary,
> >   but was the reason for PR bump).
> >
> >   And the binary is bigger with r10, identical with r6 and slightly
> >   different due to debug-prefix-map between r6 and r7:
> >
> >   $ ls -la 1.0.0-175-*/image/usr/sbin/foo
> >   -rwxr-xr-x 1 bitbake bitbake 30182460 Nov  8 08:29
> 1.0.0-175-new-r10/image/usr/sbin/foo
> >   -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 08:02
> 1.0.0-175-new-r6/image/usr/sbin/foo
> >   -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 07:49
> 1.0.0-175-new-r7/image/usr/sbin/foo
> >   -rwxr-xr-x 1 bitbake bitbake 30182224 Nov  8 07:39
> 1.0.0-175-old-r6/image/usr/sbin/foo
> >
> >   $ md5sum 1.0.0-175-*/image/usr/sbin/foo
> >   8e3ab67d596f8cc2f9c6320dab10af01  1.0.0-175-new-r10/image/usr/sbin/foo
> >   f6ff1e64fe6affb9ba0d8f278cf7ed79  1.0.0-175-new-r6/image/usr/sbin/foo
> >   6469a0b10aac233911e63c5ea97b03c0  1.0.0-175-new-r7/image/usr/sbin/foo
> >   f6ff1e64fe6affb9ba0d8f278cf7ed79  1.0.0-175-old-r6/image/usr/sbin/foo
> >
> > Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
> > ---
> > v3: added additional fix for perf (and changes in other recipes were
> moved to separate commits)
> >
> >  meta/conf/bitbake.conf | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index 67ff769046..3836a389b8 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -648,10 +648,10 @@ EXTRA_OEMAKE:prepend:task-install =
> "${PARALLEL_MAKEINST} "
> >  ##################################################################
> >  # Beware: applied last to first
> >  DEBUG_PREFIX_MAP ?= "-fcanon-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} \
> > + -fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${PV} \
> > + -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${PV} \
> > + -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${PV} \
> > + -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${PV} \
> >   -fdebug-prefix-map=${STAGING_DIR_HOST}= \
> >   -fmacro-prefix-map=${STAGING_DIR_HOST}= \
> >   -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> > --
> > 2.42.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#190753):
> https://lists.openembedded.org/g/openembedded-core/message/190753
> > Mute This Topic: https://lists.openembedded.org/mt/102623139/1997914
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
diff mbox series

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 67ff769046..3836a389b8 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -648,10 +648,10 @@  EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
 ##################################################################
 # Beware: applied last to first
 DEBUG_PREFIX_MAP ?= "-fcanon-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} \
+ -fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${PV} \
+ -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${PV} \
+ -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${PV} \
+ -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${PV} \
  -fdebug-prefix-map=${STAGING_DIR_HOST}= \
  -fmacro-prefix-map=${STAGING_DIR_HOST}= \
  -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \