diff mbox series

toolchain/custom: hide away incompatible gcc versions

Message ID 20210919114547.103955-1-yann.morin.1998@free.fr
State Rejected
Headers show
Series toolchain/custom: hide away incompatible gcc versions | expand

Commit Message

Yann E. MORIN Sept. 19, 2021, 11:45 a.m. UTC
Some CPUs have a requirement on a minimal gcc version. Until now, ot was
possible to use a custom external toolchain that has a gcc older than
the requirement, which would lead to build failures (early!) during the
build.

Propagate the gcc version requirement down to the external toolchain gcc
version choice. By limiting the selection to acceptable gcc versions, we
inform the user that its toolchain is too old, and if they decide to lie
and select one of available version, we still check that when we extract
and install their toolchain.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 .../Config.in.options                          | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Thomas Petazzoni Sept. 19, 2021, 12:02 p.m. UTC | #1
Hello,

On Sun, 19 Sep 2021 13:45:47 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Some CPUs have a requirement on a minimal gcc version. Until now, ot was
> possible to use a custom external toolchain that has a gcc older than
> the requirement, which would lead to build failures (early!) during the
> build.
> 
> Propagate the gcc version requirement down to the external toolchain gcc
> version choice. By limiting the selection to acceptable gcc versions, we
> inform the user that its toolchain is too old, and if they decide to lie
> and select one of available version, we still check that when we extract
> and install their toolchain.

I think there was a reason to not have these for external toolchains:
they can use patched gcc versions that support newer CPU cores that are
normally not supported in the same gcc upstream version. It was for
example the case I believe at some point for Linaro toolchains.

This argument is not necessarily a strong disagreement against your
patch, I'm just stating why I believe we hadn't done that in the past.

BTW, has there been some recent issue that prompted you to write/submit
this change ?

Thomas
Yann E. MORIN Sept. 19, 2021, 12:28 p.m. UTC | #2
Thomas, All,

On 2021-09-19 14:02 +0200, Thomas Petazzoni spake thusly:
> On Sun, 19 Sep 2021 13:45:47 +0200
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > Some CPUs have a requirement on a minimal gcc version. Until now, ot was
> > possible to use a custom external toolchain that has a gcc older than
> > the requirement, which would lead to build failures (early!) during the
> > build.
> > 
> > Propagate the gcc version requirement down to the external toolchain gcc
> > version choice. By limiting the selection to acceptable gcc versions, we
> > inform the user that its toolchain is too old, and if they decide to lie
> > and select one of available version, we still check that when we extract
> > and install their toolchain.
> 
> I think there was a reason to not have these for external toolchains:
> they can use patched gcc versions that support newer CPU cores that are
> normally not supported in the same gcc upstream version. It was for
> example the case I believe at some point for Linaro toolchains.
> 
> This argument is not necessarily a strong disagreement against your
> patch, I'm just stating why I believe we hadn't done that in the past.

OK, I see the point, and I agree.

> BTW, has there been some recent issue that prompted you to write/submit
> this change ?

No. I was looking at the mips CPUs entries, and I was just looking where
all those BR2_ARCH_NEEDS_GCC_AT_LEAST_xxx were used, and  suddenly my two
neurons collided one with the other, and made me check the custom
toolchains...

But OK, as I was also one to lift some custom toolchain limitations to
account for backported features, the current situation is fine.

I'll drop my patch.

Regards,
Yann E. MORIN.
diff mbox series

Patch

diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index ae78c0ef9e..99d5b7df42 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -31,60 +31,78 @@  choice
 	  Set to the gcc version that is used by your external
 	  toolchain.
 
+	  If the gcc version in your toolchain is not available below,
+	  then your toolchain is too old to be used in the current
+	  configuration (e.g. your CPU requires a more recent gcc
+	  version).
+
 config BR2_TOOLCHAIN_EXTERNAL_GCC_11
 	bool "11.x"
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_11
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_10
 	bool "10.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_11
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_10
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_9
 	bool "9.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_10
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_9
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_8
 	bool "8.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_9
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_8
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_7
 	bool "7.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_8
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_7
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_6
 	bool "6.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_7
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_6
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_5
 	bool "5.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_6
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_5
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_9
 	bool "4.9.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_5
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_8
 	bool "4.8.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_4_9
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_7
 	bool "4.7.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_4_8
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_6
 	bool "4.6.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_4_8
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_5
 	bool "4.5.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_4_8
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_4
 	bool "4.4.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_4_8
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_4
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_4_3
 	bool "4.3.x"
+	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_4_8
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_4_3
 
 config BR2_TOOLCHAIN_EXTERNAL_GCC_OLD