Re: [PATCH v2 1/3] kbuild: rust: Define probing macros for rustc
From: Miguel Ojeda
Date: Wed Aug 14 2024 - 07:27:46 EST
On Tue, Aug 13, 2024 at 1:29 AM Matthew Maurer <mmaurer@xxxxxxxxxx> wrote:
>
> 1. `rustc` support will soon be a minimum rather than a pinned version.
In the meantime, this happened, so we should update this sentence.
> 2. We already support multiple LLVMs linked into `rustc`, and these are
I guess you mean `rustc` is able to use multiple major versions of
LLVM -- or what do you mean by "multiple LLVMs linked"?
> +# $(rustc-option,<flag>)
> +# Return y if the Rust compiler supports <flag>, n otherwise
> +# Calls to this should be guarded so that they are not evaluated if
> +# CONFIG_HAVE_RUST is not set.
Hmm... why `HAVE_RUST`? Should that be `RUST_IS_AVAILABLE`? Or what is
the intention? Perhaps a comment would help here -- e.g. something
like the comment I used in the original approach [1]. Otherwise we
will forget... :)
Also, I guess you wanted to relax the precondition as much as
possible, which is great, just to double check, do we expect a case
outside `RUST=y`?
> rustc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(RUSTC) $(1) --crate-type=rlib /dev/null -o .tmp_$$/tmp.rlib)
I also had `out-dir` [1] since, if I remember correctly, `rustc` may
create temporary files in a potentially read-only location even in
this case.
Also, should we do `-Dwarnings` here?
> +# If you are testing for unstable features, consider `rustc-min-version`
> +# instead, as features may have different completeness while available.
`rustc-min-version` is not mainline yet -- we don't have a user yet,
but I can send it if so.
Thanks!
[1] https://github.com/Rust-for-Linux/linux/pull/1087#issuecomment-2218445303
Cheers,
Miguel