MIPS: Loongson{2ef,64}: Wrap -mno-branch-likely with cc-option
authorNathan Chancellor <nathan@kernel.org>
Tue, 25 Jan 2022 22:19:25 +0000 (15:19 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 7 Feb 2022 17:30:12 +0000 (18:30 +0100)
commitd49fc69293f2022785f6ee1c3c7d565271abe393
tree4541fffa1e8775b0db68d7ffc6f1cd051802569c
parent0e96ea5c3eb5904e5dc2f3d414e2aba361933b87
MIPS: Loongson{2ef,64}: Wrap -mno-branch-likely with cc-option

This flag is not supported by clang, which results in a warning:

  clang-14: warning: argument unused during compilation: '-mno-branch-likely' [-Wunused-command-line-argument]

This breaks cc-option, which adds -Werror to make this warning fatal and
catch flags that are not supported.

Wrap this flag in cc-option so that it does not cause cc-option to fail,
which can cause randconfigs to be really noisy, due to warnings not
getting disabled that should be.

Additionally, move the cc-option check to Kconfig so that the check is
done at configuration time, rather than build time, as builds with no
configuration change will be quicker because the cc-option call will not
need to happen in those instances.

Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/Kconfig
arch/mips/loongson2ef/Platform
arch/mips/loongson64/Platform