[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72mcpVL1YXyDFi-PrbQ2Uh0WUA_VNqLZaOeqQnpY5HnX8Q@mail.gmail.com>
Date: Mon, 17 Feb 2025 14:23:31 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Thomas Weißschuh <linux@...ssschuh.net>,
Masahiro Yamada <masahiroy@...nel.org>, Ben Hutchings <ben@...adent.org.uk>
Cc: Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
Urgau <urgau@...ericable.fr>
Subject: Re: [PATCH] kbuild, rust: use -fremap-path-prefix to make paths relative
On Mon, Feb 10, 2025 at 6:11 PM Thomas Weißschuh <linux@...ssschuh.net> 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
Powered by blists - more mailing lists