It is possible that the kernel toolchain generates warnings when used
together with the system toolchain. This happens for example when the
older kernel toolchain does not handle new versions of sframe debug
information. While these warnings where ignored during the evaluation
of CC_CAN_LINK, together with CONFIG_WERROR the actual userprog build
will later fail.
Example warning:
.../x86_64-linux/13.2.0/../../../../x86_64-linux/bin/ld:
error in /lib/../lib64/crt1.o(.sframe); no .sframe will be created
collect2: error: ld returned 1 exit status
Make sure that the very simple example program does not generate
warnings already to avoid breaking the userprog compilations.
Fixes: ec4a3992bc0b ("kbuild: respect CONFIG_WERROR for linker and assembler")
Fixes: 3f0ff4cc6ffb ("kbuild: respect CONFIG_WERROR for userprogs")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
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 6efcead3198989d2ab2ab6772c72d8bb61c89c4e..e67fd8d7b6841e53341045b28dc5196cc1327cbe 100755
--- a/scripts/cc-can-link.sh
+++ b/scripts/cc-can-link.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
-cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1
+cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>&1
#include <stdio.h>
int main(void)
{
--
2.51.0
On Tue, Oct 14, 2025 at 03:05:16PM +0200, Thomas Weißschuh wrote:
> It is possible that the kernel toolchain generates warnings when used
> together with the system toolchain. This happens for example when the
> older kernel toolchain does not handle new versions of sframe debug
> information. While these warnings where ignored during the evaluation
> of CC_CAN_LINK, together with CONFIG_WERROR the actual userprog build
> will later fail.
>
> Example warning:
>
> .../x86_64-linux/13.2.0/../../../../x86_64-linux/bin/ld:
> error in /lib/../lib64/crt1.o(.sframe); no .sframe will be created
> collect2: error: ld returned 1 exit status
>
> Make sure that the very simple example program does not generate
> warnings already to avoid breaking the userprog compilations.
>
> Fixes: ec4a3992bc0b ("kbuild: respect CONFIG_WERROR for linker and assembler")
> Fixes: 3f0ff4cc6ffb ("kbuild: respect CONFIG_WERROR for userprogs")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
While this makes sense as a way to immediately fix the problem and align
cc-can-link.sh with the other test functions like cc-option and like, it
is rather unfortunate that this particular warning causes an error since
the rest of the userprogs infrastructure does not care about SFrame...
I wonder if there is a way to avoid it since I think this warning does
not point to a fundamental problem.
> ---
> 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 6efcead3198989d2ab2ab6772c72d8bb61c89c4e..e67fd8d7b6841e53341045b28dc5196cc1327cbe 100755
> --- a/scripts/cc-can-link.sh
> +++ b/scripts/cc-can-link.sh
> @@ -1,7 +1,7 @@
> #!/bin/sh
> # SPDX-License-Identifier: GPL-2.0
>
> -cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1
> +cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/null 2>&1
> #include <stdio.h>
> int main(void)
> {
>
> --
> 2.51.0
>
On Thu, Nov 13, 2025 at 09:27:41PM -0700, Nathan Chancellor wrote:
> On Tue, Oct 14, 2025 at 03:05:16PM +0200, Thomas Weißschuh wrote:
> > It is possible that the kernel toolchain generates warnings when used
> > together with the system toolchain. This happens for example when the
> > older kernel toolchain does not handle new versions of sframe debug
> > information. While these warnings where ignored during the evaluation
> > of CC_CAN_LINK, together with CONFIG_WERROR the actual userprog build
> > will later fail.
> >
> > Example warning:
> >
> > .../x86_64-linux/13.2.0/../../../../x86_64-linux/bin/ld:
> > error in /lib/../lib64/crt1.o(.sframe); no .sframe will be created
> > collect2: error: ld returned 1 exit status
> >
> > Make sure that the very simple example program does not generate
> > warnings already to avoid breaking the userprog compilations.
> >
> > Fixes: ec4a3992bc0b ("kbuild: respect CONFIG_WERROR for linker and assembler")
> > Fixes: 3f0ff4cc6ffb ("kbuild: respect CONFIG_WERROR for userprogs")
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Thanks!
> While this makes sense as a way to immediately fix the problem and align
> cc-can-link.sh with the other test functions like cc-option and like, it
> is rather unfortunate that this particular warning causes an error since
> the rest of the userprogs infrastructure does not care about SFrame...
> I wonder if there is a way to avoid it since I think this warning does
> not point to a fundamental problem.
I did not find any way to avoid this specific warning, unfortunately.
This patch should make sense in any case. If we find a way to avoid the
sframe warning then that should go on top.
(...)
Thomas
On Tue, Oct 14, 2025 at 03:05:16PM +0200, Thomas Weißschuh wrote:
> It is possible that the kernel toolchain generates warnings when used
> together with the system toolchain. This happens for example when the
> older kernel toolchain does not handle new versions of sframe debug
> information. While these warnings where ignored during the evaluation
> of CC_CAN_LINK, together with CONFIG_WERROR the actual userprog build
> will later fail.
>
> Example warning:
>
> .../x86_64-linux/13.2.0/../../../../x86_64-linux/bin/ld:
> error in /lib/../lib64/crt1.o(.sframe); no .sframe will be created
> collect2: error: ld returned 1 exit status
>
> Make sure that the very simple example program does not generate
> warnings already to avoid breaking the userprog compilations.
>
> Fixes: ec4a3992bc0b ("kbuild: respect CONFIG_WERROR for linker and assembler")
> Fixes: 3f0ff4cc6ffb ("kbuild: respect CONFIG_WERROR for userprogs")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> scripts/cc-can-link.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
--
Nicolas
© 2016 - 2025 Red Hat, Inc.