~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/as-version.sh

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0-only
  3 #
  4 # Print the assembler name and its version in a 5 or 6-digit form.
  5 # Also, perform the minimum version check.
  6 # (If it is the integrated assembler, return 0 as the version, and
  7 # skip the version check.)
  8 
  9 set -e
 10 
 11 # Convert the version string x.y.z to a canonical 5 or 6-digit form.
 12 get_canonical_version()
 13 {
 14         IFS=.
 15         set -- $1
 16 
 17         # If the 2nd or 3rd field is missing, fill it with a zero.
 18         #
 19         # The 4th field, if present, is ignored.
 20         # This occurs in development snapshots as in 2.35.1.20201116
 21         echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
 22 }
 23 
 24 # Clang fails to handle -Wa,--version unless -fno-integrated-as is given.
 25 # We check -fintegrated-as, expecting it is explicitly passed in for the
 26 # integrated assembler case.
 27 check_integrated_as()
 28 {
 29         while [ $# -gt 0 ]; do
 30                 if [ "$1" = -fintegrated-as ]; then
 31                         # For the integrated assembler, we do not check the
 32                         # version here. It is the same as the clang version, and
 33                         # it has been already checked by scripts/cc-version.sh.
 34                         echo LLVM 0
 35                         exit 0
 36                 fi
 37                 shift
 38         done
 39 }
 40 
 41 check_integrated_as "$@"
 42 
 43 orig_args="$@"
 44 
 45 # Get the first line of the --version output.
 46 IFS='
 47 '
 48 set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler-with-cpp /dev/null -o /dev/null 2>/dev/null)
 49 
 50 # Split the line on spaces.
 51 IFS=' '
 52 set -- $1
 53 
 54 min_tool_version=$(dirname $0)/min-tool-version.sh
 55 
 56 if [ "$1" = GNU -a "$2" = assembler ]; then
 57         shift $(($# - 1))
 58         version=$1
 59         min_version=$($min_tool_version binutils)
 60         name=GNU
 61 else
 62         echo "$orig_args: unknown assembler invoked" >&2
 63         exit 1
 64 fi
 65 
 66 # Some distributions append a package release number, as in 2.34-4.fc32
 67 # Trim the hyphen and any characters that follow.
 68 version=${version%-*}
 69 
 70 cversion=$(get_canonical_version $version)
 71 min_cversion=$(get_canonical_version $min_version)
 72 
 73 if [ "$cversion" -lt "$min_cversion" ]; then
 74         echo >&2 "***"
 75         echo >&2 "*** Assembler is too old."
 76         echo >&2 "***   Your $name assembler version:    $version"
 77         echo >&2 "***   Minimum $name assembler version: $min_version"
 78         echo >&2 "***"
 79         exit 1
 80 fi
 81 
 82 echo $name $cversion

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php