On 2025-12-10 09:40, Anthony PERARD wrote:
On Tue, Dec 09, 2025 at 04:47:28PM -0500, Jason Andryuk wrote:
diff --git a/xen/Makefile b/xen/Makefile
index e6cf287425..aeb5dcf2ee 100644
--- 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
Is there a good reason to add this flags after the arch-specific
makefiles? If not, could you move that just before, and right after the
definition of "$(all-symbols)" as it's a variable that is used in the
same phase of the build. (With Jan's other feedback)
No, there is no reason for its location. I can move it.
# 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)
"FINAL" isn't very descriptive. A completely wrong interpretation might
be that we should use the "final" variable instead of "XEN_LDFLAGS". How
about a name that describe where this set of flags is going to be used,
like "XEN_LDFLAGS_xen_syms" (which unfortunately doesn't exactly fit
with x86 xen.efi target), or maybe suffix it with "_target" or just
"_xen"? (In Linux build system, they use "LDFLAGS_vmlinux", but I don't
know what would be the equivalent of "vmlinux" in our build system.)
I plan to use "_xen" unless anyone objects. "_xen_lds" could be another
option, but again that doesn't match efi.lds.
Hmmm - maybe my earlier xen.efi link failure was from efi.lds needing to
be updated.
The prefix "XEN_" is used as namespace, with one reason described in the
comment.
I'm not sure what you mean here. Are you just pointing out that XEN_ is
the prefix and not the target?
Also, could you use $(XEN_LDFLAGS) instead of $(LDFLAGS) ?
Yes.
Thanks,
Jason