On 3/27/25 5:31 PM, Andrew Cooper wrote:
We have checks in both xen/compiler.h, and Config.mk.  Both are incomplete.
Remove the one from compiler.h, as it's pointless to perform in addition to
the xen.git-wide one as well.

Expand the checks to cover RISCV wanting GCC 11.1, and to cover Clang on x86.

Why GCC 11.1 for RISC-V? We declared in ./README that 12.2.

~ Oleksii


PPC still is unspecified, and inherits the GCC 5.1 global baseline.

Signed-off-by: Andrew Cooper<andrew.coop...@citrix.com>
---
CC: Anthony PERARD<anthony.per...@vates.tech>
CC: Michal Orzel<michal.or...@amd.com>
CC: Jan Beulich<jbeul...@suse.com>
CC: Julien Grall<jul...@xen.org>
CC: Roger Pau Monné<roger....@citrix.com>
CC: Stefano Stabellini<sstabell...@kernel.org>
CC: Oleksii Kurochko<oleksii.kuroc...@gmail.com>

v2:
  * Change to altering Config.mk

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1738628602 with
the CI changes reverted, so as to expect failures for CentOS 7 and earlier
Ubuntu Clangs.

The $(eval $(check-y)) is badly positioned:

   xen.git/xen$ make
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
     HOSTCC  tools/fixdep
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   make[1]: *** [scripts/Makefile.host:108: tools/fixdep] Error 1
     HOSTCC  tools/symbols
   *** FATAL BUILD ERROR: Xen requires at least GCC 0x150100
   make[1]: *** [scripts/Makefile.host:108: tools/symbols] Error 1
   make: *** [Makefile:610: xen] Error 2

It is involved every time Config.mk is included, rather than once per `make`
invocation.
---
  Config.mk                  | 14 ++++++++++++--
  xen/include/xen/compiler.h | 14 --------------
  2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/Config.mk b/Config.mk
index 8a73f3da62b4..a9d62fc10cfa 100644
--- a/Config.mk
+++ b/Config.mk
@@ -125,8 +125,18 @@ define cc-ver-check-closure
      endif
  endef
-# Require GCC v4.1+
-check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")
+# Minimum GCC version: 5.1, except for RISCV which needs 11.1
+ifeq ($(XEN_TARGET_ARCH),riscv64)
+check-$(gcc) = $(call cc-ver-check,CC,0x110100,"Xen requires at least GCC 
11.1")
+else
+check-$(gcc) = $(call cc-ver-check,CC,0x050100,"Xen requires at least GCC 5.1")
+endif
+
+# Minimum Clang version: 11, x86 only
+ifeq ($(XEN_TARGET_ARCH),x86_64)
+check-$(clang) = $(call cc-ver-check,CC,0x110000,"Xen requires at least Clang 
11")
+endif
+
  $(eval $(check-y))
ld-ver-build-id = $(shell $(1) --build-id 2>&1 | \
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 636a85bc417d..43b666133a92 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -1,20 +1,6 @@
  #ifndef __LINUX_COMPILER_H
  #define __LINUX_COMPILER_H
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#error Sorry, your compiler is too old/not recognized.
-#elif CONFIG_CC_IS_GCC
-# if defined(CONFIG_ARM_32) && CONFIG_GCC_VERSION < 40900
-#  error Sorry, your version of GCC is too old - please use 4.9 or newer.
-# elif defined(CONFIG_ARM_64) && CONFIG_GCC_VERSION < 50100
-/*
- *https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
- *https://lore.kernel.org/r/20210107111841.gn1...@shell.armlinux.org.uk
- */
-#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
-# endif
-#endif
-
  #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
  /* Results in more efficient PIC code (no indirections through GOT or PLT). */
  #pragma GCC visibility push(hidden)

Reply via email to