Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp161698imu; Wed, 21 Nov 2018 17:18:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xgsbq5QSooEZ37gbfcxJK1h4mn/ZkEzEIszrvYXWYcPvwArNllMZJVzcf4IXxm4XOcNEOz X-Received: by 2002:a62:4b4d:: with SMTP id y74mr7932052pfa.186.1542849528061; Wed, 21 Nov 2018 17:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542849528; cv=none; d=google.com; s=arc-20160816; b=vHf9iiAH/agCaA5MEzgydu+Jy9r3xBlbNBLA4uM5DJxnaM4OUZmXnVS1tBFgRSr7L/ 9eykAjfN1uHm8W83a7gnw9/BVtjA9QEm4x4hMeBJgz7EMBZrcGsiRcfLrcG+6872HLqh PVeBu9fcGfv7X5nR/V5EI7kb+m5I93QcLtRMzXz1Vxg2GRJpeQHUor/ZiqAOkL1FrAfx 5yDF2UdVGXG9cYrjOuOrLLWpkTMvZpb9L3YDXOQIAfLEf0hT9MoyCufQAN+P4OsrBwyH oXBODGBf4S41whcvaFkuLXPv26scOBzexggrTwGrOEtI43uaaSxhLmpo/Ce3jJDIuaxL 0ZaQ== 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=oa92ZvHbENHAWzfWv1iCcpg0mHbAPUCYaPkvtI4YZkk=; b=CIpv3Pw0NH2RuLqd1tPDOq5uL78AHXEdjw75MMl2J3U4T1zO+T2gSHEO6FnwAP259W 6/YR9WiAEZLQ3lfM/LTWAhy74x4tYRnV8X2v48csxjb+5tn8wK0pxSfgxOvdAHxKdHAs hWnH633uaC33FlNoP6dyUALpTnBJ9roBdAS7qswUSBv4clgOW0D3qrmlQmZyl1zqWpj4 FIuB4D+YnhMDdVFI8nl9IvS6ctWV5Yq5joVCbaV9Jz92vt8pHlg0aNB7AZk6T3J0na5e MpHTU/UlOoPffwdAsMsUugWGAloBR3IDkIfeJoJH50rsFASj+Bao0jYNYeTk1k+pnhjJ LH6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HOhcm6z2; 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 f65si5255782pfb.194.2018.11.21.17.18.32; Wed, 21 Nov 2018 17:18:48 -0800 (PST) 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=HOhcm6z2; 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 S2388712AbeKVFpx (ORCPT + 99 others); Thu, 22 Nov 2018 00:45:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:40876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732372AbeKVFpw (ORCPT ); Thu, 22 Nov 2018 00:45:52 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 6F483214D9; Wed, 21 Nov 2018 19:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542827418; bh=2SRwGS/xRFpfceYigVJsMO2ndCRqAwXHpuV1+esd9vA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HOhcm6z2MmPjP9eBfFGPHsAqwcHC0af/m0FAygwCyfbiG1bK2GXHH2y3JOnxNnwdV g/pbtvmoODHRyz1cmC0rnE5ou13RI5hkDbnVLVMhEIrF9u5wp+qvwAByK9jPxyFpAl clxyHqh1knsDBLjg8oesjttVowJP6sbOid3PD2bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Masahiro Yamada , Matthias Kaehlcke , Michal Marek , Nick Desaulniers Subject: [PATCH 4.9 22/59] kbuild: Add __cc-option macro Date: Wed, 21 Nov 2018 20:06:37 +0100 Message-Id: <20181121183509.124128734@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121183508.262873520@linuxfoundation.org> References: <20181121183508.262873520@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthias Kaehlcke commit 9f3f1fd299768782465cb32cdf0dd4528d11f26b upstream. cc-option uses KBUILD_CFLAGS and KBUILD_CPPFLAGS when it determines whether an option is supported or not. This is fine for options used to build the kernel itself, however some components like the x86 boot code use a different set of flags. Add the new macro __cc-option which is a more generic version of cc-option with additional parameters. One parameter is the compiler with which the check should be performed, the other the compiler options to be used instead KBUILD_C*FLAGS. Refactor cc-option and hostcc-option to use __cc-option and move hostcc-option to scripts/Kbuild.include. Suggested-by: Arnd Bergmann Suggested-by: Masahiro Yamada Signed-off-by: Matthias Kaehlcke Acked-by: Arnd Bergmann Acked-by: Michal Marek Signed-off-by: Masahiro Yamada Signed-off-by: Nick Desaulniers Signed-off-by: Greg Kroah-Hartman --- Makefile | 2 +- scripts/Kbuild.include | 14 ++++++++++++-- scripts/Makefile.host | 6 ------ 3 files changed, 13 insertions(+), 9 deletions(-) --- a/Makefile +++ b/Makefile @@ -303,7 +303,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 +HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 HOSTCXXFLAGS = -O2 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -109,6 +109,11 @@ as-option = $(call try-run,\ as-instr = $(call try-run,\ printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) +# __cc-option +# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) +__cc-option = $(call try-run,\ + $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) + # Do not attempt to build with gcc plugins during cc-option tests. # (And this uses delayed resolution so the flags will be up to date.) CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) @@ -116,8 +121,13 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PL # cc-option # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) -cc-option = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) +cc-option = $(call __cc-option, $(CC),\ + $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) + +# hostcc-option +# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) +hostcc-option = $(call __cc-option, $(HOSTCC),\ + $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -20,12 +20,6 @@ # Will compile qconf as a C++ program, and menu as a C program. # They are linked as C++ code to the executable qconf -# hostcc-option -# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) - -hostcc-option = $(call try-run,\ - $(HOSTCC) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) - __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))