[PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"

Thomas Weißschuh posted 2 patches 7 months, 1 week ago
[PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
Posted by Thomas Weißschuh 7 months, 1 week ago
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

Re: [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
Posted by Miguel Ojeda 7 months, 1 week ago
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
Re: [PATCH 2/2] Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"
Posted by Miguel Ojeda 7 months, 1 week ago
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