On 08.12.25 10:35, Jan Beulich wrote:
On 05.12.2025 20:34, Grygorii Strashko wrote:
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -39,11 +39,23 @@ config COVERAGE
bool "Code coverage support"
depends on SYSCTL && !LIVEPATCH
select SUPPRESS_DUPLICATE_SYMBOL_WARNINGS if !ENFORCE_UNIQUE_SYMBOLS
+ select RELAX_INIT_CHECK
+ select DO_NOT_FREE_INIT_MEMORY
help
Enable code coverage support.
If unsure, say N here.
+config RELAX_INIT_CHECK
+ bool
+ help
+ Relax strict check for .init sections only in %.init.o files.
+
+config DO_NOT_FREE_INIT_MEMORY
+ bool
+ help
+ Prevent freeing of .init sections at the end of Xen boot.
+
config CONDITION_COVERAGE
bool "Condition coverage support"
depends on COVERAGE && CC_HAS_MCDC
Please obey to the somewhat special indentation rules for Kconfig files.
ok.
@@ -259,6 +259,7 @@ $(obj)/%.o: $(src)/%.S FORCE
quiet_cmd_obj_init_o = INIT_O $@
+ifneq ($(CONFIG_RELAX_INIT_CHECK),y)
define cmd_obj_init_o
$(OBJDUMP) -h $< | while read idx name sz rest; do \
case "$$name" in \
@@ -271,6 +272,11 @@ define cmd_obj_init_o
done || exit $$?; \
$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section
.$(s)=.init.$(s)) $< $@
endef
+else
+define cmd_obj_init_o
+ $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section
.$(s)=.init.$(s)) $< $@
+endef
+endif
If the objcopy indeed needs suppressing altogether (as Andrew suggests), the
unwanted redundancy here would go away anyway. Otherwise my (recurring)
request to avoid such duplication.
Could you suggest the best way to avoid duplication, please?
if/else/endif is not working inside "Custom commands" make file commands.
May be split it on two - cmd_obj_init_check and obj_init_objcopy?
--- a/xen/common/libfdt/Makefile
+++ b/xen/common/libfdt/Makefile
@@ -5,7 +5,6 @@ SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
# For CONFIG_OVERLAY_DTB, libfdt functionalities will be needed during
runtime.
ifneq ($(CONFIG_OVERLAY_DTB),y)
OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
-nocov-y += libfdt.o
endif
obj-y += libfdt.o
Is this sufficient? Don't you first need to replace the custom objcopy use?
It works just fine if .init memory is not freed, as it doesn't matter where
sections are placed.
--
Best regards,
-grygorii