From: Nathan Chancellor <nathan@kernel.org>
To: Mohamad Alsadhan <mo@sdhn.cc>
Cc: "Nicolas Schier" <nsc@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Yoann Congal" <yoann.congal@smile.fr>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v8] kbuild: host: use single executable for rustc -C linker
Date: Mon, 11 May 2026 15:59:15 +0900 [thread overview]
Message-ID: <20260511065915.GA325559@ax162> (raw)
In-Reply-To: <20260509101939.27108-1-mo@sdhn.cc>
Hi Mohamad,
On Sat, May 09, 2026 at 01:19:38PM +0300, Mohamad Alsadhan wrote:
> rustc's -C linker= option expects a single executable path. When
> HOSTCC contains a wrapper (e.g. "ccache gcc"), passing
> `-Clinker=$(HOSTCC)` results in the shell splitting the value into
> multiple words, and rustc interprets the additional word as an
> input filename:
>
> error: multiple input filenames provided ...
>
> Generate a small wrapper script and pass it to -Clinker e.g.
>
> ```
> #!/bin/sh
> ccache gcc "$@"
> ```
>
> Note that the wrapper intentionally avoids a leading `exec` to
> naturally support leading environment assignments such as:
> `VAR=VAL ccache gcc`.
>
> This fix should be general enough to address most if not all cases
> (incl. wrappers or subcommands) and avoids surprises of simpler fixes
> like just defaulting to gcc.
>
> This avoids passing the user command as an environment variable as
> that would be more challenging to trace and debug shell expansions.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1224
> Suggested-by: Yoann Congal <yoann.congal@smile.fr>
> Signed-off-by: Mohamad Alsadhan <mo@sdhn.cc>
Thanks, this seems reasonable from a Kbuild perspective (although
Nicolas may have other comments) and it appears to work for me. I expect
this to go via the Rust tree.
Acked-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
> diff --git a/Makefile b/Makefile
> index 1a219bf1c..5ebeef67f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1651,7 +1651,8 @@ CLEAN_FILES += vmlinux.symvers modules-only.symvers \
> modules.builtin.ranges vmlinux.o.map vmlinux.unstripped \
> compile_commands.json rust/test \
> rust-project.json .vmlinux.objs .vmlinux.export.c \
> - .builtin-dtbs-list .builtin-dtb.S
> + .builtin-dtbs-list .builtin-dtb.S \
> + scripts/rustc-wrapper
What tree was this generated against? It conflicts with Linus's tree due
to commit a76e30c2479c ("kbuild: Delete .builtin-dtbs.S when running
make clean") that landed in 7.0-rc6.
>
> # Directories & files removed with 'make mrproper'
> MRPROPER_FILES += include/config include/generated \
--
Cheers,
Nathan
next prev parent reply other threads:[~2026-05-11 6:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 10:19 [PATCH v8] kbuild: host: use single executable for rustc -C linker Mohamad Alsadhan
2026-05-11 6:59 ` Nathan Chancellor [this message]
2026-05-11 11:18 ` Nicolas Schier
2026-05-12 17:32 ` Yoann Congal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260511065915.GA325559@ax162 \
--to=nathan@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mo@sdhn.cc \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=yoann.congal@smile.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox