Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3816125ybi; Mon, 29 Jul 2019 13:10:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwca/WDRUniHCO5LjibNLfjc+qqkOhxplK5bUOMwuKbyUPmiSuMLDG9cufxbzv4oE8a+TKz X-Received: by 2002:a62:e403:: with SMTP id r3mr36709704pfh.37.1564431058776; Mon, 29 Jul 2019 13:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431058; cv=none; d=google.com; s=arc-20160816; b=mZxCD82fH46mwCNsg0vcjourdLqLpYZZNOqaoPcvAD5/AWtWzY6Fw4k5aSpo9lLZ6O 12SCb0ySppVceN0r51ptBi0mQv1yLntl51j6+24stTtF+3Qvlozo0xiFZoMYGYZKSaro avOSu2yC1eEhE/zWvU+KFWaKrr4NiLw4/QbWfvPw1JX6VetQMUXmNSi9k7cj664P24MQ FYU7v9uFuWQ+b5U3dWMt4fPQtkiq+UGUB6dtac+2DgeqfL0NgjUikW7zd/U5Fx3my055 EIqq4tmHg/qnBaOncEF1xnicS/PgzG47DbajDLRV9T0pBYSggwlb3URmu/S9tHokbUkK Il+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uur24QtDwp32AEMCsrV00kSZqc0I7uMjx7QwZU//vBY=; b=TZt9BhKvjqu0yt2957d6OlijrPqwTu/XWBme82jcf7Y1AirMKiKAEoMCIiTCWPH4Fr mk2n3/Jv+Bh0/BCxoodJjZgJIVVtL0x0hYIfc+1gu1zVQx282bHRsHYQw+48WS0uI06w jqlpt5LzlfDd3ngyYoBbu06n6lYfs32Y7a6D5pywS/I/H0IWSunW8IsAIiePFcE5KhgC ee45NGt0OSqsm2NAYD2DQD4MWsW8mV4W2rSsoUFQOV2GtBoLz4Wd2cVWul/YVwycmWxS XuBKsYQGYNU8pzjFdpkZfHOdtgH6NOK8DreNXaJ2UJYBki1SnFszUMLMGAMKNGrrbCqP kSBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z2LAkJt1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si26630048pgp.338.2019.07.29.13.10.43; Mon, 29 Jul 2019 13:10:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z2LAkJt1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388593AbfG2TgW (ORCPT + 99 others); Mon, 29 Jul 2019 15:36:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:50656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728992AbfG2TgT (ORCPT ); Mon, 29 Jul 2019 15:36:19 -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 875C821773; Mon, 29 Jul 2019 19:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428978; bh=WINzYg5Ou+5ohGWLM6Y5BQuTa68ooJVBWZysmX3OUWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z2LAkJt10gtK6uokItbAzxexZLVwXKFH03mYo8bs8cKVNrcu8nBazFH3Qk/PWvzg4 ZC4b1hs6mnzeYbcR2EKKmqn+Nq4CDEj+wmS2UiheBSw092WKA7/nXoTndoYV/5vKZX L2187tlMQuFxne5cAKcCan+APXXh3ly4+ZspPobU= 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 4.14 246/293] kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS Date: Mon, 29 Jul 2019 21:22:17 +0200 Message-Id: <20190729190843.308435390@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 97c744513af0..bbc9b6acb177 100644 --- a/Makefile +++ b/Makefile @@ -488,6 +488,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