From nobody Thu Aug 27 01:43:12 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1783334809; cv=none; d=zohomail.com; s=zohoarc; b=YHNZHXiNSf+ZxiEGmIWL6quPfUAVhwbKTD6awQg+vcWNyjPfcZMfFdOTTeVWgK5mEWvCSU4126qXZ1fgsIJUOUiVJL4b7sV5E+akD6BpiBpfi+dfZPJsEZEpFNuU3wBrFw4SptjK7e2Et7OP8hAHZFU4UQnI/dVxUS+SHktnwvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783334809; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=m9B0ArUitijRUw4qSBCDCV9oLIH5+U0INwoqfnPeLmTcYQr2Tc4U08WgF1jSR11dEpz5ejFxPymCV2drs/Xm0rAiPvaDhnnK5pJtU9v3e6U0nYbBry9QsKeCP03IX7bPmQyFo1gqgVGCdnM24TYjUpAt/URZ1mihvH8JbVZOXNY= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1783334809189520.9808942952416; Mon, 6 Jul 2026 03:46:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355303.1610073 (Exim 4.92) (envelope-from ) id 1wggq1-0002cV-Ul; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (output) from mailman id 1355303.1610073; Mon, 06 Jul 2026 10:46:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq1-0002ab-OW; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (input) for mailman id 1355303; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq0-0002Tv-9M for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wggpz-00HA6J-Da for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 12:46:07 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b876b-e002-0a2a0a5209dd-0a2a4501c908-10 for ; Mon, 06 Jul 2026 12:46:07 +0200 Received: from [209.85.221.47] (helo=mail-wr1-f47.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b876f-400f-0a2a45010019-d155dd2fb15a-3 for ; Mon, 06 Jul 2026 12:46:07 +0200 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-47ddf7b09aaso653562f8f.3 for ; Mon, 06 Jul 2026 03:46:07 -0700 (PDT) Received: from localhost.localdomain (2.115.147.147.dyn.plus.net. [147.147.115.2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493c63ba97csm349823985e9.12.2026.07.06.03.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 03:46:06 -0700 (PDT) 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783334767; x=1783939567; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=B0Z8jrOXkZol00KL1SpDpFTKS9vWY3gULjMbRrPXVoOJT6eWi+obwwDyvU0Y8azLyB WNN1WXT5h2Zb6Cjw8n0/UKlxMJZBex2ROy0tObXBYmogajcXmS+7vAHBxG+dX3H4+ddC 9ieS6ljC9Ga05ZvarY05mnkL1KsWet3aQNz0ElaCLXf07CocBiGLws9HFMgT8vqaJ4RW VUrZewhQCtOj59ycETSuByp2vZORDyN+vIlKS1PA7mifJ4VHykFzfjS0U8EPvb9QBUj2 vd+JOTLvOEprw1lFET1c4SArq1TOQuaGm3vkrIlZ4phK9eoBo7l51PRdEovkSg34/Ypk xwkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783334767; x=1783939567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=BsWF2IKFHDgQxG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-493d11cdd57mr108272465e9.4.1783334766457; Mon, 06 Jul 2026 03:46:06 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jan Beulich , Andrew Cooper , Teddy Astie , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Frediano Ziglio Subject: [PATCH v7 2/4] x86/efi: discard multiboot and PVH support for PE binary Date: Mon, 6 Jul 2026 11:45:55 +0100 Message-ID: <20260706104557.430097-3-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706104557.430097-1-frediano.ziglio@citrix.com> References: <20260706104557.430097-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d62444/1783334767-FF2C51E0-B5FA0B47/0/0 X-purgate-type: clean X-purgate-size: 5049 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783334810188158500 From: Roger Pau Monn=C3=A9 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=C3=A9 Signed-off-by: Frediano Ziglio Acked-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jan Beulich --- 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. Changes since v3: - Added Acked-by. Changes since v4: - more clear subject; - removed more code/data from EFI output; - removed Acked-by. Changes since v5: - simplify section exclusion using more wildcard; - exclude more multiboot functions. --- docs/hypervisor-guide/x86/how-xen-boots.rst | 6 ------ xen/arch/x86/boot/head.S | 8 ++++---- xen/arch/x86/xen.lds.S | 7 +++++++ xen/tools/combine_two_binaries.py | 2 +- 4 files changed, 12 insertions(+), 11 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 l= inked together and a PE32+ binary is created. It can be run directly from the EFI shell, and h= as ``efi_start`` as its entry symbol. =20 -.. 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. - =20 Boot ---- diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 68b963ce6f..981f262b5e 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -126,7 +126,7 @@ multiboot2_header: .size multiboot2_header, . - multiboot2_header .type multiboot2_header, @object =20 - .section .init.rodata, "a", @progbits + .section .init.rodata.multiboot, "a", @progbits =20 .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!" .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!" @@ -137,8 +137,7 @@ multiboot2_header: .Lno_nx_msg: .asciz "ERR: Not an NX-capable CPU!" #endif =20 - .section .init.data, "aw", @progbits - .subsection 1 /* Put data here after the page tables (in x86_64.S)= . */ + .section .init.data.multiboot, "aw", @progbits .align 4 =20 .word 0 @@ -154,7 +153,7 @@ vga_text_buffer: efi_platform: .byte 0 =20 - .section .init.text, "ax", @progbits + .section .init.multiboot, "ax", @progbits =20 early_error: /* Here to improve the disassembly. */ =20 @@ -712,6 +711,7 @@ trampoline_setup: /* Jump into the relocated trampoline. */ lret =20 + .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 8e63cf5bc2..4ed1d2bec1 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -57,6 +57,10 @@ SECTIONS __image_base__ =3D .; #else . =3D __image_base__; + /DISCARD/ : { + *(.text.header) + *(.init.*multiboot) + } #endif =20 #if 0 @@ -195,6 +199,7 @@ SECTIONS DECL_SECTION(.init.text) { #endif _sinittext =3D .; + *(.init.multiboot) *(.init.text) *(.text.startup) _einittext =3D .; @@ -220,6 +225,7 @@ SECTIONS *(.init.rodata.cf_clobber) __initdata_cf_clobber_end =3D .; =20 + *(.init.rodata.multiboot) *(.init.rodata) *(.init.rodata.*) =20 @@ -234,6 +240,7 @@ SECTIONS *(.initcall1.init) __initcall_end =3D .; =20 + *(.init.data.multiboot) *(.init.data) *(.init.data.rel) *(.init.data.rel.*) diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_bina= ries.py index 581e57cbc0..5f0433dcad 100755 --- a/xen/tools/combine_two_binaries.py +++ b/xen/tools/combine_two_binaries.py @@ -33,7 +33,7 @@ parser.add_argument('--map', dest=3D'mapfile', parser.add_argument('--exports', dest=3D'exports', help=3D'Symbols to export') parser.add_argument('--section-header', dest=3D'section_header', - default=3D'.section .init.text, "ax", @progbits', + default=3D'.section .init.multiboot, "ax", @progbits', help=3D'Section header declaration') parser.add_argument('-v', '--verbose', action=3D'store_true') --=20 2.43.0