From nobody Fri Nov 29 15:32:36 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1637847653; cv=none; d=zohomail.com; s=zohoarc; b=c0pPAgdd4HnHFNbIVBcNAxNVck5bwBJmlW6PinMBoEifKQh7vwxteT98f97+CaCkIhCXXYaF22jXSVUKapnDYMcP4GUl8USm3fW7fAmlS7ryTCsHpM0EqntHPpsJZRy42idk5ultAo5ejQeUAjQsxiYVsWa+55MG747D4SQRxck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637847653; 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=FQOoaCJrSx8Y/9RVOTy8dCFjN2pBzj5nR/goDQ7/pRU=; b=DDdN6fuy2f28fZU9WLl7MVxrGnRxKQqvdZMvlLB7y+0TxdR911RBDYBdujaBboWcPB8Czlb+Ki8qLQ/8S4LRqjAZngWUqNfO/p1wG3zzwzwmTuo4UBsLyD8rw+w5ATIZgvzT0TBrqIwdkm9wA2W2kHQKDfesHqd8Z0CWV0MQ8xY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163784765357191.08021077413662; Thu, 25 Nov 2021 05:40:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.231208.399946 (Exim 4.92) (envelope-from ) id 1mqEzM-0007js-Mt; Thu, 25 Nov 2021 13:40:36 +0000 Received: by outflank-mailman (output) from mailman id 231208.399946; Thu, 25 Nov 2021 13:40:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mqEzM-0007jd-Ib; Thu, 25 Nov 2021 13:40:36 +0000 Received: by outflank-mailman (input) for mailman id 231208; Thu, 25 Nov 2021 13:40:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mqEzK-00076i-UV for xen-devel@lists.xenproject.org; Thu, 25 Nov 2021 13:40:35 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 429f4ad1-4df5-11ec-a9d2-d9f7a1cc8784; Thu, 25 Nov 2021 14:40:33 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 429f4ad1-4df5-11ec-a9d2-d9f7a1cc8784 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1637847633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nGDIsDb6T+EAmgMztobre/7LJOc8NJGsQjeWYOHBbk8=; b=Ouf/tb3utT5zvnmGHTKDvynTxwMPy9UIRjCd+tQep1CGX6ZDhsU3JIJy S2LFoAdKOu8/Lc4FBYa2FcWF41rQUQgMSUJTP1KRy3uJrohjLNYH9y9+6 d9qbwzKgnXoaJUbNv0AYIYUPNabqpT0bIpDAQXhYiR8iRAOVulcrUeI2q o=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: ZNcqcpY5cip9ez4m28cyPyD+v1uU72dX8Nlm6tj6/WzseUDxnnAMIZ3dts2PukDTqIrqQevZVJ pLkXY7hE8HKW+76lKEj3v9jfBoyU8HKrHBCn3fDs1JHPDYB17zir6WLBD3CjQ62fVqIAIROrxV Te/4PVjO7VmGULtz5tdyRxvh/idbtDndSWKe2XlGMTMgiw+GNsjThz/S8WiGQrNu/9xtf4fUPp F/xiK4jxrXMQzjmmlXrRtVQMSom2clfTOq0H6xlhjv9xcVMKodwPlSMRzhHlM9OG6RJwxlqqKq tPPEoEsy7q9nPHNfH7f1b0QC X-SBRS: 5.1 X-MesageID: 58617609 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:5S89BK3bP76VCwjv9PbD5ep2kn2cJEfYwER7XKvMYLTBsI5bpzAOm mdJWWjTPv+KYWaheI91PI6wp00Hv5CBzddgHlZupC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkS5PE3oHJ9RGQ74nRLlbHILOCan8ZqTNMEn970Es6wbNh2OaEvPDia++zk YKqyyHgEAfNNw5cagr4PIra9XuDFNyr0N8plgRWicJj5TcypFFMZH4rHomjLmOQf2VhNrXSq 9Avbl2O1jixEx8FUrtJm1tgG6EAaua60QOm0hK6V0U+6/TrS+NbPqsTbZIhhUlrZzqhk8JN6 9pL8pmKdCB1H7PCntsafkRWKnQrVUFG0OevzXmXtMWSywvNcmf2wuUoB0YzVWEa0r8pWycUr 6VecW1TKEDY7w616OvTpu1Ej8I/LM7tLcUHt2tp1z3xBvc6W5HTBa7N4Le02R9t1p4XQqiGN qL1bxJUQkj/RAZuGmwPS84kg+Wx3V3bUyNx/Q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K6x6TIDAPXwM7XdLJyesId70hD6qhwISY7TiX+rb HIoB17726MtN9/YhAdcLy7VZVoBEmsl6KdgrNhWYtKPjOHhILAFugLhuHfKn/bakjDH4ZmpM FdmsNFZuEYY2IXsS+D2njaL+od X-IronPort-AV: E=Sophos;i="5.87,263,1631592000"; d="scan'208";a="58617609" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH v8 04/47] build: set XEN_BUILD_EFI earlier Date: Thu, 25 Nov 2021 13:39:23 +0000 Message-ID: <20211125134006.1076646-5-anthony.perard@citrix.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211125134006.1076646-1-anthony.perard@citrix.com> References: <20211125134006.1076646-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1637847654297100001 Content-Type: text/plain; charset="utf-8" We are going to need the variable XEN_BUILD_EFI earlier. But a side effect of calculating the value of $(XEN_BUILD_EFI) is to also to generate "efi/check.o" which is used for further checks. Thus the whole chain that check for EFI support is moved to "arch.mk". Some other changes are made to avoid too much duplication: - $(efi-check-o): Used to avoid repeating "efi/check.*". We don't set it to the path to the source as it would be wrong as soon as we support out-of-tree build. - $(LD_PE_check_cmd): As it is called twice, with an updated $(EFI_LDFLAGS). $(nr-fixups) is renamed to $(efi-nr-fixups) as the former might be a bit too generic. Signed-off-by: Anthony PERARD Reviewed-by: Jan Beulich --- Notes: v8: - rename to efi-nr-fixups rather than efi-check-relocs - use :=3D when assigning variable in makefile when recursive expansion isn't needed. - no more check of $(efi-y) value for "CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI". =20 v7: - Do the whole check for EFI support in arch.mk. So efi/check.o is produce there and used there, and produce efi/check.efi and use it th= ere. Thus avoid the need to repeat the test done for XEN_BUILD_EFI. xen/arch/x86/Makefile | 38 ++------------------------------------ xen/arch/x86/arch.mk | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 8db4cb98edbb..d7d2adc1881e 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -121,44 +121,8 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 { echo "No Multiboot2 header found" >&2; false; } mv $(TMP) $(TARGET) =20 -ifneq ($(efi-y),) - -# Check if the compiler supports the MS ABI. -export XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o ef= i/check.o 2>/dev/null && echo y) CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI =20 -# Check if the linker supports PE. -EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 -XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --= image-base=3D0x100000000 -o efi/check.efi efi/check.o)) -# If the above failed, it may be merely because of the linker not dealing = well -# with debug info. Try again with stripping it. -ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n) -EFI_LDFLAGS +=3D --strip-debug -XEN_BUILD_PE :=3D $(call ld-option,$(EFI_LDFLAGS) --image-base=3D0x1000000= 00 -o efi/check.efi efi/check.o) -endif - -ifeq ($(XEN_BUILD_PE),y) - -# Check if the linker produces fixups in PE by default -nr-fixups :=3D $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*re= loc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l) -ifeq ($(nr-fixups),2) -MKRELOC :=3D : -relocs-dummy :=3D -else -MKRELOC :=3D efi/mkreloc -relocs-dummy :=3D efi/relocs-dummy.o -# If the linker produced fixups but not precisely two of them, we need to -# disable it doing so. But if it didn't produce any fixups, it also would= n't -# recognize the option. -ifneq ($(nr-fixups),0) -EFI_LDFLAGS +=3D --disable-reloc-section -endif -endif - -endif # $(XEN_BUILD_PE) - -endif # $(efi-y) - ALL_OBJS :=3D $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/= built_in.o $(ALL_OBJS) =20 ifeq ($(CONFIG_LTO),y) @@ -217,8 +181,10 @@ endif =20 $(TARGET).efi: VIRT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n '= s, A VIRT_START$$,,p') ifeq ($(MKRELOC),:) +relocs-dummy :=3D $(TARGET).efi: ALT_BASE :=3D else +relocs-dummy :=3D efi/relocs-dummy.o $(TARGET).efi: ALT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's= , A ALT_START$$,,p') endif =20 diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index eea320e618b9..19c9cd206ed0 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -60,5 +60,47 @@ ifeq ($(CONFIG_UBSAN),y) $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=3Dalignment) endif =20 +ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) + +efi-check-o :=3D arch/x86/efi/check.o + +# Check if the compiler supports the MS ABI. +XEN_BUILD_EFI :=3D $(call if-success,$(CC) $(CFLAGS) -c $(efi-check-o:.o= =3D.c) -o $(efi-check-o),y) + +# Check if the linker supports PE. +EFI_LDFLAGS :=3D $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=3D10 +LD_PE_check_cmd =3D $(call ld-option,$(EFI_LDFLAGS) --image-base=3D0x10000= 0000 -o $(efi-check-o:.o=3D.efi) $(efi-check-o)) +XEN_BUILD_PE :=3D $(LD_PE_check_cmd) + +# If the above failed, it may be merely because of the linker not dealing = well +# with debug info. Try again with stripping it. +ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n) +EFI_LDFLAGS +=3D --strip-debug +XEN_BUILD_PE :=3D $(LD_PE_check_cmd) +endif + +ifeq ($(XEN_BUILD_PE),y) + +# Check if the linker produces fixups in PE by default +efi-nr-fixups :=3D $(shell $(OBJDUMP) -p $(efi-check-o:.o=3D.efi) | grep '= ^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l) + +ifeq ($(efi-nr-fixups),2) +MKRELOC :=3D : +else +MKRELOC :=3D efi/mkreloc +# If the linker produced fixups but not precisely two of them, we need to +# disable it doing so. But if it didn't produce any fixups, it also would= n't +# recognize the option. +ifneq ($(efi-nr-fixups),0) +EFI_LDFLAGS +=3D --disable-reloc-section +endif +endif + +endif # $(XEN_BUILD_PE) + +export XEN_BUILD_EFI XEN_BUILD_PE MKRELOC +export EFI_LDFLAGS +endif + # Set up the assembler include path properly for older toolchains. CFLAGS +=3D -Wa,-I$(BASEDIR)/include --=20 Anthony PERARD