summaryrefslogtreecommitdiff
path: root/scripts/rustc-llvm-version.sh
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-10-25 10:54:09 +0200
committerTakashi Iwai <tiwai@suse.de>2024-10-25 10:54:09 +0200
commit0216ded72db896b24cbdd8cd6531482571b25cf6 (patch)
tree56b578e29657bd3df8236c5f0cf6b8f13c17232a /scripts/rustc-llvm-version.sh
parent52345d35622026b99271edc1c58ad7cfef3b7567 (diff)
parent04177158cf98a79744937893b100020d77e6f9ac (diff)
Merge branch 'topic/compress-accel' into for-next
Pull compress-offload API extension for accel operation mode Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'scripts/rustc-llvm-version.sh')
-rwxr-xr-xscripts/rustc-llvm-version.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/rustc-llvm-version.sh b/scripts/rustc-llvm-version.sh
new file mode 100755
index 000000000000..b6063cbe5bdc
--- /dev/null
+++ b/scripts/rustc-llvm-version.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Usage: $ ./rustc-llvm-version.sh rustc
+#
+# Print the LLVM version that the Rust compiler uses in a 6 digit form.
+
+# Convert the version string x.y.z to a canonical up-to-6-digits form.
+get_canonical_version()
+{
+ IFS=.
+ set -- $1
+ echo $((10000 * $1 + 100 * $2 + $3))
+}
+
+if output=$("$@" --version --verbose 2>/dev/null | grep LLVM); then
+ set -- $output
+ get_canonical_version $3
+else
+ echo 0
+ exit 1
+fi