summaryrefslogtreecommitdiffstats
path: root/scripts/cc-version.sh
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2021-03-16 01:12:55 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2021-04-25 05:14:26 +0900
commite24b3ffcf4216d819b52618b6f17ba7410d1d845 (patch)
tree744a4dcc8d480a9f54bb88cecbcdeaec17f2e43d /scripts/cc-version.sh
parent6e0839fda3f8598b164a7f23f3eec039e2db5fbc (diff)
downloadlinux-e24b3ffcf4216d819b52618b6f17ba7410d1d845.tar.bz2
kbuild: collect minimum tool versions into scripts/min-tool-version.sh
The kernel build uses various tools, many of which are provided by the same software suite, for example, LLVM and Binutils. When you raise the minimum version of Clang/LLVM, you need to update clang_min_version in scripts/cc-version.sh and also lld_min_version in scripts/ld-version.sh. Kbuild can handle CC=clang and LD=ld.lld independently, but it does not make much sense to maintain their versions separately. Let's create a central place of minimum tool versions so you do not need to touch multiple files. scripts/min-tool-version.sh prints the minimum version of the given tool. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Diffstat (limited to 'scripts/cc-version.sh')
-rwxr-xr-xscripts/cc-version.sh20
1 files changed, 5 insertions, 15 deletions
diff --git a/scripts/cc-version.sh b/scripts/cc-version.sh
index 3f2ee885b116..f1952c522466 100755
--- a/scripts/cc-version.sh
+++ b/scripts/cc-version.sh
@@ -6,18 +6,6 @@
set -e
-# When you raise the minimum compiler version, please update
-# Documentation/process/changes.rst as well.
-gcc_min_version=4.9.0
-clang_min_version=10.0.1
-icc_min_version=16.0.3 # temporary
-
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
-# https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk
-if [ "$SRCARCH" = arm64 ]; then
- gcc_min_version=5.1.0
-fi
-
# Print the compiler name and some version components.
get_compiler_info()
{
@@ -48,18 +36,20 @@ set -- $(get_compiler_info "$@")
name=$1
+min_tool_version=$(dirname $0)/min-tool-version.sh
+
case "$name" in
GCC)
version=$2.$3.$4
- min_version=$gcc_min_version
+ min_version=$($min_tool_version gcc)
;;
Clang)
version=$2.$3.$4
- min_version=$clang_min_version
+ min_version=$($min_tool_version llvm)
;;
ICC)
version=$(($2 / 100)).$(($2 % 100)).$3
- min_version=$icc_min_version
+ min_version=$($min_tool_version icc)
;;
*)
echo "$orig_args: unknown compiler" >&2