[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v7 17/51] build: set XEN_BUILD_EFI earlier


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 7 Oct 2021 18:14:33 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OZobpDgjbqKs/ag7N0PLA129nreT/lrWiUeQXCQvB9M=; b=ACSfQWuklKwznI1F91vKRttue6fqa3xEkNmOpm57hb1RWnvxvehl+boOthyrrOGbnz6wvHuJO5fXAbdz47ssLHTfrDFoBWYGba/G07xshKcbEHDsZzhQDLIIaWteh8wjcCjpUeF8A6syFUVPtkDdm3/GokfSFqPVvtp99xQUHI4Uzn7ctxdoCgMZfU8+vM0qLi0Dh6dQoLrV+MY32DJkECL4ck9l6XZmvLz9xKb3zBDu+YPc88WWYSZ2vga6a3tu9huIxjK6CSx2I4RHfah42+W+UfuJ8zoCN4IdHeA239o5jNhABxtm8oGzMMlC4FPUdzDa7AI/D5CFozw1A2mLpw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=St+QzvNYa4ZpT19QhYrmmv+DzC+0krA7yZ6f50quLAmKtEeBU+MizanGJYjcdpxI6SkFiCQrntsHScFkzriXCjw3XKHY0zPYgj97GYQghuPY2EczrrYUMFrax5n0c0qZTHd/X4EkRdgOtRP9BrXFV6u8PNJtqxtqbbg9DKav+imTdLLbZIdOBGUZS5hBZttvg7wxoAXoYUtYD9CluqMiITaJnS89p1yviJkyWgzGrFegysOPgl6rlDGNNe/O9MoukPHMkSkFsckPv52zFhzfEwzxl1/0qPqphVX44aJ01GIRbjFGpNcQPEAX+Rspwo2TXOUceU/D47EC9HNw764J3w==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 07 Oct 2021 16:14:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

A general remark first: If I understand things correctly, a side effect
of this change is to also address the issue that I'm trying to take
care of in "x86/build: suppress EFI-related tool chain checks upon local
$(MAKE) recursion". However, while that one's a reasonable backporting
candidate, I don't think the one here is. Therefore I'd prefer my patch
to go in ahead of this change of yours. Hence I wonder whether in return
I couldn't ask you to review that one.

On 24.08.2021 12:50, Anthony PERARD wrote:
> 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-check-relocs) as the former might be
> a bit too generic.

While I don't mind the prefix addition, may I please ask that the rest
of the name remain as is, i.e. $(efi-nr-fixups)? "nr" because that's
what the variable holds, and "fixups" to distinguish from full-fledged
relocations as well as to match commentary there.

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -123,41 +123,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
>       mv $(TMP) $(TARGET)
>  
>  ifneq ($(efi-y),)
> -
> -# Check if the compiler supports the MS ABI.
> -export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o 
> efi/check.o 2>/dev/null && echo y)
>  CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
> -
> -# Check if the linker supports PE.
> -EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
> -XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) 
> --image-base=0x100000000 -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 += --strip-debug
> -XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -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 := $(shell $(OBJDUMP) -p efi/check.efi | grep 
> '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
> -ifeq ($(nr-fixups),2)
> -MKRELOC := :
> -relocs-dummy :=
> -else
> -MKRELOC := efi/mkreloc
> -relocs-dummy := 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 wouldn't
> -# recognize the option.
> -ifneq ($(nr-fixups),0)
> -EFI_LDFLAGS += --disable-reloc-section
> -endif
> -endif
> -
> -endif # $(XEN_BUILD_PE)
> -
>  endif # $(efi-y)

Is the remaining if(,) block still warranted? I.e. can't the single line

CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI

live without the surrounding conditional?

> --- 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=alignment)
>  endif
>  
> +ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
> +
> +efi-check-o = arch/x86/efi/check.o

Nit: Unless there's a reason not to, please prefer := here (and in
general).

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.