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

Reply via email to