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

Re: [PATCH v3 2/4] x86/efi: discard multiboot support for PE binary


  • To: Frediano Ziglio <freddy77@xxxxxxxxx>
  • From: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 16 Jun 2026 12:55:27 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=fm1 header.d=invisiblethingslab.com header.i="@invisiblethingslab.com" header.h="Cc:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=fm1 header.d=messagingengine.com header.i="@messagingengine.com" header.h="Cc:Content-Type:Date:Feedback-ID:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To:X-ME-Proxy:X-ME-Sender"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
  • Delivery-date: Tue, 16 Jun 2026 10:55:41 +0000
  • Feedback-id: i1568416f:Fastmail
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jun 16, 2026 at 11:13:34AM +0100, Frediano Ziglio wrote:
> From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Multiboot and PVH booting are not supported for PE, hence discards them
> in the linker script when doing a PE build.
> 
> That removes some relocations that otherwise appear due to the usage of the
> start and __efi64_mb2_start symbols in the multiboot2 header.
> 
> Section discarding is not done updating DISCARD_SECTIONS definition as the
> change is specific for x86.
> 
> No functional change intended.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>

Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>

> --
> Changes since v1:
> - improve commit message;
> - change section orders to avoid changing code order in final executable;
> - merge 2 commits;
> - removed deprecated documentation section.
> 
> Changes since v2:
> - Update commit message, join 2 sentences together.
> ---
>  docs/hypervisor-guide/x86/how-xen-boots.rst | 6 ------
>  xen/arch/x86/boot/head.S                    | 3 ++-
>  xen/arch/x86/xen.lds.S                      | 5 +++++
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/docs/hypervisor-guide/x86/how-xen-boots.rst 
> b/docs/hypervisor-guide/x86/how-xen-boots.rst
> index 8b3229005c..b6d852050a 100644
> --- a/docs/hypervisor-guide/x86/how-xen-boots.rst
> +++ b/docs/hypervisor-guide/x86/how-xen-boots.rst
> @@ -82,12 +82,6 @@ When a PEI-capable toolchain is found, the objects are 
> linked together and a
>  PE32+ binary is created.  It can be run directly from the EFI shell, and has
>  ``efi_start`` as its entry symbol.
>  
> -.. note::
> -
> -   xen.efi does contain all MB1/MB2/PVH tags included in the rest of the
> -   build.  However, entry via anything other than the EFI64 protocol is
> -   unsupported, and won't work.
> -
>  
>  Boot
>  ----
> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> index 77bb7a9e21..90faf411b9 100644
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -152,7 +152,7 @@ vga_text_buffer:
>  efi_platform:
>          .byte   0
>  
> -        .section .init.text, "ax", @progbits
> +        .section .init.multiboot, "ax", @progbits
>  
>  early_error: /* Here to improve the disassembly. */
>  
> @@ -710,6 +710,7 @@ trampoline_setup:
>          /* Jump into the relocated trampoline. */
>          lret
>  
> +        .section .init.text, "ax", @progbits
>  ENTRY(trampoline_start)
>  #include "trampoline.S"
>  ENTRY(trampoline_end)
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index f758940674..749d9719cc 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -57,6 +57,10 @@ SECTIONS
>    __image_base__ = .;
>  #else
>    . = __image_base__;
> +  /DISCARD/ : {
> +    *(.text.header)
> +    *(.init.multiboot)
> +  }
>  #endif
>  
>  #if 0
> @@ -195,6 +199,7 @@ SECTIONS
>    DECL_SECTION(.init.text) {
>  #endif
>         _sinittext = .;
> +       *(.init.multiboot)
>         *(.init.text)
>         *(.text.startup)
>         _einittext = .;
> -- 
> 2.43.0
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

Attachment: signature.asc
Description: PGP signature


 


Rackspace

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