Skip to content

Commit 1f09af0

Browse files
berolinuxmasahir0y
authored andcommitted
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: Bernhard Rosenkränzer <bero@lindev.ch> [masahiro yamada: refactor the code] Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org>
1 parent b3d9fc1 commit 1f09af0

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

scripts/ld-version.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@ if [ "$1" = GNU -a "$2" = ld ]; then
4444
elif [ "$1" = GNU -a "$2" = gold ]; then
4545
echo "gold linker is not supported as it is not capable of linking the kernel proper." >&2
4646
exit 1
47-
elif [ "$1" = LLD ]; then
48-
version=$2
49-
min_version=$lld_min_version
50-
name=LLD
51-
disp_name=LLD
5247
else
53-
echo "$orig_args: unknown linker" >&2
54-
exit 1
48+
while [ $# -gt 1 -a "$1" != "LLD" ]; do
49+
shift
50+
done
51+
52+
if [ "$1" = LLD ]; then
53+
version=$2
54+
min_version=$lld_min_version
55+
name=LLD
56+
disp_name=LLD
57+
else
58+
echo "$orig_args: unknown linker" >&2
59+
exit 1
60+
fi
5561
fi
5662

5763
# Some distributions append a package release number, as in 2.34-4.fc32

0 commit comments

Comments
 (0)