From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA7BDC433FF for ; Mon, 29 Jul 2019 19:49:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA1322171F for ; Mon, 29 Jul 2019 19:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429756; bh=GXLQEAEmuYk2XNPqRZ4LjIT/TEVruiwv4dJS6yy00WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=L+PEJY6JqNQJywRoFYN3FTW3eIUjY8scNm7yWdn0OPN9rIBIAt0IWXSwCm0aOM5vZ y8yLPONrWk2cgzxudK4DuCynKtdnX8+cxdCx3pOudzOQvx12HcTTVI207yFyxjJcz1 NlVp2yYM25+M+Ats8Yp34xfvPfOpG6Qtd0lTDggM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390493AbfG2TtP (ORCPT ); Mon, 29 Jul 2019 15:49:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:39630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390283AbfG2TtL (ORCPT ); Mon, 29 Jul 2019 15:49:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D66E221773; Mon, 29 Jul 2019 19:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429750; bh=GXLQEAEmuYk2XNPqRZ4LjIT/TEVruiwv4dJS6yy00WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y8iHJhz/V1h8V80yOyeZqS+OOikuc+Sc6p2u4AplILRB7aowa6gDt7JDK+4Bocit/ XX1F/7vuY+D7i8P+I93zzo8CyYWTYbf699uauTqveQG3WC59dFpz+Ai+0m2zWu4Bd6 Fxk13z3tJyejfR3sfx/LEUcdCoo/XauhwV7SJ3bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Smith , Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.2 084/215] kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS Date: Mon, 29 Jul 2019 21:21:20 +0200 Message-Id: <20190729190754.125100755@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 589834b3a0097a4908f4112eac0ca2feb486fa32 ] In commit ebcc5928c5d9 ("arm64: Silence gcc warnings about arch ABI drift"), the arm64 Makefile added -Wno-psabi to KBUILD_CFLAGS, which is a GCC only option so clang rightfully complains: warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option] https://clang.llvm.org/docs/DiagnosticsReference.html#wunknown-warning-option However, by default, this is merely a warning so the build happily goes on with a slew of these warnings in the process. Commit c3f0d0bc5b01 ("kbuild, LLVMLinux: Add -Werror to cc-option to support clang") worked around this behavior in cc-option by adding -Werror so that unknown flags cause an error. However, this all happens silently and when an unknown flag is added to the build unconditionally like -Wno-psabi, cc-option will always fail because there is always an unknown flag in the list of flags. This manifested as link time failures in the arm64 libstub because -fno-stack-protector didn't get added to KBUILD_CFLAGS. To avoid these weird cryptic failures in the future, make clang behave like gcc and immediately error when it encounters an unknown flag by adding -Werror=unknown-warning-option to CLANG_FLAGS. This can be added unconditionally for clang because it is supported by at least 3.0.0, according to godbolt [1] and 4.0.0, according to its documentation [2], which is far earlier than we typically support. [1]: https://godbolt.org/z/7F7rm3 [2]: https://releases.llvm.org/4.0.0/tools/clang/docs/DiagnosticsReference.html#wunknown-warning-option Link: https://github.com/ClangBuiltLinux/linux/issues/511 Link: https://github.com/ClangBuiltLinux/linux/issues/517 Suggested-by: Peter Smith Signed-off-by: Nathan Chancellor Tested-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 68ee97784c4d..fa0f48c43ab2 100644 --- a/Makefile +++ b/Makefile @@ -528,6 +528,7 @@ ifneq ($(GCC_TOOLCHAIN),) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif CLANG_FLAGS += -no-integrated-as +CLANG_FLAGS += -Werror=unknown-warning-option KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS -- 2.20.1