Commit 1f09af06 authored by Bernhard Rosenkränzer's avatar Bernhard Rosenkränzer Committed by Masahiro Yamada
Browse files

kbuild: Fix ld-version.sh script if LLD was built with LLD_VENDOR

If LLD was built with -DLLD_VENDOR="xyz", ld.lld --version output
will prefix LLD_VENDOR. Since LLD_VENDOR can contain spaces, the
LLD identifier isn't guaranteed to be $2 either.

Adjust the version checker to handle such versions of lld.

Link: https://lore.kernel.org/lkml/20210302221211.1620858-1-bero@lindev.ch/


Signed-off-by: default avatarBernhard Rosenkränzer <bero@lindev.ch>
[masahiro yamada: refactor the code]
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
parent b3d9fc14
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -44,7 +44,12 @@ if [ "$1" = GNU -a "$2" = ld ]; then
elif [ "$1" = GNU -a "$2" = gold ]; then
	echo "gold linker is not supported as it is not capable of linking the kernel proper." >&2
	exit 1
elif [ "$1" = LLD ]; then
else
	while [ $# -gt 1 -a "$1" != "LLD" ]; do
		shift
	done

	if [ "$1" = LLD ]; then
		version=$2
		min_version=$lld_min_version
		name=LLD
@@ -53,6 +58,7 @@ else
		echo "$orig_args: unknown linker" >&2
		exit 1
	fi
fi

# Some distributions append a package release number, as in 2.34-4.fc32
# Trim the hyphen and any characters that follow.