diff --git a/arch/arm/mach-rpc/Kconfig b/arch/arm/mach-rpc/Kconfig
index 55f6d829b677..106716042308 100644
--- a/arch/arm/mach-rpc/Kconfig
+++ b/arch/arm/mach-rpc/Kconfig
@@ -2,7 +2,7 @@ config ARCH_RPC
 	bool "RiscPC"
 	depends on ARCH_MULTI_V4 && !(ARCH_MULTI_V4T || ARCH_MULTI_V5)
 	depends on !(ARCH_FOOTBRIDGE || ARCH_SA1100 || ARCH_MOXART || ARCH_GEMINI)
-	depends on !CC_IS_CLANG && GCC_VERSION < 90100 && GCC_VERSION >= 60000
+	depends on !CC_IS_CLANG && GCC_VERSION < 090100 && GCC_VERSION >= 060000
 	depends on CPU_LITTLE_ENDIAN
 	depends on ATAGS
 	depends on MMU
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 505c8a1ccbe0..b318f7ad050b 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -236,7 +236,7 @@ config ARM64
 config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
 	def_bool CC_IS_CLANG
 	# https://github.com/ClangBuiltLinux/linux/issues/1507
-	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
+	depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 023600))
 	select HAVE_DYNAMIC_FTRACE_WITH_REGS
 
 config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
@@ -1814,7 +1814,7 @@ config ARM64_PTR_AUTH_KERNEL
 	depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
 	# Modern compilers insert a .note.gnu.property section note for PAC
 	# which is only understood by binutils starting with version 2.33.1.
-	depends on LD_IS_LLD || LD_VERSION >= 23301 || (CC_IS_GCC && GCC_VERSION < 90100)
+	depends on LD_IS_LLD || LD_VERSION >= 23301 || (CC_IS_GCC && GCC_VERSION < 090100)
 	depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
 	depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
 	help
diff --git a/arch/mips/vdso/Kconfig b/arch/mips/vdso/Kconfig
index a665f6108cb5..a8316108b756 100644
--- a/arch/mips/vdso/Kconfig
+++ b/arch/mips/vdso/Kconfig
@@ -12,7 +12,7 @@
 # the lack of relocations. As such, we disable the VDSO for microMIPS builds.
 
 config MIPS_LD_CAN_LINK_VDSO
-	def_bool LD_VERSION >= 22500 || LD_IS_LLD
+	def_bool LD_VERSION >= 022500 || LD_IS_LLD
 
 config MIPS_DISABLE_VDSO
 	def_bool CPU_MICROMIPS || (!CPU_MIPSR6 && !MIPS_LD_CAN_LINK_VDSO)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2ca5418457ed..e7ba3a145595 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -220,7 +220,7 @@ config PPC
 	select HAVE_FUNCTION_ERROR_INJECTION
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FUNCTION_TRACER
-	select HAVE_GCC_PLUGINS			if GCC_VERSION >= 50200   # plugin support on gcc <= 5.1 is buggy on PPC
+	select HAVE_GCC_PLUGINS			if GCC_VERSION >= 050200   # plugin support on gcc <= 5.1 is buggy on PPC
 	select HAVE_GENERIC_VDSO
 	select HAVE_HARDLOCKUP_DETECTOR_ARCH	if PPC_BOOK3S_64 && SMP
 	select HAVE_HARDLOCKUP_DETECTOR_PERF	if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index fa78595a6089..292f134f4493 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -416,7 +416,7 @@ config TOOLCHAIN_HAS_ZICBOM
 	default y
 	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zicbom)
 	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zicbom)
-	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23800
+	depends on LLD_VERSION >= 150000 || LD_VERSION >= 023800
 
 config RISCV_ISA_ZICBOM
 	bool "Zicbom extension support for non-coherent DMA operation"
@@ -440,7 +440,7 @@ config TOOLCHAIN_HAS_ZIHINTPAUSE
 	default y
 	depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zihintpause)
 	depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zihintpause)
-	depends on LLD_VERSION >= 150000 || LD_VERSION >= 23600
+	depends on LLD_VERSION >= 150000 || LD_VERSION >= 023600
 
 config FPU
 	bool "FPU support"
diff --git a/init/Kconfig b/init/Kconfig
index abf65098f1b6..402ce28c8eff 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -20,17 +20,17 @@ config CC_IS_GCC
 	def_bool $(success,test "$(cc-name)" = GCC)
 
 config GCC_VERSION
-	int
+	hex
 	default $(cc-version) if CC_IS_GCC
-	default 0
+	default 000000
 
 config CC_IS_CLANG
 	def_bool $(success,test "$(cc-name)" = Clang)
 
 config CLANG_VERSION
-	int
+	hex
 	default $(cc-version) if CC_IS_CLANG
-	default 0
+	default 000000
 
 config AS_IS_GNU
 	def_bool $(success,test "$(as-name)" = GNU)
@@ -39,7 +39,7 @@ config AS_IS_LLVM
 	def_bool $(success,test "$(as-name)" = LLVM)
 
 config AS_VERSION
-	int
+	hex
 	# Use clang version if this is the integrated assembler
 	default CLANG_VERSION if AS_IS_LLVM
 	default $(as-version)
