public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] kbuild: Fix CC_CAN_LINK detection
@ 2026-02-12 13:35 Mickaël Salaün
  2026-02-12 14:15 ` Thomas Weißschuh
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mickaël Salaün @ 2026-02-12 13:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Mickaël Salaün, linux-kernel, kernel-team,
	Nathan Chancellor, Nicolas Schier, Thomas Weißschuh, stable

Most samples cannot be build on some environments because they depend
on CC_CAN_LINK, which is set according to the result of
scripts/cc-can-link.sh called by cc_can_link_user.

Because cc-can-link.sh must now build without warning, it may fail
because it is calling printf() with an empty string:

  + cat
  + gcc -m32 -Werror -Wl,--fatal-warnings -x c - -o /dev/null
  <stdin>: In function ‘main’:
  <stdin>:4:9: error: zero-length gnu_printf format string [-Werror=format-zero-length]
  cc1: all warnings being treated as errors

Fix this warning and the samples build by actually printing something.

Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>
Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Cc: stable@vger.kernel.org
Fixes: d81d9d389b9b ("kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings")
Signed-off-by: Mickaël Salaün <mic@digikod.net>
---
 scripts/cc-can-link.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh
index e67fd8d7b684..58dc7dd6d556 100755
--- a/scripts/cc-can-link.sh
+++ b/scripts/cc-can-link.sh
@@ -5,7 +5,7 @@ cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>
 #include <stdio.h>
 int main(void)
 {
-	printf("");
+	printf("\n");
 	return 0;
 }
 END
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] kbuild: Fix CC_CAN_LINK detection
  2026-02-12 13:35 [PATCH v1] kbuild: Fix CC_CAN_LINK detection Mickaël Salaün
@ 2026-02-12 14:15 ` Thomas Weißschuh
  2026-02-12 14:50   ` Mickaël Salaün
  2026-02-13 16:29 ` Nicolas Schier
  2026-02-18 20:49 ` Nathan Chancellor
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Weißschuh @ 2026-02-12 14:15 UTC (permalink / raw)
  To: Mickaël Salaün
  Cc: linux-kbuild, linux-kernel, kernel-team, Nathan Chancellor,
	Nicolas Schier, stable

On Thu, Feb 12, 2026 at 02:35:43PM +0100, Mickaël Salaün wrote:
> Most samples cannot be build on some environments because they depend
> on CC_CAN_LINK, which is set according to the result of
> scripts/cc-can-link.sh called by cc_can_link_user.
> 
> Because cc-can-link.sh must now build without warning, it may fail
> because it is calling printf() with an empty string:
> 
>   + cat
>   + gcc -m32 -Werror -Wl,--fatal-warnings -x c - -o /dev/null
>   <stdin>: In function ‘main’:
>   <stdin>:4:9: error: zero-length gnu_printf format string [-Werror=format-zero-length]
>   cc1: all warnings being treated as errors
> 
> Fix this warning and the samples build by actually printing something.
> 
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nicolas Schier <nsc@kernel.org>
> Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Cc: stable@vger.kernel.org
> Fixes: d81d9d389b9b ("kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings")

Thanks!

Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

In my GCC 15.2 this warning is not enabled by default.

> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> ---
>  scripts/cc-can-link.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh
> index e67fd8d7b684..58dc7dd6d556 100755
> --- a/scripts/cc-can-link.sh
> +++ b/scripts/cc-can-link.sh
> @@ -5,7 +5,7 @@ cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>
>  #include <stdio.h>
>  int main(void)
>  {
> -	printf("");
> +	printf("\n");
>  	return 0;
>  }
>  END
> -- 
> 2.53.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] kbuild: Fix CC_CAN_LINK detection
  2026-02-12 14:15 ` Thomas Weißschuh
