On Mon, Feb 10, 2025 at 6:11 PM Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote: > > Remap source path prefixes in all output, including compiler > diagnostics, debug information, macro expansions, etc. Hmm... We don't do all the cases in the C side -- the docs ask to use `KCFLAGS` when one wants to remove them in the debug info: https://docs.kernel.org/kbuild/reproducible-builds.html#absolute-filenames I am not sure if there is a reason not to cover all cases in C (Cc'ing Ben). If there is a reason to not do it for the debug info by default (or if we want to make it consistent with C even if there is no reason), then I think we would need `-Zremap-path-scope=...` too, which is still unstable, sadly (Cc'ing Urgau who implemented it for Rust 1.75.0): https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/remap-path-scope.html https://github.com/rust-lang/rust/issues/111540 In such case, we would also need probably to mention in the `reproducible-builds` docs how to achieve the same as in C (e.g. passing an extra `-Zremap-path-scope=debug`, since it aggregates with the previous ones, according to compiler flag docs). > # change __FILE__ to the relative path to the source directory Perhaps we could add a note to this comment with what we do in the Rust side. > +KBUILD_RUSTFLAGS += $(call rustc-option,--remap-path-prefix=$(srcroot)/=) I don't think we need `rustc-option`, since the flag is available since a long time ago (Rust 1.26.0). So we should be able to just do: KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/= Cheers, Miguel