Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3792826ybi; Mon, 29 Jul 2019 12:43:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCIuQmh/4rbmHbPnIj/6i8SfTEMQ1d0TfGIOylHj1t2hZikaSD0/L59p/JHs1po/LChJEJ X-Received: by 2002:a63:60a:: with SMTP id 10mr74184803pgg.381.1564429420870; Mon, 29 Jul 2019 12:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429420; cv=none; d=google.com; s=arc-20160816; b=D1UJh4TyR0FjlcjwNIOV9/kpjm0HLkCpwaaSbQwojnTBPnqboJpqy4p9UOn66ElxA7 1jjLuJSbPLVA8OCGjLBL3HRyZDCK1wACfOug/rVc4x1xu1J0SRUSzF/F3FrgKRDZFnnn RT7sa6haYwDvikbLXN+rA7GsKOyfAvuyXTLtPSLSp6zhzyfLF18dFmuup5orMQI4ssjH A60+klPOlHoIpSDpWUfMpq7A/EeqrOOI9FDwpwEpfARAa8Kv63IBq5mseESA3Q+w0q73 7j/l9M7n4hvCIAOYSw25b2FAtAaRtRPU4NqRQaEgiCmDeiHC3Bi4KZ29GCeOKZbE4S8d xxHw== 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=RDe1zed5DBRYzWasrmKGm41+m2aR7c6vLsEHnWqayKA=; b=jBbCSFinK9WJqy88vXL4tkoyJuPxxeT1QgHDuG3N710v+XWHmx0p3RcErUSw4U6V7C yYSBMtQsNBUrk3LrGKGKWUeIESkEBKpYlyV1ZoXB6WGQayj5fceVcaJHApj+D/XZ1G32 QZVSE8qPM+5RhiAdwf5lM1ChbcmYiv78Kado4YtbrkUwo4xV4a4E69WrLh8Ks22Ek+Ek rboitbjiwZt+q5uxLAjYvhRXV4xRhDUgWvTRZGPWx9c2E8GrtI3xfzojnyPewL7jcSq5 NayKv+NWZVLr6KOwndFAuaLkZljaSY+wimivys5X++o3V8VpD1QV2wlqgUIHW532hJlF b4Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KuHTm9fU; 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 d38si28201902pgl.519.2019.07.29.12.43.25; Mon, 29 Jul 2019 12:43:40 -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=KuHTm9fU; 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 S2388777AbfG2TlC (ORCPT + 99 others); Mon, 29 Jul 2019 15:41:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:56296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389235AbfG2Tk5 (ORCPT ); Mon, 29 Jul 2019 15:40:57 -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 E0F5220C01; Mon, 29 Jul 2019 19:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429256; bh=ErSDoMWJEx5kZ5qOQldqBfPKn6POSRmpI5lfAV70L0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KuHTm9fUa+2e20DW10+sjHB0yig04dZq/JafwbOeyYhDckm+NGLv58cgodyy80eK1 EMOQTA+3dzX5eURttkEd967R2C+5syJ5TJnaUYEUP7izPa1BuZRxUVNGkz5+5GwUr6 4jSfDsnciT6IchieqMXLSmWTc8HlEKxd9psaRj3A= 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.19 041/113] kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS Date: Mon, 29 Jul 2019 21:22:08 +0200 Message-Id: <20190729190705.555524104@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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 a4463d880ae2..c1f38f4107d9 100644 --- a/Makefile +++ b/Makefile @@ -491,6 +491,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