Subject: Re: linux-next: build warning after merge of Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 23 Apr 2025 09:55:03 +1000

Hi Linus,

On Tue, 22 Apr 2025 08:59:00 -0700 Linus Torvalds <[email-masked]> wrote:
>
> On Tue, 22 Apr 2025 at 03:47, Stephen Rothwell <[email-masked]> wrote:
> >
> > These builds were done with a gcc 11.1.0 cross compiler.  
> 
> That sounds like there might be some issue with the cross-compiler
> logic somewhere, because the Makefile logic is using the standard
> 
>     KBUILD_CFLAGS += $(call cc-option, xyzzy)
> 
> pattern.  We literally have seven other occurrences of that same logic
> just in that same Makefile above it (and many more in other
> makefiles).
> 
> IOW, it's *supposed* to only actually use the flag if the compiler
> supports it, so having the compiler then say "I don't recognize that
> option" is kind of odd. We've explicitly tested that the compiler
> supports it.

Yeah, I thought it was strange.

> Does the warning happen for all files that get built, or just some
> specific ones? I wonder if we have some issue where we end up using
> two different compilers (I'd assume native and cross-built), and we
> use KBUILD_CFLAGS for the wrong compiler (or we use cc-option with the
> wrong compiler, but I'd expect that to affect *everything* - that
> 'cc-option' thing is not some kind of unusual pattern).

It happens only for a couple of files.  Here is the full sparc64 build
log:

------------------------------------------------------------------------
<stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
cc1: note: unrecognized command-line option '-Wno-unterminated-string-initialization' may have been intended to silence earlier diagnostics
/home/sfr/next/next/arch/sparc/vdso/vclock_gettime.c:274:1: warning: no previous prototype for '__vdso_clock_gettime' [-Wmissing-prototypes]
  274 | __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
      | ^~~~~~~~~~~~~~~~~~~~
/home/sfr/next/next/arch/sparc/vdso/vclock_gettime.c:302:1: warning: no previous prototype for '__vdso_clock_gettime_stick' [-Wmissing-prototypes]
  302 | __vdso_clock_gettime_stick(clockid_t clock, struct __kernel_old_timespec *ts)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sfr/next/next/arch/sparc/vdso/vclock_gettime.c:327:1: warning: no previous prototype for '__vdso_gettimeofday' [-Wmissing-prototypes]
  327 | __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
      | ^~~~~~~~~~~~~~~~~~~
/home/sfr/next/next/arch/sparc/vdso/vclock_gettime.c:363:1: warning: no previous prototype for '__vdso_gettimeofday_stick' [-Wmissing-prototypes]
  363 | __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option '-Wno-unterminated-string-initialization' may have been intended to silence earlier diagnostics
In file included from /home/sfr/next/next/arch/sparc/vdso/vdso32/vclock_gettime.c:22:
/home/sfr/next/next/arch/sparc/vdso/vdso32/../vclock_gettime.c:274:1: warning: no previous prototype for '__vdso_clock_gettime' [-Wmissing-prototypes]
  274 | __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
      | ^~~~~~~~~~~~~~~~~~~~
/home/sfr/next/next/arch/sparc/vdso/vdso32/../vclock_gettime.c:302:1: warning: no previous prototype for '__vdso_clock_gettime_stick' [-Wmissing-prototypes]
  302 | __vdso_clock_gettime_stick(clockid_t clock, struct __kernel_old_timespec *ts)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sfr/next/next/arch/sparc/vdso/vdso32/../vclock_gettime.c:327:1: warning: no previous prototype for '__vdso_gettimeofday' [-Wmissing-prototypes]
  327 | __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
      | ^~~~~~~~~~~~~~~~~~~
/home/sfr/next/next/arch/sparc/vdso/vdso32/../vclock_gettime.c:363:1: warning: no previous prototype for '__vdso_gettimeofday_stick' [-Wmissing-prototypes]
  363 | __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option '-Wno-unterminated-string-initialization' may have been intended to silence earlier diagnostics
/home/sfr/next/next/kernel/fork.c: In function '__do_sys_clone3':
/home/sfr/next/next/kernel/fork.c:3150:2: warning: #warning clone3() entry point is missing, please fix [-Wcpp]
 3150 | #warning clone3() entry point is missing, please fix
      |  ^~~~~~~
/home/sfr/next/next/kernel/fork.c: At top level:
cc1: note: unrecognized command-line option '-Wno-unterminated-string-initialization' may have been intended to silence earlier diagnostics
/home/sfr/next/next/kernel/fork.c:3150:2: warning: #warning clone3() entry point is missing, please fix [-Wcpp]
 3150 | #warning clone3() entry point is missing, please fix
      |  ^~~~~~~
cc1: note: unrecognized command-line option '-Wno-unterminated-string-initialization' may have been intended to silence earlier diagnostics
WARNING: modpost: EXPORT symbol "_mcount" [vmlinux] version generation failed, symbol will not be versioned.
Is "_mcount" prototyped in <asm/asm-prototypes.h>?
------------------------------------------------------------------------

However:

$ /opt/cross/gcc-11.1.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc -Werror -Wno-unterminated-string-initialization -c -x c /dev/null
$ echo $?
0
$ /opt/cross/gcc-11.1.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc -Werror -Wunterminated-string-initialization -c -x c /dev/null
sparc64-linux-gcc: error: unrecognized command-line option '-Wunterminated-string-initialization'
$ echo $?
1

-- 
Cheers,
Stephen Rothwell