@@ -48,17 +48,17 @@ config LD_IS_BFD
 	def_bool $(success,test "$(ld-name)" = BFD)
 
 config LD_VERSION
-	int
+	hex
 	default $(ld-version) if LD_IS_BFD
-	default 0
+	default 000000
 
 config LD_IS_LLD
 	def_bool $(success,test "$(ld-name)" = LLD)
 
 config LLD_VERSION
-	int
+	hex
 	default $(ld-version) if LD_IS_LLD
-	default 0
+	default 000000
 
 config RUST_IS_AVAILABLE
 	def_bool $(success,$(srctree)/scripts/rust_is_available.sh)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d93dbe5a1d14..9d5f061fc4cf 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -258,7 +258,7 @@ config DEBUG_INFO_NONE
 config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 	bool "Rely on the toolchain's implicit default DWARF version"
 	select DEBUG_INFO
-	depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
+	depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 023502 && AS_HAS_NON_CONST_LEB128)
 	help
 	  The implicit default version of DWARF debug info produced by a
 	  toolchain changes over time.
@@ -270,7 +270,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 config DEBUG_INFO_DWARF4
 	bool "Generate DWARF Version 4 debuginfo"
 	select DEBUG_INFO
-	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
+	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 023502)
 	help
 	  Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
 	  if using clang without clang's integrated assembler, and gdb 7.0+.
@@ -282,7 +282,7 @@ config DEBUG_INFO_DWARF4
 config DEBUG_INFO_DWARF5
 	bool "Generate DWARF Version 5 debuginfo"
 	select DEBUG_INFO
-	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
+	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 023502 && AS_HAS_NON_CONST_LEB128)
 	help
 	  Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
 	  5.0+ accepts the -gdwarf-5 flag but only had partial support for some
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index ca09b1cf8ee9..2ad969c6eb29 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -29,7 +29,7 @@ config CC_HAS_KASAN_SW_TAGS
 # Old GCC versions do not have proper support for no_sanitize_address.
 # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89124 for details.
 config CC_HAS_WORKING_NOSANITIZE_ADDRESS
-	def_bool !CC_IS_GCC || GCC_VERSION >= 80300
+	def_bool !CC_IS_GCC || GCC_VERSION >= 080300
 
 menuconfig KASAN
 	bool "KASAN: dynamic memory safety error detector"
diff --git a/scripts/as-version.sh b/scripts/as-version.sh
index 1a21495e9ff0..778ccbc82ca8 100755
--- a/scripts/as-version.sh
+++ b/scripts/as-version.sh
@@ -1,14 +1,14 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-only
 #
-# Print the assembler name and its version in a 5 or 6-digit form.
+# Print the assembler name and its version in a 6-digit form.
 # Also, perform the minimum version check.
 # (If it is the integrated assembler, return 0 as the version, and
 # skip the version check.)
 
 set -e
 
-# Convert the version string x.y.z to a canonical 5 or 6-digit form.
+# Convert the version string x.y.z to a canonical 6-digit form.
 get_canonical_version()
 {
 	IFS=.
@@ -18,7 +18,7 @@ get_canonical_version()
 	#
 	# The 4th field, if present, is ignored.
 	# This occurs in development snapshots as in 2.35.1.20201116
-	echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
+	printf "%06d\n" $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
 }
 
 # Clang fails to handle -Wa,--version unless -fno-integrated-as is given.
diff --git a/scripts/cc-version.sh b/scripts/cc-version.sh
index 2401c86fcf53..fe9f446a40b4 100755
--- a/scripts/cc-version.sh
+++ b/scripts/cc-version.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 #
-# Print the C compiler name and its version in a 5 or 6-digit form.
+# Print the C compiler name and its version in a 6-digit form.
 # Also, perform the minimum version check.
 
 set -e
@@ -22,12 +22,12 @@ get_c_compiler_info()
 	EOF
 }
 
-# Convert the version string x.y.z to a canonical 5 or 6-digit form.
+# Convert the version string x.y.z to a canonical 6-digit form.
 get_canonical_version()
 {
 	IFS=.
 	set -- $1
-	echo $((10000 * $1 + 100 * $2 + $3))
+	printf "%06d\n" $((10000 * $1 + 100 * $2 + $3))
 }
 
 # $@ instead of $1 because multiple words might be given, e.g. CC="ccache gcc".
diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
index a78b804b680c..a00693198a53 100755
--- a/scripts/ld-version.sh
+++ b/scripts/ld-version.sh
@@ -1,12 +1,12 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 #
-# Print the linker name and its version in a 5 or 6-digit form.
+# Print the linker name and its version in a 6-digit form.
 # Also, perform the minimum version check.
 
 set -e
 
-# Convert the version string x.y.z to a canonical 5 or 6-digit form.
+# Convert the version string x.y.z to a canonical 6-digit form.
 get_canonical_version()
 {
 	IFS=.
@@ -16,7 +16,7 @@ get_canonical_version()
 	#
 	# The 4th field, if present, is ignored.
 	# This occurs in development snapshots as in 2.35.1.20201116
-	echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
+	printf "%06d\n" $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
 }
 
 orig_args="$@"
