* [PATCH 0/2] kbuild: revert relative paths in compiler outputs
@ 2025-05-11 6:02 Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 1/2] Revert "kbuild: make all file references relative to source root" Thomas Weißschuh
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2025-05-11 6:02 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Jonathan Corbet, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: linux-kbuild, linux-doc, linux-kernel, rust-for-linux,
Matthieu Baerts, Ville Syrjälä, Thomas Weißschuh
-ffile-prefix-map/--remap-path-prefix break the ability of debuggers to
find the source file corresponding to object files. As there is no
simple or uniform way to specify the source directory explicitly, this
breaks developers workflows.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (2):
Revert "kbuild: make all file references relative to source root"
Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
Documentation/kbuild/reproducible-builds.rst | 17 +++++++++++++++++
Makefile | 3 +--
2 files changed, 18 insertions(+), 2 deletions(-)
---
base-commit: 3ce9925823c7d6bb0e6eb951bf2db0e9e182582d
change-id: 20250511-kbuild-revert-file-prefix-map-4de45dfada75
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Revert "kbuild: make all file references relative to source root"
2025-05-11 6:02 [PATCH 0/2] kbuild: revert relative paths in compiler outputs Thomas Weißschuh
@ 2025-05-11 6:02 ` Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative" Thomas Weißschuh
2025-05-12 9:13 ` [PATCH 0/2] kbuild: revert relative paths in compiler outputs Masahiro Yamada
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2025-05-11 6:02 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Jonathan Corbet, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: linux-kbuild, linux-doc, linux-kernel, rust-for-linux,
Matthieu Baerts, Ville Syrjälä, Thomas Weißschuh
This reverts commit cacd22ce69585a91c386243cd662ada962431e63.
-ffile-prefix-map breaks the ability of debuggers to find the source
file corresponding to object files. As there is no simple or uniform
way to specify the source directory explicitly, this breaks developers
workflows.
Revert the unconditional usage of -ffile-prefix-map.
Reported-by: Matthieu Baerts <matttbe@kernel.org>
Closes: https://lore.kernel.org/lkml/edc50aa7-0740-4942-8c15-96f12f2acc7e@kernel.org/
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Closes: https://lore.kernel.org/lkml/aBEttQH4kimHFScx@intel.com/
Fixes: cacd22ce6958 ("kbuild: make all file references relative to source root")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Documentation/kbuild/reproducible-builds.rst | 17 +++++++++++++++++
Makefile | 2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Documentation/kbuild/reproducible-builds.rst b/Documentation/kbuild/reproducible-builds.rst
index a7762486c93fcd3eba08b836bed622a41e829e41..f2dcc39044e66ddd165646e0b51ccb0209aca7dd 100644
--- a/Documentation/kbuild/reproducible-builds.rst
+++ b/Documentation/kbuild/reproducible-builds.rst
@@ -46,6 +46,21 @@ The kernel embeds the building user and host names in
`KBUILD_BUILD_USER and KBUILD_BUILD_HOST`_ variables. If you are
building from a git commit, you could use its committer address.
+Absolute filenames
+------------------
+
+When the kernel is built out-of-tree, debug information may include
+absolute filenames for the source files. This must be overridden by
+including the ``-fdebug-prefix-map`` option in the `KCFLAGS`_ variable.
+
+Depending on the compiler used, the ``__FILE__`` macro may also expand
+to an absolute filename in an out-of-tree build. Kbuild automatically
+uses the ``-fmacro-prefix-map`` option to prevent this, if it is
+supported.
+
+The Reproducible Builds web site has more information about these
+`prefix-map options`_.
+
Generated files in source packages
----------------------------------
@@ -116,5 +131,7 @@ See ``scripts/setlocalversion`` for details.
.. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
.. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host
+.. _KCFLAGS: kbuild.html#kcflags
+.. _prefix-map options: https://reproducible-builds.org/docs/build-path/
.. _Reproducible Builds project: https://reproducible-builds.org/
.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/
diff --git a/Makefile b/Makefile
index b29cc321ffd9c6a5a201d110bd8a88092c380f65..f3f7dbf8ca284fbbab6bf2459982447471234f5f 100644
--- a/Makefile
+++ b/Makefile
@@ -1068,7 +1068,7 @@ KBUILD_CFLAGS += -fno-builtin-wcslen
# change __FILE__ to the relative path to the source directory
ifdef building_out_of_srctree
-KBUILD_CPPFLAGS += $(call cc-option,-ffile-prefix-map=$(srcroot)/=)
+KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=)
KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/=
endif
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
2025-05-11 6:02 [PATCH 0/2] kbuild: revert relative paths in compiler outputs Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 1/2] Revert "kbuild: make all file references relative to source root" Thomas Weißschuh
@ 2025-05-11 6:02 ` Thomas Weißschuh
2025-05-11 20:58 ` Miguel Ojeda
2025-05-12 9:13 ` [PATCH 0/2] kbuild: revert relative paths in compiler outputs Masahiro Yamada
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Weißschuh @ 2025-05-11 6:02 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Jonathan Corbet, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: linux-kbuild, linux-doc, linux-kernel, rust-for-linux,
Matthieu Baerts, Ville Syrjälä, Thomas Weißschuh
This reverts commit dbdffaf50ff9cee3259a7cef8a7bd9e0f0ba9f13.
--remap-path-prefix breaks the ability of debuggers to find the source
file corresponding to object files. As there is no simple or uniform
way to specify the source directory explicitly, this breaks developers
workflows.
Revert the unconditional usage of --remap-path-prefix, equivalent to the
same change for -ffile-prefix-map in KBUILD_CPPFLAGS.
Fixes: Fixes: dbdffaf50ff9 ("kbuild, rust: use -fremap-path-prefix to make paths relative")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile b/Makefile
index f3f7dbf8ca284fbbab6bf2459982447471234f5f..1e1d28d50bf373afb9de787afd7f4148191cc463 100644
--- a/Makefile
+++ b/Makefile
@@ -1069,7 +1069,6 @@ KBUILD_CFLAGS += -fno-builtin-wcslen
# change __FILE__ to the relative path to the source directory
ifdef building_out_of_srctree
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=)
-KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/=
endif
# include additional Makefiles when needed
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
2025-05-11 6:02 ` [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative" Thomas Weißschuh
@ 2025-05-11 20:58 ` Miguel Ojeda
2025-05-11 21:07 ` Miguel Ojeda
0 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2025-05-11 20:58 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Jonathan Corbet, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, linux-kbuild, linux-doc,
linux-kernel, rust-for-linux, Matthieu Baerts,
Ville Syrjälä
On Sun, May 11, 2025 at 8:02 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
>
> Fixes: Fixes: dbdffaf50ff9 ("kbuild, rust: use -fremap-path-prefix to make paths relative")
Double "Fixes:"
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Hmm... could you please give a bit of detail on what workflow breaks?
I quickly tried to open a C and a Rust object file with gdb and it
seemed fine. I can try later on after some travel.
In any case, Masahiro: if you need to revert, then please feel free to add:
Acked-by: Miguel Ojeda <ojeda@kernel.org>
(We can keep commit 2c8725c1dca3 ("rust: kbuild: skip
`--remap-path-prefix` for `rustdoc`") since it just filters out; and
that way we don't forget re-adding it if needed).
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
2025-05-11 20:58 ` Miguel Ojeda
@ 2025-05-11 21:07 ` Miguel Ojeda
0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-05-11 21:07 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Jonathan Corbet, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, linux-kbuild, linux-doc,
linux-kernel, rust-for-linux, Matthieu Baerts,
Ville Syrjälä
On Sun, May 11, 2025 at 10:58 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Hmm... could you please give a bit of detail on what workflow breaks?
> I quickly tried to open a C and a Rust object file with gdb and it
> seemed fine. I can try later on after some travel.
Ah, I think I may get it now -- do you mean if the debugger is invoked
in a different working directory than the srctree?
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] kbuild: revert relative paths in compiler outputs
2025-05-11 6:02 [PATCH 0/2] kbuild: revert relative paths in compiler outputs Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 1/2] Revert "kbuild: make all file references relative to source root" Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative" Thomas Weißschuh
@ 2025-05-12 9:13 ` Masahiro Yamada
2 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-05-12 9:13 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nathan Chancellor, Nicolas Schier, Jonathan Corbet, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, linux-kbuild, linux-doc, linux-kernel,
rust-for-linux, Matthieu Baerts, Ville Syrjälä
On Sun, May 11, 2025 at 3:02 PM Thomas Weißschuh <linux@weissschuh.net> wrote:
>
> -ffile-prefix-map/--remap-path-prefix break the ability of debuggers to
> find the source file corresponding to object files. As there is no
> simple or uniform way to specify the source directory explicitly, this
> breaks developers workflows.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Thomas Weißschuh (2):
> Revert "kbuild: make all file references relative to source root"
> Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
>
> Documentation/kbuild/reproducible-builds.rst | 17 +++++++++++++++++
> Makefile | 3 +--
> 2 files changed, 18 insertions(+), 2 deletions(-)
> ---
> base-commit: 3ce9925823c7d6bb0e6eb951bf2db0e9e182582d
> change-id: 20250511-kbuild-revert-file-prefix-map-4de45dfada75
>
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>
Both applied.
(I locally fixed the doubled Fixes:)
Thanks.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-12 9:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-11 6:02 [PATCH 0/2] kbuild: revert relative paths in compiler outputs Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 1/2] Revert "kbuild: make all file references relative to source root" Thomas Weißschuh
2025-05-11 6:02 ` [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative" Thomas Weißschuh
2025-05-11 20:58 ` Miguel Ojeda
2025-05-11 21:07 ` Miguel Ojeda
2025-05-12 9:13 ` [PATCH 0/2] kbuild: revert relative paths in compiler outputs Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).