From patchwork Tue Jun 13 23:08:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 9784923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EB5C60244 for ; Tue, 13 Jun 2017 23:10:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 803052856A for ; Tue, 13 Jun 2017 23:10:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74A4528592; Tue, 13 Jun 2017 23:10:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0538C2856A for ; Tue, 13 Jun 2017 23:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753870AbdFMXKC (ORCPT ); Tue, 13 Jun 2017 19:10:02 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:36300 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753813AbdFMXJ7 (ORCPT ); Tue, 13 Jun 2017 19:09:59 -0400 Received: by mail-pg0-f44.google.com with SMTP id a70so66701974pge.3 for ; Tue, 13 Jun 2017 16:09:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jpLIIBEKHTzUiTK9lJ7xk+r1wDdAx1OLzBuFIQMU6IA=; b=pHI52W9I9HRmqsXt5sXRoNyJReaIG02ck6sF6PXEVi3VDhJEb23PgUriAe59E6XKVr bozRP1sS7hAurLFBHOeWDIinsvnoedY+QIkv0RnrHBGoTGye3r3HPms/p9VXLtzrw6+7 iDWUQI0fKsl8PBg8XYjCGL0jl5qyeBPVrLnlyzItoOHVJJqSHOCkUs4G+BAYV2EJZ78E 0W6pJK9FZ/JPKWk0iVquyVNvwaYaO6ltwxHJhV2toiDWDQpxwjAZBt6vA20pdogEd5Us 2H3VdFSACV3C0UH/IY5QOyqBw0sk01YTvTOV29txTKCwkWih4768B/v7z48RVZrFYR9H UMxA== X-Gm-Message-State: AKS2vOxIHXJiHBtJHycg3TqGBlXNe0x5FFn2Bc3CnYRKIH3QHexBGvp6 peYqOC2/4uCMJIUQ X-Received: by 10.84.214.137 with SMTP id j9mr1733647pli.137.1497395398629; Tue, 13 Jun 2017 16:09:58 -0700 (PDT) Received: from mka.mtv.corp.google.com ([172.22.64.162]) by smtp.gmail.com with ESMTPSA id e18sm29179939pfk.118.2017.06.13.16.09.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 16:09:57 -0700 (PDT) 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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Masahiro Yamada --- 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,\