From patchwork Mon Nov 12 11:57:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 1727901 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4D664DFE80 for ; Mon, 12 Nov 2012 11:58:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751662Ab2KLL5l (ORCPT ); Mon, 12 Nov 2012 06:57:41 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:55159 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100Ab2KLL5j (ORCPT ); Mon, 12 Nov 2012 06:57:39 -0500 Received: from mudshark.cambridge.arm.com (mudshark.cambridge.arm.com [10.1.79.58]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id qACBvXE7025842; Mon, 12 Nov 2012 11:57:33 GMT Received: by mudshark.cambridge.arm.com (Postfix, from userid 1000) id 42705C277E; Mon, 12 Nov 2012 11:57:33 +0000 (GMT) From: Will Deacon To: kvm@vger.kernel.org Cc: penberg@kernel.org, marc.zyngier@arm.com, c.dall@virtualopensystems.com, matt.evans@arm.com, peter.maydell@linaro.org, Will Deacon Subject: [RFC PATCH 02/16] kvm tools: only enable LTO if supported by GCC Date: Mon, 12 Nov 2012 11:57:16 +0000 Message-Id: <1352721450-11340-3-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1352721450-11340-1-git-send-email-will.deacon@arm.com> References: <1352721450-11340-1-git-send-email-will.deacon@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Commit 99423f12db2a ("kvm tools: enable LTO") unconditionally enabled link-time-optimisations when building kvmtool. Unfortunately, passing -flto to a GCC without support for the option, results in a fatal build error: cc1: error: LTO support has not been enabled in this configuration This patch adds a check to the kvm tools Makefile so that LTO is only enabled if the host compiler supports it. Signed-off-by: Will Deacon --- tools/kvm/Makefile | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile index f12e587..23a7c40 100644 --- a/tools/kvm/Makefile +++ b/tools/kvm/Makefile @@ -226,6 +226,11 @@ ifeq ($(call try-cc,$(SOURCE_AIO),$(FLAGS_AIO) -static),y) LIBS_STATOPT += -laio endif +FLAGS_LTO := -flto +ifeq ($(call try-cc,$(SOURCE_HELLO),$(FLAGS_LTO)),y) + CFLAGS += $(FLAGS_LTO) +endif + ifneq ($(call try-build,$(SOURCE_STATIC),-static,),y) $(error No static libc found. Please install glibc-static package.) endif @@ -244,7 +249,7 @@ DEFINES += -DKVMTOOLS_VERSION='"$(KVMTOOLS_VERSION)"' DEFINES += -DBUILD_ARCH='"$(ARCH)"' KVM_INCLUDE := include -CFLAGS += $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include/uapi -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/uapi -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 -fno-strict-aliasing -g -flto +CFLAGS += $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include/uapi -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/uapi -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 -fno-strict-aliasing -g WARNINGS += -Wall WARNINGS += -Wcast-align