Xen: Update compiler checks
PATCH v3 1/1 Xen: Update compiler checks
We have checks in both xen/compiler.h, and Config.mk. Both are incomplete.
The check in Config.mk sees $(CC) in system and cross-compiler form, so cannot express anything more than the global baseline. Change it to simply 5.1.
In xen/compiler.h, rewrite the expression for clarity/brevity.
Include a GCC 12.2 check for RISCV, and include a Clang 11 baseline check.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>
v3:
* Reinstate the xen/compiler.h block
* Restrict Config.mk to the baseline only
v2:
* Change to altering Config.mk
https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1738778376 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 | 4 ++-- xen/include/xen/compiler.h | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-)
Config.mk +2 -2
@@ -125,8 +125,8 @@ 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") +# Require GCC v5.1 as the project global baseline +check-$(gcc) = $(call cc-ver-check,CC,0x050100,"Xen requires at least GCC 5.1") $(eval $(check-y)) ld-ver-build-id = $(shell $(1) --build-id 2>&1 | \
xen/include/xen/compiler.h +14 -12
@@ -1,19 +1,21 @@#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/[email protected] -*/ -# error Sorry, your version of GCC is too old - please use 5.1 or newer. +#if CONFIG_CC_IS_GCC + +# if defined(CONFIG_RISCV ) &&CONFIG_GCC_VERSION <120200 +# error Sorry, please use GCC >= 12.2 +# elif CONFIG_GCC_VERSION <50100 +# error Sorry, please use GCC >= 5.1# endif -#endif + +#elif CONFIG_CC_IS_CLANG + +# if CONFIG_CLANG_VERSION <110000 +# error Sorry, please use Clang >= 11 +# endif + +#endif /* Compiler checks. */ #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE /* Results in more efficient PIC code (no indirections through GOT or PLT). */
Signature · 1 line
2.39.5
Quoted 10 lines · Andrew Cooper
We have checks in both
xen/compiler.h, and Config.mk. Both are incomplete.The check in Config.mk sees $(CC) in system and cross-compiler form, so cannot express anything more than the global baseline. Change it to simply 5.1.
In
xen/compiler.h, rewrite the expression for clarity/brevity.Include a GCC 12.2 check for RISCV, and include a Clang 11 baseline check.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 26 lines · Andrew Cooper
The $(eval $(check-y)) is badly positioned:
xen.git/xen$ make
*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100
HOSTCCtools/fixdep
*** FATAL BUILD ERROR: Xen requires at least GCC0x150100make[1]: *** [scripts/Makefile.host:108:tools/fixdep] Error 1
HOSTCCtools/symbols
*** FATAL BUILD ERROR: Xen requires at least GCC0x150100make[1]: *** [scripts/Makefile.host:108:tools/symbols] Error 1
make: *** [Makefile:610: xen] Error 2
Quoted 2 lines
It is involved every time Config.mk is included, rather than once per
makeinvocation.
It's worth than that ;-). $(eval $(check-y)) doesn't print anything, it actually replace $(CC) by something that just print this error message and thus refuse to build anything. So even if the eval was only done once, you'll still have this stream of error message.
Anyway, is this check still useful somehow? Or could we replace it by a check in ./configure for the tools and one in either Kconfig or "xen/Makefile" for the hypervisor?
Cheers,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
Quoted 27 lines · Anthony PERARD
Quoted 26 lines · Andrew Cooper
The $(eval $(check-y)) is badly positioned:
xen.git/xen$ make
*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100*** FATAL BUILD ERROR: Xen requires at least GCC0x150100
HOSTCCtools/fixdep
*** FATAL BUILD ERROR: Xen requires at least GCC0x150100make[1]: *** [scripts/Makefile.host:108:tools/fixdep] Error 1
HOSTCCtools/symbols
*** FATAL BUILD ERROR: Xen requires at least GCC0x150100make[1]: *** [scripts/Makefile.host:108:tools/symbols] Error 1
make: *** [Makefile:610: xen] Error 2
Quoted 5 lines
Quoted 2 lines
It is involved every time Config.mk is included, rather than once per
makeinvocation.It's worth than that ;-). $(eval $(check-y)) doesn't print anything, it actually replace $(CC) by something that just print this error message and thus refuse to build anything.
Oh, that's far worse.
Quoted 2 lines
So even if the eval was only done
once, you'll still have this stream of error message.
It appears the author didn't know about $(error).
Quoted 3 lines
Anyway, is this check still useful somehow? Or could we replace it by a check in ./configure for the tools and one in either
Kconfigor "xen/Makefile" for the hypervisor?
I'm quite sure it predates ./configure. But I don't think there's any reason to keep it around in this form - like this it's borderline useless.
~Andrew