Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3798479ybi; Mon, 29 Jul 2019 12:50:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMTloua9v7Dp6vwNPj4u9EFC6pzZEXRo+V4+SWYBv0CBcjlHpw9mQaJ3a86FcSLQa2T2Tl X-Received: by 2002:a17:902:2a6b:: with SMTP id i98mr105579113plb.75.1564429842500; Mon, 29 Jul 2019 12:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429842; cv=none; d=google.com; s=arc-20160816; b=JYVNFDHX8DLA/cX/XjTX8wp9j/TZ5M98ll01oyC68TwMlYaVvU1i8b3NbgXTTzD4/n KmX8ag9vNDxbfTjECQPgMTQ1WXTMmJnp2N80lqbXIboU0sa07JlGXG6BL0bgJkfv+5s4 iYUiwqHCr98Sc7f98DmbRViNHqknuG1cQb0Gclz7dz6hGl+hy/b+icHfcSXd+2ZUWEQC rZUXsm+Agg0XBe/kqEmGGpl/Qgj32cDXxTApHezi4HTZ9A34ZHbaN0hG/xn5Ye/P16x0 rfO2hhNfd7Kj/1i8Ojf+Mqdd1xsQI8Y/u9gVdHbDO46xFsaP67mfqcwxwM959Fr8F4bG Ir3Q== 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=amnsXXQRCp0MIcpRip+wy7YdffCVWiem32xONSfcw3k=; b=qbi90T1VdZak9f5GFEmt2f7zLdznVitt4cuoaHsUcZWXeAPQTB7Bts1DrJvc/wjVtC cviUCPmvaIOLg83Q/V9f31Pmgxw7kPrxCCTLi7Uo4GGXntl+Ft4H7a1drL6L+1LW2jtD wKLGJkdt6TCKQvfkX7o8x0CIFsuM0ozXjGEKLe2ogB4QNXAqIbCOkTVoMOLNRqM/zyX4 s5LX96Ww/orcG1ULTQfL5H1MN+JHIMJ3inWe0B4IT3/wxG1Tmq1sCMTgpdonnsqfcDyN kAvKD7U9gUoC4A7i7DmmvmCd3oVKbMjoFe8WuUTB2GlxqE0Izkj9ehXtCnoNIy58sMY6 Me7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y8iHJhz/"; 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 p35si27349516pgb.484.2019.07.29.12.50.27; Mon, 29 Jul 2019 12:50:42 -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="Y8iHJhz/"; 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 S2390490AbfG2TtP (ORCPT + 99 others); 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