Re: Kbuild: CC= handling broken for tools/

From: Michal Marek
Date: Fri Nov 11 2016 - 07:38:09 EST


On 2016-11-11 12:23, Jiri Slaby wrote:
> Hi,
>
> I am trying a new gcc with new warnings enabled:
>
> make O=../a/gcc7/ CC='gcc-7' V=1 kernel/exit.o
> EXTRA_CFLAGS='-Wimplicit-fallthrough=3'

Note that EXTRA_CFLAGS is a makefile variable read by both kbuild and
tools/build apparently.

>
> But the build fails when building under tools/:
[...]
> gcc: error: unrecognized command line option â-Wimplicit-fallthrough=3â;
> did you mean â-Wno-fallthroughâ?
>
>
> Apparently, CC is not respected for tools/ dir.

Jiri can better explain the behavior of the tools/ Makefiles, but if you
want to use extra flags for kernel compilation, you should be using the
KCFLAGS variable (see Documentation/kbuild/kbuild.txt).

Michal