@ 2026-02-12 14:50   ` Mickaël Salaün
  0 siblings, 0 replies; 5+ messages in thread
From: Mickaël Salaün @ 2026-02-12 14:50 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: linux-kbuild, linux-kernel, kernel-team, Nathan Chancellor,
	Nicolas Schier, stable

On Thu, Feb 12, 2026 at 03:15:47PM +0100, Thomas Weißschuh wrote:
> On Thu, Feb 12, 2026 at 02:35:43PM +0100, Mickaël Salaün wrote:
> > Most samples cannot be build on some environments because they depend
> > on CC_CAN_LINK, which is set according to the result of
> > scripts/cc-can-link.sh called by cc_can_link_user.
> > 
> > Because cc-can-link.sh must now build without warning, it may fail
> > because it is calling printf() with an empty string:
> > 
> >   + cat
> >   + gcc -m32 -Werror -Wl,--fatal-warnings -x c - -o /dev/null
> >   <stdin>: In function ‘main’:
> >   <stdin>:4:9: error: zero-length gnu_printf format string [-Werror=format-zero-length]
> >   cc1: all warnings being treated as errors
> > 
> > Fix this warning and the samples build by actually printing something.
> > 
> > Cc: Nathan Chancellor <nathan@kernel.org>
> > Cc: Nicolas Schier <nsc@kernel.org>
> > Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > Cc: stable@vger.kernel.org
> > Fixes: d81d9d389b9b ("kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings")
> 
> Thanks!
> 
> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> 
> In my GCC 15.2 this warning is not enabled by default.

Some for me, but it is the case with GCC 13.3.0 on Ubuntu 24 LTS.

> 
> > Signed-off-by: Mickaël Salaün <mic@digikod.net>
> > ---
> >  scripts/cc-can-link.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh
> > index e67fd8d7b684..58dc7dd6d556 100755
> > --- a/scripts/cc-can-link.sh
> > +++ b/scripts/cc-can-link.sh
> > @@ -5,7 +5,7 @@ cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>
> >  #include <stdio.h>
> >  int main(void)
> >  {
> > -	printf("");
> > +	printf("\n");
> >  	return 0;
> >  }
> >  END
> > -- 
> > 2.53.0
> > 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] kbuild: Fix CC_CAN_LINK detection
  2026-02-12 13:35 [PATCH v1] kbuild: Fix CC_CAN_LINK detection Mickaël Salaün
  2026-02-12 14:15 ` Thomas Weißschuh
@ 2026-02-13 16:29 ` Nicolas Schier
  2026-02-18 20:49 ` Nathan Chancellor
  2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2026-02-13 16:29 UTC (permalink / raw)
  To: Mickaël Salaün
  Cc: linux-kbuild, linux-kernel, kernel-team, Nathan Chancellor,
	Thomas Weißschuh, stable

On Thu, Feb 12, 2026 at 02:35:43PM +0100, Mickaël Salaün wrote:
> Most samples cannot be build on some environments because they depend
> on CC_CAN_LINK, which is set according to the result of
> scripts/cc-can-link.sh called by cc_can_link_user.
> 
> Because cc-can-link.sh must now build without warning, it may fail
> because it is calling printf() with an empty string:
> 
>   + cat
>   + gcc -m32 -Werror -Wl,--fatal-warnings -x c - -o /dev/null
>   <stdin>: In function ‘main’:
>   <stdin>:4:9: error: zero-length gnu_printf format string [-Werror=format-zero-length]
>   cc1: all warnings being treated as errors
> 
> Fix this warning and the samples build by actually printing something.
> 
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nicolas Schier <nsc@kernel.org>
> Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Cc: stable@vger.kernel.org
> Fixes: d81d9d389b9b ("kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings")
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> ---
>  scripts/cc-can-link.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks!

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] kbuild: Fix CC_CAN_LINK detection
  2026-02-12 13:35 [PATCH v1] kbuild: Fix CC_CAN_LINK detection Mickaël Salaün
  2026-02-12 14:15 ` Thomas Weißschuh
  2026-02-13 16:29 ` Nicolas Schier
@ 2026-02-18 20:49 ` Nathan Chancellor
  2 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2026-02-18 20:49 UTC (permalink / raw)
  To: linux-kbuild, Mickaël Salaün
  Cc: linux-kernel, kernel-team, Nathan Chancellor, Nicolas Schier,
	Thomas Weißschuh, stable

On Thu, 12 Feb 2026 14:35:43 +0100, Mickaël Salaün wrote:
> Most samples cannot be build on some environments because they depend
> on CC_CAN_LINK, which is set according to the result of
> scripts/cc-can-link.sh called by cc_can_link_user.
> 
> Because cc-can-link.sh must now build without warning, it may fail
> because it is calling printf() with an empty string:
> 
> [...]

Applied to

  https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes

Thanks!

[1/1] kbuild: Fix CC_CAN_LINK detection
      https://git.kernel.org/kbuild/c/be55899b71630

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-18 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 13:35 [PATCH v1] kbuild: Fix CC_CAN_LINK detection Mickaël Salaün
2026-02-12 14:15 ` Thomas Weißschuh
2026-02-12 14:50   ` Mickaël Salaün
2026-02-13 16:29 ` Nicolas Schier
2026-02-18 20:49 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox