Some options we allow the build admin to select may require new enough
tool chain components to fulfill (partly or entirely). Provide yet
another control to pick what action to take at the end of the build
process - be silent about this, warn, or fail the build.

Signed-off-by: Jan Beulich <jbeul...@suse.com>
---
This may not be fine grained enough: Optimization settings (like added
by "x86: allow Kconfig control over psABI level") may want dealing with
differently than security relevant ones (like XEN_SHSTK or XEN_IBT).

Whether to do this uniformly at the end of the build is up for
discussion: In the "warn" case we will want the resulting output late,
so it is more likely to be noticed. In the "fail build" case though we
may want the failure to occur early.
---
v3: New.

--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -64,6 +64,25 @@ config UNSUPPORTED
          preview features as defined by SUPPORT.md. (Note that if an option
          doesn't depend on UNSUPPORTED it doesn't imply that is supported.)
 
+choice
+       prompt "How to deal with settings which cannot be satisified"
+       default UNSATISFIED_WARNING
+       help
+         Some selectable options may depend on e.g. tool chain functionality.
+         Select here how to deal with such when actually building a such
+         configured hypervisor.
+
+config UNSATISFIED_SILENT
+       bool "silent"
+
+config UNSATISFIED_WARNING
+       bool "emit warnings"
+
+config UNSATISFIED_ERROR
+       bool "fail the build"
+
+endchoice
+
 config LTO
        bool "Link Time Optimisation"
        depends on BROKEN
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -588,6 +588,10 @@ $(TARGET): outputmakefile FORCE
        $(Q)$(MAKE) $(build)=arch/$(SRCARCH) include
        $(Q)$(MAKE) $(build)=. arch/$(SRCARCH)/include/asm/asm-offsets.h
        $(Q)$(MAKE) $(build)=. MKRELOC=$(MKRELOC) 'ALL_OBJS=$(ALL_OBJS-y)' 
'ALL_LIBS=$(ALL_LIBS-y)' $@
+ifneq ($(CONFIG_UNSATISFIED_SILENT),y)
+       $(Q)$(if $(strip $(XEN_CONFIG_UNSATISFIED)),$(MAKE),:) \
+           $(build)=. 'XEN_CONFIG_UNSATISFIED=$(XEN_CONFIG_UNSATISFIED)' 
check_unsatisfied
+endif
 
 SUBDIRS = xsm arch common crypto drivers lib test
 define all_sources
--- a/xen/build.mk
+++ b/xen/build.mk
@@ -88,3 +88,11 @@ targets += prelink.o
 
 $(TARGET): prelink.o FORCE
        $(Q)$(MAKE) $(build)=arch/$(SRCARCH) $@
+
+PHONY += check_unsatisfied
+check_unsatisfied:
+       $(Q): $(if $(filter y,$(CONFIG_UNSATISFIED_WARNING)), \
+                  $(warning The following selections could not be satisfied:), 
\
+                  $(shell echo 'The following selections could not be 
satisfied:' >&2)) \
+             $(foreach c,$(sort $(XEN_CONFIG_UNSATISFIED)),$(shell echo ' - 
CONFIG_$c' >&2)) \
+             $(if $(filter y,$(CONFIG_UNSATISFIED_ERROR)),$(error Failing 
build))


Reply via email to