Re: [PATCH v2] Kbuild: fix issues with rustc-option
From: Alice Ryhl
Date: Wed Oct 09 2024 - 05:26:07 EST
On Tue, Oct 8, 2024 at 10:53 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Tue, Oct 8, 2024 at 10:23 PM Matthew Maurer <mmaurer@xxxxxxxxxx> wrote:
> >
> > In that case we should omit `-o $$TMP`, because `rustc` is emitting a
> > warning that it's ignoring `--out-dir` because `-o` is set.
>
> Yes, we need to omit `-o` or we could use `--out-dir` together with
> one of the `--emit=X=...` types to be more explicit and avoid building
> the `.rlib`, which is what I did in the GitHub issue.
Miguel, can you link this issue? I don't think I saw it.
> IIRC I used `obj` to run most of the compiler stages just in case that
> mattered, but perhaps an even simpler one is good enough, e.g.
> `metadata`.
>
> I think just `--out-dir` should be fine and is simpler for this use
> case. However, apparently outputting to stdout works too, so we could
> do:
>
> --emit=obj=- - >/dev/null
>
> and avoid the output file altogether. We still most likely need the
> `--out-dir` in case temporaries are created.
Masahiro, are you able to clarify how to pass TMPOUT to rustc?
__rustc-option = $(call try-run2,\
$(1) $(2) $(3) --crate-type=rlib $(srctree)/rust/probe.rs
--out-dir=$(TMPOUT),$(3),$(4))
Should I use $(TMPOUT) or $$TMPOUT for this case? Right now, only TMP
is defined inside try-run. I am assuming that there is a reason for
having TMP be defined in try-run, rather than just using $(TMP)
everywhere. Does the same reason apply to TMPOUT? Should I add a
TMPOUT=$(TMPOUT) inside try-run?
Alice