Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1485302ybl; Thu, 22 Aug 2019 15:37:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzreKlCIwqyuGK6lEHoxpLfhD76xqS3vG1G/s6olTV5VHQJplF6Ws000DTQTlvy1HTRF3gA X-Received: by 2002:aa7:81d4:: with SMTP id c20mr1631920pfn.235.1566513444471; Thu, 22 Aug 2019 15:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566513444; cv=none; d=google.com; s=arc-20160816; b=iTtFGtvMwgRoPay57XWblZOcryPORGdnT9rYjognmioxlGvYSCbysdKSfpzZYvW7D0 9EXTiZPJY3wfF3CLdsSikSfGH82PwcBKgtgKuIpQbsqcn0ohbwFj9G5l1Ca71pe+BN9y 2AnAq739x41ME0/qstgtdDAjLvFkmcRgcn3rOuPBtngwKHcba45dKJOoNQ4Wzz0R/NAn p3HsUaRIBf70xsQqu1jLgpJ8RD6y0LSOwPY66UhDBmsBqGpm09U34omKc3l6ukDaAz7Q 6GcHdwTKmOJ+sWx123Fm2SdUqN5NCHjrSu/xxtz6BtbvxoM1msypDRMljxY7j3p+7Fx2 mFsg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xR6RvMQaDkuH3GvR6ZSarO50grYTFBogqVRLbvza5As=; b=RWPsgXLE0V1frfqtjheMl3K/HbmGkoNavWkYM+zwwPZWWQcmDF21azjt0G/rY2yUgc HFnKKL3Q0HlNhPU8YdKRaUiv00ogyYK0RmbHT6IGNBeMzFgcSDiA5C1J6J4gswJVYBSN 0NZdsltxrSD433F/l2R0idrDAcWSeU9JdtT9r1F8zHYZ6uCGxiY9QNsrlRsa0R4RVV1+ r+e3GOEwlAuw0ZB9VI6HcqbX5SsNNBOWoc+scJySukZDSRu9/QB6b0VgJQaY3KkNjim1 u+1c0oYupq/oRqZ1aZDpemmvCN/z1gvB72bv4lXVuvITnebHVLIK2S+DaQ/iBD9uCqPw Rp2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ebq7Wq23; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si463257pge.215.2019.08.22.15.37.09; Thu, 22 Aug 2019 15:37:24 -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=Ebq7Wq23; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391122AbfHVROd (ORCPT + 99 others); Thu, 22 Aug 2019 13:14:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:58858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390555AbfHVRIw (ORCPT ); Thu, 22 Aug 2019 13:08:52 -0400 Received: from sasha-vm.mshome.net (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A6FC23426; Thu, 22 Aug 2019 17:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566493732; bh=m5gHbQrcUMFbJ76EWBnK/TgYPTtChWNCLVydJT9814s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ebq7Wq23ZvKj83f0XkNZ8EyfABiK632RAvxEIWv3OaRHKCyr6zNQaQCkPiq2o5ujG naWauOILhgl7iLc9MBBxSj+3Rs3y46w7zLU14PrNjil3AXPdjtkNRTHFo7pXgFro9y X8peOQscRsYFxsxdH2GYg/CqJjPuCTlaqRFy17Lo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephen Boyd , Peter Smith , Nick Desaulniers , Douglas Anderson , Nathan Chancellor , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.2 069/135] kbuild: Check for unknown options with cc-option usage in Kconfig and clang Date: Thu, 22 Aug 2019 13:07:05 -0400 Message-Id: <20190822170811.13303-70-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822170811.13303-1-sashal@kernel.org> References: <20190822170811.13303-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.2.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.2.10-rc1 X-KernelTest-Deadline: 2019-08-24T17:07+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd [ Upstream commit e8de12fb7cde2c85bc31097cd098da79a4818305 ] If the particular version of clang a user has doesn't enable -Werror=unknown-warning-option by default, even though it is the default[1], then make sure to pass the option to the Kconfig cc-option command so that testing options from Kconfig files works properly. Otherwise, depending on the default values setup in the clang toolchain we will silently assume options such as -Wmaybe-uninitialized are supported by clang, when they really aren't. A compilation issue only started happening for me once commit 589834b3a009 ("kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS") was applied on top of commit b303c6df80c9 ("kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig"). This leads kbuild to try and test for the existence of the -Wmaybe-uninitialized flag with the cc-option command in scripts/Kconfig.include, and it doesn't see an error returned from the option test so it sets the config value to Y. Then the Makefile tries to pass the unknown option on the command line and -Werror=unknown-warning-option catches the invalid option and breaks the build. Before commit 589834b3a009 ("kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS") the build works fine, but any cc-option test of a warning option in Kconfig files silently evaluates to true, even if the warning option flag isn't supported on clang. Note: This doesn't change cc-option usages in Makefiles because those use a different rule that includes KBUILD_CFLAGS by default (see the __cc-option command in scripts/Kbuild.incluide). The KBUILD_CFLAGS variable already has the -Werror=unknown-warning-option flag set. Thanks to Doug for pointing out the different rule. [1] https://clang.llvm.org/docs/DiagnosticsReference.html#wunknown-warning-option Cc: Peter Smith Cc: Nick Desaulniers Cc: Douglas Anderson Signed-off-by: Stephen Boyd Reviewed-by: Nathan Chancellor Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/Kconfig.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include index 8a5c4d645eb14..4bbf4fc163a29 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y) # $(cc-option,) # Return y if the compiler supports , n otherwise -cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) +cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null) # $(ld-option,) # Return y if the linker supports , n otherwise -- 2.20.1