From patchwork Wed Feb 26 11:33:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11406313 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5A2B14B4 for ; Wed, 26 Feb 2020 11:42:18 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 921B724685 for ; Wed, 26 Feb 2020 11:42:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="KAOr+pRP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 921B724685 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6v4C-0003Ax-8P; Wed, 26 Feb 2020 11:41:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6v4A-00039k-Ro for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 11:41:26 +0000 X-Inumbo-ID: e7acb5a8-588c-11ea-8cb6-bc764e2007e4 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e7acb5a8-588c-11ea-8cb6-bc764e2007e4; Wed, 26 Feb 2020 11:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582717280; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xHJSK+ksoK9OQta1FpeZ8S5l79r9MroWvjBMZmZjrxo=; b=KAOr+pRP5ZjjbLZw1LfajUoTcM/FRH1e8gt7s+LA8eioZ4oZyVvOSnrb hTtolwKoQx07oEzRZ1q4Lp1hpNgnSccq0weRvjsEo8MTKaMnZnqyD04eA MC6Ftho4ZAuo1j/YncefY4CNiTuOO9GxXuElbLFgCKpBtFlrE2wIOPbu9 w=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: SipcPua4BGfp/QVTy+Gw23/L45n9qgjdXiXQffCmOYfg7FsVehvwbKR9Rp4N3iywBY3HmIdQ0D ymQ0g6oNtUh84EUKn9YZn1z65u2dyUWyCoPT3EXs0R53NX49Xf+vcMHEpN7o5josbihzHVsA4U DUSeIcBHURPiH81cOmLTgS46aq8oskmmrX659KxDc07ysoS4jT+FIaU83nNWCOLMtp7O7KEaDO oyMBtBOj99/NjxTmlzqZW7sywgt5toLkFpG9oME3lzUcbUtpbLBuQFKfftAHE9G1WY7VCSrJlD wb8= X-SBRS: 2.7 X-MesageID: 13038476 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,487,1574139600"; d="scan'208";a="13038476" From: Anthony PERARD To: Date: Wed, 26 Feb 2020 11:33:55 +0000 Message-ID: <20200226113355.2532224-24-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200226113355.2532224-1-anthony.perard@citrix.com> References: <20200226113355.2532224-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH v3 23/23] xen/build: use if_changed to build guest_%.o X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich , Anthony PERARD , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Use if_changed for building all guest_%.o objects, and make use of command that already exist. This patch also introduces CFLAGS_$@, it is used so that flags are applied to all .o .i and .s targets. This patch make a change to the way guest_%.o files are built, and now run the same commands that enforce unique symbols. But with patch "xen,symbols: rework file symbols selection", symbols should still select the file symbols directive intended to be used for guest_%.o objects. Signed-off-by: Anthony PERARD --- xen/Rules.mk | 5 ++++- xen/arch/x86/mm/Makefile | 15 +++++++++------ xen/arch/x86/mm/hap/Makefile | 15 +++++++++------ xen/arch/x86/mm/shadow/Makefile | 15 +++++++++------ 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index 02cd37d04054..1ffb02f42914 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -115,6 +115,9 @@ endif # FIXME LTO broken, but we would need a different way to filter -flto out # $(obj-bin-y): CFLAGS := $(filter-out -flto,$(CFLAGS)) +# target with its suffix stripped +target-stem = $(basename $@) + # Calculation of flags, first the generic flags, then the arch specific flags, # and last the flags modified for a target or a directory. @@ -123,7 +126,7 @@ a_flags = -MMD -MF $(@D)/.$(@F).d $(XEN_AFLAGS) include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk -c_flags += $(CFLAGS-y) +c_flags += $(CFLAGS-y) $(CFLAGS_$(target-stem).o) a_flags += $(CFLAGS-y) $(AFLAGS-y) quiet_cmd_ld_builtin = LD $@ diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile index a2431fde6bb4..4750bfa0ff91 100644 --- a/xen/arch/x86/mm/Makefile +++ b/xen/arch/x86/mm/Makefile @@ -11,11 +11,14 @@ obj-y += p2m.o p2m-pt.o obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o obj-y += paging.o -guest_walk_%.o: guest_walk.c Makefile - $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ +$(foreach gw,$(filter guest_walk_%.o,$(obj-y)),\ + $(eval CFLAGS_$(gw) = -DGUEST_PAGING_LEVELS=$$*)) -guest_walk_%.i: guest_walk.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ +guest_walk_%.o: guest_walk.c FORCE + $(call if_changed_rule,cc_o_c) -guest_walk_%.s: guest_walk.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@ +guest_walk_%.i: guest_walk.c FORCE + $(call if_changed,cpp_i_c) + +guest_walk_%.s: guest_walk.c FORCE + $(call if_changed,cc_s_c) diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile index 22e7ad54bd33..8cd31e9cdc5e 100644 --- a/xen/arch/x86/mm/hap/Makefile +++ b/xen/arch/x86/mm/hap/Makefile @@ -5,11 +5,14 @@ obj-y += guest_walk_4level.o obj-y += nested_hap.o obj-y += nested_ept.o -guest_walk_%level.o: guest_walk.c Makefile - $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ +$(foreach gw,$(filter guest_walk_%level.o,$(obj-y)),\ + $(eval CFLAGS_$(gw) = -DGUEST_PAGING_LEVELS=$$*)) -guest_walk_%level.i: guest_walk.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ +guest_walk_%level.o: guest_walk.c FORCE + $(call if_changed_rule,cc_o_c) -guest_walk_%level.s: guest_walk.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@ +guest_walk_%level.i: guest_walk.c FORCE + $(call if_changed,cpp_i_c) + +guest_walk_%level.s: guest_walk.c FORCE + $(call if_changed,cc_s_c) diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile index 23d3ff10802c..d11e9e2fac08 100644 --- a/xen/arch/x86/mm/shadow/Makefile +++ b/xen/arch/x86/mm/shadow/Makefile @@ -6,11 +6,14 @@ else obj-y += none.o endif -guest_%.o: multi.c Makefile - $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ +$(foreach gw,$(filter guest_%.o,$(obj-y)),\ + $(eval CFLAGS_$(gw) = -DGUEST_PAGING_LEVELS=$$*)) -guest_%.i: multi.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ +guest_%.o: multi.c FORCE + $(call if_changed_rule,cc_o_c) -guest_%.s: multi.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@ +guest_%.i: multi.c FORCE + $(call if_changed,cpp_i_c) + +guest_%.s: multi.c FORCE + $(call if_changed,cc_s_c)