Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753950AbdFMXKD (ORCPT ); Tue, 13 Jun 2017 19:10:03 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:34395 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753825AbdFMXJ7 (ORCPT ); Tue, 13 Jun 2017 19:09:59 -0400 From: Matthias Kaehlcke To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , "H . J . Lu" , David Woodhouse , Masahiro Yamada , Michal Marek Cc: x86@kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Davidson , Greg Hackmann , Nick Desaulniers , Stephen Hines , Kees Cook , Arnd Bergmann , Bernhard.Rosenkranzer@linaro.org, Peter Foley , Behan Webster , Douglas Anderson , Matthias Kaehlcke Subject: [PATCH v2 2/4] kbuild: Add hostcc-option macro Date: Tue, 13 Jun 2017 16:08:52 -0700 Message-Id: <20170613230854.112282-3-mka@chromium.org> X-Mailer: git-send-email 2.13.1.518.g3df882009-goog In-Reply-To: <20170613230854.112282-1-mka@chromium.org> References: <20170613230854.112282-1-mka@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1679 Lines: 45 hostcc-option is equivalent to cc-option, but uses the host compiler and HOSTCFLAGS. Change HOSTCFLAGS to a simple expanded variable to allow for HOSTCFLAGS += $(call hostcc-option, ...). Suggested-by: Arnd Bergmann Suggested-by: Masahiro Yamada Signed-off-by: Matthias Kaehlcke --- Changes in v2: - Patch added in v2 Makefile | 2 +- scripts/Kbuild.include | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 83f6d9972cab..b234bba6d652 100644 --- a/Makefile +++ b/Makefile @@ -303,7 +303,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$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) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 6dd0d1a921d6..4965ed92fc1e 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -123,6 +123,10 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) cc-option = $(call cc-option-raw, $(CC), $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),\ $(1), $(2)) +# hostcc-option +# Usage: HOSTCFLAGS += $(call hostcc-option, -fno-delete-null-pointer-checks,) +hostcc-option = $(call cc-option-raw, $(HOSTCC), $(HOSTCFLAGS), $(1), $(2)) + # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ -- 2.13.1.518.g3df882009-goog