From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f194.google.com ([209.85.215.194]:33942 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726717AbfG2OXl (ORCPT ); Mon, 29 Jul 2019 10:23:41 -0400 Received: by mail-pg1-f194.google.com with SMTP id n9so22129769pgc.1 for ; Mon, 29 Jul 2019 07:23:41 -0700 (PDT) Message-ID: <5d3f016c.1c69fb81.b4775.c7d0@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190725154730.80169-1-swboyd@chromium.org> From: Stephen Boyd Subject: Re: [PATCH v2] kbuild: Check for unknown options with cc-option usage in Kconfig and clang Date: Mon, 29 Jul 2019 07:23:39 -0700 Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Masahiro Yamada Cc: Michal Marek , Linux Kernel Mailing List , Linux Kbuild mailing list , clang-built-linux , Peter Smith , Nathan Chancellor , Nick Desaulniers , Douglas Anderson Quoting Masahiro Yamada (2019-07-29 03:02:40) >=20 > Thanks for catching this. >=20 > I wonder if we could fix this issue > by one-liner, like this: >=20 >=20 > diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include > index 8a5c4d645eb1..4bbf4fc163a2 100644 > --- a/scripts/Kconfig.include > +++ b/scripts/Kconfig.include > @@ -25,7 +25,7 @@ failure =3D $(if-success,$(1),n,y) >=20 > # $(cc-option,) > # Return y if the compiler supports , n otherwise > -cc-option =3D $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/nul= l) > +cc-option =3D $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c > /dev/null -o /dev/null) >=20 > # $(ld-option,) > # Return y if the linker supports , n otherwise >=20 >=20 >=20 > This propagates not only -Werror=3Dunknown-warning-option > but also other clang flags to Kconfig. >=20 >=20 > Currently, we do not pass the target triplet to Kconfig. > This means, cc-option in Kconfig evaluates the given flags > against host-arch instead of target-arch. > The compiler flags are mostly independent of the architecture, > and this is not a big deal, I think. > But, maybe, would it make more sense to pass the other > basic clang flags as well? >=20 Yes that also works and I had that earlier. I wanted to mirror what was done in scripts/Kbuild.include where there's a CC_OPTION_CFLAGS variable. I'm happy either way, so it's up to you.