Message ID | 20250327163114.405824-1-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] Xen: Update compiler checks | expand |
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.cooper3@citrix.com> > --- > CC: Anthony PERARD<anthony.perard@vates.tech> > CC: Michal Orzel<michal.orzel@amd.com> > CC: Jan Beulich<jbeulich@suse.com> > CC: Julien Grall<julien@xen.org> > CC: Roger Pau Monné<roger.pau@citrix.com> > CC: Stefano Stabellini<sstabellini@kernel.org> > CC: Oleksii Kurochko<oleksii.kurochko@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.GN1551@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)
On 27/03/2025 4:31 pm, Andrew Cooper wrote: > 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)) No, this doesn't work. Tracing a RISC-V cross-compile, it's invoked with different $(CC)'s. + gcc -dumpversion + awk -F. { printf "0x%02x%02x%02x", $1, $2, $3} + [ 786432 -ge 327936 ] + echo y + riscv64-linux-gnu-gcc -dumpversion + awk -F. { printf "0x%02x%02x%02x", $1, $2, $3} + [ 786432 -ge 1114368 ] + echo n ~Andrew
On 27.03.2025 17:31, 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. Isn't this premature? The Config.mk one doesn't terminate the build, according to what there is in the post-commit-message area? > Expand the checks to cover RISCV wanting GCC 11.1, and to cover Clang on x86. ./README says 12.2 though. > PPC still is unspecified, and inherits the GCC 5.1 global baseline. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > --- > CC: Anthony PERARD <anthony.perard@vates.tech> > CC: Michal Orzel <michal.orzel@amd.com> > CC: Jan Beulich <jbeulich@suse.com> > CC: Julien Grall <julien@xen.org> > CC: Roger Pau Monné <roger.pau@citrix.com> > CC: Stefano Stabellini <sstabellini@kernel.org> > CC: Oleksii Kurochko <oleksii.kurochko@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. Right, I guess the $(eval ...) wants to move to every */Makefile in the top-level subdirs. But as you said elsewhere, that's an orthogonal issue. Jan
On 27/03/2025 4:37 pm, Oleksii Kurochko wrote: > > > 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. Sorry, that's me not paying enough attention. I'll fix. ~Andrew
On 27/03/2025 4:39 pm, Jan Beulich wrote: > On 27.03.2025 17:31, 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. > Isn't this premature? The Config.mk one doesn't terminate the build, according > to what there is in the post-commit-message area? It's also broken for cross-compiles, in a way that I don't have time to fix now. I'm going to leave this as a 5.1 baseline across the board, and reintroduce the xen/compile.h one with the per-arch nuances. ~Andrew
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.GN1551@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)
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. PPC still is unspecified, and inherits the GCC 5.1 global baseline. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Anthony PERARD <anthony.perard@vates.tech> CC: Michal Orzel <michal.orzel@amd.com> CC: Jan Beulich <jbeulich@suse.com> CC: Julien Grall <julien@xen.org> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Oleksii Kurochko <oleksii.kurochko@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(-)