From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650751; cv=none; d=zohomail.com; s=zohoarc; b=H4uf7yJ2XczgsZK7SNvL4lwRtLGZRtm+vdOuwUUQ52MZ/wqX0UkNXTmOfKqKYpPh4A7T60yyXstNHppr6CteBD9wXRrcouBvRAAqd39ifDdeFAUDr6vxWouqbAhxQW+w/JWEo+TYQ+Vl4Qs8nv9oZOv+SXF9h4uXwbzZv/BTn2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KXYuruBCRO8igkiV9uZ199TyigFgpnQqWIg0gYJTz/g=; b=h3YStxalhYoH7FC94bhvPGeEsXUJJMOAE20VEC1SnIAULXpL/w9LCbb897hBM4uZhq1hADHWbNRXcvSGLJjMpkalN09kogUZn6Nhtm2HenXTAqTevM/jNvYLPZN42tVpTe8clUcqsfhnFHjzzB6jGZ+wf+SZv0+fnnoLWyTkFVk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158565075150489.66378254367987; Tue, 31 Mar 2020 03:32:31 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBa-0001MZ-NO; Tue, 31 Mar 2020 10:31:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBZ-0001LQ-53 for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:57 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d1aa006c-733a-11ea-b58d-bc764e2007e4; Tue, 31 Mar 2020 10:31:45 +0000 (UTC) X-Inumbo-ID: d1aa006c-733a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650705; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wQpJCnzMoRgzJpnbgfA1CHBstAlwYXGC9u9GZzIVVmQ=; b=hs2BC54o31gv5gLJn0TyXBnJLkoxByZQCfRqOy9ZenUS0710wW9y/KI+ lZn2oA5HrSnxm6Nme7G0BYYPMBpWk8si4omuH7yd0M7iv5TMMFSmlpqP2 qYTbl90hHkmsLYZuvJCEunRPsEbA+8r27HzWZ7E8SWVUZh4uqEJ41uHIl w=; Authentication-Results: esa4.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: MSGSmPs3sYGlLB0PaYCu5K2FfYtM/L7Y1zJapIZGEUvAxPLOzU3z1C2XjFIfLaXLfMbViOphRD HFpK2W+jh7KnPdCBDQtLakIdbpAWG3JWtWLNcKPWQ6A0+Iy7bCb8t1k9hdX4Ted/ONBAMP7wRA /2xWFIQdL3pGh16FxUw7xublwYqoQOzauqaM1aYRjLtzl0mYLZNSPeytohXYuw/qf3O6fDgkcb dDrH70nUHLOUCaLpbBpq+2VqqBGNqGyeO0ivMaWvhUXV2Sg7mFWTGHdwMudBXh/lXkXh0oH8Ph vwg= X-SBRS: 2.7 X-MesageID: 15575933 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15575933" From: Anthony PERARD To: Subject: [XEN PATCH v4 01/18] xen/arm: Rename all early printk macro Date: Tue, 31 Mar 2020 11:30:45 +0100 Message-ID: <20200331103102.1105674-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Anthony PERARD , Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We are going to move the generation of the early printk macro into Kconfig. This means all macro will be prefix with CONFIG_. We do that ahead of the change. We also take the opportunity to better name some variables, which are used by only one driver and wouldn't make sens for other UART driver. Thus, - EARLY_UART_REG_SHIFT became CONFIG_EARLY_UART_8250_REG_SHIFT - EARLY_PRINTK_VERSION_* became CONFIG_EARLY_UART_SCIF_VERSION_* The other variables are change to have the prefix CONFIG_EARLY_UART_ when they change a parameter of the driver. So we have now: - CONFIG_EARLY_UART_BAUD_RATE - CONFIG_EARLY_UART_BASE_ADDRESS - CONFIG_EARLY_UART_INIT Signed-off-by: Anthony PERARD Acked-by: Julien Grall Tested-by: Stefano Stabellini --- Notes: v4: - cleanup in head.S, removing extra () and space =20 Patch v3 and early where in "xen/arm: Configure early printk via Kconfig" series. =20 v3: - Revert the renaming of EARLY_PRINTK to CONFIG_EARLY_PRINTK in the makefiles, as this doesn't work well with user provided CONFIG_EARLY_PRINTK. This is done in the following patch instead. =20 - rename CONFIG_EARLY_UART_BAUD_RATE to CONFIG_EARLY_UART_PL011_BAUD_RA= TE xen/arch/arm/Rules.mk | 14 +++++++------- xen/arch/arm/arm32/debug-8250.inc | 2 +- xen/arch/arm/arm32/debug-pl011.inc | 4 ++-- xen/arch/arm/arm32/debug-scif.inc | 4 ++-- xen/arch/arm/arm32/debug.S | 4 ++-- xen/arch/arm/arm32/head.S | 10 +++++----- xen/arch/arm/arm64/debug-8250.inc | 4 ++-- xen/arch/arm/arm64/debug-pl011.inc | 4 ++-- xen/arch/arm/arm64/debug.S | 4 ++-- xen/arch/arm/arm64/head.S | 10 +++++----- xen/include/asm-arm/early_printk.h | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index 022a3a6f82ba..faa09ea111ec 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -66,9 +66,9 @@ endif endif ifeq ($(EARLY_PRINTK_INC),scif) ifneq ($(word 3,$(EARLY_PRINTK_CFG)),) -CFLAGS-y +=3D -DEARLY_PRINTK_VERSION_$(word 3,$(EARLY_PRINTK_CFG)) +CFLAGS-y +=3D -DCONFIG_EARLY_UART_SCIF_VERSION_$(word 3,$(EARLY_PRINTK_CFG= )) else -CFLAGS-y +=3D -DEARLY_PRINTK_VERSION_NONE +CFLAGS-y +=3D -DCONFIG_EARLY_UART_SCIF_VERSION_NONE endif endif =20 @@ -77,11 +77,11 @@ EARLY_PRINTK :=3D y endif =20 CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_PRINTK -CFLAGS-$(EARLY_PRINTK_INIT_UART) +=3D -DEARLY_PRINTK_INIT_UART -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_PRINTK_INC=3D\"debug-$(EARLY_PRINTK_IN= C).inc\" -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_PRINTK_BAUD=3D$(EARLY_PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_UART_BASE_ADDRESS=3D$(EARLY_UART_BASE_= ADDRESS) -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_UART_REG_SHIFT=3D$(EARLY_UART_REG_SHIF= T) +CFLAGS-$(EARLY_PRINTK_INIT_UART) +=3D -DCONFIG_EARLY_UART_INIT +CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_PRINTK_INC=3D\"debug-$(EARLY_PR= INTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_UART_PL011_BAUD_RATE=3D$(EARLY_= PRINTK_BAUD) +CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_UART_BASE_ADDRESS=3D$(EARLY_UAR= T_BASE_ADDRESS) +CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_UART_8250_REG_SHIFT=3D$(EARLY_U= ART_REG_SHIFT) =20 else # !CONFIG_DEBUG =20 diff --git a/xen/arch/arm/arm32/debug-8250.inc b/xen/arch/arm/arm32/debug-8= 250.inc index 0759a27ee157..c47e8be4aaf3 100644 --- a/xen/arch/arm/arm32/debug-8250.inc +++ b/xen/arch/arm/arm32/debug-8250.inc @@ -23,7 +23,7 @@ */ .macro early_uart_ready rb rc 1: - ldr \rc, [\rb, #(UART_LSR << EARLY_UART_REG_SHIFT)] /* Read LS= R */ + ldr \rc, [\rb, #(UART_LSR << CONFIG_EARLY_UART_8250_REG_SHIFT)= ] /* Read LSR */ tst \rc, #UART_LSR_THRE /* Check Xmit holding register fla= g */ beq 1b /* Wait for the UART to be read= y */ .endm diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-= pl011.inc index ec462eabab5c..214f68dc95bd 100644 --- a/xen/arch/arm/arm32/debug-pl011.inc +++ b/xen/arch/arm/arm32/debug-pl011.inc @@ -25,9 +25,9 @@ * rd: scratch register 2 (unused here) */ .macro early_uart_init rb, rc, rd - mov \rc, #(7372800 / EARLY_PRINTK_BAUD % 16) + mov \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE % 16) str \rc, [\rb, #FBRD] /* -> UARTFBRD (Baud divisor fraction)= */ - mov \rc, #(7372800 / EARLY_PRINTK_BAUD / 16) + mov \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16) str \rc, [\rb, #IBRD] /* -> UARTIBRD (Baud divisor integer) = */ mov \rc, #0x60 /* 8n1 */ str \rc, [\rb, #LCR_H] /* -> UARTLCR_H (Line control) */ diff --git a/xen/arch/arm/arm32/debug-scif.inc b/xen/arch/arm/arm32/debug-s= cif.inc index 3f01c909c238..b2b82501e792 100644 --- a/xen/arch/arm/arm32/debug-scif.inc +++ b/xen/arch/arm/arm32/debug-scif.inc @@ -19,10 +19,10 @@ =20 #include =20 -#ifdef EARLY_PRINTK_VERSION_NONE +#ifdef CONFIG_EARLY_UART_SCIF_VERSION_NONE #define STATUS_REG SCIF_SCFSR #define TX_FIFO_REG SCIF_SCFTDR -#elif EARLY_PRINTK_VERSION_A +#elif CONFIG_EARLY_UART_SCIF_VERSION_A #define STATUS_REG SCIFA_SCASSR #define TX_FIFO_REG SCIFA_SCAFTDR #endif diff --git a/xen/arch/arm/arm32/debug.S b/xen/arch/arm/arm32/debug.S index 1829b29915e0..e77c76d0debc 100644 --- a/xen/arch/arm/arm32/debug.S +++ b/xen/arch/arm/arm32/debug.S @@ -19,8 +19,8 @@ =20 #include =20 -#ifdef EARLY_PRINTK_INC -#include EARLY_PRINTK_INC +#if defined (CONFIG_EARLY_PRINTK_INC) +#include CONFIG_EARLY_PRINTK_INC #endif =20 /* diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index e9d356f05c2b..c404fa973e9b 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -36,8 +36,8 @@ #define XEN_FIRST_SLOT first_table_offset(XEN_VIRT_START) #define XEN_SECOND_SLOT second_table_offset(XEN_VIRT_START) =20 -#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) -#include EARLY_PRINTK_INC +#if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_EARLY_PRINTK_INC) +#include CONFIG_EARLY_PRINTK_INC #endif =20 /* @@ -223,7 +223,7 @@ GLOBAL(init_secondary) 1: =20 #ifdef CONFIG_EARLY_PRINTK - mov_w r11, EARLY_UART_BASE_ADDRESS /* r11 :=3D UART base address= */ + mov_w r11, CONFIG_EARLY_UART_BASE_ADDRESS /* r11 :=3D UART base = address */ PRINT("- CPU ") print_reg r7 PRINT(" booting -\r\n") @@ -706,8 +706,8 @@ ENTRY(switch_ttbr) * Clobbers r0 - r3 */ init_uart: - mov_w r11, EARLY_UART_BASE_ADDRESS -#ifdef EARLY_PRINTK_INIT_UART + mov_w r11, CONFIG_EARLY_UART_BASE_ADDRESS +#ifdef CONFIG_EARLY_UART_INIT early_uart_init r11, r1, r2 #endif PRINT("- UART enabled -\r\n") diff --git a/xen/arch/arm/arm64/debug-8250.inc b/xen/arch/arm/arm64/debug-8= 250.inc index 53d6828bfafe..30ea13077e22 100644 --- a/xen/arch/arm/arm64/debug-8250.inc +++ b/xen/arch/arm/arm64/debug-8250.inc @@ -25,7 +25,7 @@ */ .macro early_uart_ready xb c 1: - ldrb w\c, [\xb, #UART_LSR << EARLY_UART_REG_SHIFT] + ldrb w\c, [\xb, #UART_LSR << CONFIG_EARLY_UART_8250_REG_SHIFT] and w\c, w\c, #UART_LSR_THRE cmp w\c, #UART_LSR_THRE b.ne 1b @@ -38,7 +38,7 @@ */ .macro early_uart_transmit xb wt /* UART_THR transmit holding */ - strb \wt, [\xb, #UART_THR << EARLY_UART_REG_SHIFT] + strb \wt, [\xb, #UART_THR << CONFIG_EARLY_UART_8250_REG_SHIFT] .endm =20 /* diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-= pl011.inc index 569c3dfbcf47..385deff49b1b 100644 --- a/xen/arch/arm/arm64/debug-pl011.inc +++ b/xen/arch/arm/arm64/debug-pl011.inc @@ -24,9 +24,9 @@ * c: scratch register number */ .macro early_uart_init xb, c - mov x\c, #(7372800 / EARLY_PRINTK_BAUD % 16) + mov x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE % 16) strh w\c, [\xb, #0x28] /* -> UARTFBRD (Baud divisor fraction= ) */ - mov x\c, #(7372800 / EARLY_PRINTK_BAUD / 16) + mov x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16) strh w\c, [\xb, #0x24] /* -> UARTIBRD (Baud divisor integer)= */ mov x\c, #0x60 /* 8n1 */ str w\c, [\xb, #0x2C] /* -> UARTLCR_H (Line control) */ diff --git a/xen/arch/arm/arm64/debug.S b/xen/arch/arm/arm64/debug.S index b7f53ac0519b..71cad9d762b2 100644 --- a/xen/arch/arm/arm64/debug.S +++ b/xen/arch/arm/arm64/debug.S @@ -19,8 +19,8 @@ =20 #include =20 -#ifdef EARLY_PRINTK_INC -#include EARLY_PRINTK_INC +#ifdef CONFIG_EARLY_PRINTK_INC +#include CONFIG_EARLY_PRINTK_INC #endif =20 /* diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index e5015f93a2d8..5d44667bd89d 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -45,8 +45,8 @@ #define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \ (__HEAD_FLAG_PHYS_BASE << 3)) =20 -#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) -#include EARLY_PRINTK_INC +#if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_EARLY_PRINTK_INC) +#include CONFIG_EARLY_PRINTK_INC #endif =20 /* @@ -363,7 +363,7 @@ GLOBAL(init_secondary) 1: =20 #ifdef CONFIG_EARLY_PRINTK - ldr x23, =3DEARLY_UART_BASE_ADDRESS /* x23 :=3D UART base addres= s */ + ldr x23, =3DCONFIG_EARLY_UART_BASE_ADDRESS /* x23 :=3D UART base= address */ PRINT("- CPU ") print_reg x24 PRINT(" booting -\r\n") @@ -843,8 +843,8 @@ ENTRY(switch_ttbr) * Clobbers x0 - x1 */ init_uart: - ldr x23, =3DEARLY_UART_BASE_ADDRESS -#ifdef EARLY_PRINTK_INIT_UART + ldr x23, =3DCONFIG_EARLY_UART_BASE_ADDRESS +#ifdef CONFIG_EARLY_UART_INIT early_uart_init x23, 0 #endif PRINT("- UART enabled -\r\n") diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/asm-arm/early= _printk.h index 078cf701dcb0..d5485decfa9f 100644 --- a/xen/include/asm-arm/early_printk.h +++ b/xen/include/asm-arm/early_printk.h @@ -15,7 +15,7 @@ =20 /* need to add the uart address offset in page to the fixmap address */ #define EARLY_UART_VIRTUAL_ADDRESS \ - (FIXMAP_ADDR(FIXMAP_CONSOLE) +(EARLY_UART_BASE_ADDRESS & ~PAGE_MASK)) + (FIXMAP_ADDR(FIXMAP_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE= _MASK)) =20 #endif /* !CONFIG_EARLY_PRINTK */ =20 --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650750; cv=none; d=zohomail.com; s=zohoarc; b=L4z8Kn6nZ1l/HBpjnnbySXnKBLTIqgEY0fLUNMaJmQdn54aXGXA705u3MSe3vVqJ47OXYclMN82un3g9TaikaTMzYTxB84+l0khY24BGeyUXjDZKP8wBBFvx+75dvh/pZdfRNGUGUfMd5KZgXHeVidzr+cfNA2OZtUUwoB6x5bA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wI5zgFdGlFhpQl+d94a8AYJJOCRaD1oSzwz7GEaqP48=; b=BZkE23MC5i9ETSENCpjLxMXdH/+ynv/7lZvmkwv7PrjG7kLvLadh1IYs3Uoy6jTjw59N9HXZQV/RgvKASfTTRK6G8Mf1xvzDVNnDkh4IC1jNIiwYaur9tO4oX9sJwWG9NpTqm3sums3j/YlK7+WV2gVed0827MaPX8B8BUa8Xq4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650750766897.6266506862836; Tue, 31 Mar 2020 03:32:30 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBQ-0001Cm-Oz; Tue, 31 Mar 2020 10:31:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBP-0001BY-4a for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:47 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d09690aa-733a-11ea-b58d-bc764e2007e4; Tue, 31 Mar 2020 10:31:43 +0000 (UTC) X-Inumbo-ID: d09690aa-733a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sNgjHBk2Ub9IV5dX5PmvAFWim3DFw38IPkUQjM0l93c=; b=I4Kd1X0uJO2xpQaX7MMXMDLVOePWTujn1OzsbmaZLSyg05eau26Sc5XC +pheXhoF3DWhOI0JtoyyQMd+eYqWE+K4ocxHEv8Tv9mUThcm3aKVbryAW TynD7WHQH4iZmQBh9/en9k442RCUa0IY5dXV4c7+uBtd2PjPA1iAZS54J Y=; Authentication-Results: esa4.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 692EqEhhPsuERZf0Poxx/kmYoGw34xlGaKjCd20ldW8qDo4arAil8LoweShxL8HG79HI5qlrLg xJhJnaPk+UkAYXA2x2jNiswXD80lLor1s55A372K9dsohDUOF42Y0FR2hCiWaDtCXHkCAcP/l3 rO70+c1N9Krv4wXW8RbCdcp5SYuZD/zigYoirFsMeVjDy5/72k5Iaav+LLZ6l7I7TiLz9C25gK tB5eno24l5Yd9O+uW97SKGzDYyc7rK0bZ/zHVLU56RuUwAvK2mCfTiWCUym5CacKGLSW37oNmq NjI= X-SBRS: 2.7 X-MesageID: 15575941 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15575941" From: Anthony PERARD To: Subject: [XEN PATCH v4 02/18] xen/arm: Configure early printk via Kconfig Date: Tue, 31 Mar 2020 11:30:46 +0100 Message-ID: <20200331103102.1105674-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Julien Grall , Jan Beulich , Anthony PERARD , Samuel Thibault , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor. Furthermore, early printk is one of the few odds one that are not using Kconfig. So this is about time to move it to Kconfig. The new kconfigs options allow a user to eather select a UART driver to use at boot time, and set the parameters, or it is still possible to select a platform which will set the parameters. If CONFIG_EARLY_PRINTK is present in the environment or on the make command line, make will return an error. Signed-off-by: Julien Grall Signed-off-by: Anthony PERARD Tested-by: Stefano Stabellini Reviewed-by: Julien Grall --- Notes: v4: - Add range to EARLY_UART_BASE_ADDRESS so that kconfig won't accept address higher than 4G on ARM_32 - have EARLY_PRINTK_THUNDERX depends on ARM_64 because the default base address is above 4G - Add deprecation warning to the help of the choice of early printk driver/platform. - in early-printk.txt, add that early printk is available with EXPERT. =20 Patch v3 and early where in "xen/arm: Configure early printk via Kconfig" series. =20 v3: - rename EARLY_PRINK to CONFIG_EARLY_PRINTK in makefile here (which select which object to build). - rename EARLY_UART_BAUD_RATE to EARLY_UART_PL011_BAUD_RATE - typos - drop the list of aliases in early-printk.txt. Kconfig choice menu should be enough. - reword early-printk.txt. - rework how EARLY_PRINTK is set to Y and use that instead of a list of all EARLY_UART_* - Add a check to ask user to use Kconfig to set early printk. - rework the possible choice to have all uart driver and platform specific option together. - have added or reword prompt and help messages of the different options. The platform specific option don't have extended help, the prompt is probably enough. (The non-platform specific options have the help message that Julien have written in the first version.) - have made EARLY_UART_INIT dependent on the value of EARLY_UART_PL011_BAUD_RATE so that there is no need to expose _INIT to users. docs/misc/arm/early-printk.txt | 71 ++--- xen/Kconfig.debug | 2 + xen/arch/arm/Kconfig.debug | 289 ++++++++++++++++++ xen/arch/arm/Makefile | 2 +- xen/arch/arm/Rules.mk | 74 +---- xen/arch/arm/arm32/Makefile | 2 +- xen/arch/arm/arm64/Makefile | 2 +- .../minios.cfg =3D> xen/arch/x86/Kconfig.debug | 0 8 files changed, 319 insertions(+), 123 deletions(-) create mode 100644 xen/arch/arm/Kconfig.debug copy stubdom/c/minios.cfg =3D> xen/arch/x86/Kconfig.debug (100%) diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt index 89e081e51eaf..aa22826075a4 100644 --- a/docs/misc/arm/early-printk.txt +++ b/docs/misc/arm/early-printk.txt @@ -1,64 +1,39 @@ How to enable early printk =20 -Early printk can only be enabled if debug=3Dy. You may want to enable it if -you are debbuging code that executes before the console is initialized. +Early printk can only be enabled if CONFIG_DEBUG=3Dy or in EXPERT mode. You +may want to enable it if you are debugging code that executes before the +console is initialized. =20 Note that selecting this option will limit Xen to a single UART definition. Attempting to boot Xen image on a different platform *will not work*, so t= his option should not be enable for Xens that are intended to be portable. =20 -CONFIG_EARLY_PRINTK=3D,, +Select one of the "Early printk via * UART" in the choice possible for +"Early printk" in the "Debugging options" of Kconfig. You will then need to +set other options, which depends on the driver selected. =20 - and are mandatory arguments: +CONFIG_EARLY_UART_BASE_ADDRESS is a mandatory argument, it is the base +physical address of the UART to use. =20 - - is the name of the driver, see xen/arch/arm/arm{32,64}/debug-*.i= nc - (where corresponds to the wildcarded *). - - is the base physical address of the UART to use +Other options depends on the driver selected: + - 8250 + - CONFIG_EARLY_UART_8250_REG_SHIFT is, optionally, the left-shift to + apply to the register offsets within the uart. + - pl011 + - CONFIG_EARLY_UART_PL011_BAUD_RATE is, optionally, a baud rate which + should be used to configure the UART at start of day. =20 - varies depending on : + If CONFIG_EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will + not try to initialize the UART, so that bootloader or firmware + settings can be used for maximum compatibility. + - scif + - CONFIG_EARLY_UART_SCIF_VERSION_* is, optionally, the interface versi= on + of the UART. Default to version NONE. =20 - - 8250,, - - is, optionally, the left-shift to apply to the - register offsets within the uart. - - pl011,, - - is, optionally a baud rate which should be used to - configure the UART at start of day. - - If is not given then the code will not try to - initialize the UART, so that bootloader or firmware settings can - be used for maximum compatibility. - - scif,, - - SCIF is, optionally, the interface version of the UART. - - If is not given then the default interface version (SCIF) - will be used. - For all other uarts there are no additional options. =20 As a convenience it is also possible to select from a list of -predefined configurations using CONFIG_EARLY_PRINTK=3Dmach where mach is -the name of the machine: - - - brcm: printk with 8250 on Broadcom 7445D0 boards with A15 processors. - - dra7: printk with 8250 on DRA7 platform - - exynos5250: printk with the second UART - - fastmodel: printk on ARM Fastmodel software emulators - - hikey960: printk with pl011 with Hikey 960 - - juno: printk with pl011 on Juno platform - - lager: printk with SCIF0 on Renesas Lager board (R-Car H2 processor) - - midway: printk with the pl011 on Calxeda Midway processors - - mvebu: printk with the MVEBU for Marvell Armada 3700 SoCs - - omap5432: printk with UART3 on TI OMAP5432 processors - - rcar3: printk with SCIF2 on Renesas R-Car Gen3 processors - - seattle: printk with pl011 for AMD Seattle processor - - sun6i: printk with 8250 on Allwinner A31 processors - - sun7i: printk with 8250 on Allwinner A20 processors - - thunderx: printk with pl011 for Cavium ThunderX processor - - vexpress: printk with pl011 for versatile express - - xgene-mcdivitt: printk with 820 on Xgene mcdivitt platform - - xgene-storm: printk with 820 on Xgene storm platform - - zynqmp: printk with Cadence UART for Xilinx ZynqMP SoCs - -These settings are is hardcoded in xen/arch/arm/Rules.mk, -see there when adding support for new machines. +predefined configurations available in the list of choice for "Early +printk" for specific platform. =20 By default early printk is disabled. diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index b3511e81a275..ee6ee33b69be 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -128,6 +128,8 @@ config XMEM_POOL_POISON Poison free blocks with 0xAA bytes and verify them when a block is allocated in order to spot use-after-free issues. =20 +source "arch/$(SRCARCH)/Kconfig.debug" + endif # DEBUG || EXPERT =20 endmenu diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug new file mode 100644 index 000000000000..35ccd132732b --- /dev/null +++ b/xen/arch/arm/Kconfig.debug @@ -0,0 +1,289 @@ +choice + bool "Early printk" + optional + help + You may want to enable early printk if you are debugging code + that executes before the console is initialized. + + Note that selecting this option will limit Xen to a single UART + definition. Attempting to boot Xen image on a different + platform *will not work*, so this option should not be enable + for Xens that are intended to be portable. + + Choose one of the UART drivers for early printk, then you'll + have to specify the parameters, like the base address. + + Deprecated: Alternatively, there are platform specific options + which will have default values for the various parameters. But + such option will soon be removed. + + config EARLY_UART_CHOICE_8250 + select EARLY_UART_8250 + bool "Early printk via 8250 UART" + help + Say Y here if you wish the early printk to direct their + output to a 8250 UART. You can use this option to + provide the parameters for the 8250 UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + config EARLY_UART_CHOICE_CADENCE + select EARLY_UART_CADENCE + depends on ARM_64 + bool "Early printk via Cadence UART" + help + Say Y here if you wish the early printk to direct their + output to a Cadence UART. You can use this option to + provide the parameters for the Cadence UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + config EARLY_UART_CHOICE_EXYNOS4210 + select EARLY_UART_EXYNOS4210 + depends on ARM_32 + bool "Early printk via Exynos4210 UART" + help + Say Y here if you wish the early printk to direct their + output to a Exynos 4210 UART. You can use this option to + provide the parameters for the Exynos 4210 UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + config EARLY_UART_CHOICE_MESON + select EARLY_UART_MESON + depends on ARM_64 + bool "Early printk via MESON UART" + help + Say Y here if you wish the early printk to direct their + output to a MESON UART. You can use this option to + provide the parameters for the MESON UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + config EARLY_UART_CHOICE_MVEBU + select EARLY_UART_MVEBU + depends on ARM_64 + bool "Early printk via MVEBU UART" + help + Say Y here if you wish the early printk to direct their + output to a MVEBU UART. You can use this option to + provide the parameters for the MVEBU UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + config EARLY_UART_CHOICE_PL011 + select EARLY_UART_PL011 + bool "Early printk via PL011 UART" + help + Say Y here if you wish the early printk to direct their + output to a PL011 UART. You can use this option to + provide the parameters for the PL011 UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + config EARLY_UART_CHOICE_SCIF + select EARLY_UART_SCIF + bool "Early printk via SCIF UART" + help + Say Y here if you wish the early printk to direct their + output to a SCIF UART. You can use this option to + provide the parameters for the SCIF UART rather than + selecting one of the platform specific options below if + you know the parameters for the port. + + This option is preferred over the platform specific + options; the platform specific options are deprecated + and will soon be removed. + + config EARLY_PRINTK_BRCM + bool "Early printk with 8250 on Broadcom 7445D0 boards with A15 processo= rs" + select EARLY_UART_8250 + config EARLY_PRINTK_DRA7 + bool "Early printk with 8250 on DRA7 platform" + select EARLY_UART_8250 + config EARLY_PRINTK_EXYNOS5250 + bool "Early printk with the second UART on Exynos5250" + select EARLY_UART_EXYNOS4210 + depends on ARM_32 + config EARLY_PRINTK_FASTMODEL + bool "Early printk with pl011 on ARM Fastmodel software emulators" + select EARLY_UART_PL011 + config EARLY_PRINTK_HIKEY960 + bool "Early printk with pl011 with Hikey 960" + select EARLY_UART_PL011 + config EARLY_PRINTK_JUNO + bool "Early printk with pl011 on Juno platform" + select EARLY_UART_PL011 + config EARLY_PRINTK_LAGER + bool "Early printk with SCIF0 on Renesas Lager board (R-Car H2 processor= )" + select EARLY_UART_SCIF + config EARLY_PRINTK_MIDWAY + bool "Early printk with pl011 on Calxeda Midway processors" + select EARLY_UART_PL011 + config EARLY_PRINTK_MVEBU + bool "Early printk with MVEBU for Marvell Armada 3700 SoCs" + select EARLY_UART_MVEBU + depends on ARM_64 + config EARLY_PRINTK_OMAP5432 + bool "Early printk with UART3 on TI OMAP5432 processors" + select EARLY_UART_8250 + config EARLY_PRINTK_RCAR3 + bool "Early printk with SCIF2 on Renesas R-Car Gen3 processors" + select EARLY_UART_SCIF + config EARLY_PRINTK_SEATTLE + bool "Early printk with pl011 for AMD Seattle processor" + select EARLY_UART_PL011 + config EARLY_PRINTK_SUN6I + bool "Early printk with 8250 on Allwinner A31 processors" + select EARLY_UART_8250 + config EARLY_PRINTK_SUN7I + bool "Early printk with 8250 on Allwinner A20 processors" + select EARLY_UART_8250 + config EARLY_PRINTK_THUNDERX + bool "Early printk with pl011 for Cavium ThunderX processor" + select EARLY_UART_PL011 + depends on ARM_64 + config EARLY_PRINTK_VEXPRESS + bool "Early printk with pl011 for versatile express" + select EARLY_UART_PL011 + config EARLY_PRINTK_XGENE_MCDIVITT + bool "Early printk with 820 on Xgene mcdivitt platform" + select EARLY_UART_8250 + config EARLY_PRINTK_XGENE_STORM + bool "Early printk with 820 on Xgene storm platform" + select EARLY_UART_8250 + config EARLY_PRINTK_ZYNQMP + bool "Early printk with Cadence UART for Xilinx ZynqMP SoCs" + select EARLY_UART_CADENCE + depends on ARM_64 +endchoice + + +config EARLY_UART_8250 + select EARLY_PRINTK + bool +config EARLY_UART_CADENCE + select EARLY_PRINTK + bool +config EARLY_UART_EXYNOS4210 + select EARLY_PRINTK + bool +config EARLY_UART_MESON + select EARLY_PRINTK + bool +config EARLY_UART_MVEBU + select EARLY_PRINTK + bool +config EARLY_UART_PL011 + select EARLY_PRINTK + bool +config EARLY_UART_SCIF + select EARLY_PRINTK + bool + +config EARLY_PRINTK + bool + +config EARLY_UART_BASE_ADDRESS + depends on EARLY_PRINTK + hex "Early printk, physical base address of debug UART" + range 0x0 0xffffffff if ARM_32 + default 0xF040AB00 if EARLY_PRINTK_BRCM + default 0x4806A000 if EARLY_PRINTK_DRA7 + default 0x1c090000 if EARLY_PRINTK_FASTMODEL + default 0x12c20000 if EARLY_PRINTK_EXYNOS5250 + default 0xfff32000 if EARLY_PRINTK_HIKEY960 + default 0x7ff80000 if EARLY_PRINTK_JUNO + default 0xe6e60000 if EARLY_PRINTK_LAGER + default 0xfff36000 if EARLY_PRINTK_MIDWAY + default 0xd0012000 if EARLY_PRINTK_MVEBU + default 0x48020000 if EARLY_PRINTK_OMAP5432 + default 0xe6e88000 if EARLY_PRINTK_RCAR3 + default 0xe1010000 if EARLY_PRINTK_SEATTLE + default 0x01c28000 if EARLY_PRINTK_SUN6I + default 0x01c28000 if EARLY_PRINTK_SUN7I + default 0x87e024000000 if EARLY_PRINTK_THUNDERX + default 0x1c090000 if EARLY_PRINTK_VEXPRESS + default 0x1c021000 if EARLY_PRINTK_XGENE_MCDIVITT + default 0x1c020000 if EARLY_PRINTK_XGENE_STORM + default 0xff000000 if EARLY_PRINTK_ZYNQMP + +config EARLY_UART_PL011_BAUD_RATE + depends on EARLY_UART_PL011 + int "Early printk UART baud rate for pl011" + help + Optionally sets the baud rate which should be used to configure + the UART at start of day. + + If EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will + not try to initialize the UART, so that bootloader or firmware + settings can be used for maximum compatibility. + + default 115200 if EARLY_PRINTK_FASTMODEL + default 0 + +config EARLY_UART_INIT + depends on EARLY_UART_PL011 && EARLY_UART_PL011_BAUD_RATE !=3D 0 + def_bool y + +config EARLY_UART_8250_REG_SHIFT + depends on EARLY_UART_8250 + int "Early printk, left-shift to apply to the register offsets within the= 8250 UART" + help + EARLY_UART_8250_REG_SHIFT is, optionally, the left-shift to + apply to the register offsets within the UART with early + printk. + + Default to 0. + + default 2 if EARLY_PRINTK_BRCM + default 2 if EARLY_PRINTK_DRA7 + default 2 if EARLY_PRINTK_OMAP5432 + default 2 if EARLY_PRINTK_SUN6I + default 2 if EARLY_PRINTK_SUN7I + default 2 if EARLY_PRINTK_XGENE_MCDIVITT + default 2 if EARLY_PRINTK_XGENE_STORM + default 0 + +choice EARLY_UART_SCIF_VERSION + prompt "Early printk UART SCIF interface version" + depends on EARLY_UART_SCIF + default EARLY_UART_SCIF_VERSION_NONE + help + Select the interface version of the SCIF UART. + + Select EARLY_UART_SCIF_VERSION_NONE to use the default + interface version (SCIF). + config EARLY_UART_SCIF_VERSION_NONE + bool "default SCIF UART interface" + config EARLY_UART_SCIF_VERSION_A + bool "SCIF UART interface version A" +endchoice + +config EARLY_PRINTK_INC + string + default "debug-8250.inc" if EARLY_UART_8250 + default "debug-cadence.inc" if EARLY_UART_CADENCE + default "debug-exynos4210.inc" if EARLY_UART_EXYNOS4210 + default "debug-meson.inc" if EARLY_UART_MESON + default "debug-mvebu.inc" if EARLY_UART_MVEBU + default "debug-pl011.inc" if EARLY_UART_PL011 + default "debug-scif.inc" if EARLY_UART_SCIF diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 1044c2298a05..12f92a4bd3f9 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -16,7 +16,7 @@ obj-y +=3D device.o obj-y +=3D domain.o obj-y +=3D domain_build.init.o obj-y +=3D domctl.o -obj-$(EARLY_PRINTK) +=3D early_printk.o +obj-$(CONFIG_EARLY_PRINTK) +=3D early_printk.o obj-y +=3D gic.o obj-y +=3D gic-v2.o obj-$(CONFIG_GICV3) +=3D gic-v3.o diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index faa09ea111ec..3ad284aa71a4 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -18,76 +18,6 @@ CFLAGS-$(CONFIG_ARM_32) +=3D -mcpu=3Dcortex-a15 CFLAGS-$(CONFIG_ARM_64) +=3D -mcpu=3Dgeneric CFLAGS-$(CONFIG_ARM_64) +=3D -mgeneral-regs-only # No fp registers etc =20 -EARLY_PRINTK :=3D n - -ifeq ($(CONFIG_DEBUG),y) - -# See docs/misc/arm/early-printk.txt for syntax - -EARLY_PRINTK_brcm :=3D 8250,0xF040AB00,2 -EARLY_PRINTK_dra7 :=3D 8250,0x4806A000,2 -EARLY_PRINTK_fastmodel :=3D pl011,0x1c090000,115200 -EARLY_PRINTK_exynos5250 :=3D exynos4210,0x12c20000 -EARLY_PRINTK_hikey960 :=3D pl011,0xfff32000 -EARLY_PRINTK_juno :=3D pl011,0x7ff80000 -EARLY_PRINTK_lager :=3D scif,0xe6e60000 -EARLY_PRINTK_midway :=3D pl011,0xfff36000 -EARLY_PRINTK_mvebu :=3D mvebu,0xd0012000 -EARLY_PRINTK_omap5432 :=3D 8250,0x48020000,2 -EARLY_PRINTK_rcar3 :=3D scif,0xe6e88000 -EARLY_PRINTK_seattle :=3D pl011,0xe1010000 -EARLY_PRINTK_sun6i :=3D 8250,0x01c28000,2 -EARLY_PRINTK_sun7i :=3D 8250,0x01c28000,2 -EARLY_PRINTK_thunderx :=3D pl011,0x87e024000000 -EARLY_PRINTK_vexpress :=3D pl011,0x1c090000 -EARLY_PRINTK_xgene-mcdivitt :=3D 8250,0x1c021000,2 -EARLY_PRINTK_xgene-storm :=3D 8250,0x1c020000,2 -EARLY_PRINTK_zynqmp :=3D cadence,0xff000000 - -ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),) -EARLY_PRINTK_CFG :=3D $(subst $(comma), ,$(EARLY_PRINTK_$(CONFIG_EARLY_PRI= NTK))) -else -EARLY_PRINTK_CFG :=3D $(subst $(comma), ,$(CONFIG_EARLY_PRINTK)) -endif - -# Extract configuration from string -EARLY_PRINTK_INC :=3D $(word 1,$(EARLY_PRINTK_CFG)) -EARLY_UART_BASE_ADDRESS :=3D $(word 2,$(EARLY_PRINTK_CFG)) - -# UART specific options -ifeq ($(EARLY_PRINTK_INC),8250) -EARLY_UART_REG_SHIFT :=3D $(word 3,$(EARLY_PRINTK_CFG)) -endif -ifeq ($(EARLY_PRINTK_INC),pl011) -ifneq ($(word 3,$(EARLY_PRINTK_CFG)),) -EARLY_PRINTK_INIT_UART :=3D y -EARLY_PRINTK_BAUD :=3D $(word 3,$(EARLY_PRINTK_CFG)) -endif -endif -ifeq ($(EARLY_PRINTK_INC),scif) -ifneq ($(word 3,$(EARLY_PRINTK_CFG)),) -CFLAGS-y +=3D -DCONFIG_EARLY_UART_SCIF_VERSION_$(word 3,$(EARLY_PRINTK_CFG= )) -else -CFLAGS-y +=3D -DCONFIG_EARLY_UART_SCIF_VERSION_NONE -endif -endif - -ifneq ($(EARLY_PRINTK_INC),) -EARLY_PRINTK :=3D y -endif - -CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_PRINTK -CFLAGS-$(EARLY_PRINTK_INIT_UART) +=3D -DCONFIG_EARLY_UART_INIT -CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_PRINTK_INC=3D\"debug-$(EARLY_PR= INTK_INC).inc\" -CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_UART_PL011_BAUD_RATE=3D$(EARLY_= PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_UART_BASE_ADDRESS=3D$(EARLY_UAR= T_BASE_ADDRESS) -CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_UART_8250_REG_SHIFT=3D$(EARLY_U= ART_REG_SHIFT) - -else # !CONFIG_DEBUG - -ifneq ($(CONFIG_EARLY_PRINTK),) -# Early printk is dependant on a debug build. -$(error CONFIG_EARLY_PRINTK enabled for non-debug build) -endif - +ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),) + $(error You must use 'make menuconfig' to enable/disable early printk = now) endif diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile index 539bbef298a7..96105d238307 100644 --- a/xen/arch/arm/arm32/Makefile +++ b/xen/arch/arm/arm32/Makefile @@ -1,6 +1,6 @@ obj-y +=3D lib/ =20 -obj-$(EARLY_PRINTK) +=3D debug.o +obj-$(CONFIG_EARLY_PRINTK) +=3D debug.o obj-y +=3D domctl.o obj-y +=3D domain.o obj-y +=3D entry.o diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile index db8565b71a33..40642ff57494 100644 --- a/xen/arch/arm/arm64/Makefile +++ b/xen/arch/arm/arm64/Makefile @@ -2,7 +2,7 @@ obj-y +=3D lib/ =20 obj-y +=3D cache.o obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) +=3D bpi.o -obj-$(EARLY_PRINTK) +=3D debug.o +obj-$(CONFIG_EARLY_PRINTK) +=3D debug.o obj-y +=3D domctl.o obj-y +=3D domain.o obj-y +=3D entry.o diff --git a/stubdom/c/minios.cfg b/xen/arch/x86/Kconfig.debug similarity index 100% copy from stubdom/c/minios.cfg copy to xen/arch/x86/Kconfig.debug --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650735; cv=none; d=zohomail.com; s=zohoarc; b=TWwNAJo/I7dYFNjIziaxIT6sv1PqFh6UpdXqAPHEeWb0qBPDM9jKGi1nQwJRNQ03nfPqHrpTaiYe/IanklA2MLkjto+gtScNFYC2UWn0SV151ygwm5B61sc3ZAzoTi0a/KGsj/sREQpcuOGdxWLgYwajsDsYoU9pKxYDXSiBThQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650735; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+yjm5qBjNMub4gnXIry+xcr2VSy+rffmsnw/LzAavJc=; b=OudD+tDcsvmjFYf5mGJIfr70lcU1JxG/4uXs6t5hnLx9cFoqxeW1NHWePjdAUx/RBmP3hBi+hSeQbvhKyeT9JG80T+xVosFxZL9eue7a4yIY+sdg6Agl4Do/kk4+P91A7A4rb7PuU29l6DP+bNoLx+BQm+JFbdZymlUk7UIJV7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650735435700.7929680592199; Tue, 31 Mar 2020 03:32:15 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBM-00019Y-VS; Tue, 31 Mar 2020 10:31:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBL-00018n-By for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:43 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cff915aa-733a-11ea-b58d-bc764e2007e4; Tue, 31 Mar 2020 10:31:42 +0000 (UTC) X-Inumbo-ID: cff915aa-733a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650702; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qGmk9lWzyjZ3W046CwcY92BlKqx7jNo/u56lSdPKuD8=; b=M+V2fjk9zAZojQK1gYCDZup4XKIyiANvzkQw0MeNFlIkQwggw5aYjk0g RVf93WSAp+HbBdtwHACE9EUd88ORscQahRFufz7x3hn3x0aMsSJD7erDO Mue57TK3hQH8MEWGyHl5oMZz1WyVqFos4vsIIq3quUnX8UWs1iwpIpiWt Y=; Authentication-Results: esa4.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Q41Dgutv3UEMP88hLbqoHIPWRjZelnChWC4N+3EKHIT6I0hWP4gjOXSYkV2hG1vXayO2aBa5De 7KYkWz1603oCA61DLY5/tH+OuQ/Embk7DrkvzHLAGJDrAlMTIKLzfVHMWjFEtUOK6yDWjlmB/Y l1wxfiXxwRRuhcwW1b7rrGzdKErtk6Nxz9MNyvh3oHBt+isru6PU09DExd8WRRSzaCShqGyjYi KQ9CzNrFnasj9Rhjm3AxU83Vqd3uaHHzoPBOHP3r1soXM0ti6tlVJDNyTNFzrfuyNAMTbqyS8N g2I= X-SBRS: 2.7 X-MesageID: 15575940 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15575940" From: Anthony PERARD To: Subject: [XEN PATCH v4 03/18] build,arm: Fix deps check of head.o Date: Tue, 31 Mar 2020 11:30:47 +0100 Message-ID: <20200331103102.1105674-4-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Anthony PERARD , Volodymyr Babchuk , Stefano Stabellini , Julien Grall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" arm*/head.o isn't in obj-y or extra-y, so make don't load the associated .*.d file (or .*.cmd file when if_changed will be used). There is a workaround where .*.d file is added manually into DEPS. Changing DEPS isn't needed, we can simply add head.o into extra-y and the dependency files will be loaded. Signed-off-by: Anthony PERARD Acked-by: Julien Grall --- Notes: v4: - new patch, fix rebuild of head.o with "xen/build: Start using if_changed" applied xen/arch/arm/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 12f92a4bd3f9..7273f356f190 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -62,6 +62,7 @@ obj-$(CONFIG_SBSA_VUART_CONSOLE) +=3D vpl011.o obj-y +=3D vsmc.o obj-y +=3D vpsci.o obj-y +=3D vuart.o +extra-y +=3D $(TARGET_SUBARCH)/head.o =20 #obj-bin-y +=3D ....o =20 @@ -72,8 +73,6 @@ endif =20 ALL_OBJS :=3D $(TARGET_SUBARCH)/head.o $(ALL_OBJS) =20 -DEPS +=3D $(TARGET_SUBARCH)/.head.o.d - ifdef CONFIG_LIVEPATCH all_symbols =3D --all-symbols ifdef CONFIG_FAST_SYMBOL_LOOKUP --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650716; cv=none; d=zohomail.com; s=zohoarc; b=Dsc89ksPbpBGZ6mbgIILBVVLfrr9OrTOZYgb4RxcTVpidcU7aQQbPuYkr94nvd4Qj58QcQqfLKAgp994qbRdoxE/qds87KJZUgToDSdeGLBt8reStbKroU6klM2uhy0oVSkNCrPPDuO6qGx5lBFH+HMtfYJ8mAv/JlTOOmlHFmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650716; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vBOhiAtIZEUD6MGQ4PfIgqdgVHfD1nG2EdwahzBOJmg=; b=ZrsV8GjIaQ8R+4zCihSyvQNMXEf8LwHDmK2y4Nf8oIO+/Do9OTGQUcqqxqp2fZRz3uUtPVvIdcJacR6lLlAC1v1EEQ4qXDiLdCWWh9p/BZ1OnpPKG+vdHOVACIhONzlW1XwSZSV48+2nxv3lYJNCXDUY1btAhDb+3/nfehHuMxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158565071636684.22647189725672; Tue, 31 Mar 2020 03:31:56 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAq-0000vP-7T; Tue, 31 Mar 2020 10:31:12 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAo-0000v9-PE for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:10 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bb7a65d5-733a-11ea-ba0c-12813bfff9fa; Tue, 31 Mar 2020 10:31:08 +0000 (UTC) X-Inumbo-ID: bb7a65d5-733a-11ea-ba0c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650669; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bHmbNn+xSjp5FPcLqfUyNkXyOAlVeYUAo2LAo99Colo=; b=Mwj+3OaEOY2ZBW/o2daYxFPGSM5dqLBB12qgqBGunILpTEKWMHGMqSke HtLR2xAmnkzrJOOadz1cN5M5ZF5alMRAPwHUMG5sYrgLbX0F9a62hskU5 FP/WbFXfKl4c7S6yjoyJGI1mMfpXThdoNFycUqD3zyg3YsVOeeaqYIiAP o=; Authentication-Results: esa1.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: DvYawsXKEXC6awT2cHsXcWfV6x//viIjD3hTAbpaqyBW4QbZWaiEAlqovsqjePmT6uGJqnJC7i uTZ8qUbmmrogWoBBAwwixf+VLqCmFo4tZhGnWrJTAX5XT2TpC6f+05e5PMBEyD704VshiPJPuq JOSbeaZ7R/dtpu9DVJANZRZrIs0hWBN4DpX6fDs9//hlLLmciZwSoGRdX5oBUGnqRm/iIS8XlJ vmGOlEWfSW7Qyu+LQ3dXANoJfy0KsgGG68Ga3PQVxsSsEtl3LJ/KLqAKcM2o+Q48H0A9vQ8da1 PQ4= X-SBRS: 2.7 X-MesageID: 15138784 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15138784" From: Anthony PERARD To: Subject: [XEN PATCH v4 04/18] xen/build: include include/config/auto.conf in main Makefile Date: Tue, 31 Mar 2020 11:30:48 +0100 Message-ID: <20200331103102.1105674-5-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We are going to generate the CFLAGS early from "xen/Makefile" instead of in "Rules.mk", but we need to include "config/auto.conf", so include it in "Makefile". Before including "config/auto.conf" we check which make target a user is calling, as some targets don't need "auto.conf". For targets that needs auto.conf, make will generate it (and a default .config if missing). root-make-done is to avoid doing the calculation again once Rules.mk takes over and is been executed with the root Makefile. When Rules.mk is including xen/Makefile, `config-build' and `need-config' are undefined so auto.conf will not be included again (it is already included by Rules.mk) and kconfig target are out of reach of Rules.mk. We are introducing a target %config to catch all targets for kconfig. So we need an extra target %/.config to prevent make from trying to regenerate $(XEN_ROOT)/.config that is included in Config.mk. The way targets are filtered is inspired by Kbuild, with some code imported from Linux. That's why there is PHONY variable that isn't used yet, for example. Signed-off-by: Anthony PERARD Reviewed-by: Jan Beulich --- Notes: v4: - check that root-make-done hasn't been set to an expected value instead of checking if it has been set at all. - Add a shorthand $(kconfig) to run kconfig targets. =20 v3: - filter only for %config instead of both config %config - keep the multi-target pattern rule trick for include/config/auto.conf instead of using Linux's newer pattern (we dont have tristate.conf so don't need to change it) - use y/n for root-make-done, config-build, need-config instead of relying on ifdef and ifndef and on assigning an empty value meaning undef - use space for indentation - explain why %/.config is suddenly needed. xen/Makefile | 98 +++++++++++++++++++++++++++++--------- xen/scripts/Kbuild.include | 5 ++ 2 files changed, 80 insertions(+), 23 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index e5f7b1ae13bc..8375070e0d41 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -49,7 +49,73 @@ default: build .PHONY: dist dist: install =20 -build install:: include/config/auto.conf + +ifneq ($(root-make-done),y) +# section to run before calling Rules.mk, but only once. +# +# To make sure we do not include .config for any of the *config targets +# catch them early, and hand them over to tools/kconfig/Makefile + +clean-targets :=3D %clean +no-dot-config-targets :=3D $(clean-targets) \ + uninstall debug cloc \ + cscope TAGS tags MAP gtags \ + xenversion + +config-build :=3D n +need-config :=3D y + +ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) + need-config :=3D n + endif +endif + +ifneq ($(filter %config,$(MAKECMDGOALS)),) + config-build :=3D y +endif + +export root-make-done :=3D y +endif # root-make-done + +include scripts/Kbuild.include + +ifeq ($(config-build),y) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D +# *config targets only - make sure prerequisites are updated, and descend +# in tools/kconfig to make the *config target + +config: FORCE + $(MAKE) $(kconfig) $@ + +# Config.mk tries to include .config file, don't try to remake it +%/.config: ; + +%config: FORCE + $(MAKE) $(kconfig) $@ + +else # !config-build + +ifeq ($(need-config),y) +include include/config/auto.conf +# Read in dependencies to all Kconfig* files, make sure to run syncconfig = if +# changes are detected. +include include/config/auto.conf.cmd + +# Allow people to just run `make` as before and not force them to configure +$(KCONFIG_CONFIG): + $(MAKE) $(kconfig) defconfig + +# The actual configuration files used during the build are stored in +# include/generated/ and include/config/. Update them if .config is newer = than +# include/config/auto.conf (which mirrors .config). +# +# This exploits the 'multi-target pattern rule' trick. +# The syncconfig should be executed only once to make all the targets. +include/config/%.conf include/config/%.conf.cmd: $(KCONFIG_CONFIG) + $(MAKE) $(kconfig) syncconfig + +endif # need-config =20 .PHONY: build install uninstall clean distclean MAP build install uninstall debug clean distclean MAP:: @@ -254,9 +320,6 @@ cscope: _MAP: $(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|= \(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map =20 -.PHONY: FORCE -FORCE: - %.o %.i %.s: %.c FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F) =20 @@ -277,25 +340,6 @@ $(foreach base,arch/x86/mm/guest_walk_% \ arch/x86/mm/shadow/guest_%, \ $(foreach ext,o i s,$(call build-intermediate,$(base).$(ext)))) =20 -kconfig :=3D oldconfig config menuconfig defconfig allyesconfig allnoconfi= g \ - nconfig xconfig gconfig savedefconfig listnewconfig olddefconfig \ - randconfig $(notdir $(wildcard arch/$(SRCARCH)/configs/*_defconfig)) -.PHONY: $(kconfig) -$(kconfig): - $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=3D$(ARCH) SRCAR= CH=3D$(SRCARCH) HOSTCC=3D"$(HOSTCC)" HOSTCXX=3D"$(HOSTCXX)" $@ - -include/config/%.conf: include/config/auto.conf.cmd $(KCONFIG_CONFIG) - $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=3D$(ARCH) SRCAR= CH=3D$(SRCARCH) HOSTCC=3D"$(HOSTCC)" HOSTCXX=3D"$(HOSTCXX)" syncconfig - -# Allow people to just run `make` as before and not force them to configure -$(KCONFIG_CONFIG): - $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=3D$(ARCH) SRCAR= CH=3D$(SRCARCH) HOSTCC=3D"$(HOSTCC)" HOSTCXX=3D"$(HOSTCXX)" defconfig - -# Break the dependency chain for the first run -include/config/auto.conf.cmd: ; - --include $(BASEDIR)/include/config/auto.conf.cmd - .PHONY: cloc cloc: $(eval tmpfile :=3D $(shell mktemp)) @@ -307,3 +351,11 @@ cloc: cloc --list-file=3D$(tmpfile) rm $(tmpfile) =20 +endif #config-build + +PHONY +=3D FORCE +FORCE: + +# Declare the contents of the PHONY variable as phony. We keep that +# information in a variable so we can use it in if_changed and friends. +.PHONY: $(PHONY) diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include index 806c68824ed5..14f68fa42868 100644 --- a/xen/scripts/Kbuild.include +++ b/xen/scripts/Kbuild.include @@ -32,3 +32,8 @@ cc-ifversion =3D $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(= 2)000 ] && echo $(3) || e # Usage: # $(MAKE) $(clean) dir clean :=3D -f $(BASEDIR)/scripts/Makefile.clean clean -C + +# Shorthand for kconfig +# Usage: +# $(MAKE) $(kconfig) target +kconfig =3D -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=3D$(ARCH) SR= CARCH=3D$(SRCARCH) HOSTCC=3D"$(HOSTCC)" HOSTCXX=3D"$(HOSTCXX)" --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650717; cv=none; d=zohomail.com; s=zohoarc; b=mMv3V8nZomtRJJ8eTJfogKcI2EhAoSVQsQbGVle6ePovuqFSbCxX+5BYMQkmfaZm3lPngoeSrHayWItPomTg4SlpnYmM+IUb7wsqhB6jherhG3gYd+Mg7799ktauk1ie9w0a5SRi22jtO7cKnA+OqPDF9lx7EJdTzJ61iPj87rY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650717; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TSdU3hw1zDwYIc9UDRLuSQ2t17LJ88jgd3erBijHrsA=; b=GKaeyEzeCiHklcWjizz84TpZbicL4/sOCPm1qmTFihigL+To2PV49kW5LdOybPG+QXZB7NpZ1eeiW+5oIVh5ObFBdjY/0YzsUOmoReLHwvkyScdUzxaxB/yNcBA32qnNmu5BFd+lAIZwusqUkSYUL/fOv27PO9GS/P8qjTcq71s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650717653446.2709805636167; Tue, 31 Mar 2020 03:31:57 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAv-0000wS-JZ; Tue, 31 Mar 2020 10:31:17 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAt-0000vy-Li for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:15 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bd184d20-733a-11ea-ba0c-12813bfff9fa; Tue, 31 Mar 2020 10:31:10 +0000 (UTC) X-Inumbo-ID: bd184d20-733a-11ea-ba0c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650671; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z9+M96E+n/Hy3z7gJKZ88aBj5n9HL0vJXghsNjxddMo=; b=gppCY4m6nUGxkyp3zbrHk0MUmzJhdWsUTzyG03uMiC3pFEGUcRiaIuh2 BhiGlFtmT2POCz1+23OwkGfSuTGKdMUS4i8ukNuES5WRpgh46/6ksEKWG LM65AmslrUvkB6UMhZIfOFpT/wuSO6Lg/qDCYmVja0EFaEvrOcOUrScDM c=; Authentication-Results: esa1.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: gm2gZRJ9f+J/hypl/Llejvy7D09o6OKigL2xnVNqz0J/SV9vsJiFfiWQJ4XIRFYCu9pVv2VgDu nQPSR3pNotCx/MApBr+qwsItuhPvSdv+xu7Sva0vNs5aqPbluswIqqOXGF19N/AIajzRMLIrS0 UDmgm0T/II7R9zW/B2fNL9ZRC0LL3BCpmwU07UbfUHc9GhpwIRCYTA+elUjuogYIDTgFMm/5lW mVY5+oQajHSh4LMSCg6PhDhZo6tL5XvB84rNjATw2t8WfCjgCAMG33T0hzj6ghbj1oxfkZ4hhv RAs= X-SBRS: 2.7 X-MesageID: 15138787 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15138787" From: Anthony PERARD To: Subject: [XEN PATCH v4 05/18] xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS) Date: Tue, 31 Mar 2020 11:30:49 +0100 Message-ID: <20200331103102.1105674-6-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Tim Deegan , Jan Beulich , Anthony PERARD , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In a later patch ("xen/build: have the root Makefile generates the CFLAGS), we want to generate the CFLAGS in xen/Makefile, then export it and have Rules.mk use a CFLAGS from the environment variables. That changes the flavor of the CFLAGS and flags intended for one target (like -D__OBJECT_FILE__ and -M%) gets propagated and duplicated. So we start by moving such flags out of $(CFLAGS) and into $(c_flags) which is to be modified by only Rules.mk. __OBJECT_FILE__ is only used by arch/x86/mm/*.c files, so having it in $(c_flags) is enough, we don't need it in $(a_flags). For include/Makefile and as-insn we can keep using CFLAGS, but since it doesn't have -M* flags anymore there is no need to filter them out. The XEN_BUILD_EFI tests in arch/x86/Makefile was filtering out CFLAGS-y, but according to dd40177c1bc8 ("x86-64/EFI: add CFLAGS to check compile"), it was done to filter out -MF. CFLAGS doesn't have those flags anymore, so no filtering is needed. This is inspired by the way Kbuild generates CFLAGS for each targets. Signed-off-by: Anthony PERARD Reviewed-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Notes: v4: - drop change in as-insn macro, and keep filtering-out -M% %.d =20 v3: - include/Makefile: Keep using CFLAGS, but since it doesn't have -M* flags anymore, no need to filter it. - Write c_flags and a_flags on a single line. - arch/x86/Makefile: remove the filter-out of dependency flags they are remove from CFLAGS anyway. (was intended to be done in xen/build: have the root Makefile generates the CFLAGS originally, move the change to this patch). - also modify as-insn as it is now xen/ only. xen/Rules.mk | 23 +++++++++++------------ xen/arch/arm/Makefile | 4 ++-- xen/arch/x86/Makefile | 6 +++--- xen/arch/x86/mm/Makefile | 6 +++--- xen/arch/x86/mm/hap/Makefile | 6 +++--- xen/arch/x86/mm/shadow/Makefile | 6 +++--- xen/include/Makefile | 2 +- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index 9079df7978a7..3408a35dbf53 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -57,7 +57,6 @@ CFLAGS +=3D -Werror -Wredundant-decls -Wno-pointer-arith $(call cc-option-add,CFLAGS,CC,-Wvla) CFLAGS +=3D -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h CFLAGS-$(CONFIG_DEBUG_INFO) +=3D -g -CFLAGS +=3D '-D__OBJECT_FILE__=3D"$@"' =20 ifneq ($(CONFIG_CC_IS_CLANG),y) # Clang doesn't understand this command line argument, and doesn't appear = to @@ -70,9 +69,6 @@ AFLAGS +=3D -D__ASSEMBLY__ =20 ALL_OBJS :=3D $(ALL_OBJS-y) =20 -# Get gcc to generate the dependencies for us. -CFLAGS-y +=3D -MMD -MP -MF $(@D)/.$(@F).d - CFLAGS +=3D $(CFLAGS-y) # allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE CFLAGS +=3D $(EXTRA_CFLAGS_XEN_CORE) @@ -146,9 +142,12 @@ endif # Always build obj-bin files as binary even if they come from C source.=20 $(obj-bin-y): CFLAGS :=3D $(filter-out -flto,$(CFLAGS)) =20 +c_flags =3D -MMD -MP -MF $(@D)/.$(@F).d $(CFLAGS) '-D__OBJECT_FILE__=3D"$@= "' +a_flags =3D -MMD -MP -MF $(@D)/.$(@F).d $(AFLAGS) + built_in.o: $(obj-y) $(extra-y) ifeq ($(obj-y),) - $(CC) $(CFLAGS) -c -x c /dev/null -o $@ + $(CC) $(c_flags) -c -x c /dev/null -o $@ else ifeq ($(CONFIG_LTO),y) $(LD_LTO) -r -o $@ $(filter-out $(extra-y),$^) @@ -159,7 +158,7 @@ endif =20 built_in_bin.o: $(obj-bin-y) $(extra-y) ifeq ($(obj-bin-y),) - $(CC) $(AFLAGS) -c -x assembler /dev/null -o $@ + $(CC) $(a_flags) -c -x assembler /dev/null -o $@ else $(LD) $(LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) endif @@ -178,7 +177,7 @@ SRCPATH :=3D $(patsubst $(BASEDIR)/%,%,$(CURDIR)) =20 %.o: %.c Makefile ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y) - $(CC) $(CFLAGS) -c $< -o $(@D)/.$(@F).tmp -MQ $@ + $(CC) $(c_flags) -c $< -o $(@D)/.$(@F).tmp -MQ $@ ifeq ($(CONFIG_CC_IS_CLANG),y) $(OBJCOPY) --redefine-sym $<=3D$(SRCPATH)/$< $(@D)/.$(@F).tmp $@ else @@ -186,11 +185,11 @@ else endif rm -f $(@D)/.$(@F).tmp else - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(c_flags) -c $< -o $@ endif =20 %.o: %.S Makefile - $(CC) $(AFLAGS) -c $< -o $@ + $(CC) $(a_flags) -c $< -o $@ =20 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name s= z rest; do \ @@ -205,12 +204,12 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): = %.init.o: %.o Makefile $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=3D= .init.$(s)) $< $@ =20 %.i: %.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) $< -o $@ + $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@ =20 %.s: %.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -S $< -o $@ + $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@ =20 %.s: %.S Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(AFLAGS)) $< -o $@ + $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ =20 -include $(DEPS_INCLUDE) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 7273f356f190..913f6cdeed3f 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -120,10 +120,10 @@ $(TARGET)-syms: prelink.o xen.lds rm -f $(@D)/.$(@F).[0-9]* =20 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c - $(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $< + $(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $< =20 xen.lds: xen.lds.S - $(CC) -P -E -Ui386 $(AFLAGS) -o $@ $< + $(CC) -P -E -Ui386 $(a_flags) -o $@ $< sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new mv -f .xen.lds.d.new .xen.lds.d =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index e954edbc2e0a..1405525105d9 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -168,7 +168,7 @@ EFI_LDFLAGS +=3D --major-os-version=3D2 --minor-os-vers= ion=3D0 EFI_LDFLAGS +=3D --major-subsystem-version=3D2 --minor-subsystem-version= =3D0 =20 # Check if the compiler supports the MS ABI. -export XEN_BUILD_EFI :=3D $(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CF= LAGS)) -c efi/check.c -o efi/check.o 2>/dev/null && echo y) +export XEN_BUILD_EFI :=3D $(shell $(CC) $(CFLAGS) -c efi/check.c -o efi/ch= eck.o 2>/dev/null && echo y) # Check if the linker supports PE. XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsyste= m=3D10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI @@ -223,7 +223,7 @@ efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.= o efi/relocs-dummy.o: $(B efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o efi/relocs-dummy.= o: ; =20 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/= asm-macros.h - $(CC) $(filter-out -Wa$(comma)% -flto,$(CFLAGS)) -S -o $@ $< + $(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -o $@ $< =20 asm-macros.i: CFLAGS +=3D -D__ASSEMBLY__ -P =20 @@ -240,7 +240,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i M= akefile =20 efi.lds: AFLAGS +=3D -DEFI xen.lds efi.lds: xen.lds.S - $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $< + $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $< sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new mv -f .$(@F).d.new .$(@F).d =20 diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile index d87dc0aa6eeb..a2431fde6bb4 100644 --- a/xen/arch/x86/mm/Makefile +++ b/xen/arch/x86/mm/Makefile @@ -12,10 +12,10 @@ obj-$(CONFIG_HVM) +=3D p2m-ept.o p2m-pod.o obj-y +=3D paging.o =20 guest_walk_%.o: guest_walk.c Makefile - $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ + $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ =20 guest_walk_%.i: guest_walk.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -DGUEST_PAGING_LEVELS=3D$* -c= $< -o $@ + $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -= c $< -o $@ =20 guest_walk_%.s: guest_walk.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -DGUEST_PAGING_LEVELS=3D$* -S = $< -o $@ + $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -S= $< -o $@ diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile index b14a9aff93d2..22e7ad54bd33 100644 --- a/xen/arch/x86/mm/hap/Makefile +++ b/xen/arch/x86/mm/hap/Makefile @@ -6,10 +6,10 @@ obj-y +=3D nested_hap.o obj-y +=3D nested_ept.o =20 guest_walk_%level.o: guest_walk.c Makefile - $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ + $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ =20 guest_walk_%level.i: guest_walk.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -DGUEST_PAGING_LEVELS=3D$* -c= $< -o $@ + $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -= c $< -o $@ =20 guest_walk_%level.s: guest_walk.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -DGUEST_PAGING_LEVELS=3D$* -S = $< -o $@ + $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -S= $< -o $@ diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makef= ile index ff03a9937f9b..23d3ff10802c 100644 --- a/xen/arch/x86/mm/shadow/Makefile +++ b/xen/arch/x86/mm/shadow/Makefile @@ -7,10 +7,10 @@ obj-y +=3D none.o endif =20 guest_%.o: multi.c Makefile - $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ + $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ =20 guest_%.i: multi.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(CFLAGS)) -DGUEST_PAGING_LEVELS=3D$* -c= $< -o $@ + $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -= c $< -o $@ =20 guest_%.s: multi.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(CFLAGS)) -DGUEST_PAGING_LEVELS=3D$* -S = $< -o $@ + $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -S= $< -o $@ diff --git a/xen/include/Makefile b/xen/include/Makefile index 433bad9055b2..a488a98d8bb7 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -64,7 +64,7 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-b= uild-header.py mv -f $@.new $@ =20 compat/%.i: compat/%.c Makefile - $(CPP) $(filter-out -Wa$(comma)% -M% %.d -include %/include/xen/config.h,= $(CFLAGS)) $(cppflags-y) -o $@ $< + $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(CFLAGS= )) $(cppflags-y) -o $@ $< =20 compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-sou= rce.py mkdir -p $(@D) --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650757; cv=none; d=zohomail.com; s=zohoarc; b=DaEFM168j3KwySCrPYb+HwKOpF2X5mkrMVNg29iPgR5AcJoQj6P/eKsQLVX2mbD1q1lx+Sxp/iPzR5praJdi5rp7U0oAT+Vi0ICMgyvYOTLDhr3WDs88yGVIRGok1szoujVNGfBK7+LPM70LYBVLYAeL48O+MtJjTHfRqpMBOVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ckke9Vg+k4p1bI3H1ZqGEUHEDEeXbaLsVaUl0l1kZHE=; b=P6gTS6Ixm4BqRpqM6wuaZ8BRRoDyZaKuWmPEdqcnWBYcscO9FmfZXsyHCxFcoFvYQdufV1yZ661IGkllzpS/iO84FsQz/Er6+jjPLt/C0s9mocIUAQ0bwrjMUjzVJdzvhEUAXkfMgOwefACroK7wDtN0QORPn5C2EMexWuvjnes= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650757405512.7395019552049; Tue, 31 Mar 2020 03:32:37 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBV-0001Hg-6Z; Tue, 31 Mar 2020 10:31:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEBU-0001Gy-4X for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:52 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d09ef088-733a-11ea-83d8-bc764e2007e4; Tue, 31 Mar 2020 10:31:43 +0000 (UTC) X-Inumbo-ID: d09ef088-733a-11ea-83d8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=urX0oNruXSy704Xb8768tt/5GIHekC4HLoiuLnPVD/c=; b=LlNkG8TEHFa+CWjds2RDWA4zBIgCpxYqTFi+J78LkG0VX1qCLVt1odTF 2epO1u8s2Zb74QcMVBKiketAmqioS+INRHWXcT/RzyTE33ndXSv07EBfO uJLV55VvvKRonvd3qrgaStROQCVGtu66cHZ+wufv0YiidhcHEpNAFsfta 8=; Authentication-Results: esa4.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 0yoP6ZNd3hbcRXq3TRT5lLXe+Po9gv3SZLR28+g94EwCZZi9ze9HxYXjO9N2G3KE0cGS+8A2Ij QuLVtsgn8Dc6TZ5FB6upkk8GNPZGJahhgQH1/idqr+91uzY0xEasjgU+0O7KB8AhP3ik0HwLeC +bpNVfV1XxpQyAobH4L7h5abdt3lz4lJcW+FqQc3fN7eKpK5xZ3CeS2+/Nru8Ob4x10IpZpmF3 XOozLuGEzM9bTeV4d1IGExjx0FkhVRhxtpkGtt8jTGXaAh257X8yVQQtouYIwqg/GzyhxJS9nc M0s= X-SBRS: 2.7 X-MesageID: 15575939 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15575939" From: Anthony PERARD To: Subject: [XEN PATCH v4 06/18] xen/build: have the root Makefile generates the CFLAGS Date: Tue, 31 Mar 2020 11:30:50 +0100 Message-ID: <20200331103102.1105674-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD , Daniel De Graaf , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Instead of generating the CFLAGS in Rules.mk everytime we enter a new subdirectory, we are going to generate most of them a single time, and export the result in the environment so that Rules.mk can use it. The only flags left to be generated are the ones that depend on the targets, but the variable $(c_flags) takes care of that. Arch specific CFLAGS are generated by a new file "arch/*/arch.mk" which is included by the root Makefile. We export the *FLAGS via the environment variables XEN_*FLAGS because Rules.mk still includes Config.mk and would add duplicated flags to CFLAGS. When running Rules.mk in the root directory (xen/), the variable `root-make-done' is set, so `need-config' will remain undef and so the root Makefile will not generate the cflags again. We can't use CFLAGS in subdirectories to add flags to particular targets, instead start to use CFLAGS-y. Idem for AFLAGS. So there are two different CFLAGS-y, the one in xen/Makefile (and arch.mk), and the one in subdirs that Rules.mk is going to use. We can't add to XEN_CFLAGS because it is exported, so making change to it might be propagated to subdirectory which isn't intended. Some style change are introduced in this patch: when LDFLAGS_DIRECT is included in LDFLAGS use of CFLAGS-$(CONFIG_INDIRECT_THUNK) instead of ifeq(). There is on FIXME added about LTO build, but since LTO is marked as BROKEN, this commit doesn't attempt to filter -flto flags out of the CFLAGS. Signed-off-by: Anthony PERARD --- Notes: v4: - typos - Adding $(AFLAGS-y) to $(AFLAGS) =20 v3: - squash "xen/build: introduce ccflags-y and CFLAGS_$@" here, with those changes: - rename ccflags-y to simply CFLAGS-y and start using AFLAGS-y in subdirs. - remove CFLAGS_$@, we don't need it yet. - fix build of xen.lds and efi.lds which needed -D to be a_flags - remove arch_ccflags, and modify c_flags directly with that change, reorder c_flags, so that target specific flags are = last. - remove HAVE_AS_QUOTED_SYM from envvar and check XEN_CFLAGS to find if it's there when adding -D__OBJECT_LABEL__. - fix missing some flags in AFLAGS (like -fshort-wchar in xen/arch/x86/efi/Makefile, and -D__OBJECT_LABEL__ and CFLAGS-stack-boundary) - keep COV_FLAGS generation in Rules.mk since it doesn't invovle to call CC - fix clang test for "asm()-s support .include." (in a new patch done ahead) - include Kconfig.include in xen/Makefile because as-option-add is defined there now. xen/Makefile | 58 +++++++++++++++++++ xen/Rules.mk | 74 +++++++----------------- xen/arch/arm/Makefile | 10 ++-- xen/arch/arm/Rules.mk | 23 -------- xen/arch/arm/{Rules.mk =3D> arch.mk} | 5 -- xen/arch/arm/efi/Makefile | 2 +- xen/arch/x86/Makefile | 24 ++++---- xen/arch/x86/Rules.mk | 91 ++---------------------------- xen/arch/x86/{Rules.mk =3D> arch.mk} | 17 ++---- xen/arch/x86/efi/Makefile | 2 +- xen/common/libelf/Makefile | 4 +- xen/common/libfdt/Makefile | 4 +- xen/include/Makefile | 2 +- xen/xsm/flask/Makefile | 2 +- xen/xsm/flask/ss/Makefile | 2 +- 15 files changed, 115 insertions(+), 205 deletions(-) copy xen/arch/arm/{Rules.mk =3D> arch.mk} (85%) copy xen/arch/x86/{Rules.mk =3D> arch.mk} (87%) diff --git a/xen/Makefile b/xen/Makefile index 8375070e0d41..372692841913 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -115,6 +115,64 @@ $(KCONFIG_CONFIG): include/config/%.conf include/config/%.conf.cmd: $(KCONFIG_CONFIG) $(MAKE) $(kconfig) syncconfig =20 +ifeq ($(CONFIG_DEBUG),y) +CFLAGS +=3D -O1 +else +CFLAGS +=3D -O2 +endif + +ifeq ($(CONFIG_FRAME_POINTER),y) +CFLAGS +=3D -fno-omit-frame-pointer +else +CFLAGS +=3D -fomit-frame-pointer +endif + +CFLAGS +=3D -nostdinc -fno-builtin -fno-common +CFLAGS +=3D -Werror -Wredundant-decls -Wno-pointer-arith +$(call cc-option-add,CFLAGS,CC,-Wvla) +CFLAGS +=3D -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h +CFLAGS-$(CONFIG_DEBUG_INFO) +=3D -g + +ifneq ($(CONFIG_CC_IS_CLANG),y) +# Clang doesn't understand this command line argument, and doesn't appear = to +# have an suitable alternative. The resulting compiled binary does functi= on, +# but has an excessively large symbol table. +CFLAGS +=3D -Wa,--strip-local-absolute +endif + +AFLAGS +=3D -D__ASSEMBLY__ + +CFLAGS +=3D $(CFLAGS-y) +# allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE +CFLAGS +=3D $(EXTRA_CFLAGS_XEN_CORE) + +# Most CFLAGS are safe for assembly files: +# -std=3Dgnu{89,99} gets confused by #-prefixed end-of-line comments +# -flto makes no sense and annoys clang +AFLAGS +=3D $(filter-out -std=3Dgnu% -flto,$(CFLAGS)) $(AFLAGS-y) + +# LDFLAGS are only passed directly to $(LD) +LDFLAGS +=3D $(LDFLAGS_DIRECT) $(LDFLAGS-y) + +ifeq ($(CONFIG_UBSAN),y) +CFLAGS_UBSAN :=3D -fsanitize=3Dundefined +else +CFLAGS_UBSAN :=3D +endif + +ifeq ($(CONFIG_LTO),y) +CFLAGS +=3D -flto +LDFLAGS-$(CONFIG_CC_IS_CLANG) +=3D -plugin LLVMgold.so +endif + +include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk + +# define new variables to avoid the ones defines in Config.mk +export XEN_CFLAGS :=3D $(CFLAGS) +export XEN_AFLAGS :=3D $(AFLAGS) +export XEN_LDFLAGS :=3D $(LDFLAGS) +export CFLAGS_UBSAN + endif # need-config =20 .PHONY: build install uninstall clean distclean MAP diff --git a/xen/Rules.mk b/xen/Rules.mk index 3408a35dbf53..0def40a00a09 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -38,59 +38,17 @@ ALL_OBJS-y +=3D $(BASEDIR)/arch/$(TARGET_= ARCH)/built_in.o ALL_OBJS-$(CONFIG_CRYPTO) +=3D $(BASEDIR)/crypto/built_in.o =20 # Initialise some variables -CFLAGS_UBSAN :=3D - -ifeq ($(CONFIG_DEBUG),y) -CFLAGS +=3D -O1 -else -CFLAGS +=3D -O2 -endif - -ifeq ($(CONFIG_FRAME_POINTER),y) -CFLAGS +=3D -fno-omit-frame-pointer -else -CFLAGS +=3D -fomit-frame-pointer -endif - -CFLAGS +=3D -nostdinc -fno-builtin -fno-common -CFLAGS +=3D -Werror -Wredundant-decls -Wno-pointer-arith -$(call cc-option-add,CFLAGS,CC,-Wvla) -CFLAGS +=3D -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h -CFLAGS-$(CONFIG_DEBUG_INFO) +=3D -g - -ifneq ($(CONFIG_CC_IS_CLANG),y) -# Clang doesn't understand this command line argument, and doesn't appear = to -# have an suitable alternative. The resulting compiled binary does functi= on, -# but has an excessively large symbol table. -CFLAGS +=3D -Wa,--strip-local-absolute -endif - -AFLAGS +=3D -D__ASSEMBLY__ +CFLAGS-y :=3D +AFLAGS-y :=3D =20 ALL_OBJS :=3D $(ALL_OBJS-y) =20 -CFLAGS +=3D $(CFLAGS-y) -# allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE -CFLAGS +=3D $(EXTRA_CFLAGS_XEN_CORE) - -# Most CFLAGS are safe for assembly files: -# -std=3Dgnu{89,99} gets confused by #-prefixed end-of-line comments -# -flto makes no sense and annoys clang -AFLAGS +=3D $(filter-out -std=3Dgnu% -flto,$(CFLAGS)) - -# LDFLAGS are only passed directly to $(LD) -LDFLAGS +=3D $(LDFLAGS_DIRECT) - -LDFLAGS +=3D $(LDFLAGS-y) - SPECIAL_DATA_SECTIONS :=3D rodata $(foreach a,1 2 4 8 16, \ $(foreach w,1 2 4, \ rodata.str$(w).$(a= )) \ rodata.cst$(a)) \ $(foreach r,rel rel.ro,data.$(r).local) =20 -include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk - include Makefile =20 define gendep @@ -107,7 +65,7 @@ $(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extr= a-y)),$(eval $(call gend subdir-y :=3D $(subdir-y) $(filter %/, $(obj-y)) obj-y :=3D $(patsubst %/, %/built_in.o, $(obj-y)) =20 -$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS +=3D -DINIT_SE= CTIONS_ONLY +$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y +=3D -DINIT_= SECTIONS_ONLY =20 ifeq ($(CONFIG_COVERAGE),y) ifeq ($(CONFIG_CC_IS_CLANG),y) @@ -115,19 +73,16 @@ ifeq ($(CONFIG_CC_IS_CLANG),y) else COV_FLAGS :=3D -fprofile-arcs -ftest-coverage endif -$(filter-out %.init.o $(nocov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS= +=3D $(COV_FLAGS) +$(filter-out %.init.o $(nocov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS= -y +=3D $(COV_FLAGS) endif =20 ifeq ($(CONFIG_UBSAN),y) -CFLAGS_UBSAN +=3D -fsanitize=3Dundefined # Any -fno-sanitize=3D options need to come after any -fsanitize=3D options $(filter-out %.init.o $(noubsan-y),$(obj-y) $(obj-bin-y) $(extra-y)): \ -CFLAGS +=3D $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter -fno-%,$(CFLAGS_= UBSAN)) +CFLAGS-y +=3D $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter -fno-%,$(CFLAG= S_UBSAN)) endif =20 ifeq ($(CONFIG_LTO),y) -CFLAGS +=3D -flto -LDFLAGS-$(CONFIG_CC_IS_CLANG) +=3D -plugin LLVMgold.so # Would like to handle all object files as bitcode, but objects made from # pure asm are in a different format and have to be collected separately. # Mirror the directory tree, collecting them as built_in_bin.o. @@ -140,10 +95,19 @@ obj-bin-y :=3D endif =20 # Always build obj-bin files as binary even if they come from C source.=20 -$(obj-bin-y): CFLAGS :=3D $(filter-out -flto,$(CFLAGS)) +# FIXME LTO broken, but we would need a different way to filter -flto out +# $(obj-bin-y): CFLAGS :=3D $(filter-out -flto,$(CFLAGS)) + +# Calculation of flags, first the generic flags, then the arch specific fl= ags, +# and last the flags modified for a target or a directory. + +c_flags =3D -MMD -MP -MF $(@D)/.$(@F).d $(XEN_CFLAGS) '-D__OBJECT_FILE__= =3D"$@"' +a_flags =3D -MMD -MP -MF $(@D)/.$(@F).d $(XEN_AFLAGS) + +include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk =20 -c_flags =3D -MMD -MP -MF $(@D)/.$(@F).d $(CFLAGS) '-D__OBJECT_FILE__=3D"$@= "' -a_flags =3D -MMD -MP -MF $(@D)/.$(@F).d $(AFLAGS) +c_flags +=3D $(CFLAGS-y) +a_flags +=3D $(CFLAGS-y) $(AFLAGS-y) =20 built_in.o: $(obj-y) $(extra-y) ifeq ($(obj-y),) @@ -152,7 +116,7 @@ else ifeq ($(CONFIG_LTO),y) $(LD_LTO) -r -o $@ $(filter-out $(extra-y),$^) else - $(LD) $(LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) endif endif =20 @@ -160,7 +124,7 @@ built_in_bin.o: $(obj-bin-y) $(extra-y) ifeq ($(obj-bin-y),) $(CC) $(a_flags) -c -x assembler /dev/null -o $@ else - $(LD) $(LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) endif =20 # Force execution of pattern rules (for which PHONY cannot be directly use= d). diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 913f6cdeed3f..9f1ab2335756 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -95,24 +95,24 @@ prelink_lto.o: $(ALL_OBJS) =20 # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ else prelink.o: $(ALL_OBJS) - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ endif =20 $(TARGET)-syms: prelink.o xen.lds - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \ + $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o \ $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).0 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \ + $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o \ $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).1 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ $(@D)/.$(@F).1.o -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --xensyms --sysv --sort \ diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index 3ad284aa71a4..e69de29bb2d1 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -1,23 +0,0 @@ -######################################## -# arm-specific definitions - -# -# If you change any of these configuration options then you must -# 'make clean' before rebuilding. -# - -CFLAGS +=3D -I$(BASEDIR)/include - -$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) -$(call cc-option-add,CFLAGS,CC,-Wnested-externs) - -# Prevent floating-point variables from creeping into Xen. -CFLAGS-$(CONFIG_ARM_32) +=3D -msoft-float -CFLAGS-$(CONFIG_ARM_32) +=3D -mcpu=3Dcortex-a15 - -CFLAGS-$(CONFIG_ARM_64) +=3D -mcpu=3Dgeneric -CFLAGS-$(CONFIG_ARM_64) +=3D -mgeneral-regs-only # No fp registers etc - -ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),) - $(error You must use 'make menuconfig' to enable/disable early printk = now) -endif diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/arch.mk similarity index 85% copy from xen/arch/arm/Rules.mk copy to xen/arch/arm/arch.mk index 3ad284aa71a4..c8186f58288d 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/arch.mk @@ -1,11 +1,6 @@ ######################################## # arm-specific definitions =20 -# -# If you change any of these configuration options then you must -# 'make clean' before rebuilding. -# - CFLAGS +=3D -I$(BASEDIR)/include =20 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile index d34c9168914a..e3ff2c3f283c 100644 --- a/xen/arch/arm/efi/Makefile +++ b/xen/arch/arm/efi/Makefile @@ -1,4 +1,4 @@ -CFLAGS +=3D -fshort-wchar +CFLAGS-y +=3D -fshort-wchar =20 obj-y +=3D boot.init.o runtime.o obj-$(CONFIG_ACPI) +=3D efi-dom0.init.o diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 1405525105d9..a805e9982e85 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -121,32 +121,32 @@ prelink-efi_lto.o: $(ALL_OBJS) efi/runtime.o efi/comp= at.o =20 # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ =20 prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) preli= nk-efi_lto.o efi/boot.init.o - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ else prelink.o: $(ALL_OBJS) - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ =20 prelink-efi.o: $(ALL_OBJS) efi/boot.init.o efi/runtime.o efi/compat.o - $(LD) $(LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^) + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^) endif =20 $(TARGET)-syms: prelink.o xen.lds - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).0 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \ >$(@D)/.$(@F).0.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 $(NM) -pa --format=3Dsysv $(@D)/.$(@F).1 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-= y) \ >$(@D)/.$(@F).1.S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ $(@D)/.$(@F).1.o -o $@ $(NM) -pa --format=3Dsysv $(@D)/$(@F) \ | $(BASEDIR)/tools/symbols --xensyms --sysv --sort \ @@ -159,7 +159,7 @@ note.o: $(TARGET)-syms --rename-section=3D.data=3D.note.gnu.build-id -S $@.bin $@ rm -f $@.bin =20 -EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=3D10 +EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 EFI_LDFLAGS +=3D --image-base=3D$(1) --stack=3D0,0 --heap=3D0,0 --strip-de= bug EFI_LDFLAGS +=3D --section-alignment=3D0x200000 --file-alignment=3D0x20 EFI_LDFLAGS +=3D --major-image-version=3D$(XEN_VERSION) @@ -168,7 +168,7 @@ EFI_LDFLAGS +=3D --major-os-version=3D2 --minor-os-vers= ion=3D0 EFI_LDFLAGS +=3D --major-subsystem-version=3D2 --minor-subsystem-version= =3D0 =20 # Check if the compiler supports the MS ABI. -export XEN_BUILD_EFI :=3D $(shell $(CC) $(CFLAGS) -c efi/check.c -o efi/ch= eck.o 2>/dev/null && echo y) +export XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o ef= i/check.o 2>/dev/null && echo y) # Check if the linker supports PE. XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsyste= m=3D10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI @@ -178,7 +178,7 @@ $(TARGET).efi: ALT_BASE =3D 0x$(shell $(NM) efi/relocs-= dummy.o | sed -n 's, A ALT_ =20 ifneq ($(build_id_linker),) ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y) -CFLAGS +=3D -DBUILD_ID_EFI +CFLAGS-y +=3D -DBUILD_ID_EFI EFI_LDFLAGS +=3D $(build_id_linker) note_file :=3D efi/buildid.o # NB: this must be the last input in the linker call, because inputs follo= wing @@ -225,7 +225,7 @@ efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.= o efi/relocs-dummy.o: ; asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/= asm-macros.h $(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -o $@ $< =20 -asm-macros.i: CFLAGS +=3D -D__ASSEMBLY__ -P +asm-macros.i: CFLAGS-y +=3D -D__ASSEMBLY__ -P =20 $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile echo '#if 0' >$@.new @@ -238,7 +238,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i M= akefile echo '#endif' >>$@.new $(call move-if-changed,$@.new,$@) =20 -efi.lds: AFLAGS +=3D -DEFI +efi.lds: AFLAGS-y +=3D -DEFI xen.lds efi.lds: xen.lds.S $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $< sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 4b7ab784670c..56fe22c979ea 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -1,89 +1,10 @@ ######################################## # x86-specific definitions =20 -XEN_IMG_OFFSET :=3D 0x200000 - -CFLAGS +=3D -I$(BASEDIR)/include -CFLAGS +=3D -I$(BASEDIR)/include/asm-x86/mach-generic -CFLAGS +=3D -I$(BASEDIR)/include/asm-x86/mach-default -CFLAGS +=3D -DXEN_IMG_OFFSET=3D$(XEN_IMG_OFFSET) -CFLAGS +=3D '-D__OBJECT_LABEL__=3D$(subst /,$$,$(subst -,_,$(subst $(BASED= IR)/,,$(CURDIR))/$@))' - -# Prevent floating-point variables from creeping into Xen. -CFLAGS +=3D -msoft-float - -ifeq ($(CONFIG_CC_IS_CLANG),y) -# Note: Any test which adds -no-integrated-as will cause subsequent tests = to -# succeed, and not trigger further additions. -# -# The tests to select whether the integrated assembler is usable need to h= appen -# before testing any assembler features, or else the result of the tests w= ould -# be stale if the integrated assembler is not used. - -# Older clang's built-in assembler doesn't understand .skip with labels: -# https://bugs.llvm.org/show_bug.cgi?id=3D27369 -$(call as-option-add,CFLAGS,CC,".L0: .L1: .skip (.L1 - .L0)",,\ - -no-integrated-as) - -# Check whether clang asm()-s support .include. -$(call as-option-add,CFLAGS,CC,".include \"asm-x86/indirect_thunk_asm.h\""= ,,\ - -no-integrated-as) - -# Check whether clang keeps .macro-s between asm()-s: -# https://bugs.llvm.org/show_bug.cgi?id=3D36110 -$(call as-option-add,CFLAGS,CC,\ - ".macro FOO;.endm"$$(close); asm volatile $$(open)".m= acro FOO;.endm",\ - -no-integrated-as) -endif - -$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) -$(call cc-option-add,CFLAGS,CC,-Wnested-externs) -$(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX) -$(call as-option-add,CFLAGS,CC,"crc32 %eax$$(comma)%eax",-DHAVE_AS_SSE4_2) -$(call as-option-add,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_AS_EPT) -$(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND) -$(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE) -$(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT) -$(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED) -$(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB) -$(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1", \ - -U__OBJECT_LABEL__ -DHAVE_AS_QUOTED_SYM \ - '-D__OBJECT_LABEL__=3D$(subst $(BASEDIR)/,,$(CURDIR))= /$$@') -$(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INV= PCID) - -# GAS's idea of true is -1. Clang's idea is 1 -$(call as-option-add,CFLAGS,CC,\ - ".if ((1 > 0) < 0); .error \"\";.endif",,-DHAVE_AS_NEGATIVE_TRUE) - -# Check to see whether the assmbler supports the .nop directive. -$(call as-option-add,CFLAGS,CC,\ - ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE) - -CFLAGS +=3D -mno-red-zone -fpic -fno-asynchronous-unwind-tables - -# Xen doesn't use SSE interally. If the compiler supports it, also skip t= he -# SSE setup for variadic function calls. -CFLAGS +=3D -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) - -# Compile with thunk-extern, indirect-branch-register if avaiable. -ifeq ($(CONFIG_INDIRECT_THUNK),y) -CFLAGS +=3D -mindirect-branch=3Dthunk-extern -mindirect-branch-register -CFLAGS +=3D -fno-jump-tables +ifneq ($(filter -DHAVE_AS_QUOTED_SYM,$(XEN_CFLAGS)),) +object_label_flags =3D '-D__OBJECT_LABEL__=3D$(subst $(BASEDIR)/,,$(CURDIR= ))/$@' +else +object_label_flags =3D '-D__OBJECT_LABEL__=3D$(subst /,$$,$(subst -,_,$(su= bst $(BASEDIR)/,,$(CURDIR))/$@))' endif - -# If supported by the compiler, reduce stack alignment to 8 bytes. But all= ow -# this to be overridden elsewhere. -$(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary= =3D3) -CFLAGS +=3D $(CFLAGS-stack-boundary) - -ifeq ($(CONFIG_UBSAN),y) -# Don't enable alignment sanitisation. x86 has efficient unaligned access= es, -# and various things (ACPI tables, hypercall pages, stubs, etc) are wont-f= ix. -# It also causes an as-yet-unidentified crash on native boot before the -# console starts. -$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=3Dalignment) -endif - -# Set up the assembler include path properly for older toolchains. -CFLAGS +=3D -Wa,-I$(BASEDIR)/include - +c_flags +=3D $(object_label_flags) $(CFLAGS-stack-boundary) +a_flags +=3D $(object_label_flags) $(CFLAGS-stack-boundary) diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/arch.mk similarity index 87% copy from xen/arch/x86/Rules.mk copy to xen/arch/x86/arch.mk index 4b7ab784670c..2a51553edb3c 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/arch.mk @@ -1,13 +1,12 @@ ######################################## # x86-specific definitions =20 -XEN_IMG_OFFSET :=3D 0x200000 +export XEN_IMG_OFFSET :=3D 0x200000 =20 CFLAGS +=3D -I$(BASEDIR)/include CFLAGS +=3D -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS +=3D -I$(BASEDIR)/include/asm-x86/mach-default CFLAGS +=3D -DXEN_IMG_OFFSET=3D$(XEN_IMG_OFFSET) -CFLAGS +=3D '-D__OBJECT_LABEL__=3D$(subst /,$$,$(subst -,_,$(subst $(BASED= IR)/,,$(CURDIR))/$@))' =20 # Prevent floating-point variables from creeping into Xen. CFLAGS +=3D -msoft-float @@ -46,9 +45,7 @@ $(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_= FSGSBASE) $(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT) $(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED) $(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB) -$(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1", \ - -U__OBJECT_LABEL__ -DHAVE_AS_QUOTED_SYM \ - '-D__OBJECT_LABEL__=3D$(subst $(BASEDIR)/,,$(CURDIR))= /$$@') +$(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1",-DHAVE_AS_QUOTED_SYM) $(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INV= PCID) =20 # GAS's idea of true is -1. Clang's idea is 1 @@ -66,15 +63,14 @@ CFLAGS +=3D -mno-red-zone -fpic -fno-asynchronous-unwin= d-tables CFLAGS +=3D -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) =20 # Compile with thunk-extern, indirect-branch-register if avaiable. -ifeq ($(CONFIG_INDIRECT_THUNK),y) -CFLAGS +=3D -mindirect-branch=3Dthunk-extern -mindirect-branch-register -CFLAGS +=3D -fno-jump-tables -endif +CFLAGS-$(CONFIG_INDIRECT_THUNK) +=3D -mindirect-branch=3Dthunk-extern +CFLAGS-$(CONFIG_INDIRECT_THUNK) +=3D -mindirect-branch-register +CFLAGS-$(CONFIG_INDIRECT_THUNK) +=3D -fno-jump-tables =20 # If supported by the compiler, reduce stack alignment to 8 bytes. But all= ow # this to be overridden elsewhere. $(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary= =3D3) -CFLAGS +=3D $(CFLAGS-stack-boundary) +export CFLAGS-stack-boundary =20 ifeq ($(CONFIG_UBSAN),y) # Don't enable alignment sanitisation. x86 has efficient unaligned access= es, @@ -86,4 +82,3 @@ endif =20 # Set up the assembler include path properly for older toolchains. CFLAGS +=3D -Wa,-I$(BASEDIR)/include - diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 4bc0a196e9ca..490d791aae2d 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -1,4 +1,4 @@ -CFLAGS +=3D -fshort-wchar +CFLAGS-y +=3D -fshort-wchar =20 %.o: %.ihex $(OBJCOPY) -I ihex -O binary $< $@ diff --git a/xen/common/libelf/Makefile b/xen/common/libelf/Makefile index 3d9e38f27e65..464c448d9d37 100644 --- a/xen/common/libelf/Makefile +++ b/xen/common/libelf/Makefile @@ -3,10 +3,10 @@ nocov-y +=3D libelf.o =20 SECTIONS :=3D text data $(SPECIAL_DATA_SECTIONS) =20 -CFLAGS +=3D -Wno-pointer-sign +CFLAGS-y +=3D -Wno-pointer-sign =20 libelf.o: libelf-temp.o Makefile $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$(s)) $= < $@ =20 libelf-temp.o: libelf-tools.o libelf-loader.o libelf-dominfo.o #libelf-rel= ocate.o - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile index c075bbf5462a..e2a5e59380a0 100644 --- a/xen/common/libfdt/Makefile +++ b/xen/common/libfdt/Makefile @@ -5,10 +5,10 @@ SECTIONS :=3D text data $(SPECIAL_DATA_SECTIONS) obj-y +=3D libfdt.o nocov-y +=3D libfdt.o =20 -CFLAGS +=3D -I$(BASEDIR)/include/xen/libfdt/ +CFLAGS-y +=3D -I$(BASEDIR)/include/xen/libfdt/ =20 libfdt.o: libfdt-temp.o Makefile $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$(s)) $= < $@ =20 libfdt-temp.o: $(LIBFDT_OBJS) - $(LD) $(LDFLAGS) -r -o $@ $^ + $(LD) $(XEN_LDFLAGS) -r -o $@ $^ diff --git a/xen/include/Makefile b/xen/include/Makefile index a488a98d8bb7..2a10725d689b 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -64,7 +64,7 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-b= uild-header.py mv -f $@.new $@ =20 compat/%.i: compat/%.c Makefile - $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(CFLAGS= )) $(cppflags-y) -o $@ $< + $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CF= LAGS)) $(cppflags-y) -o $@ $< =20 compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-sou= rce.py mkdir -p $(@D) diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile index b1fd45421993..011ef5ca91f8 100644 --- a/xen/xsm/flask/Makefile +++ b/xen/xsm/flask/Makefile @@ -4,7 +4,7 @@ obj-y +=3D flask_op.o =20 obj-y +=3D ss/ =20 -CFLAGS +=3D -I./include +CFLAGS-y +=3D -I./include =20 AWK =3D awk =20 diff --git a/xen/xsm/flask/ss/Makefile b/xen/xsm/flask/ss/Makefile index 046ce8f53326..d32b9e07138e 100644 --- a/xen/xsm/flask/ss/Makefile +++ b/xen/xsm/flask/ss/Makefile @@ -8,4 +8,4 @@ obj-y +=3D services.o obj-y +=3D conditional.o obj-y +=3D mls.o =20 -CFLAGS +=3D -I../include +CFLAGS-y +=3D -I../include --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650713; cv=none; d=zohomail.com; s=zohoarc; b=g40z84MSC273AfoXxMpEvyk3P3Twwsmd4fCsn+wndyf0UUjxj0ryzX8yG5HnkCYw6BSsuciNCK5KlrDiMg7l7ZpHVOzbB+347DhW19YaxD+KlZ/U1BZQ9mPQBty4NTt0PaxOzJkXuwYnIies7dlV45ZdeuGsfgFbqBzZV8NUZZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4XHHKXhc5BnJwZs44Pab7WF+OpUEm8gkkLQhewGsGII=; b=BXh5Gq4pcYeFrNETkPlQA6gRXPUAJuXNLb2e75VUg52tnXYCxjCe0Bn+mGX1YgUHakN2yIW2LRdMTPUC8xhM0xWCDGqaaEGZMvto1zS8DuYR4xlZGVy+gSSywf0s+tQ1Wy8777lkzNhQxYnUX3c5zzr3hhqk9drxkL1UlrCDbXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650713275535.6215023361635; Tue, 31 Mar 2020 03:31:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAp-0000vJ-Vb; Tue, 31 Mar 2020 10:31:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAo-0000vA-MJ for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:10 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bc469bd6-733a-11ea-b58d-bc764e2007e4; Tue, 31 Mar 2020 10:31:09 +0000 (UTC) X-Inumbo-ID: bc469bd6-733a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650670; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9qsUPcuNZB94vcMy9A4eDY05j7eFH8egvaVUDX3e+N4=; b=P8m4r/cGzT/HK+6p8mv9xeS3J1VebosLqwZwnTTK0wmiR1FTcEX8dO+4 U/eZtrpSHbm5rv5JASnW/HuYf5/xG32vQLL/rkEyxHBkE/OXlEWPPF/am X1WaKNcoF+kOq1HqTBv0Kk2WZ4Zdb+pWk5Fr3VGn+heUfHASWiGpfP100 M=; Authentication-Results: esa1.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: M+Lfh2hbsCFUWmZLcxiwSyDh+gfuAqOD/NyLBDiSDyImtJfy+/jaWlANC1qSF5gUktIeB/EaRH RaqZ79KFNJcwBGG/CnLK44jT2YQbKDFgOpaGERr07aAfoaSQNcC4IEVzax+EFf2pCA/qrVW6mN E/JEkNiuE3LmlgHC3QEs8L5Hvtg/W39xm/Rl13Jtt7BVhc0r89iFFknbzT0uQTWQQEcEru4wZr Ful4VulXxHYAj5TtK53hHV1n7pp8R+qT+KDHcXJ5/brzOMfn9a01E2n9g3DY5QZ7zUQIJXMBxE cNk= X-SBRS: 2.7 X-MesageID: 15138786 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15138786" From: Anthony PERARD To: Subject: [XEN PATCH v4 07/18] build: Introduce documentation for xen Makefiles Date: Tue, 31 Mar 2020 11:30:51 +0100 Message-ID: <20200331103102.1105674-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This start explainning the variables that can be used in the many Makefiles in xen/. Most of the document copies and modifies text from Linux v5.4 document linux.git/Documentation/kbuild/makefiles.rst. Modification are mostly to avoid mentioning kbuild. Thus I've added the SPDX tag which was only in index.rst in linux.git. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v4: - new patch docs/misc/xen-makefiles/makefiles.rst | 87 +++++++++++++++++++++++++++ xen/Rules.mk | 4 ++ 2 files changed, 91 insertions(+) create mode 100644 docs/misc/xen-makefiles/makefiles.rst diff --git a/docs/misc/xen-makefiles/makefiles.rst b/docs/misc/xen-makefile= s/makefiles.rst new file mode 100644 index 000000000000..a86e3a612d61 --- /dev/null +++ b/docs/misc/xen-makefiles/makefiles.rst @@ -0,0 +1,87 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Xen Makefiles +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Documentation for the build system of Xen, found in xen.git/xen/. + +Makefile files +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Description of the syntax that can be used in most Makefiles named +'Makefile'. ('xen/Makefile' isn't part of the description.) + +'Makefile's are consumed by 'Rules.mk' when building. + +Goal definitions +---------------- + + Goal definitions are the main part (heart) of the Makefile. + These lines define the files to be built, any special compilation + options, and any subdirectories to be entered recursively. + + The most simple makefile contains one line: + + Example:: + + obj-y +=3D foo.o + + This tells the build system that there is one object in that + directory, named foo.o. foo.o will be built from foo.c or foo.S. + + The following pattern is often used to have object selected + depending on the configuration: + + Example:: + + obj-$(CONFIG_FOO) +=3D foo.o + + $(CONFIG_FOO) can evaluates to y. + If CONFIG_FOO is not y, then the file will not be compiled nor linked. + +Descending down in directories +------------------------------ + + A Makefile is only responsible for building objects in its own + directory. Files in subdirectories should be taken care of by + Makefiles in these subdirs. The build system will automatically + invoke make recursively in subdirectories, provided you let it know of + them. + + To do so, obj-y is used. + acpi lives in a separate directory, and the Makefile present in + drivers/ tells the build system to descend down using the following + assignment. + + Example:: + + #drivers/Makefile + obj-$(CONFIG_ACPI) +=3D acpi/ + + If CONFIG_ACPI is set to 'y' + the corresponding obj- variable will be set, and the build system + will descend down in the apci directory. + The build system only uses this information to decide that it needs + to visit the directory, it is the Makefile in the subdirectory that + specifies what is modular and what is built-in. + + It is good practice to use a `CONFIG_` variable when assigning directory + names. This allows the build system to totally skip the directory if the + corresponding `CONFIG_` option is 'y'. + +Compilation flags +----------------- + + CFLAGS-y and AFLAGS-y + These two flags apply only to the makefile in which they + are assigned. They are used for all the normal cc, as and ld + invocations happening during a recursive build. + + $(CFLAGS-y) is necessary because the top Makefile owns the + variable $(XEN_CFLAGS) and uses it for compilation flags for the + entire tree. And the variable $(CFLAGS) is modified by Config.mk + which evaluated in every subdirs. + + CFLAGS-y specifies options for compiling with $(CC). + AFLAGS-y specifies assembler options. diff --git a/xen/Rules.mk b/xen/Rules.mk index 0def40a00a09..7f28c3bc6c13 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -1,3 +1,7 @@ +# +# See docs/misc/xen-makefiles/makefiles.rst on variables that can be used = in +# Makefile and are consumed by Rules.mk +# =20 -include $(BASEDIR)/include/config/auto.conf =20 --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650714; cv=none; d=zohomail.com; s=zohoarc; b=FmgEFr6aigcKSdZ1ZJntfOWxXf88vVt4iZhvsIZ20KzkZkDrFVhikFh7keOPXYJN15+blu6wJXR6zyudXeX8xj3e7tK6L2OJO+PPs+KE6A0hZRDZfc2ErTCmvztboYA65qE7YVSfmD9Yr7X72vOtaky/12LthmZkOgSWOhCO+dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650714; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7IyL9AXyP+y00mHrl2YgMwIX3/E8w1LEAzrsoXhDK4s=; b=UFJKfTMez0Sbe69IAZjovqdsHSxmy3rxqhQ32DYR8da5bXe29kpDBrVWvC6V4oB/I/hP9xLU0DCRc4pBQTYVkT0oWsPSEWnWbTZ4XlChzZFMBrzKH2m0clOwlqUtmTmL89p+tUXuiTbgDyc5CDkxekcZei0jsluziX0vAlm/pIM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650714601364.37407570141363; Tue, 31 Mar 2020 03:31:54 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEB0-0000zK-At; Tue, 31 Mar 2020 10:31:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAy-0000yn-ME for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:20 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bec3dd88-733a-11ea-b58d-bc764e2007e4; Tue, 31 Mar 2020 10:31:13 +0000 (UTC) X-Inumbo-ID: bec3dd88-733a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650674; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OYE88/tj0Eiuv+psYdXYwHPdKpl+cAgiq9sanZybeHo=; b=gJYp5gPp6tT9qo32lseOqReZ4i2116RTmTpVaPeZo7dhhZv356hA8o0V 1JcJ1f5zgq1SdcorU1lAz/4G07bFHaZOK3U6iD61WF+65HO8RK1WWZz7g NHWTisfwfIXwlAc8FvOC3Vlyv71+z0vFkwao6Cs5r05sCsTu1/qZ4P9Mg I=; Authentication-Results: esa1.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: bbwSsfvgN7UDcIvMlbiDws0zTHCCsZrFohTrRNm0tyHKqmuOEjplg+HLwjFesDUz0VhGQ5uQkT ruknPCt24wUJ8xoavvkXnSpkM7ahHXlHXVyJIjqdR0hQnJ77iS+M5R3tP5qUip7dLpKfCmXFI7 lrFyUc23oS7MtMTSTpgLFPQKa0JU+LZMO1W05p2nei1VsGvKS+DJHDLRXUAdlYQp7YHtS0weEu PwrqrB7bJnkTK+yEiv/WvugrA3uRLLsQsixpr3+/sz4Z19rD3KM0FeN5T+8g/WgeA/OBFcZnkU ejo= X-SBRS: 2.7 X-MesageID: 15138791 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15138791" From: Anthony PERARD To: Subject: [XEN PATCH v4 08/18] xen/build: introduce if_changed and if_changed_rule Date: Tue, 31 Mar 2020 11:30:52 +0100 Message-ID: <20200331103102.1105674-9-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The if_changed macro from Linux, in addition to check if any files needs an update, check if the command line has changed since the last invocation. The latter will force a rebuild if any options to the executable have changed. if_changed_rule checks dependencies like if_changed, but execute rule_$(1) instead of cmd_$(1) when a target needs to be rebuilt. A rule_ macro can call more than one cmd_ macro. One of the cmd_ macro in a rule need to be call using a macro that record the command line, so cmd_and_record is introduced. It is similar to cmd_and_fixup from Linux but without a call to fixdep which we don't have yet. (We will later replace cmd_and_record by cmd_and_fixup.) Example of a rule_ macro: define rule_cc_o_c $(call cmd_and_record,cc_o_o) $(call cmd,objcopy) endef This needs one of the call to use cmd_and_record, otherwise no .*.cmd file will be created, and the target will keep been rebuilt. In order for if_changed to works correctly, we need to load the .%.cmd files that the macro generates, this is done by adding targets in to the $(targets) variable. We use intermediate_targets to add %.init.o dependency %.o to target since there aren't in obj-y. We also add $(MAKECMDGOALS) to targets so that when running for example `make common/memory.i`, make will load the associated .%.cmd dependency file. Beside the if_changed*, we import the machinery used for a "beautify output". The important one is when running make with V=3D2 which help to debug the makefiles by printing why a target is been rebuilt, via the $(echo-why) macro. if_changed and if_changed_rule aren't used yet. Most of this code is copied from Linux v5.4, including the documentation. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v4: - Use :=3D in make whenever possible (instead of =3D) - insert new string in .gitignore somewhere more plausible. - import documentation from Linux .gitignore | 1 + docs/misc/xen-makefiles/makefiles.rst | 99 ++++++++++++++++++++++++ xen/Makefile | 53 ++++++++++++- xen/Rules.mk | 33 +++++++- xen/scripts/Kbuild.include | 107 ++++++++++++++++++++++++++ 5 files changed, 291 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4ca679ddbc9a..bfa53723b38b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .hg +.*.cmd .*.tmp *.orig *~ diff --git a/docs/misc/xen-makefiles/makefiles.rst b/docs/misc/xen-makefile= s/makefiles.rst index a86e3a612d61..9efd8464a763 100644 --- a/docs/misc/xen-makefiles/makefiles.rst +++ b/docs/misc/xen-makefiles/makefiles.rst @@ -85,3 +85,102 @@ Compilation flags =20 CFLAGS-y specifies options for compiling with $(CC). AFLAGS-y specifies assembler options. + + +Build system infrastructure +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +This chapter describe some of the macro used when building Xen. + +Macros +------ + + + if_changed + if_changed is the infrastructure used for the following commands. + + Usage:: + + target: source(s) FORCE + $(call if_changed,ld/objcopy/...) + + When the rule is evaluated, it is checked to see if any files + need an update, or the command line has changed since the last + invocation. The latter will force a rebuild if any options + to the executable have changed. + Any target that utilises if_changed must be listed in $(targets), + otherwise the command line check will fail, and the target will + always be built. + if_changed may be used in conjunction with custom commands as + defined in "Custom commands". + + Note: It is a typical mistake to forget the FORCE prerequisite. + Another common pitfall is that whitespace is sometimes + significant; for instance, the below will fail (note the extra space + after the comma):: + + target: source(s) FORCE + + **WRONG!** $(call if_changed, ld/objcopy/...) + + Note: + if_changed should not be used more than once per target. + It stores the executed command in a corresponding .cmd + + file and multiple calls would result in overwrites and + unwanted results when the target is up to date and only the + tests on changed commands trigger execution of commands. + + ld + Link target. + + Example:: + + targets +=3D setup setup.o bootsect bootsect.o + $(obj)/setup $(obj)/bootsect: %: %.o FORCE + $(call if_changed,ld) + + $(targets) are assigned all potential targets, by which the build + system knows the targets and will: + + 1) check for commandline changes + + The ": %: %.o" part of the prerequisite is a shorthand that + frees us from listing the setup.o and bootsect.o files. + + Note: + It is a common mistake to forget the "targets :=3D" assignment, + resulting in the target file being recompiled for no + obvious reason. + + objcopy + Copy binary. Uses OBJCOPYFLAGS usually specified in + arch/$(ARCH)/Makefile. + +Custom commands +--------------- + + When the build system is executing with V=3D0, then only + a shorthand of a command is normally displayed. + To enable this behaviour for custom commands, two variables are + required to be set:: + + quiet_cmd_ - what shall be echoed + cmd_ - the command to execute + + Example:: + + # xsm/flask/Makefile + mkflask :=3D policy/mkflask.sh + quiet_cmd_mkflask =3D MKFLASK $@ + cmd_mkflask =3D $(CONFIG_SHELL) $(mkflask) $(AWK) include \ + $(FLASK_H_DEPEND) + + include/flask.h: $(FLASK_H_DEPEND) $(mkflask) FORCE + $(call if_changed,mkflask) + + When updating the include/flask.h target, the line: + + MKFLASK include/flask.h + + will be displayed with "make V=3D0". (V=3D0 is the default) diff --git a/xen/Makefile b/xen/Makefile index 372692841913..c4cd4d07a9bc 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -52,7 +52,57 @@ dist: install =20 ifneq ($(root-make-done),y) # section to run before calling Rules.mk, but only once. + +# Beautify output +# ------------------------------------------------------------------------= --- +# +# Normally, we echo the whole command before executing it. By making +# that echo $($(quiet)$(cmd)), we now have the possibility to set +# $(quiet) to choose other forms of output instead, e.g. +# +# quiet_cmd_cc_o_c =3D Compiling $(RELDIR)/$@ +# cmd_cc_o_c =3D $(CC) $(c_flags) -c -o $@ $< +# +# If $(quiet) is empty, the whole command will be printed. +# If it is set to "quiet_", only the short version will be printed. +# If it is set to "silent_", nothing will be printed at all, since +# the variable $(silent_cmd_cc_o_c) doesn't exist. +# +# A simple variant is to prefix commands with $(Q) - that's useful +# for commands that shall be hidden in non-verbose mode. # +# $(Q)ln $@ :< +# +# If KBUILD_VERBOSE equals 0 then the above command will be hidden. +# If KBUILD_VERBOSE equals 1 then the above command is displayed. +# +# To put more focus on warnings, be less verbose as default +# Use 'make V=3D1' to see the full commands + +ifeq ("$(origin V)", "command line") + KBUILD_VERBOSE :=3D $(V) +endif +ifndef KBUILD_VERBOSE + KBUILD_VERBOSE :=3D 0 +endif + +ifeq ($(KBUILD_VERBOSE),1) + quiet :=3D + Q :=3D +else + quiet :=3D quiet_ + Q :=3D @ +endif + +# If the user is running make -s (silent mode), suppress echoing of +# commands + +ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) + quiet :=3D silent_ +endif + +export quiet Q KBUILD_VERBOSE + # To make sure we do not include .config for any of the *config targets # catch them early, and hand them over to tools/kconfig/Makefile =20 @@ -258,7 +308,8 @@ _clean: delete-unfresh-files $(MAKE) $(clean) arch/x86 $(MAKE) $(clean) test $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=3D$(ARCH) SRCAR= CH=3D$(SRCARCH) clean - find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" -o -name "*.gcno" = \) -exec rm -f {} \; + find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \ + -o -name "*.gcno" -o -name ".*.cmd" \) -exec rm -f {} \; rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map = $(TARGET)-syms $(TARGET)-syms.map *~ core rm -f include/asm-*/asm-offsets.h rm -f .banner diff --git a/xen/Rules.mk b/xen/Rules.mk index 7f28c3bc6c13..f531fd5e342d 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -42,6 +42,7 @@ ALL_OBJS-y +=3D $(BASEDIR)/arch/$(TARGET_AR= CH)/built_in.o ALL_OBJS-$(CONFIG_CRYPTO) +=3D $(BASEDIR)/crypto/built_in.o =20 # Initialise some variables +targets :=3D CFLAGS-y :=3D AFLAGS-y :=3D =20 @@ -69,6 +70,10 @@ $(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extr= a-y)),$(eval $(call gend subdir-y :=3D $(subdir-y) $(filter %/, $(obj-y)) obj-y :=3D $(patsubst %/, %/built_in.o, $(obj-y)) =20 +# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to +# tell kbuild to descend +subdir-obj-y :=3D $(filter %/built_in.o, $(obj-y)) + $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y +=3D -DINIT_= SECTIONS_ONLY =20 ifeq ($(CONFIG_COVERAGE),y) @@ -124,6 +129,10 @@ else endif endif =20 +targets +=3D built_in.o +targets +=3D $(filter-out $(subdir-obj-y), $(obj-y)) $(extra-y) +targets +=3D $(MAKECMDGOALS) + built_in_bin.o: $(obj-bin-y) $(extra-y) ifeq ($(obj-bin-y),) $(CC) $(a_flags) -c -x assembler /dev/null -o $@ @@ -132,7 +141,7 @@ else endif =20 # Force execution of pattern rules (for which PHONY cannot be directly use= d). -.PHONY: FORCE +PHONY +=3D FORCE FORCE: =20 %/built_in.o: FORCE @@ -180,4 +189,26 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %= .init.o: %.o Makefile %.s: %.S Makefile $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ =20 +# Add intermediate targets: +# When building objects with specific suffix patterns, add intermediate +# targets that the final targets are derived from. +intermediate_targets =3D $(foreach sfx, $(2), \ + $(patsubst %$(strip $(1)),%$(sfx), \ + $(filter %$(strip $(1)), $(targets)))) +# %.init.o <- %.o +targets +=3D $(call intermediate_targets, .init.o, .o) + -include $(DEPS_INCLUDE) + +# Read all saved command lines and dependencies for the $(targets) we +# may be building above, using $(if_changed{,_dep}). As an +# optimization, we don't need to read them if the target does not +# exist, we will rebuild anyway in that case. + +existing-targets :=3D $(wildcard $(sort $(targets))) + +-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) + +# Declare the contents of the PHONY variable as phony. We keep that +# information in a variable so we can use it in if_changed and friends. +.PHONY: $(PHONY) diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include index 14f68fa42868..0de6ca21c0a2 100644 --- a/xen/scripts/Kbuild.include +++ b/xen/scripts/Kbuild.include @@ -2,11 +2,30 @@ #### # kbuild: Generic definitions =20 +# Convenient variables +squote :=3D ' +empty :=3D +space :=3D $(empty) $(empty) +space_escape :=3D _-_SPACE_-_ +pound :=3D \# + +### +# Name of target with a '.' as filename prefix. foo/bar.o =3D> foo/.bar.o +dot-target =3D $(@D)/.$(@F) + ### # dependencies DEPS =3D .*.d DEPS_INCLUDE =3D $(addsuffix .d2, $(basename $(wildcard $(DEPS)))) =20 +### +# real prerequisites without phony targets +real-prereqs =3D $(filter-out $(PHONY), $^) + +### +# Escape single quote for use in echo statements +escsq =3D $(subst $(squote),'\$(squote)',$1) + # as-insn: Check whether assembler supports an instruction. # Usage: cflags-y +=3D $(call as-insn,CC FLAGS,"insn",option-yes,option-no) as-insn =3D $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \ @@ -37,3 +56,91 @@ clean :=3D -f $(BASEDIR)/scripts/Makefile.clean clean -C # Usage: # $(MAKE) $(kconfig) target kconfig =3D -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=3D$(ARCH) SR= CARCH=3D$(SRCARCH) HOSTCC=3D"$(HOSTCC)" HOSTCXX=3D"$(HOSTCXX)" + +# echo command. +# Short version is used, if $(quiet) equals `quiet_', otherwise full one. +echo-cmd =3D $(if $($(quiet)cmd_$(1)),\ + echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) + +# printing commands +cmd =3D @set -e; $(echo-cmd) $(cmd_$(1)) + +### +# if_changed - execute command if any prerequisite is newer than +# target, or command line has changed +# if_changed_rule - as if_changed but execute rule instead + +ifneq ($(KBUILD_NOCMDDEP),1) +# Check if both commands are the same including their order. Result is emp= ty +# string if equal. User may override this check using make KBUILD_NOCMDDEP= =3D1 +cmd-check =3D $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_= $@))), \ + $(subst $(space),$(space_escape),$(strip $(cmd_$1= )))) +else +cmd-check =3D $(if $(strip $(cmd_$@)),,1) +endif + +# Replace >$< with >$$< to preserve $ when reloading the .cmd file +# (needed for make) +# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file +# (needed for make) +# Replace >'< with >'\''< to be able to enclose the whole string in '...' +# (needed for the shell) +make-cmd =3D $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd= _$(1))))) + +# Find any prerequisites that is newer than target or that does not exist. +# PHONY targets skipped in both cases. +any-prereq =3D $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $= ^),$^) + +# Execute command if command has changed or prerequisite(s) are updated. +if_changed =3D $(if $(any-prereq)$(cmd-check), = \ + $(cmd); = \ + printf '%s\n' 'cmd_$@ :=3D $(make-cmd)' > $(dot-target).cmd, @:) + +# Usage: $(call if_changed_rule,foo) +# Will check if $(cmd_foo) or any of the prerequisites changed, +# and if so will execute $(rule_foo). +if_changed_rule =3D $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:) + +cmd_and_record =3D = \ + $(cmd); = \ + printf '%s\n' 'cmd_$@ :=3D $(make-cmd)' > $(dot-target).cmd + +### +# why - tell why a target got built +# enabled by make V=3D2 +# Output (listed in the order they are checked): +# (1) - due to target is PHONY +# (2) - due to target missing +# (3) - due to: file1.h file2.h +# (4) - due to command line change +# (5) - due to missing .cmd file +# (6) - due to target not in $(targets) +# (1) PHONY targets are always build +# (2) No target, so we better build it +# (3) Prerequisite is newer than target +# (4) The command line stored in the file named dir/.target.cmd +# differed from actual command line. This happens when compiler +# options changes +# (5) No dir/.target.cmd file (used to store command line) +# (6) No dir/.target.cmd file and target not listed in $(targets) +# This is a good hint that there is a bug in the kbuild file +ifeq ($(KBUILD_VERBOSE),2) +why =3D = \ + $(if $(filter $@, $(PHONY)),- due to target is PHONY, = \ + $(if $(wildcard $@), = \ + $(if $(any-prereq),- due to: $(any-prereq), = \ + $(if $(cmd-check), = \ + $(if $(cmd_$@),- due to command line change, = \ + $(if $(filter $@, $(targets)), = \ + - due to missing .cmd file, = \ + - due to $(notdir $@) not in $$(targets) = \ + ) = \ + ) = \ + ) = \ + ), = \ + - due to target missing = \ + ) = \ + ) + +echo-why =3D $(call escsq, $(strip $(why))) +endif --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585650713; cv=none; d=zohomail.com; s=zohoarc; b=ZUo+vmQjKdL4IT38iG07NhAplHhnCgvAQ9n++ICBa/zXyTp+0UScAgYETowAyZlWbZk+9EcZQaMx4ft/BJ7k2vZTFRZuwGh2mTj4a2GwFvf5brBW4OkOpgVry5/jpoCRbPpfOyQdxdWY8bhWm1BbNL8lyLXfI6IiUDY9sGZFGa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585650713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G1wwGnGqEw262+QdNrvb7kOQm15W+2VrcJ8Y5Q48S9k=; b=mck2wW6XIbL3uXNyWyiHrSmn9w9lBtBn0J2QUHyXVIiCs4wN3DhSGcnJqW8Ln23YOupAvxpE2sIIqgC9WlEYO4/hUEksc8YZ+feVF1EQNRbZU7y3OhJhxLBE6tbKnmY/71T47yuNYweOGDKL5djMQglEEdA/3u7AtKGE/rUqvBU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585650713505353.85575250822035; Tue, 31 Mar 2020 03:31:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAv-0000wa-TA; Tue, 31 Mar 2020 10:31:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEAt-0000vz-MR for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:31:15 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bd2aa47a-733a-11ea-b58d-bc764e2007e4; Tue, 31 Mar 2020 10:31:10 +0000 (UTC) X-Inumbo-ID: bd2aa47a-733a-11ea-b58d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585650671; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B2c8PFnX2lG4+CRuHl+fzIwey4dBLqAwqoZqdNixUwE=; b=FLbs6kVrUrc+UuR5GtTI1DogJw1eNK9IDocs37mwNutGdIHe7YiJtviT qaNsLz4Kw2F9gvSeoPIDIVysRNYEaX40iIgKErKXOkhCpCFws81Hajs7j QrHbnLWclZQ62sfZQIkLQugThieZiV5L91vCPHITrA0JheTnh3ATPPitm 8=; Authentication-Results: esa1.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 5jDjny+ZUqEGwf81l377FYnEOtjMnxe54Topdbn3WJfafEY6mRx6h1HRHfY1kfYqPpg1xCGxzh Q9zNMJo0vUU1pmGoFq0dLIZQLKsSnchnFahOhaqr1iZ+SXpJyy8njiYQKwrZ5mUpGB1tAJE+iV RbTcbtffzzPpjDZFvrjeZntdy/UId6JZImK8b08zfpRYBy0bkhcsN8Hc4GnR6zy6MuDq6wsckC S/3BqkEg8A5udvkzJUNOjtUG3ThlMn717fcV7HJpAlUSiemtG/BZesxrW6yXD+P7zmdMYkeyGo e4Y= X-SBRS: 2.7 X-MesageID: 15138790 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15138790" From: Anthony PERARD To: Subject: [XEN PATCH v4 09/18] xen/build: Start using if_changed Date: Tue, 31 Mar 2020 11:30:53 +0100 Message-ID: <20200331103102.1105674-10-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD , Daniel De Graaf , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This patch start to use if_changed introduced in a previous commit. Whenever if_changed is called, the target must have FORCE as dependency so that if_changed can check if the command line to be run has changed, so the macro $(real-prereqs) must be used to discover the dependencies without "FORCE". Whenever a target isn't in obj-y, it should be added to extra-y so the .*.cmd dependency file associated with the target can be loaded. This is done for xsm/flask/ and both common/lib{elf,fdt}/ and arch/x86/Makefile. For the targets that generate .*.d dependency files, there's going to be two dependency files (.*.d and .*.cmd) until we can merge them together in a later patch via fixdep from Linux. One cleanup, libelf-relocate.o doesn't exist anymore. We import cmd_ld and cmd_objcopy from Linux v5.4. Signed-off-by: Anthony PERARD Reviewed-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- Notes: v4: - typos - fix missing FORCE in libfdt/Makefile - typo flask vs flash in xsm - in xsm, use *_H_DEPEND in command lines of mkaccess and mkflask instead of $(real-prereq) to avoid including the script as argument of itself. xen/Rules.mk | 68 +++++++++++++++++++++++++++----------- xen/arch/arm/Makefile | 4 +-- xen/arch/x86/Makefile | 1 + xen/arch/x86/efi/Makefile | 7 ++-- xen/common/libelf/Makefile | 12 ++++--- xen/common/libfdt/Makefile | 11 +++--- xen/xsm/flask/Makefile | 17 +++++++--- 7 files changed, 85 insertions(+), 35 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index f531fd5e342d..5e668f5ba0d8 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -56,6 +56,18 @@ SPECIAL_DATA_SECTIONS :=3D rodata $(foreach a,1 2 4 8 16= , \ =20 include Makefile =20 +# Linking +# ------------------------------------------------------------------------= --- + +quiet_cmd_ld =3D LD $@ +cmd_ld =3D $(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs) + +# Objcopy +# ------------------------------------------------------------------------= --- + +quiet_cmd_objcopy =3D OBJCOPY $@ +cmd_objcopy =3D $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ + define gendep ifneq ($(1),$(subst /,:,$(1))) DEPS +=3D $(dir $(1)).$(notdir $(1)).d @@ -165,29 +177,47 @@ else $(CC) $(c_flags) -c $< -o $@ endif =20 -%.o: %.S Makefile - $(CC) $(a_flags) -c $< -o $@ +quiet_cmd_cc_o_S =3D CC $@ +cmd_cc_o_S =3D $(CC) $(a_flags) -c $< -o $@ + +%.o: %.S FORCE + $(call if_changed,cc_o_S) + + +quiet_cmd_obj_init_o =3D INIT_O $@ +define cmd_obj_init_o + $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx nam= e sz rest; do \ + case "$$name" in \ + .*.local) ;; \ + .text|.text.*|.data|.data.*|.bss) \ + test $$sz !=3D 0 || continue; \ + echo "Error: size of $<:$$name is 0x$$sz" >&2; \ + exit $$(expr $$idx + 1);; \ + esac; \ + done; \ + $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)= =3D.init.$(s)) $< $@ +endef + +$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE + $(call if_changed,obj_init_o) + +quiet_cmd_cpp_i_c =3D CPP $@ +cmd_cpp_i_c =3D $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@ + +quiet_cmd_cc_s_c =3D CC $@ +cmd_cc_s_c =3D $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@ =20 -$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile - $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name s= z rest; do \ - case "$$name" in \ - .*.local) ;; \ - .text|.text.*|.data|.data.*|.bss) \ - test $$sz !=3D 0 || continue; \ - echo "Error: size of $<:$$name is 0x$$sz" >&2; \ - exit $$(expr $$idx + 1);; \ - esac; \ - done - $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=3D= .init.$(s)) $< $@ +quiet_cmd_s_S =3D CPP $@ +cmd_s_S =3D $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ =20 -%.i: %.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@ +%.i: %.c FORCE + $(call if_changed,cpp_i_c) =20 -%.s: %.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@ +%.s: %.c FORCE + $(call if_changed,cc_s_c) =20 -%.s: %.S Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ +%.s: %.S FORCE + $(call if_changed,cpp_s_S) =20 # Add intermediate targets: # When building objects with specific suffix patterns, add intermediate diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 9f1ab2335756..b79ad55646bd 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -97,8 +97,8 @@ prelink_lto.o: $(ALL_OBJS) prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o $(LD) $(XEN_LDFLAGS) -r -o $@ $^ else -prelink.o: $(ALL_OBJS) - $(LD) $(XEN_LDFLAGS) -r -o $@ $^ +prelink.o: $(ALL_OBJS) FORCE + $(call if_changed,ld) endif =20 $(TARGET)-syms: prelink.o xen.lds diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index a805e9982e85..44137d919b66 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_TBOOT) +=3D tboot.o obj-y +=3D hpet.o obj-y +=3D vm_event.o obj-y +=3D xstate.o +extra-y +=3D asm-macros.i =20 x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h =20 diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 490d791aae2d..3e4c395b7535 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -1,7 +1,10 @@ CFLAGS-y +=3D -fshort-wchar =20 -%.o: %.ihex - $(OBJCOPY) -I ihex -O binary $< $@ +quiet_cmd_objcopy_o_ihex =3D OBJCOPY $@ +cmd_objcopy_o_ihex =3D $(OBJCOPY) -I ihex -O binary $< $@ + +%.o: %.ihex FORCE + $(call if_changed,objcopy_o_ihex) =20 boot.init.o: buildid.o =20 diff --git a/xen/common/libelf/Makefile b/xen/common/libelf/Makefile index 464c448d9d37..a92326c982e9 100644 --- a/xen/common/libelf/Makefile +++ b/xen/common/libelf/Makefile @@ -1,12 +1,16 @@ obj-bin-y :=3D libelf.o nocov-y +=3D libelf.o +libelf-objs :=3D libelf-tools.o libelf-loader.o libelf-dominfo.o =20 SECTIONS :=3D text data $(SPECIAL_DATA_SECTIONS) +OBJCOPYFLAGS :=3D $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$= (s)) =20 CFLAGS-y +=3D -Wno-pointer-sign =20 -libelf.o: libelf-temp.o Makefile - $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$(s)) $= < $@ +libelf.o: libelf-temp.o FORCE + $(call if_changed,objcopy) =20 -libelf-temp.o: libelf-tools.o libelf-loader.o libelf-dominfo.o #libelf-rel= ocate.o - $(LD) $(XEN_LDFLAGS) -r -o $@ $^ +libelf-temp.o: $(libelf-objs) FORCE + $(call if_changed,ld) + +extra-y +=3D libelf-temp.o $(libelf-objs) diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile index e2a5e59380a0..6bd207cf8ffa 100644 --- a/xen/common/libfdt/Makefile +++ b/xen/common/libfdt/Makefile @@ -1,14 +1,17 @@ include Makefile.libfdt =20 SECTIONS :=3D text data $(SPECIAL_DATA_SECTIONS) +OBJCOPYFLAGS :=3D $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$= (s)) =20 obj-y +=3D libfdt.o nocov-y +=3D libfdt.o =20 CFLAGS-y +=3D -I$(BASEDIR)/include/xen/libfdt/ =20 -libfdt.o: libfdt-temp.o Makefile - $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=3D.init.$(s)) $= < $@ +libfdt.o: libfdt-temp.o FORCE + $(call if_changed,objcopy) =20 -libfdt-temp.o: $(LIBFDT_OBJS) - $(LD) $(XEN_LDFLAGS) -r -o $@ $^ +libfdt-temp.o: $(LIBFDT_OBJS) FORCE + $(call if_changed,ld) + +extra-y +=3D libfdt-temp.o $(LIBFDT_OBJS) diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile index 011ef5ca91f8..7d0831e2b865 100644 --- a/xen/xsm/flask/Makefile +++ b/xen/xsm/flask/Makefile @@ -20,12 +20,21 @@ AV_H_FILES =3D include/av_perm_to_string.h include/av_p= ermissions.h ALL_H_FILES =3D $(FLASK_H_FILES) $(AV_H_FILES) =20 $(obj-y) ss/built_in.o: $(ALL_H_FILES) +extra-y +=3D $(ALL_H_FILES) =20 -$(FLASK_H_FILES): $(FLASK_H_DEPEND) - $(CONFIG_SHELL) policy/mkflask.sh $(AWK) include $(FLASK_H_DEPEND) +mkflask :=3D policy/mkflask.sh +quiet_cmd_mkflask =3D MKFLASK $@ +cmd_mkflask =3D $(CONFIG_SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND) =20 -$(AV_H_FILES): $(AV_H_DEPEND) - $(CONFIG_SHELL) policy/mkaccess_vector.sh $(AWK) $(AV_H_DEPEND) +$(FLASK_H_FILES): $(FLASK_H_DEPEND) $(mkflask) FORCE + $(call if_changed,mkflask) + +mkaccess :=3D policy/mkaccess_vector.sh +quiet_cmd_mkaccess =3D MKACCESS VECTOR $@ +cmd_mkaccess =3D $(CONFIG_SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND) + +$(AV_H_FILES): $(AV_H_DEPEND) $(mkaccess) FORCE + $(call if_changed,mkaccess) =20 obj-bin-$(CONFIG_XSM_FLASK_POLICY) +=3D flask-policy.o flask-policy.o: policy.bin --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651678; cv=none; d=zohomail.com; s=zohoarc; b=S8Lku4tvm/12nm8jHJ0aw9+kZFJUXI8F686iFPta5G1kTYjV0ct5MNcFEYCYBWn39dk/1ZpqbbBkxDARp6vcKr+5PFBcs3q2oj6UZHltpFMC0ldfnWKcuWGqMyrLc2vx5PFgcSyoge016FKX3OTpDj//k9Q/QD/6mSLqqWboQkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651678; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9TgtAm6ppL6Wzy8KM5jKIGWA7bYs/NQKIO13HeuveUs=; b=a38974EUbWW/TUA0Ubikg2sMfyhQVsQkus6K+OfrslO2j9V7840LEtCqWtdMZnbwF9Zu5HD+7ooINK83ucMtWv/zSXmaD6OmIkcIrFiAsh2pBRrKHUNPCB4wIT2TewBj9kaku0yg+MMY4LWrJ7AVOaifzRp2wQPwuUjBO5Exc3A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651678346417.3751246638484; Tue, 31 Mar 2020 03:47:58 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQZ-0002vr-2G; Tue, 31 Mar 2020 10:47:27 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQX-0002uY-9C for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:25 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fe66ed16-733c-11ea-83d8-bc764e2007e4; Tue, 31 Mar 2020 10:47:19 +0000 (UTC) X-Inumbo-ID: fe66ed16-733c-11ea-83d8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OFAz1fugU3l3YdNV5mZP5c0I0tExp22dADHA+0CiQhM=; b=KApy001RsL3+yLM/84Mo6qzQq6tMonqNhNL84OWNOhf71vJn5NivbYHa kbJAwEo5Go3hbaoCHaTNCegSSfxB21i/V1zUFSIHs6YLb+/7qYsJpEOm0 25UlN6wfu7I1ddK9WHLoqgV0fRWlSl1tIiF43+8Xdy+hbPw2PCU3MxxGp 8=; Authentication-Results: esa5.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AyEooyTpBqlOIWVXy3xFHTEcW0CEkYpDuLUyZnvUsv7BHR4ALDW7+qBFx/qWQrD4WtMusLgvTr hG53AY9mh4XSiCK0ayJn9KIqQKOWjeX5bVb0AAiTTTdYPsjzJWqXzFqO35fJ5bY1+5kA5vApli YBwlcF03FKg74rvgckr08MhTaQUjwxkdo477xHcdaNRuUE0qJgpyOtyvS8/NrQQREPJQaUksZQ 5vD6ZNg4uMX2mkIyVgIZiJvzu3GC8+qwWMt1M2042SR1wpPnCp6G2//JkM0PXltg91tIjTrRP/ CvU= X-SBRS: 2.7 X-MesageID: 15246893 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15246893" From: Anthony PERARD To: Subject: [XEN PATCH v4 10/18] xen/build: use if_changed on built_in.o Date: Tue, 31 Mar 2020 11:30:54 +0100 Message-ID: <20200331103102.1105674-11-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In the case where $(obj-y) is empty, we also replace $(c_flags) by $(XEN_CFLAGS) to avoid generating an .%.d dependency file. This avoid make trying to include %.h file in the ld command if $(obj-y) isn't empty anymore on a second run. Signed-off-by: Anthony PERARD --- Notes: v4: - Have cmd_ld_builtin depends on CONFIG_LTO, which simplify built_in.o rule. xen/Rules.mk | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index 5e668f5ba0d8..c744175fd6f0 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -130,15 +130,24 @@ include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk c_flags +=3D $(CFLAGS-y) a_flags +=3D $(CFLAGS-y) $(AFLAGS-y) =20 -built_in.o: $(obj-y) $(extra-y) -ifeq ($(obj-y),) - $(CC) $(c_flags) -c -x c /dev/null -o $@ -else +quiet_cmd_ld_builtin =3D LD $@ ifeq ($(CONFIG_LTO),y) - $(LD_LTO) -r -o $@ $(filter-out $(extra-y),$^) +cmd_ld_builtin =3D \ + $(LD_LTO) -r -o $@ $(filter-out $(extra-y),$(real-prereqs)) else - $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) +cmd_ld_builtin =3D \ + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$(real-prereqs)) endif + +quiet_cmd_cc_builtin =3D LD $@ +cmd_cc_builtin =3D \ + $(CC) $(XEN_CFLAGS) -c -x c /dev/null -o $@ + +built_in.o: $(obj-y) $(extra-y) FORCE +ifeq ($(obj-y),) + $(call if_changed,cc_builtin) +else + $(call if_changed,ld_builtin) endif =20 targets +=3D built_in.o --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651681; cv=none; d=zohomail.com; s=zohoarc; b=UpsvXdlPp/p1yZX6MNIuNDb0dKShO1jAnZfvrwfNK6PxZXxEMJNTLp1i2iYZ2b3XaJwClxgbGDsAv6Hntb3aQiPQx8n6Dkus7eTrgUJLb43I41xmmuong2v/saNUCgkFtQd47kNDIZdfYL5mgwJLMns8AIFU5HEv6nBMJK7U9co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651681; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S2IfWeSxw0YzhM0E+kH190Kn386hWQb4dNuf91/2yk0=; b=EgFoOph5d7IkSLIoPA16rmse/1IULOj3bpcltdcoTtKwBaWdEyDUvUF4yHMdNg5UH9ARlMODvJtERXihwL5iY2VM7RqkrBR3riS2tcRWs4ixBARHAv13HBipZsMnAP9VhCT5P0qlHILCgiievJB6pm3ytgk9WWpkDxG5ffPt+Bk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158565168141483.52087226014908; Tue, 31 Mar 2020 03:48:01 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQd-0002y8-KG; Tue, 31 Mar 2020 10:47:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQc-0002xQ-9m for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:30 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 02dda9ca-733d-11ea-b4f4-bc764e2007e4; Tue, 31 Mar 2020 10:47:27 +0000 (UTC) X-Inumbo-ID: 02dda9ca-733d-11ea-b4f4-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651648; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C/idYU1VU2IlndD5vCH9ocRvuNC+krC6KqsaRrZnf0k=; b=bce8vxZW7Fz6WB2qh825b+suND+A5ftH+tV63fpKgRqrcwolTsoYY9h2 PR+MWHsO26sEewsWQiScN04ZjojQEulROKahCQgiyTyQdHcN1sWYN6OMn k8T5TaWL9NucKIWfj9eDKmgjlV3jjPnmIXMw2DRRve2FGUWq7nkb3AnOY E=; 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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: FNgE11mTYU3wsjPR7QjbGUq7CMfBh/nCRoj0+HaxpFVo+1Opo9Q5qyCTJic45FydjzPbBNEQad J5YRSwElfxKn3Sqm/6yhWDN1sS3WqC6QVX5pkI26WcZ90zBaYCsgxK3X6AFQOapbCu3OA0NaLY D7MSyax+UZ5a9LhqwZ6q/5+qOMBHBPhHPxaFpzju6JprHsF5391LXlhgLFSdxDxHc0wj20NtIq 8pTtfzdsJdsMhdLhOwcAKnFaqleWxl6iai9uOHXvDh5xrWv4ek9IuA7UJSV9PU9Vx4iRY9Blpv z48= X-SBRS: 2.7 X-MesageID: 14931630 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.72,327,1580792400"; d="scan'208";a="14931630" From: Anthony PERARD To: Subject: [XEN PATCH v4 11/18] xen/build: Use if_changed_rules with %.o:%.c targets Date: Tue, 31 Mar 2020 11:30:55 +0100 Message-ID: <20200331103102.1105674-12-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use $(dot-target) to have the target name prefix with a dot. Now, when the CC command has run, it is recorded in .*.cmd file, then if_changed_rules will compare it on subsequent runs. Signed-off-by: Anthony PERARD Reviewed-by: Jan Beulich --- xen/Rules.mk | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index c744175fd6f0..e126e4972dec 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -173,19 +173,27 @@ FORCE: =20 SRCPATH :=3D $(patsubst $(BASEDIR)/%,%,$(CURDIR)) =20 -%.o: %.c Makefile +quiet_cmd_cc_o_c =3D CC $@ ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y) - $(CC) $(c_flags) -c $< -o $(@D)/.$(@F).tmp -MQ $@ -ifeq ($(CONFIG_CC_IS_CLANG),y) - $(OBJCOPY) --redefine-sym $<=3D$(SRCPATH)/$< $(@D)/.$(@F).tmp $@ -else - $(OBJCOPY) --redefine-sym $( (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651684478467.420387744163; Tue, 31 Mar 2020 03:48:04 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQS-0002tK-Ck; Tue, 31 Mar 2020 10:47:20 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQQ-0002t8-8y for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:18 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fcbfefe4-733c-11ea-ba0c-12813bfff9fa; Tue, 31 Mar 2020 10:47:17 +0000 (UTC) X-Inumbo-ID: fcbfefe4-733c-11ea-ba0c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651638; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FHYkNezbYLhFdJXNlxKEcwRSWLaRLmX8bAyIhKPah8Y=; b=NYFlKxqkELkcGEBXT8Hl803eImMavEh8wPZYuaK+3q4cFMvT8kpr3thN uCpPPV46RNv/UYa8OmBKf3wc2TIu9ilzzCQ5rpEqMC3LMJhHxlXZfxNSl anHW8E4Lqfs0KXhFmH+9s8j34eWFV160OoKNxSx20goji/Xe10ijXVYH/ E=; Authentication-Results: esa1.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ypJnTiuFBLZby/9ovzioVFf4dDg8dnxaKj1qHxWlrIt6ZckfnlKpIYfdTkeu5DEONZ86RvcvzY AtNZgtZouTHBtKrdBFyn417H+LiRjLSNfMnfpqxBKaiZg++/pBR+3s1gnEmnrAfP7IZteFszw4 Hez/QNIZc/hLSLQNFSVc6LbtaiGaZZDR7wsMomIUVrbAl5vYm9yBGadvXWnfSufRfmaI/OwmfO itcAhoe8e6DMHKgJPyrBsGwVAR8wv7Ibb9hfcff6tITpnZXLrhQSbOutFNxAYjViap4Ou6Kalp FG4= X-SBRS: 2.7 X-MesageID: 15139848 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15139848" From: Anthony PERARD To: Subject: [XEN PATCH v4 12/18] xen/build: factorise generation of the linker scripts Date: Tue, 31 Mar 2020 11:30:56 +0100 Message-ID: <20200331103102.1105674-13-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In Arm and X86 makefile, generating the linker script is the same, so we can simply have both call the same macro. We need to add *.lds files into extra-y so that Rules.mk can find the .*.cmd dependency file and load it. Change made to the command line: - Use of $(CPP) instead of $(CC) -E - Remove -Ui386. We don't compile Xen for i386 anymore, so that macro is never defined. Also it doesn't make sense on Arm. Signed-off-by: Anthony PERARD --- Notes: v4: - fix rebuild by adding FORCE as dependency - Use $(CPP) - remove -Ui386 - avoid using "define" for cmd_cc_lds_S, as adding '; \' on each line is still mandatory for if_changed (or cmd) macro to work. xen/Rules.mk | 6 ++++++ xen/arch/arm/Makefile | 8 ++++---- xen/arch/x86/Makefile | 8 ++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index e126e4972dec..616c6ae179d8 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -236,6 +236,12 @@ cmd_s_S =3D $(CPP) $(filter-out -Wa$(comma)%,$(a_flags= )) $< -o $@ %.s: %.S FORCE $(call if_changed,cpp_s_S) =20 +# Linker scripts, .lds.S -> .lds +quiet_cmd_cc_lds_S =3D LDS $@ +cmd_cc_lds_S =3D $(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $<;= \ + sed -e 's/.*\.lds\.o:/$(@F):/g' <$(dot-target).d >$(dot-target).d.new;= \ + mv -f $(dot-target).d.new $(dot-target).d + # Add intermediate targets: # When building objects with specific suffix patterns, add intermediate # targets that the final targets are derived from. diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index b79ad55646bd..45484d6d11b2 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -64,6 +64,8 @@ obj-y +=3D vpsci.o obj-y +=3D vuart.o extra-y +=3D $(TARGET_SUBARCH)/head.o =20 +extra-y +=3D xen.lds + #obj-bin-y +=3D ....o =20 ifdef CONFIG_DTB_FILE @@ -122,10 +124,8 @@ $(TARGET)-syms: prelink.o xen.lds asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $< =20 -xen.lds: xen.lds.S - $(CC) -P -E -Ui386 $(a_flags) -o $@ $< - sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new - mv -f .xen.lds.d.new .xen.lds.d +xen.lds: xen.lds.S FORCE + $(call if_changed,cc_lds_S) =20 dtb.o: $(CONFIG_DTB_FILE) =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 44137d919b66..eb6f7a6aceca 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -72,6 +72,7 @@ obj-y +=3D hpet.o obj-y +=3D vm_event.o obj-y +=3D xstate.o extra-y +=3D asm-macros.i +extra-y +=3D xen.lds =20 x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h =20 @@ -173,6 +174,7 @@ export XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -= c efi/check.c -o efi/check. # Check if the linker supports PE. XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsyste= m=3D10 -o efi/check.efi efi/check.o 2>/dev/null && echo y)) CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI +extra-$(XEN_BUILD_PE) +=3D efi.lds =20 $(TARGET).efi: VIRT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n '= s, A VIRT_START$$,,p') $(TARGET).efi: ALT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's= , A ALT_START$$,,p') @@ -240,10 +242,8 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i = Makefile $(call move-if-changed,$@.new,$@) =20 efi.lds: AFLAGS-y +=3D -DEFI -xen.lds efi.lds: xen.lds.S - $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $< - sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new - mv -f .$(@F).d.new .$(@F).d +xen.lds efi.lds: xen.lds.S FORCE + $(call if_changed,cc_lds_S) =20 boot/mkelf32: boot/mkelf32.c $(HOSTCC) $(HOSTCFLAGS) -o $@ $< --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651687; cv=none; d=zohomail.com; s=zohoarc; b=FG5LuBfzkYW79WRNfpVK3Vd6jrQ2kS1hDukfX8TKa4KCPSVuODDChODRRpd+PC1zf5zEhRrLm6rX0E3HKfs+O1qCzuSjwccdzPSmFzfeHorjSNt3/M6JDCSfVXKbO+QjFmGTxYAJ8mwUu8g68SanW3V7DK7nGLabo8nZFNA/9cI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651687; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Stq0mk+X7HH5WZDkNs0Paa0P8H9sBMbSziOS+TBzoIg=; b=TbVRjHfQzAs7C/A9Q2Upq5oE7C8vXuWJ1GveyUGJSNsUry28mGfMAzwFSHJtj1itpnBqKAFVH0lXnTSSSeejn3K0mMHdEkVQeJrkU3Edv/ZajSEikUDra6BTwIES50wDNF2rBydJ4a5e/ct0w53JcKKnE6V4tpIWVdaW9MWtXaw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651687115116.92157176141359; Tue, 31 Mar 2020 03:48:07 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQi-00033G-8z; Tue, 31 Mar 2020 10:47:36 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQh-00032A-7o for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:35 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 05b79fdf-733d-11ea-ba0c-12813bfff9fa; Tue, 31 Mar 2020 10:47:32 +0000 (UTC) X-Inumbo-ID: 05b79fdf-733d-11ea-ba0c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sTRFnOyU0qysVRQKIYm0QNOBqhQc72Q/G0zAnlz7wss=; b=WkV+h0PCk7bhHCZu30gDrjMdITnj0n/1Tbr6PaS31bQysA6lyaBmyVQe RxLWRqF1ngjOr9ToheOGKnEOrPOVUyMcOjQtJp7eF7YVzXwVmyGzKTjZv Q0Rw9GDW164DtNCHmzMVCAq6bvuR2pHWmag+FWaRY8xUn4+nKbBIGG9Gi c=; Authentication-Results: esa3.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: viTSuHUT56dAd46Npgp61E6wHa4ri6NYqsb0L7KvibMGiKbnoav/JB/670NXVr7YjHfSVYzvMy BHNSFWPTVt/yTHp9rdWDbgWj7Ft84gStkYjngUTbtjuCAR7Xnl+Oxy7dw9xxqJjqBrcxhnPGA8 eX4rOCQLX4L91ytvh+m7kbGGU7bH3BVQciDty5hI+Vhwoqe8imQmJSC4OAHDh9T5BrnYN6OlHj VfPaUE/tdfYgvoAq7Wa4b0fYZ90QkEKXTdal2+K5f9yZR1BZbMrFzNn6vzm9iiPO6YS1kClMIf 4Ws= X-SBRS: 2.7 X-MesageID: 14904511 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="14904511" From: Anthony PERARD To: Subject: [XEN PATCH v4 13/18] xen/build: Use if_changed for prelink*.o Date: Tue, 31 Mar 2020 11:30:57 +0100 Message-ID: <20200331103102.1105674-14-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: Anthony PERARD , Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We change the dependencies of prelink-efi.o so that we can use the same command line. The dependency on efi/built_in.o isn't needed because, we already have: efi/*.o: efi/built_in.o to build efi/*.o files that prelink-efi.o needs. Signed-off-by: Anthony PERARD Reviewed-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- Notes: v4: - fix rebuild, prelink.o and prelink-efi.o needs to be in targets xen/arch/x86/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index eb6f7a6aceca..7676fb1c5bc8 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -128,11 +128,13 @@ prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$= (ALL_OBJS)) prelink_lto.o prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) preli= nk-efi_lto.o efi/boot.init.o $(LD) $(XEN_LDFLAGS) -r -o $@ $^ else -prelink.o: $(ALL_OBJS) - $(LD) $(XEN_LDFLAGS) -r -o $@ $^ +prelink.o: $(ALL_OBJS) FORCE + $(call if_changed,ld) + +prelink-efi.o: $(filter-out %/efi/built_in.o,$(ALL_OBJS)) efi/boot.init.o = efi/runtime.o efi/compat.o FORCE + $(call if_changed,ld) =20 -prelink-efi.o: $(ALL_OBJS) efi/boot.init.o efi/runtime.o efi/compat.o - $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^) +targets +=3D prelink.o prelink-efi.o endif =20 $(TARGET)-syms: prelink.o xen.lds --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651680; cv=none; d=zohomail.com; s=zohoarc; b=M2sZ2HwaGhFKaRjFVayDEKViCLrLi9gSFzVQdltptMXSR0LV8E/JmX4QCNW8G8Fqu7aAkWnqaiKPB+/N90TWk4Trk/G/cvPTwZZBY6Po0QaTqo+bL/uQvPqj3HGv4DOTtGeF6GYLoYfm4ld2ZCji2Jr94hQa8wH2ikIuQbl/tc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651680; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tIS541Mi+XnbgBEzrjOW0GARa2CcjMRTiX6ya5D4eh8=; b=GC9PR/MGrtqfA1lLWDVLdHAHibIdYUHFBb3aWl8G638Gm1YEAiW41fNismv23CDxamoREYJ10InDb+s73S9VCFgVVntwG2ic/rxcdFgOMIKO1kpr2OlnEXwyyeIbgZUuK0z56PYUnVkxLN0fl4Dk7mOMkDsF53M5Psi3r2sc8EE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651680864342.33159340472184; Tue, 31 Mar 2020 03:48:00 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQT-0002tr-PR; Tue, 31 Mar 2020 10:47:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQS-0002tI-9L for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:20 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fd9b1d8a-733c-11ea-b4f4-bc764e2007e4; Tue, 31 Mar 2020 10:47:18 +0000 (UTC) X-Inumbo-ID: fd9b1d8a-733c-11ea-b4f4-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651638; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WEganlCLf9iH3li5o79RD1d6TA/dpojCk7fL8gRP9n0=; b=fTlyCkFS4Ywt1BqVlkF9CeHrRiWvgH1lcDSanwrZ4XiqU1YC1wJIZP6n xVO3YgOrnu8jsojLt4ES3LgEqri0G54cM8XPGjvzCn5CpmO1VV7tVEMGK gPqCTm4YQxTtvCbc/doQsxS3Ywi6YBsfH5IW7VV8VdY83AIi4tV6jQKg3 Q=; Authentication-Results: esa3.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 0KDMJMtNxrN6s0LlHcU/7e1xwJ6DcJdKAx+045ZEeYVQVmJkmVRdd2fe2uf3B6DLSSpNzY+AKq cEFIBneGnWhS+NNkGmpc8MRMKw+X6yMqTIGR0jVJ2NGHm6gEqE2tWfK3/Cc31a7ros55XicrIJ PapZAZQ/U4ZQm7L/nM4xT4GMrLyWuhlnifT9ZxZVT3FswYguJri3B+TBYgL/8c7bX1Lg4TFZY0 g9i1wa292pSezYjvx3L9KLRM1d5hbvz/jwdAhy70AkGYZ4q2rp4XSNIUK7Xpp0ekgYLU+Z/OQ/ 9ws= X-SBRS: 2.7 X-MesageID: 14904501 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="14904501" From: Anthony PERARD To: Subject: [XEN PATCH v4 14/18] xen,symbols: rework file symbols selection Date: Tue, 31 Mar 2020 11:30:58 +0100 Message-ID: <20200331103102.1105674-15-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We want to use the same rune to build mm/*/guest_*.o as the one use to build every other *.o object. The consequence it that file symbols that the program ./symbols prefer changes with CONFIG_ENFORCE_UNIQUE_SYMBOLS=3Dy. (1) Currently we have those two file symbols: guest_walk.c guest_walk_2.o (2) with CONFIG_ENFORCE_UNIQUE_SYMBOLS used on guest_walk.c, we will have: arch/x86/mm/guest_walk.c guest_walk_2.o The order in which those symbols are present may be different. Currently, in case (1) ./symbols chooses the *.o symbol (object file name). But in case (2), may choose the *.c symbol (source file name with path component) if it is first We want to have ./symbols choose the object file name symbol in both cases. So this patch changes that ./symbols prefer the "object file name" symbol over the "source file name with path component" symbols. The new intended order of preference is: - first object file name symbol - first source file name with path components symbol - last source file name without any path component symbol Signed-off-by: Anthony PERARD --- Notes: v4: - rescope enum symbol_type - remove setting values to enums, as it's not needed. - rename the enumeration symbols =20 commmit rewriting: =20 We want to use the same rune to build mm/*/guest_*.o as the one use to build every other *.o object. The consequence it that file symbols that the program ./symbols prefere changes with CONFIG_ENFORCE_UNIQUE_SYMBOL= S=3Dy. =20 (1) Currently we have those two file symboles: guest_walk.c guest_walk_2.o (2) with CONFIG_ENFORCE_UNIQUE_SYMBOLS used on guest_walk.c, we will ha= ve: arch/x86/mm/guest_walk.c guest_walk_2.o =20 The order in which those symbols are present may be different. =20 Currently, in case (1) ./symbols chooses the *.o symbol (object file name). But in case (2), may choose the *.c symbol (source file name with path component) if it is first. =20 This patch changes that ./symbols prefere the "object file name" symbol= over the "source file name with path component" symbols. xen/tools/symbols.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c index 9f9e2c990061..b3a9465b32d3 100644 --- a/xen/tools/symbols.c +++ b/xen/tools/symbols.c @@ -84,7 +84,12 @@ static int read_symbol(FILE *in, struct sym_entry *s) { char str[500], type[20] =3D ""; char *sym, stype; - static enum { symbol, single_source, multi_source } last; + static enum symbol_type { + symbol, + file_source, + path_source, + obj_file, + } last; static char *filename; int rc =3D -1; =20 @@ -125,13 +130,20 @@ static int read_symbol(FILE *in, struct sym_entry *s) * prefer the first one if that names an object file or has a * directory component (to cover multiply compiled files). */ - bool multi =3D strchr(str, '/') || (sym && sym[1] =3D=3D 'o'); + enum symbol_type current; =20 - if (multi || last !=3D multi_source) { + if (sym && sym[1] =3D=3D 'o') + current =3D obj_file; + else if (strchr(str, '/')) + current =3D path_source; + else + current =3D file_source; + + if (current > last || last =3D=3D file_source) { free(filename); filename =3D *str ? strdup(str) : NULL; + last =3D current; } - last =3D multi ? multi_source : single_source; goto skip_tail; } =20 --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651684; cv=none; d=zohomail.com; s=zohoarc; b=T8/EGQn1I9GD3OnE9sNfUojadodMkwq03/bDQuE1OGW92OXtQZL8tU3CUxb1MdGupJoYi4QvLCkNZV7ZBtT/jrgUNN5mrdwTzFTY7eRmPTps457fzsEHKdIifNhrN+kAkgJVIjVFoyXhHej4cSKHM3yZN/XHByxYR267UHQi0AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651684; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8VrObT3kbfNzRPU3kE5IEdc3uWTCUZD1VxwIDB9hRH0=; b=PXth2Nj21w0256MBa1350wQZTzS78hQuPBuPX4qLC+9QOTko0sFytHLucTACIKHyvoxYRe6w8bBcO7ebT0sOZ+AZE2eS1/q3XxZ8+VudgJ0axUhQF76YRojJPIQZ532BWBT+7nvZoP/kcWy8gr5RA5OFR8Pl1pOcxZ8gxfcj3rM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651684348639.8195057272886; Tue, 31 Mar 2020 03:48:04 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQi-00033g-Ij; Tue, 31 Mar 2020 10:47:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQh-00032F-Aa for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:35 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 038cc518-733d-11ea-b4f4-bc764e2007e4; Tue, 31 Mar 2020 10:47:27 +0000 (UTC) X-Inumbo-ID: 038cc518-733d-11ea-b4f4-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651648; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hJREXR/Deb6xN8gdjZwqytr8p+Qcw1FoTGCESEajh20=; b=VWXWNdVduAGTFZXcfLXzaB1LzcKnQOkh/sG8zUBS3q8Y5TwAvByuc/ja L94IZEwBenMQCXnhLlCQYVNP+LN3qAh7CpSuRdr0m2Q70IMZ6b1Box+cy Ovz6BxZfkPbdTT9jjk6JjLmn0uYENMOLW3dkBWjZdeivDhRYdDmFJcI52 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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: M1Eh0mQ4Ys0U/xe6Q7L+JvVmMf0aCsAbBWLadE3vSGRZQbkzv+ClHUFKMDThikDWsVXVjMHeKH ssbS6H+M+tko5HYaokNkeNVS7TS28zzJrvyYelc2L5Y2KEbE4Ww5H/Or/2aD6AMZlCoi3r5h8n ZtyQJQcdhLgDJCflK6wSLcnM1l20avL5WggdaYfFBD5NHROHeG+AfU9EVsL+7GeJAyx04A6ra/ 4gY2dMNASHEIq03UmGLGqX6mtc/oF7yfjpCufrvRUwtM8kvxGBI/c4Xdnl2Ghi1It7H1fjFKyY Ad8= X-SBRS: 2.7 X-MesageID: 14931634 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.72,327,1580792400"; d="scan'208";a="14931634" From: Anthony PERARD To: Subject: [XEN PATCH v4 15/18] xen/build: use if_changed to build guest_%.o Date: Tue, 31 Mar 2020 11:30:59 +0100 Message-ID: <20200331103102.1105674-16-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Wei Liu , Andrew Cooper , Tim Deegan , George Dunlap , Jan Beulich , Anthony PERARD , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use if_changed for building all guest_%.o objects, and make use of command that already exist. 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 --- Notes: v4: - remove the introduction of Kbuild's CFLAGS_$@ and simply use make's per-target variable customization. Mostly to avoid using $(eval ) which might not work as expected on make 3.80. xen/arch/x86/mm/Makefile | 14 ++++++++------ xen/arch/x86/mm/hap/Makefile | 15 +++++++++------ xen/arch/x86/mm/shadow/Makefile | 14 ++++++++------ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile index a2431fde6bb4..a66a57314489 100644 --- a/xen/arch/x86/mm/Makefile +++ b/xen/arch/x86/mm/Makefile @@ -11,11 +11,13 @@ obj-y +=3D p2m.o p2m-pt.o obj-$(CONFIG_HVM) +=3D p2m-ept.o p2m-pod.o obj-y +=3D paging.o =20 -guest_walk_%.o: guest_walk.c Makefile - $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ +guest_walk_%.o guest_walk_%.i guest_walk_%.s: CFLAGS-y +=3D -DGUEST_PAGING= _LEVELS=3D$* =20 -guest_walk_%.i: guest_walk.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -= c $< -o $@ +guest_walk_%.o: guest_walk.c FORCE + $(call if_changed_rule,cc_o_c) =20 -guest_walk_%.s: guest_walk.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -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..34720b2fbe2e 100644 --- a/xen/arch/x86/mm/hap/Makefile +++ b/xen/arch/x86/mm/hap/Makefile @@ -5,11 +5,14 @@ obj-y +=3D guest_walk_4level.o obj-y +=3D nested_hap.o obj-y +=3D nested_ept.o =20 -guest_walk_%level.o: guest_walk.c Makefile - $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ +guest_walk_%level.o guest_walk_%level.i guest_walk_%level.s: \ + CFLAGS-y +=3D -DGUEST_PAGING_LEVELS=3D$* =20 -guest_walk_%level.i: guest_walk.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -= c $< -o $@ +guest_walk_%level.o: guest_walk.c FORCE + $(call if_changed_rule,cc_o_c) =20 -guest_walk_%level.s: guest_walk.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -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/Makef= ile index 23d3ff10802c..e00f9cb1aaba 100644 --- a/xen/arch/x86/mm/shadow/Makefile +++ b/xen/arch/x86/mm/shadow/Makefile @@ -6,11 +6,13 @@ else obj-y +=3D none.o endif =20 -guest_%.o: multi.c Makefile - $(CC) $(c_flags) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ +guest_%.o guest_%.i guest_%.s: CFLAGS-y +=3D -DGUEST_PAGING_LEVELS=3D$* =20 -guest_%.i: multi.c Makefile - $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -= c $< -o $@ +guest_%.o: multi.c FORCE + $(call if_changed_rule,cc_o_c) =20 -guest_%.s: multi.c Makefile - $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=3D$* -S= $< -o $@ +guest_%.i: multi.c FORCE + $(call if_changed,cpp_i_c) + +guest_%.s: multi.c FORCE + $(call if_changed,cc_s_c) --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651682; cv=none; d=zohomail.com; s=zohoarc; b=IgLPHwTBtbkfS8JiqdXP/bVYcG0hn1mFXlZ8TO+LDSp0Owh3U9W7IdCXfWgKDybNhrzMBtYW3mBwXvQ6ioKjEVikROW03mAFsFlN5qjW08S7nZe9rs3VUevFTMgsgbleQtOK6ia7tblfS2gMO+J4oyNeq+bYDI/3QOtc/QAB30I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651682; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=h1bXAsh6rLmDPaF1PX1d94XVtvKrRnX6JomdXdI/e3Q=; b=cE3IhbdA44AOQQZgyzjCFGnkh2M1uC0ROTbhC9ir5iYO6r5pMiCI7SQ4HU9kDwpdQjFf/H2qK6xMnn18f95jdkUtIrrM0sfDyCs/+eGqKUoExfmS5nkhsd078ew5o8IruYOZlEaGFl37TaB0+EjSmefqbTXLNd+0G0oAgaG4d7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651682355215.38839775202564; Tue, 31 Mar 2020 03:48:02 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQd-0002xm-BK; Tue, 31 Mar 2020 10:47:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQc-0002xN-7S for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:30 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0454d062-733d-11ea-ba0c-12813bfff9fa; Tue, 31 Mar 2020 10:47:29 +0000 (UTC) X-Inumbo-ID: 0454d062-733d-11ea-ba0c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651650; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JeUsPgvppjoTgoSQDJQrJ8xz/P7fKJCsWup60MnRC1U=; b=GtT/9khLtDcBk8y/h5QXzDOjEQ0lNpzFZsS2fMCp1GjTeNmo/IJF4DnU T3+GGpAW7wOwTgqvuTNYLSn4P5E2CN7WbzJVq3IQTFUrGrUI7MDS6yocv glbQSz25lrkshODfmGhtRcTfPX9+d9FMuV7/Yk1TNG+nFvr6Sle3tXSCF s=; Authentication-Results: esa3.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: KdzNX0PSUNBli/sj0NvYAwoVyQVUg1hP+RRdG1xUB/X0PuJWpmXnTDjgFCgTu+HupwK+L0fl/h 1DgloYAoGWi7gA1yc3+WJocpwEf9f5JeLW22v02ECeAzzcIflghDVEbZvR5y+118u0SUFXSz/a xp7g4KZvCF8ixnFdnylqbySHJxGis1Nm9HybGm79Q5RDUrnw5mrykNzNockz0mSkugi+nHxz+D HQ5fBzPfzoljcyv5vN8A1auu6RqdZhlarQ45GT06F3a39VK69twjlTik7sdxqfHPBrBMBN0HaX Gqs= X-SBRS: 2.7 X-MesageID: 14904509 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="14904509" From: Anthony PERARD To: Subject: [XEN PATCH v4 16/18] build,xsm: Fix multiple call Date: Tue, 31 Mar 2020 11:31:00 +0100 Message-ID: <20200331103102.1105674-17-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Anthony PERARD , Daniel De Graaf Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Both script mkflask.sh and mkaccess_vector.sh generates multiple files. Exploits the 'multi-target pattern rule' trick to call each scripts only once. Signed-off-by: Anthony PERARD Reviewed-by: Jan Beulich --- Notes: v4: - new patch xen/xsm/flask/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile index 7d0831e2b865..48577cbe3f04 100644 --- a/xen/xsm/flask/Makefile +++ b/xen/xsm/flask/Makefile @@ -26,14 +26,14 @@ mkflask :=3D policy/mkflask.sh quiet_cmd_mkflask =3D MKFLASK $@ cmd_mkflask =3D $(CONFIG_SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND) =20 -$(FLASK_H_FILES): $(FLASK_H_DEPEND) $(mkflask) FORCE +$(patsubst include/%,\%/%,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) = FORCE $(call if_changed,mkflask) =20 mkaccess :=3D policy/mkaccess_vector.sh quiet_cmd_mkaccess =3D MKACCESS VECTOR $@ cmd_mkaccess =3D $(CONFIG_SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND) =20 -$(AV_H_FILES): $(AV_H_DEPEND) $(mkaccess) FORCE +$(patsubst include/%,\%/%,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE $(call if_changed,mkaccess) =20 obj-bin-$(CONFIG_XSM_FLASK_POLICY) +=3D flask-policy.o --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651687; cv=none; d=zohomail.com; s=zohoarc; b=ErjQizmxE7c/qDxkKQeSfP3e6zgLcA2X9HuUbOhwtse8Y26AJTilhTL0xx6i3CoIRtlPaCK4ljQlErYELsLq6t2V/Hdwu+fynIxaBPDzByPVXwg/UaqEWGX+ZWxC/YcBuxixftkeqxEF02OJnWbEfIeXJRGUTpmBsQF1zgAivOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651687; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H+wiZhljHIQ6SIAHtKH0xdEB7sKzd87RqEFlaxxOGss=; b=KMQ3qRNv4FnvD070IYZWSXD6lE/e+e6Zjx9kuMHbVEQ3YEm/AU1UaQ7qNvIIuGGjV9oOiLtf8MutJAkuv/jXMuXUfe7SBR5WWzlFTipAdheOz5dsZvrgSaYafKPNaoMJjquHoSGdd4rXcvmEgB1+SsADLLuo880rXjtmQCWsQSU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651687640915.6508790146404; Tue, 31 Mar 2020 03:48:07 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQP-0002t2-4D; Tue, 31 Mar 2020 10:47:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQN-0002sx-F8 for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:15 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fb74fcb0-733c-11ea-83d8-bc764e2007e4; Tue, 31 Mar 2020 10:47:14 +0000 (UTC) X-Inumbo-ID: fb74fcb0-733c-11ea-83d8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651634; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lDRlkg899SiCd2y5eU+46cWGS8nMcYP2KjNS9HXZkJQ=; b=Rmb7vlqpDUQaTqhpNDP3W5UUUXiiPDc91cQdYEQ3v/+sPISX9KT+6FZA KEdB2DdeGBJQGcejmavJ5d3hHlx/n/WCZAw4s0nuYBkYfEiHaTusQJF0E vJZCqwikflzu1MNazAuMFQArsuk9DsbsUyzn6X2jEYQypPRbUEeQ3QhOG g=; Authentication-Results: esa5.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: KKYv3hltNk9TmzAmAoHvsretgA6PJB5TeyF8tz5qS/yKcCQTNyCfBz9WTM5wDzT4sCowpxArvM KZ+3R5bg/di9dMKgUkrPSa5mCxw8zEw/VVcIYcOQ9eLXaly89cRpZEcNabf6bpC5Z2Q2TImclL APSXo3f0oz3ejAcxRaP7OuPU4zbIWcP301tnH88lHQ8lW+yYnhgGYWiVmDpeqbDT5+5ffhly2u 7vBM66ZQCMklSIqNWEA0bqEhVkRRJFZraAq16pLD88HOOiogApflvjf5WgdAgpI3h09DcofwoW yjI= X-SBRS: 2.7 X-MesageID: 15246891 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15246891" From: Anthony PERARD To: Subject: [XEN PATCH v4 17/18] build,include: rework compat-build-source.py Date: Tue, 31 Mar 2020 11:31:01 +0100 Message-ID: <20200331103102.1105674-18-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Improvement are: - give the path to xlat.lst as argument - include `grep -v` in compat-build-source.py script, we don't need to write this in several scripted language. - have 'xlat.lst' path as a variable. No changes in final compat/%.h headers. Signed-off-by: Anthony PERARD --- Notes: v4: - new patch xen/include/Makefile | 11 ++++++----- xen/tools/compat-build-source.py | 8 +++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index 2a10725d689b..74b26a028902 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -50,6 +50,8 @@ public-$(CONFIG_ARM) :=3D $(wildcard public/arch-arm/*.h = public/arch-arm/*/*.h) .PHONY: all all: $(headers-y) =20 +xlat_lst =3D xlat.lst + compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py set -e; id=3D_$$(echo $@ | tr '[:lower:]-/.' '[:upper:]___'); \ echo "#ifndef $$id" >$@.new; \ @@ -66,10 +68,9 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-= build-header.py compat/%.i: compat/%.c Makefile $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CF= LAGS)) $(cppflags-y) -o $@ $< =20 -compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-sou= rce.py +compat/%.c: public/%.h $(xlat_lst) Makefile $(BASEDIR)/tools/compat-build-= source.py mkdir -p $(@D) - grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \ - $(PYTHON) $(BASEDIR)/tools/compat-build-source.py >$@.new + $(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(xlat_lst) <$< >$@.new mv -f $@.new $@ =20 compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-field= s.sh Makefile @@ -80,12 +81,12 @@ compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASED= IR)/tools/get-fields.sh M mv -f $@.new $@ =20 .PRECIOUS: compat/.xlat/%.lst -compat/.xlat/%.lst: xlat.lst Makefile +compat/.xlat/%.lst: $(xlat_lst) Makefile mkdir -p $(@D) grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re '= s,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >$@.new $(call move-if-changed,$@.new,$@) =20 -xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' xlat.lst | uniq) +xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:b= lank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(xlat_lst) | uniq) xlat-y :=3D $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) =20 compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) Makefile diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-sour= ce.py index c664eb85e633..c7fc2c53db61 100755 --- a/xen/tools/compat-build-source.py +++ b/xen/tools/compat-build-source.py @@ -12,7 +12,11 @@ pats =3D [ [ r"XEN_GUEST_HANDLE(_[0-9A-Fa-f]+)?", r"COMPAT_HANDLE" ], ]; =20 -xlatf =3D open('xlat.lst', 'r') +try: + xlatf =3D open(sys.argv[1], 'r') +except IndexError: + print('missing path to xlat.lst argument') + sys.exit(1) for line in xlatf.readlines(): match =3D re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip()) if match[1]: @@ -24,6 +28,8 @@ for pat in pats: pat[0] =3D re.compile(pat[0]) =20 for line in sys.stdin.readlines(): + if 'DEFINE_XEN_GUEST_HANDLE(long)' in line: + continue for pat in pats: line =3D re.sub(pat[0], pat[1], line) print(line.rstrip()) --=20 Anthony PERARD From nobody Sat May 4 23:46:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585651689; cv=none; d=zohomail.com; s=zohoarc; b=QWAgw+pZ7XSSbP51pLHacsxfvHu0zMgfYF8L7NqYs3/DJjHiAPmgE60k65OZvZ1VSaude3Y+vySHxdw3TS+qW9ADc2vXiRH8Byt865nv/RaP15NoBRRCScM6HflwQkJz2VRzywMdkNyZb8G8b195KzcIMZX/ua2tY4ZFUtbwoks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585651689; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ATYHfr/NTe1ZwwVdoG9DI49dMI/lBC4DFBQw3BIcmx0=; b=bAgA3MtbHcztq5YRcZMcaErrdkaIsw1SsrmgOOW3/eNxY7/7Oxv4HoFv9kY8UCgXRvsSl8uz3soBofvPpOv1r0pHGSf+UWWiKfsZyI8iTJbSwg/mRNR1T96U+3PZYCfQS82Z0LeHCy+zbgxg/2ZP8sopfWkSfHXNdlun3IOlnyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585651689222154.72410041761907; Tue, 31 Mar 2020 03:48:09 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQe-0002zD-Sz; Tue, 31 Mar 2020 10:47:32 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJEQe-0002yr-8N for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:47:32 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 05b79fde-733d-11ea-ba0c-12813bfff9fa; Tue, 31 Mar 2020 10:47:31 +0000 (UTC) X-Inumbo-ID: 05b79fde-733d-11ea-ba0c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585651652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N7cdETdSaKZOO05IMNGn7YDoG1qlk9BVAckRaXOBzec=; b=NH3xMd0tnYb3VnRu7YlQYKvEKY3WjS1SfHV+l8Kkf+rNCK+umM+qYqtp vxnouSW1KoVSwemNIiPDAhXn7t+VBrGPhwUkulLqkH+EE6HQCCIBgHOWR 4ELeda9AkCWC+oGuPmKqDIhMnQ03X7ufdNwqgJQ7neeEykYfUIcg7Kzpa E=; Authentication-Results: esa3.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: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 7oqI99Sx8QxzF42MQfY6RaxBGM1ZoLJQb+hXhhUCKUVygx9S5kOmct60LpSyeImn4Tq7pOqOe0 aqU8QY8S5kbkgGbLv0qVXViTV5FjFbBIn3n9iDPf9aSkylHItwKoh4vreqxxrzaT5X42g3Cxi9 +eDz/lLme9k0lLBfBB9MTXFzxlsebNSONTLlm3wSE5pqGRt5td4EvayUEYGY6nkrwFPI6iTA11 Wop4KByle/BQK+WDI5wc2saDEmIL2wAzgZ2XOnuhjgtjCuckZfvePdls1sivFq0SGiUc5ySP63 /qA= X-SBRS: 2.7 X-MesageID: 14904510 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="14904510" From: Anthony PERARD To: Subject: [XEN PATCH v4 18/18] build,include: rework compat-build-header.py Date: Tue, 31 Mar 2020 11:31:02 +0100 Message-ID: <20200331103102.1105674-19-anthony.perard@citrix.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200331103102.1105674-1-anthony.perard@citrix.com> References: <20200331103102.1105674-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Anthony PERARD Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Replace a mix of shell script and python script by all python script. Remove the unnecessary "grep -v '^# [0-9]'". It is to hide the linemarkers generated by the preprocessor. But adding -P inhibit there generation, thus the grep isn't needed anymore. gcc -E -P and clang -E -P have different behavior. While both don't generates linemarkers, gcc also removes all empty lines while clang keep them all. We don't need those empty lines, so we don't generates them in the final compat/%.h headers. (This replace `uniq` which was only de-duplicating empty line.) The only changes in the final generated headers it that they don't have empty lines anymore. Signed-off-by: Anthony PERARD --- Notes: v4: - new patch xen/include/Makefile | 13 ++---------- xen/tools/compat-build-header.py | 36 ++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index 74b26a028902..7e2d0ff667e8 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -53,20 +53,11 @@ all: $(headers-y) xlat_lst =3D xlat.lst =20 compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py - set -e; id=3D_$$(echo $@ | tr '[:lower:]-/.' '[:upper:]___'); \ - echo "#ifndef $$id" >$@.new; \ - echo "#define $$id" >>$@.new; \ - echo "#include " >>$@.new; \ - $(if $(filter-out compat/arch-%.h,$@),echo "#include <$(patsubst compat/%= ,public/%,$@)>" >>$@.new;) \ - $(if $(prefix-y),echo "$(prefix-y)" >>$@.new;) \ - grep -v '^# [0-9]' $< | \ - $(PYTHON) $(BASEDIR)/tools/compat-build-header.py | uniq >>$@.new; \ - $(if $(suffix-y),echo "$(suffix-y)" >>$@.new;) \ - echo "#endif /* $$id */" >>$@.new + $(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $@ "$(prefix-y)" "$= (suffix-y)" >>$@.new; \ mv -f $@.new $@ =20 compat/%.i: compat/%.c Makefile - $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CF= LAGS)) $(cppflags-y) -o $@ $< + $(CPP) -P $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN= _CFLAGS)) $(cppflags-y) -o $@ $< =20 compat/%.c: public/%.h $(xlat_lst) Makefile $(BASEDIR)/tools/compat-build-= source.py mkdir -p $(@D) diff --git a/xen/tools/compat-build-header.py b/xen/tools/compat-build-head= er.py index b85c43f13faf..d89a900ea02c 100755 --- a/xen/tools/compat-build-header.py +++ b/xen/tools/compat-build-header.py @@ -2,6 +2,12 @@ =20 import re,sys =20 +try: + type(str.maketrans) +except AttributeError: + # For python2 + import string as str + pats =3D [ [ r"__InClUdE__(.*)", r"#include\1\n#pragma pack(4)" ], [ r"__IfDeF__ (XEN_HAVE.*)", r"#ifdef \1" ], @@ -20,7 +26,33 @@ pats =3D [ [ r"(^|[^\w])long([^\w]|$$)", r"\1int\2" ] ]; =20 +output_filename =3D sys.argv[1] + +# tr '[:lower:]-/.' '[:upper:]___' +header_id =3D '_' + \ + output_filename.upper().translate(str.maketrans('-/.','___')) + +header =3D """#ifndef {0} +#define {0} +#include """.format(header_id) + +print(header) + +if not re.match("compat/arch-.*.h$", output_filename): + x =3D output_filename.replace("compat/","public/") + print('#include <%s>' % x) + +def print_if_nonempty(s): + if len(s): + print(s) + +print_if_nonempty(sys.argv[2]) + for line in sys.stdin.readlines(): for pat in pats: - line =3D re.subn(pat[0], pat[1], line)[0] - print(line.rstrip()) + line =3D re.sub(pat[0], pat[1], line.rstrip()) + print_if_nonempty(line) + +print_if_nonempty(sys.argv[3]) + +print("#endif /* %s */" % header_id) --=20 Anthony PERARD