[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] xen: Add CONFIG_GC_SECTIONS
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Wed, 10 Dec 2025 11:57:32 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=BQz/FFAFUrmwb/tx1E8h2JuWA0WJCGIpZB66hVqwGpc=; b=ufDIPBpOIozXC9TZB/0zJCSAd/Sr52fV3DLS8IrPXNwJpxhhlPY7gPkeCC6baIlkP3xnD2nDA2fkDdJT/Vn0PUWvqJmP4S6xpqAyvkpcTcV3hDxSwn9zv1zuVyY0bAf58BUCEb3dallcIlo2BPBZ7Fvd3NNm+Rpv5Glv4Qi+H2If/6xMKDlJMnulkHLX4R3Nv0MM4n9WVwl3JHjQ7zkGVM977S0SaVygGEe6vN0elyK0Hy41xDLmQYGDNn9PV94qWJRo4tm6ptcD19lpI8C/JeGeQpS0trilAu4SLCKiLYM2oHAf4w848tX5QmtPztlDapqDNniNxNPwW1bFpkW9Iw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dh9/FZtenJqrBrxs6BmfFLVUd9v3zOfpL9tH/Sa3bvvKk6UJ+lO35yKGkXhHnY6pSWVpDLm54Al2l27aaq3IORmN4p4572moF6Sbtik6dUv/p5xVf/95k/8PRs56mHgDm3dtP/hYZQnwlJH3g80Jr59rzzlTNi2ug4PEXtmUzCyiB2RNrhsOZYlreP/8tA+5xkWKkxaeAnUjQMYrUuo+a5f28u0G43+y+bk0bDFhoJF53c+mv6O2TRecSOpPG76qi56zrFt2Wyx3HZp9793MlHrDj1pikFdgn3G5LFMs2q4n97xcYYOHBbCpcC2p7ssJJb/SgASROCGF5wgBUg+9qQ==
- Cc: Victor Lira <victorm.lira@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, "Connor Davis" <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 10 Dec 2025 16:57:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2025-12-10 03:17, Jan Beulich wrote:
On 09.12.2025 22:47, Jason Andryuk wrote:
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -469,10 +469,13 @@ all-symbols-$(CONFIG_FAST_SYMBOL_LOOKUP) += --sort-by-name
include $(srctree)/arch/$(SRCARCH)/arch.mk
+XEN_FINAL_LDFLAGS-$(CONFIG_GC_SECTIONS) := --gc-sections
+
# define new variables to avoid the ones defined in Config.mk
export XEN_CFLAGS := $(CFLAGS)
export XEN_AFLAGS := $(AFLAGS)
export XEN_LDFLAGS := $(LDFLAGS)
+export XEN_FINAL_LDFLAGS := $(LDFLAGS) $(XEN_FINAL_LDFLAGS-y)
export CFLAGS_UBSAN
Imo the introduction of XEN_FINAL_LDFLAGS would best be a separate, prereq
change. That could then also go in already while the KEEP() issue is still
being sorted.
The appending of --gc-sections should then also be truly appending, so make
sure that e.g. anything set by arch/$(SRCARCH)/arch.mk wouldn't be purged
again. IOW I think ahead of that include we want
XEN_FINAL_LDFLAGS-y :=
This all sounds fine, though with Anthony's response the variable name
may change.
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -680,4 +680,13 @@ config PM_STATS
Enable collection of performance management statistics to aid in
analyzing and tuning power/performance characteristics of the system
+config GC_SECTIONS
+ bool "Garbage Collect Sections"
+ select CC_SPLIT_SECTIONS
+ help
+ During final linking, garbage collect unused sections. This will
+ reduce the size of the final Xen binary
+
+ Only supported for ELF/Multiboot xen/xen.gz, not EFI xen.efi.
This last sentence is x86-centric, which it shouldn't be here (or it should
say that this is an x86-only aspect).
I also wonder whether this wouldn't better live next to CC_SPLIT_SECTIONS.
If I put it immediately after CC_SPLIT_SECTIONS, menuconfig puts it as a
top level option:
│ │ [*] Garbage Collect Sections
│ │ Architecture Features --->
│ │ Common Features --->
I thought Common Features was a better place for it.
Also, I think it should probably gain " if EXPERT" as well.
Thanks,
Jason
|