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

TOMOYO Linux Cross Reference
Linux/scripts/ld-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 ] ~

Diff markup

Differences between /scripts/ld-version.sh (Version linux-6.11.5) and /scripts/ld-version.sh (Version linux-6.0.19)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 #                                                   3 #
  4 # Print the linker name and its version in a 5      4 # Print the linker name and its version in a 5 or 6-digit form.
  5 # Also, perform the minimum version check.          5 # Also, perform the minimum version check.
  6                                                     6 
  7 set -e                                              7 set -e
  8                                                     8 
  9 # Convert the version string x.y.z to a canoni      9 # Convert the version string x.y.z to a canonical 5 or 6-digit form.
 10 get_canonical_version()                            10 get_canonical_version()
 11 {                                                  11 {
 12         IFS=.                                      12         IFS=.
 13         set -- $1                                  13         set -- $1
 14                                                    14 
 15         # If the 2nd or 3rd field is missing,      15         # If the 2nd or 3rd field is missing, fill it with a zero.
 16         #                                          16         #
 17         # The 4th field, if present, is ignore     17         # The 4th field, if present, is ignored.
 18         # This occurs in development snapshots     18         # This occurs in development snapshots as in 2.35.1.20201116
 19         echo $((10000 * $1 + 100 * ${2:-0} + $     19         echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
 20 }                                                  20 }
 21                                                    21 
 22 orig_args="$@"                                     22 orig_args="$@"
 23                                                    23 
 24 # Get the first line of the --version output.      24 # Get the first line of the --version output.
 25 IFS='                                              25 IFS='
 26 '                                                  26 '
 27 set -- $(LC_ALL=C "$@" --version)                  27 set -- $(LC_ALL=C "$@" --version)
 28                                                    28 
 29 # Split the line on spaces.                        29 # Split the line on spaces.
 30 IFS=' '                                            30 IFS=' '
 31 set -- $1                                          31 set -- $1
 32                                                    32 
 33 min_tool_version=$(dirname $0)/min-tool-versio     33 min_tool_version=$(dirname $0)/min-tool-version.sh
 34                                                    34 
 35 if [ "$1" = GNU -a "$2" = ld ]; then               35 if [ "$1" = GNU -a "$2" = ld ]; then
 36         shift $(($# - 1))                          36         shift $(($# - 1))
 37         version=$1                                 37         version=$1
 38         min_version=$($min_tool_version binuti     38         min_version=$($min_tool_version binutils)
 39         name=BFD                                   39         name=BFD
 40         disp_name="GNU ld"                         40         disp_name="GNU ld"
 41 elif [ "$1" = GNU -a "$2" = gold ]; then           41 elif [ "$1" = GNU -a "$2" = gold ]; then
 42         echo "gold linker is not supported as      42         echo "gold linker is not supported as it is not capable of linking the kernel proper." >&2
 43         exit 1                                     43         exit 1
 44 else                                               44 else
 45         while [ $# -gt 1 -a "$1" != "LLD" ]; d     45         while [ $# -gt 1 -a "$1" != "LLD" ]; do
 46                 shift                              46                 shift
 47         done                                       47         done
 48                                                    48 
 49         if [ "$1" = LLD ]; then                    49         if [ "$1" = LLD ]; then
 50                 version=$2                         50                 version=$2
 51                 min_version=$($min_tool_versio     51                 min_version=$($min_tool_version llvm)
 52                 name=LLD                           52                 name=LLD
 53                 disp_name=LLD                      53                 disp_name=LLD
 54         else                                       54         else
 55                 echo "$orig_args: unknown link     55                 echo "$orig_args: unknown linker" >&2
 56                 exit 1                             56                 exit 1
 57         fi                                         57         fi
 58 fi                                                 58 fi
 59                                                    59 
 60 # There may be something after the version, su !!  60 # Some distributions append a package release number, as in 2.34-4.fc32
 61 # release number (like Fedora's "2.34-4.fc32") !!  61 # Trim the hyphen and any characters that follow.
 62 # added before the "compatible with GNU linker !!  62 version=${version%-*}
 63 # after just numbers and periods.              << 
 64 version=${version%%[!0-9.]*}                   << 
 65                                                    63 
 66 cversion=$(get_canonical_version $version)         64 cversion=$(get_canonical_version $version)
 67 min_cversion=$(get_canonical_version $min_vers     65 min_cversion=$(get_canonical_version $min_version)
 68                                                    66 
 69 if [ "$cversion" -lt "$min_cversion" ]; then       67 if [ "$cversion" -lt "$min_cversion" ]; then
 70         echo >&2 "***"                             68         echo >&2 "***"
 71         echo >&2 "*** Linker is too old."          69         echo >&2 "*** Linker is too old."
 72         echo >&2 "***   Your $disp_name versio     70         echo >&2 "***   Your $disp_name version:    $version"
 73         echo >&2 "***   Minimum $disp_name ver     71         echo >&2 "***   Minimum $disp_name version: $min_version"
 74         echo >&2 "***"                             72         echo >&2 "***"
 75         exit 1                                     73         exit 1
 76 fi                                                 74 fi
 77                                                    75 
 78 echo $name $cversion                               76 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