* Re: [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3
2025-04-14 17:12 [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3 Miguel Ojeda
@ 2025-04-14 20:17 ` Nicolas Schier
2025-04-14 20:22 ` Miguel Ojeda
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2025-04-14 20:17 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Masahiro Yamada, Alex Gaynor, Nathan Chancellor, linux-kbuild,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, linux-kernel, patches, stable
On Mon, Apr 14, 2025 at 07:12:41PM +0200 Miguel Ojeda wrote:
>GNU Make 4.3 changed the behavior of `#` inside commands in commit
>c6966b323811 ("[SV 20513] Un-escaped # are not comments in function
>invocations"):
>
> * WARNING: Backward-incompatibility!
> Number signs (#) appearing inside a macro reference or function invocation
> no longer introduce comments and should not be escaped with backslashes:
> thus a call such as:
> foo := $(shell echo '#')
> is legal. Previously the number sign needed to be escaped, for example:
> foo := $(shell echo '\#')
> Now this latter will resolve to "\#". If you want to write makefiles
> portable to both versions, assign the number sign to a variable:
> H := \#
> foo := $(shell echo '$H')
> This was claimed to be fixed in 3.81, but wasn't, for some reason.
> To detect this change search for 'nocomment' in the .FEATURES variable.
>
>Unlike other commits in the kernel about this issue, such as commit
>633174a7046e ("lib/raid6/test/Makefile: Use $(pound) instead of \#
>for Make 4.3"), that fixed the issue for newer GNU Makes, in our case
>it was the opposite, i.e. we need to fix it for the older ones: someone
>building with e.g. 4.2.1 gets the following error:
>
> scripts/Makefile.compiler:81: *** unterminated call to function 'call': missing ')'. Stop.
>
>Thus use the existing variable to fix it.
>
>Reported-by: moyi geek
>Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/291565/topic/x/near/512001985
>Cc: stable@vger.kernel.org
>Fixes: e72a076c620f ("kbuild: fix issues with rustc-option")
>Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
>---
> scripts/Makefile.compiler | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
>index 7ed7f92a7daa..f4fcc1eaaeae 100644
>--- a/scripts/Makefile.compiler
>+++ b/scripts/Makefile.compiler
>@@ -79,7 +79,7 @@ ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
> # Usage: MY_RUSTFLAGS += $(call __rustc-option,$(RUSTC),$(MY_RUSTFLAGS),-Cinstrument-coverage,-Zinstrument-coverage)
> # TODO: remove RUSTC_BOOTSTRAP=1 when we raise the minimum GNU Make version to 4.4
> __rustc-option = $(call try-run,\
>- echo '#![allow(missing_docs)]#![feature(no_core)]#![no_core]' | RUSTC_BOOTSTRAP=1\
>+ echo '$(pound)![allow(missing_docs)]$(pound)![feature(no_core)]$(pound)![no_core]' | RUSTC_BOOTSTRAP=1\
> $(1) --sysroot=/dev/null $(filter-out --sysroot=/dev/null --target=%,$(2)) $(3)\
> --crate-type=rlib --out-dir=$(TMPOUT) --emit=obj=- - >/dev/null,$(3),$(4))
>
>
>base-commit: a3cd5f507b72c0532c3345b6913557efab34f405
>--
>2.49.0
>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3
2025-04-14 17:12 [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3 Miguel Ojeda
2025-04-14 20:17 ` Nicolas Schier
@ 2025-04-14 20:22 ` Miguel Ojeda
2025-04-15 9:27 ` Alice Ryhl
2025-04-15 18:47 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2025-04-14 20:22 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Masahiro Yamada, Alex Gaynor, Nathan Chancellor, Nicolas Schier,
linux-kbuild, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, rust-for-linux, linux-kernel, patches, stable
On Mon, Apr 14, 2025 at 7:13 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Reported-by: moyi geek
moyi told me it is OK to add the email from Zulip, so:
Reported-by: moyi geek <1441339168@qq.com>
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3
2025-04-14 17:12 [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3 Miguel Ojeda
2025-04-14 20:17 ` Nicolas Schier
2025-04-14 20:22 ` Miguel Ojeda
@ 2025-04-15 9:27 ` Alice Ryhl
2025-04-15 18:47 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Alice Ryhl @ 2025-04-15 9:27 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Masahiro Yamada, Alex Gaynor, Nathan Chancellor, Nicolas Schier,
linux-kbuild, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
rust-for-linux, linux-kernel, patches, stable
On Mon, Apr 14, 2025 at 07:12:41PM +0200, Miguel Ojeda wrote:
> GNU Make 4.3 changed the behavior of `#` inside commands in commit
> c6966b323811 ("[SV 20513] Un-escaped # are not comments in function
> invocations"):
>
> * WARNING: Backward-incompatibility!
> Number signs (#) appearing inside a macro reference or function invocation
> no longer introduce comments and should not be escaped with backslashes:
> thus a call such as:
> foo := $(shell echo '#')
> is legal. Previously the number sign needed to be escaped, for example:
> foo := $(shell echo '\#')
> Now this latter will resolve to "\#". If you want to write makefiles
> portable to both versions, assign the number sign to a variable:
> H := \#
> foo := $(shell echo '$H')
> This was claimed to be fixed in 3.81, but wasn't, for some reason.
> To detect this change search for 'nocomment' in the .FEATURES variable.
>
> Unlike other commits in the kernel about this issue, such as commit
> 633174a7046e ("lib/raid6/test/Makefile: Use $(pound) instead of \#
> for Make 4.3"), that fixed the issue for newer GNU Makes, in our case
> it was the opposite, i.e. we need to fix it for the older ones: someone
> building with e.g. 4.2.1 gets the following error:
>
> scripts/Makefile.compiler:81: *** unterminated call to function 'call': missing ')'. Stop.
>
> Thus use the existing variable to fix it.
>
> Reported-by: moyi geek
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/291565/topic/x/near/512001985
> Cc: stable@vger.kernel.org
> Fixes: e72a076c620f ("kbuild: fix issues with rustc-option")
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3
2025-04-14 17:12 [PATCH] rust: kbuild: use `pound` to support GNU Make < 4.3 Miguel Ojeda
` (2 preceding siblings ...)
2025-04-15 9:27 ` Alice Ryhl
@ 2025-04-15 18:47 ` Miguel Ojeda
3 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2025-04-15 18:47 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Masahiro Yamada, Alex Gaynor, Nathan Chancellor, Nicolas Schier,
linux-kbuild, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, rust-for-linux, linux-kernel, patches, stable
On Mon, Apr 14, 2025 at 7:13 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Thus use the existing variable to fix it.
Applied to `rust-fixes` -- thanks everyone!
If Kbuild wants to pick it up instead, please let me know and I will drop it.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread