Files
Linux_Drivers/linux_5.10/scripts/lld-version.sh
sam.xiang 5c7dd7acc3 [linux] create linux_5.10.4 from T-head official:
repo: https://github.com/T-head-Semi/linux
	commit: b1313fe517ca3703119dcc99ef3bbf75ab42bcfb

Change-Id: I6cbb35294024ea3a66140e311f4bb705fd7fd626
2023-03-10 20:32:41 +08:00

21 lines
519 B
Bash
Executable File

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