public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Schier <nsc@kernel.org>
To: Mohamad Alsadhan <mo@sdhn.cc>
Cc: nathan@kernel.org, ojeda@kernel.org, gary@garyguo.net,
	linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org,
	Yoann Congal <yoann.congal@smile.fr>
Subject: Re: [PATCH v5] kbuild: host: use single executable for rustc -C linker
Date: Wed, 25 Mar 2026 09:45:05 +0100	[thread overview]
Message-ID: <acOgkfn-cOOy2YNG@levanger> (raw)
In-Reply-To: <20260321150034.9915-1-mo@sdhn.cc>

Hi Mohamad,

On Sat, Mar 21, 2026 at 06:00:34PM +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 "$@"
>   ```
> 
> 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!

Reviewed-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>

Unfortunately, I overlooked the missing entries for 'clean'/'mrproper'
and scripts/.gitignore.  Is it ok for you if I the following diff to
your patch?


diff --git a/Makefile b/Makefile
index a8d8ed711f9b..69fa18565219 100644
--- a/Makefile
+++ b/Makefile
@@ -1676,7 +1676,8 @@ MRPROPER_FILES += include/config include/generated          \
 		  vmlinux-gdb.py \
 		  rpmbuild \
 		  rust/libmacros.so rust/libmacros.dylib \
-		  rust/libpin_init_internal.so rust/libpin_init_internal.dylib
+		  rust/libpin_init_internal.so rust/libpin_init_internal.dylib \
+		  scripts/rustc-wrapper
 
 # clean - Delete most, but leave enough to build external modules
 #
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 4215c2208f7e..b3948b148c4b 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -6,6 +6,7 @@
 /kallsyms
 /module.lds
 /recordmcount
+/rustc-wrapper
 /rustdoc_test_builder
 /rustdoc_test_gen
 /sign-file


Kind regards,
Nicolas

  reply	other threads:[~2026-03-25  9:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260227132713.23106-1-mo@sdhn.cc/>
2026-03-12  0:28 ` [PATCH v3] kbuild: host: use single executable for rustc -C linker Mohamad Alsadhan
2026-03-12 13:50   ` Nicolas Schier
2026-03-17 11:10     ` Mohamad Alsadhan
2026-03-20  6:50       ` Nicolas Schier
2026-03-17 11:20   ` [PATCH v4] " Mohamad Alsadhan
2026-03-20  6:51     ` Nicolas Schier
2026-03-21 14:57       ` Mohamad Alsadhan
2026-03-21 15:00     ` [PATCH v5] " Mohamad Alsadhan
2026-03-25  8:45       ` Nicolas Schier [this message]
2026-03-29  2:12         ` Mohamad Alsadhan
2026-03-29 19:46           ` Nicolas Schier
2026-03-25 14:25       ` 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=acOgkfn-cOOy2YNG@levanger \
    --to=nsc@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mo@sdhn.cc \
    --cc=nathan@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --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