2 # SPDX-License-Identifier: GPL-2.0
4 # Usage: $ ./scripts/lld-version.sh ld.lld
6 # Print the linker version of `ld.lld' in a 5 or 6-digit form
7 # such as `100001' for ld.lld 10.0.1 etc.
9 linker_string="$($* --version)"
11 if ! ( echo $linker_string | grep -q LLD ); then
16 VERSION=$(echo $linker_string | cut -d ' ' -f 2)
17 MAJOR=$(echo $VERSION | cut -d . -f 1)
18 MINOR=$(echo $VERSION | cut -d . -f 2)
19 PATCHLEVEL=$(echo $VERSION | cut -d . -f 3)
20 printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL