Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp68966ybl; Thu, 22 Aug 2019 20:00:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxS2FlwCouNxN09b+Vhdq1HN6AiYiBTZS/uGSpnm3JhCydZNVDQLavcONqj474iOI+RinTq X-Received: by 2002:a17:902:3064:: with SMTP id u91mr1885904plb.244.1566529243491; Thu, 22 Aug 2019 20:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566529243; cv=none; d=google.com; s=arc-20160816; b=zY7hcmCxzkag72JMAAzQHQq/XEKZ3XRwvWSh88LneHk+0gC84HGaEBaUpxF+Ec7wzl Ludk3Be4SdsNF1Tw6o8Y2Ir6CvhNRDzsxgkE1txcIuaKVXtwWE+wFWFUmZov4chznPtQ V18zM0VgnSJNDNUOPwT8XQLvwueFshxLeKQDVdkPi3Lucwmox07esNjViCe2KmQAdzjB 9m4aLcf0V7M7KaPaA4yZPrsNi0ccZHPU1O7lUI/PCO2rS2kHiERvLZ14ek6lcH6hAZAU cZMtxoxnPO9oiFmmopsHFYhnr0SNcIcbMN2loaRQ3sGHt07vLllu0MRLr/qEhW+n2AmG 0ayw== 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=dN6kdapHVePTk8n5NAYF7/m5tuBIeKH6CvH4XS5OMl4=; b=UgWl4KGLchAQVgp4/sRGo+c9WirPGfAneK7ujOOC7UaBiZewxg9xWIxDya+cFWDusm +D0qU6y7RMvqMzCXfEz9F5OFm8dONV7ijXbCQkFawqmvlaqhgr2AesbWjZlZ9Oft5kAc Wh6RFI4034bSLpceUxCeYF5VIeD4fw/t/FGNC1aaUBwS/W4bUaKPOjCjZKJ+1DisUIQE JRQmvvsWXdvfRuoG/cfKkDhqDzk5VgYVP7v7l8xl830xvcBCKhfGhwtUI1bnzoDUammV CerBzg7+KYJ18HbfOWgZbXL5Tn9tb1rMfKpQ54NsZ42f6jFerErH1DzyccUDsrBP7IRb 2N6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gI1RuaXU; 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 z190si869672pgd.303.2019.08.22.20.00.26; Thu, 22 Aug 2019 20:00:43 -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=gI1RuaXU; 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 S2392229AbfHVRbR (ORCPT + 99 others); Thu, 22 Aug 2019 13:31:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:50726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404557AbfHVRZ7 (ORCPT ); Thu, 22 Aug 2019 13:25:59 -0400 Received: from localhost (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (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 9FA542341C; Thu, 22 Aug 2019 17:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566494758; bh=rSE9tySoDK9NcP8IePbKZZLmlTlkfFUSKzFTEfDHgZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gI1RuaXUe3J4qsHBneA02wtP4kaec7fX88qtesbyn0hprRPYtb+PDqC5kXYB0vjsi aha0aUe72Sb15VGpswv2TWn2mAOM5z7X8OIJ0luxOSnQ1HTc4m1nbws76IG83UlFQw Sxf/Gut4FJH0/VJG9iiUxq1ACxhm20lg9Cq0Nn+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Smith , Nick Desaulniers , Douglas Anderson , Stephen Boyd , Nathan Chancellor , Masahiro Yamada , Sasha Levin Subject: [PATCH 4.19 42/85] kbuild: Check for unknown options with cc-option usage in Kconfig and clang Date: Thu, 22 Aug 2019 10:19:15 -0700 Message-Id: <20190822171733.116438013@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190822171731.012687054@linuxfoundation.org> References: <20190822171731.012687054@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 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 dad5583451afb..3b2861f47709b 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -20,7 +20,7 @@ success = $(if-success,$(1),y,n) # $(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