]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
kbuild: initialize CLANG_FLAGS correctly in the top Makefile
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 29 Jul 2019 09:15:17 +0000 (18:15 +0900)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitcd2f01de2da97237718dc8fdd2b3540b624d5024
tree4a6652d311c3f2d04e1a1d266799f12da01103ca
parentdc5a8fa2a3c5930f1a64d7afda4c3eb10f4e6158
kbuild: initialize CLANG_FLAGS correctly in the top Makefile

BugLink: https://bugs.launchpad.net/bugs/1839376
commit 5241ab4cf42d3a93b933b55d3d53f43049081fa1 upstream.

CLANG_FLAGS is initialized by the following line:

  CLANG_FLAGS     := --target=$(notdir $(CROSS_COMPILE:%-=%))

..., which is run only when CROSS_COMPILE is set.

Some build targets (bindeb-pkg etc.) recurse to the top Makefile.

When you build the kernel with Clang but without CROSS_COMPILE,
the same compiler flags such as -no-integrated-as are accumulated
into CLANG_FLAGS.

If you run 'make CC=clang' and then 'make CC=clang bindeb-pkg',
Kbuild will recompile everything needlessly due to the build command
change.

Fix this by correctly initializing CLANG_FLAGS.

Fixes: 238bcbc4e07f ("kbuild: consolidate Clang compiler flags")
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Makefile