[PATCH 6.19 801/844] kbuild: Fix CC_CAN_LINK detection
From: Sasha Levin
Date: Sat Feb 28 2026 - 14:53:56 EST
From: Mickaël Salaün <mic@xxxxxxxxxxx>
[ Upstream commit be55899b71630c79ad01df54c92e467e47644f87 ]
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: stable@xxxxxxxxxxxxxxx
Fixes: d81d9d389b9b ("kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings")
Signed-off-by: Mickaël Salaün <mic@xxxxxxxxxxx>
Reviewed-by: Nicolas Schier <nsc@xxxxxxxxxx>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260212133544.1331437-1-mic@xxxxxxxxxxx
Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
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 e67fd8d7b6841..58dc7dd6d5568 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.51.0