Skip to contentSkip to conversation

glibc: Forward -ffile-prefix-map option to assembler flags

PATCH In review Khem Raj 2 participants 5 messages Apr 21, 2025 – Nov 18, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v3 1/2 glibc: Forward -ffile-prefix-map option to assembler flags

---
v2: No change
v3: No change

 ...le-prefix-map-from-CFLAGS-to-ASFLAGS.patch | 24 +++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.41.bb         |  1 +
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc/0001-Propagate-ffile-prefix-map-from-CFLAGS-to-ASFLAGS.patch
meta/recipes-core/glibc/glibc/0001-Propagate-ffile-prefix-map-from-CFLAGS-to-ASFLAGS.patch new file +24 -0
new file mode 100644
index 00000000000..862c7b9086e
@@ -0,0 +1,24 @@
+From 603e50d6b8ccadb32d59b0497f76629665c1794b Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 16 Apr 2025 19:51:01 -0700
+Subject: [PATCH] Propagate -ffile-prefix-map from CFLAGS to ASFLAGS.
+
+Upstream-Status: Submitted [https://sourceware.org/pipermail/libc-alpha/2025-April/165969.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ Makeconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makeconfig b/Makeconfig
+index e35c5cfe4e..7a19c731c6 100644
+--- a/Makeconfig
++++ b/Makeconfig
+@@ -1176,7 +1176,7 @@ endif
+ 
+ # The assembler can generate debug information too.
+ ifndef ASFLAGS
+-ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
++ASFLAGS := $(filter -g% -fdebug-prefix-map=% -ffile-prefix-map=%,$(CFLAGS))
+ endif
+ override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu)
+ 
meta/recipes-core/glibc/glibc_2.41.bb +1 -0
index d707e1a6775..82dcf08fcd0 100644
@@ -54,6 +54,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
            file://0023-tests-Skip-2-qemu-tests-that-can-hang-in-oe-selftest.patch \
            file://0001-stdlib-Add-single-threaded-fast-path-to-rand.patch \
+           file://0001-Propagate-ffile-prefix-map-from-CFLAGS-to-ASFLAGS.patch \
 "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
author
#1 lore raw

PATCH v3 2/2 bitbake.conf: Switch prefix mapping to use -ffile-prefix-map

-ffile-prefix map is more comprehensive when it comes to reproducible builds and its superset of all prefix-mapping options in compilers

This makes is cleaner and workable across gcc and clang, clang does not support -fcanon-prefix-map and it has to be explicitly omitted when using clang.

There are lambdas generated in templates by clang which still get the absolute paths despite -fdebug-prefix-map, this helps with that as well.

nasm is an outlier and we have fixed it by adding -fdebug-prefix-map option luckily we do not pass DEBUG_PREFIX_MAP to nasm, in all recipes which use nasm either pass -fdebug-prefix-map explicitly to nasm or they rewrite it to use nasm flags syntax.

We have discussed this in past [1]

[1] https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#10281

Cc Jacob Kroon <[email protected]>
Cc Martin Jansa <[email protected]>

---
v2: Drop using --ffile-prefix in go
v3: Fix copydebugsources to use --file-prefix-map instead of -fdebug-prefix-map
and few more places

 meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
 meta/conf/bitbake.conf                             | 14 +++++---------
 meta/lib/oe/package.py                             |  2 +-
 meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
 .../python/python3-maturin_1.8.3.bb                |  2 +-
 meta/recipes-devtools/rust/cargo_1.85.1.bb         |  2 +-
 6 files changed, 11 insertions(+), 17 deletions(-)
meta/classes-recipe/kernel-arch.bbclass +2 -4
index 968551267f9..7aea9cd3e8e 100644
@@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}"
 
 KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
  -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
- -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
 "
 KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
 KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
meta/conf/bitbake.conf +5 -9
index 8f90026f7c2..b4e1964f77d 100644
@@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
 ##################################################################
 TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
 # Beware: applied last to first
-DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \
- -fmacro-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
- -fmacro-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${STAGING_DIR_HOST}= \
- -fmacro-prefix-map=${STAGING_DIR_HOST}= \
- -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
- -fmacro-prefix-map=${STAGING_DIR_NATIVE}= \
+DEBUG_PREFIX_MAP ?= "\
+ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${STAGING_DIR_HOST}= \
+ -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
 "
 DEBUG_LEVELFLAG ?= "-g"
 
meta/lib/oe/package.py +1 -1
index 0db14f21642..0bcc04ea54a 100644
@@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
 
         prefixmap = {}
         for flag in cflags.split():
-            if not flag.startswith("-fdebug-prefix-map"):
+            if not flag.startswith("-ffile-prefix-map"):
                 continue
             if "recipe-sysroot" in flag:
                 continue
meta/recipes-devtools/gcc/libgfortran.inc +1 -1
index 4560421ed1f..fa6aecaaa30 100644
@@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
 # An arm hard float target like raspberrypi4 won't build
 # as CFLAGS don't make it to the fortran compiler otherwise
 # (the configure script sets FC to $GFORTRAN unconditionally)
-export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
+export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
 
 do_configure () {
 	for target in libbacktrace libgfortran
meta/recipes-devtools/python/python3-maturin_1.8.3.bb +1 -1
index 3ec4d0c103b..08975e177f0 100644
@@ -10,7 +10,7 @@ SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
 
 S = "${WORKDIR}/maturin-${PV}"
 
-CFLAGS += "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
+CFLAGS += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
 
 DEPENDS += "\
     python3-setuptools-rust-native \
meta/recipes-devtools/rust/cargo_1.85.1.bb +1 -1
index db18ecfda9a..150c2d2b801 100644
@@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 
 inherit cargo pkgconfig
 
-DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
+DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
 
 do_cargo_setup_snapshot () {
 	${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
#2 lore raw

Re: [OE-core] [PATCH v3 2/2] bitbake.conf: Switch prefix mapping to use -ffile-prefix-map

This patch seems to have caused some regression in packaging the source for some recipes.
I don't have a lot of info yet, just finished bisecting.

The issue I see is with "audiofile" recipe from meta-oe that I wanted to debug with master branch: with this patch the -src package is empty. Without it, it is populated fine. I guess there are other recipes also, but that's what I stumbled upon.

Will try to look at it, but if you have any ideas, I'm all ears. But in any case, FYI.

Quoted 138 lines · Khem Raj via lists.openembedded.org

-ffile-prefix map is more comprehensive when it comes to reproducible builds and its superset of all prefix-mapping options in compilers

This makes is cleaner and workable across gcc and clang, clang does not support -fcanon-prefix-map and it has to be explicitly omitted when using clang.

There are lambdas generated in templates by clang which still get the absolute paths despite -fdebug-prefix-map, this helps with that as well.

nasm is an outlier and we have fixed it by adding -fdebug-prefix-map option luckily we do not pass DEBUG_PREFIX_MAP to nasm, in all recipes which use nasm either pass -fdebug-prefix-map explicitly to nasm or they rewrite it to use nasm flags syntax.

We have discussed this in past [1]

[1] https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#10281

Cc Jacob Kroon <[email protected]>
Cc Martin Jansa <[email protected]>

---
v2: Drop using --ffile-prefix in go
v3: Fix copydebugsources to use --file-prefix-map instead of -fdebug-prefix-map
and few more places

 meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
 meta/conf/bitbake.conf                             | 14 +++++---------
 meta/lib/oe/package.py                             |  2 +-
 meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
 .../python/python3-maturin_1.8.3.bb                |  2 +-
 meta/recipes-devtools/rust/cargo_1.85.1.bb         |  2 +-
 6 files changed, 11 insertions(+), 17 deletions(-)
meta/classes-recipe/kernel-arch.bbclass +2 -4
index 968551267f9..7aea9cd3e8e 100644
@@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}"
 
 KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
  -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
- -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
 "
 KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
 KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
meta/conf/bitbake.conf +5 -9
index 8f90026f7c2..b4e1964f77d 100644
@@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
 ##################################################################
 TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
 # Beware: applied last to first
-DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \
- -fmacro-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
- -fmacro-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${STAGING_DIR_HOST}= \
- -fmacro-prefix-map=${STAGING_DIR_HOST}= \
- -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
- -fmacro-prefix-map=${STAGING_DIR_NATIVE}= \
+DEBUG_PREFIX_MAP ?= "\
+ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${STAGING_DIR_HOST}= \
+ -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
 "
 DEBUG_LEVELFLAG ?= "-g"
 
meta/lib/oe/package.py +1 -1
index 0db14f21642..0bcc04ea54a 100644
@@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
 
         prefixmap = {}
         for flag in cflags.split():
-            if not flag.startswith("-fdebug-prefix-map"):
+            if not flag.startswith("-ffile-prefix-map"):
                 continue
             if "recipe-sysroot" in flag:
                 continue
meta/recipes-devtools/gcc/libgfortran.inc +1 -1
index 4560421ed1f..fa6aecaaa30 100644
@@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
 # An arm hard float target like raspberrypi4 won't build
 # as CFLAGS don't make it to the fortran compiler otherwise
 # (the configure script sets FC to $GFORTRAN unconditionally)
-export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
+export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
 
 do_configure () {
 	for target in libbacktrace libgfortran
meta/recipes-devtools/python/python3-maturin_1.8.3.bb +1 -1
index 3ec4d0c103b..08975e177f0 100644
@@ -10,7 +10,7 @@ SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
 
 S = "${WORKDIR}/maturin-${PV}"
 
-CFLAGS += "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
+CFLAGS += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
 
 DEPENDS += "\
     python3-setuptools-rust-native \
meta/recipes-devtools/rust/cargo_1.85.1.bb +1 -2
index db18ecfda9a..150c2d2b801 100644
@@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 
 inherit cargo pkgconfig
 
-DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
+DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
 
 do_cargo_setup_snapshot () {
 	${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#215180): https://lists.openembedded.org/g/openembedded-core/message/215180
Mute This Topic: https://lists.openembedded.org/mt/112379635/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#3 lore raw

Re: [OE-core] [PATCH v3 2/2] bitbake.conf: Switch prefix mapping to use -ffile-prefix-map

Quoted 9 lines · Gyorgy Sarvari

This patch seems to have caused some regression in packaging the source for some recipes.
I don't have a lot of info yet, just finished bisecting.

The issue I see is with "audiofile" recipe from meta-oe that I wanted to debug with master branch: with this patch the -src package is empty. Without it, it is populated fine. I guess there are other recipes also, but that's what I stumbled upon.

It's an old package, I wonder if it has a mind of its own when it comes to compiler
flags. I don't see anything in the recipe metadata that leads towards the issue.
I wonder if this recipe can be dropped going forward.

Quoted 165 lines

Will try to look at it, but if you have any ideas, I'm all ears. But in any case, FYI.

Quoted 11 lines · Khem Raj via lists.openembedded.org

-ffile-prefix map is more comprehensive when it comes to reproducible builds and its superset of all prefix-mapping options in compilers

This makes is cleaner and workable across gcc and clang, clang does not support -fcanon-prefix-map and it has to be explicitly omitted when using clang.

There are lambdas generated in templates by clang which still get the absolute paths despite -fdebug-prefix-map, this helps with that as well.

nasm is an outlier and we have fixed it by adding -fdebug-prefix-map

option

Quoted 7 lines

luckily we do not pass DEBUG_PREFIX_MAP to nasm, in all recipes which use nasm either pass -fdebug-prefix-map explicitly to nasm or they rewrite it to use nasm flags syntax.

We have discussed this in past [1]

[1]

https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#10281

Quoted 7 lines
Cc Jacob Kroon <[email protected]>
Cc Martin Jansa <[email protected]>

---
v2: Drop using --ffile-prefix in go
v3: Fix copydebugsources to use --file-prefix-map instead of

-fdebug-prefix-map

Review

Quoted 11 lines

and few more places

 meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
 meta/conf/bitbake.conf                             | 14 +++++---------
 meta/lib/oe/package.py                             |  2 +-
 meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
 .../python/python3-maturin_1.8.3.bb                |  2 +-
 meta/recipes-devtools/rust/cargo_1.85.1.bb         |  2 +-
 6 files changed, 11 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/meta/classes-recipe/kernel-arch.bbclass

meta/classes-recipe/kernel-arch.bbclass HOST_OBJCOPY_KERNEL_ARCH ?=

Quoted 4 lines

index 968551267f9..7aea9cd3e8e 100644

meta/classes-recipe/kernel-arch.bbclass +0 -0
@@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?=

"${TARGET_OBJCOPY_KERNEL_ARCH}"

meta/conf/bitbake.conf EXTRA_OEMAKE:prepend:task-install =

Quoted 17 lines
meta/classes-recipe/kernel-arch.bbclass +2 -4
 KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
  -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
- -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
 "
 KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
 KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
meta/conf/bitbake.conf +0 -0
index 8f90026f7c2..b4e1964f77d 100644
@@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install =

"${PARALLEL_MAKEINST} "

Review

Quoted 34 lines
meta/conf/bitbake.conf +5 -9
 ##################################################################
 TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
 # Beware: applied last to first
-DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \
- -fmacro-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
- -fmacro-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
- -fdebug-prefix-map=${STAGING_DIR_HOST}= \
- -fmacro-prefix-map=${STAGING_DIR_HOST}= \
- -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
- -fmacro-prefix-map=${STAGING_DIR_NATIVE}= \
+DEBUG_PREFIX_MAP ?= "\
+ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${STAGING_DIR_HOST}= \
+ -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
 "
 DEBUG_LEVELFLAG ?= "-g"
 
meta/lib/oe/package.py +1 -1
index 0db14f21642..0bcc04ea54a 100644
@@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
 
         prefixmap = {}
         for flag in cflags.split():
-            if not flag.startswith("-fdebug-prefix-map"):
+            if not flag.startswith("-ffile-prefix-map"):
                 continue
             if "recipe-sysroot" in flag:
                 continue
(quoted diff) +0 -0

b/meta/recipes-devtools/gcc/libgfortran.inc

Quoted 8 lines

index 4560421ed1f..fa6aecaaa30 100644

meta/recipes-devtools/gcc/libgfortran.inc +0 -1
@@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
 # An arm hard float target like raspberrypi4 won't build
 # as CFLAGS don't make it to the fortran compiler otherwise
 # (the configure script sets FC to $GFORTRAN unconditionally)
-export GFORTRAN = "${FC} -fcanon-prefix-map
(quoted diff) +0 -2
-fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR}
-fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"

meta/recipes-devtools/gcc/libgfortran.inc EXTRA_OECONF_PATHS = "\ · line 11

Quoted 1 line
meta/recipes-devtools/gcc/libgfortran.inc +1 -0
+export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR}

-ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"

Review

Quoted 4 lines
meta/recipes-devtools/gcc/libgfortran.inc +0 -0
 do_configure () {
      for target in libbacktrace libgfortran
(quoted diff) +0 -0

b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb

meta/recipes-devtools/python/python3-maturin_1.8.3.bb SRC_URI[sha256sum] =

Quoted 4 lines

index 3ec4d0c103b..08975e177f0 100644

meta/recipes-devtools/python/python3-maturin_1.8.3.bb +0 -0
@@ -10,7 +10,7 @@ SRC_URI[sha256sum] =

"304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015

meta/recipes-devtools/python/python3-maturin_1.8.3.bb SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015

Quoted 4 lines
meta/recipes-devtools/python/python3-maturin_1.8.3.bb +0 -1
 S = "${WORKDIR}/maturin-${PV}"
 
-CFLAGS +=

"-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"

meta/recipes-devtools/python/python3-maturin_1.8.3.bb SRC_URI[sha256sum] = · line 12

Quoted 1 line
meta/recipes-devtools/python/python3-maturin_1.8.3.bb +1 -0
+CFLAGS +=

"-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"

Review

Quoted 4 lines
meta/recipes-devtools/python/python3-maturin_1.8.3.bb +0 -0
 DEPENDS += "\
     python3-setuptools-rust-native \
(quoted diff) +0 -0

b/meta/recipes-devtools/rust/cargo_1.85.1.bb

meta/recipes-devtools/rust/cargo_1.85.1.bb CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" · line 22

Quoted 8 lines

index db18ecfda9a..150c2d2b801 100644

meta/recipes-devtools/rust/cargo_1.85.1.bb +0 -1
@@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 
 inherit cargo pkgconfig
 
-DEBUG_PREFIX_MAP +=

"-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"

meta/recipes-devtools/rust/cargo_1.85.1.bb CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" · line 22

Quoted 1 line
meta/recipes-devtools/rust/cargo_1.85.1.bb +1 -0
+DEBUG_PREFIX_MAP +=

"-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"

meta/recipes-devtools/rust/cargo_1.85.1.bb CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" · line 24

Quoted 3 lines
meta/recipes-devtools/rust/cargo_1.85.1.bb +0 -0
 do_cargo_setup_snapshot () {
      ${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh

--prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig

Quoted 4 lines
meta/recipes-devtools/rust/cargo_1.85.1.bb +0 -1
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#215180):

https://lists.openembedded.org/g/openembedded-core/message/215180

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/112379635/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Re: [OE-core] [PATCH v3 2/2] bitbake.conf: Switch prefix mapping to use -ffile-prefix-map

Quoted 18 lines · Khem Raj

On Tue, Nov 18, 2025 at 10:12 AM Gyorgy Sarvari
<[email protected]> wrote:

This patch seems to have caused some regression in packaging the source
for some recipes.
I don't have a lot of info yet, just finished bisecting.

The issue I see is with "audiofile" recipe from meta-oe that I wanted to
debug with master branch: with this patch the -src package is empty. Without it, it is populated fine. I guess there are other recipes also,
but that's what I stumbled upon.

Quoted 5 lines

It's an old package, I wonder if it has a mind of its own when it comes to compiler
flags. I don't see anything in the recipe metadata that leads towards the issue.
I wonder if this recipe can be dropped going forward.

I'm not sure if it's about the age[1], but it might be about being overly smart when it comes to compilation... as another example I noticed that sqlite3 has the same issue (which can be also opinionated about things): using this patch it generates an empty src package.

I see that the debugsources.list file contains some funky paths (with added "sources" folder in the middle of the path), which is used to copy these files.

But most likely I will go offline for the day, and will check back on it tomorrow, unless someone will be faster.

[1]: unrelated funny thing: audiofile seems to work fine in all branches (at the least ptests), except for Kirkstone, that's what started this...

Quoted 190 lines

    Will try to look at it, but if you have any ideas, I'm all ears.
    But in
    any case, FYI.

    On 4/21/25 19:29, Khem Raj via lists.openembedded.org
    <http://lists.openembedded.org> wrote:
    > -ffile-prefix map is more comprehensive when it comes to
    reproducible
    > builds and its superset of all prefix-mapping options in compilers
    >
    > This makes is cleaner and workable across gcc and clang, clang
    does not
    > support -fcanon-prefix-map and it has to be explicitly omitted
    when using
    > clang.
    >
    > There are lambdas generated in templates by clang which still
    get the
    > absolute paths despite -fdebug-prefix-map, this helps with that
    as well.
    >
    > nasm is an outlier and we have fixed it by adding
    -fdebug-prefix-map option
    > luckily we do not pass DEBUG_PREFIX_MAP to nasm, in all recipes
    which use
    > nasm either pass -fdebug-prefix-map explicitly to nasm or they
    rewrite it
    > to use nasm flags syntax.
    >
    > We have discussed this in past [1]
    >
    > [1]
    https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/#10281
    >
    > Signed-off-by: Khem Raj <[email protected]>
    > Cc: Jacob Kroon <[email protected]>
    > Cc: Martin Jansa <[email protected]>
    > ---
    > v2: Drop using --ffile-prefix in go
    > v3: Fix copydebugsources to use --file-prefix-map instead of
    -fdebug-prefix-map
    >     and few more places
    >
    >  meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
    >  meta/conf/bitbake.conf                             | 14
    +++++---------
    >  meta/lib/oe/package.py                             |  2 +-
    >  meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
    >  .../python/python3-maturin_1.8.3.bb
    <http://python3-maturin_1.8.3.bb>                |  2 +-
    >  meta/recipes-devtools/rust/cargo_1.85.1.bb
    <http://cargo_1.85.1.bb>         |  2 +-
    >  6 files changed, 11 insertions(+), 17 deletions(-)
    >
    > diff --git a/meta/classes-recipe/kernel-arch.bbclass
    b/meta/classes-recipe/kernel-arch.bbclass
    > index 968551267f9..7aea9cd3e8e 100644
    > --- a/meta/classes-recipe/kernel-arch.bbclass
    > +++ b/meta/classes-recipe/kernel-arch.bbclass
    > @@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?=
    "${TARGET_OBJCOPY_KERNEL_ARCH}"
    > 
    >  KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
    >   -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
    > - -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
    > - -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
    > - -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
    > - -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
    > + -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
    > + -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
    >  "
    >  KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
    >  KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
    > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
    > index 8f90026f7c2..b4e1964f77d 100644
    > --- a/meta/conf/bitbake.conf
    > +++ b/meta/conf/bitbake.conf
    > @@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install =
    "${PARALLEL_MAKEINST} "
    >  ##################################################################
    >  TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
    >  # Beware: applied last to first
    > -DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \
    > - -fmacro-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
    > - -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
    > - -fmacro-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
    > - -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
    > - -fdebug-prefix-map=${STAGING_DIR_HOST}= \
    > - -fmacro-prefix-map=${STAGING_DIR_HOST}= \
    > - -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
    > - -fmacro-prefix-map=${STAGING_DIR_NATIVE}= \
    > +DEBUG_PREFIX_MAP ?= "\
    > + -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
    > + -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
    > + -ffile-prefix-map=${STAGING_DIR_HOST}= \
    > + -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
    >  "
    >  DEBUG_LEVELFLAG ?= "-g"
    > 
    > diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
    > index 0db14f21642..0bcc04ea54a 100644
    > --- a/meta/lib/oe/package.py
    > +++ b/meta/lib/oe/package.py
    > @@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
    > 
    >          prefixmap = {}
    >          for flag in cflags.split():
    > -            if not flag.startswith("-fdebug-prefix-map"):
    > +            if not flag.startswith("-ffile-prefix-map"):
    >                  continue
    >              if "recipe-sysroot" in flag:
    >                  continue
    > diff --git a/meta/recipes-devtools/gcc/libgfortran.inc
    b/meta/recipes-devtools/gcc/libgfortran.inc
    > index 4560421ed1f..fa6aecaaa30 100644
    > --- a/meta/recipes-devtools/gcc/libgfortran.inc
    > +++ b/meta/recipes-devtools/gcc/libgfortran.inc
    > @@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
    >  # An arm hard float target like raspberrypi4 won't build
    >  # as CFLAGS don't make it to the fortran compiler otherwise
    >  # (the configure script sets FC to $GFORTRAN unconditionally)
    > -export GFORTRAN = "${FC} -fcanon-prefix-map
    -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR}
    -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
    > +export GFORTRAN = "${FC}
    -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR}
    -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
    > 
    >  do_configure () {
    >       for target in libbacktrace libgfortran
    > diff --git
    a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
    <http://python3-maturin_1.8.3.bb>
    b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
    <http://python3-maturin_1.8.3.bb>
    > index 3ec4d0c103b..08975e177f0 100644
    > --- a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
    <http://python3-maturin_1.8.3.bb>
    > +++ b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
    <http://python3-maturin_1.8.3.bb>
    > @@ -10,7 +10,7 @@ SRC_URI[sha256sum] =
    "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
    > 
    >  S = "${WORKDIR}/maturin-${PV}"
    > 
    > -CFLAGS +=
    "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
    > +CFLAGS +=
    "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
    > 
    >  DEPENDS += "\
    >      python3-setuptools-rust-native \
    > diff --git a/meta/recipes-devtools/rust/cargo_1.85.1.bb
    <http://cargo_1.85.1.bb>
    b/meta/recipes-devtools/rust/cargo_1.85.1.bb <http://cargo_1.85.1.bb>
    > index db18ecfda9a..150c2d2b801 100644
    > --- a/meta/recipes-devtools/rust/cargo_1.85.1.bb
    <http://cargo_1.85.1.bb>
    > +++ b/meta/recipes-devtools/rust/cargo_1.85.1.bb
    <http://cargo_1.85.1.bb>
    > @@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
    > 
    >  inherit cargo pkgconfig
    > 
    > -DEBUG_PREFIX_MAP +=
    "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
    > +DEBUG_PREFIX_MAP +=
    "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
    > 
    >  do_cargo_setup_snapshot () {
    >     
     ${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh
    --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
    >
    > -=-=-=-=-=-=-=-=-=-=-=-
    > Links: You receive all messages sent to this group.
    > View/Reply Online (#215180):
    https://lists.openembedded.org/g/openembedded-core/message/215180
    > Mute This Topic: https://lists.openembedded.org/mt/112379635/6084445
    > Group Owner: [email protected]
    <mailto:openembedded-core%[email protected]>
    > Unsubscribe:
    https://lists.openembedded.org/g/openembedded-core/unsub
    [[email protected]]
    > -=-=-=-=-=-=-=-=-=-=-=-
    >