Re: [PATCH 5/6] kbuild: rust: replace proc macros dependency on `core.o` with the version text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 9, 2024 at 7:31 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> The touched file, include/config/*, is an implementation detail
> in Kconfig and fixdep.
>
> Rather, I'd like to put the string "CONFIG_RUST_VERSION_TEXT"
> in the comment of the source file.
>
> This is the idea adopted in include/linux/compiler-version.h

+1, I did it this way to follow the same pattern to the previous patch
on `core.o`, since that one needed another approach, but I am happy to
change it.

> I do not know how to do it for rust/core.o because there is no in-tree
> source file.
>
> But, can we add rust/core.rs, from which
> rustlib/src/rust/library/core/src/macros/mod.rs is imported?

That is an interesting idea... :)

Hmm... I think `core` is a bit too special for that, since we need
attributes on the crate root and it is the one defining things like
`include!`. Even if we generated the file on the fly to mimic the
original, we would still need to handle the paths for each module or
recreate a directory hierarchy or similar.

We are also in talks with the Rust project to figure out building
`core` in a stable way, so the details around it may change too, e.g.
probably something like passing a flag like `-Cbuild-std=core`. They
may also want to figure out the right input file path themselves, i.e.
rather than having to provide one from our side.

So I think a hack may not be worth it compared to depending on the
implementation detail, and may be a bit brittle until we know the
final details of that.

Thanks!

Cheers,
Miguel





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux