ANDROID: Add CONFIG_LLD_VERSION
CONFIG_LLD_VERSION was originally added in commit d5750cd3c548 ("kbuild:
Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1"), which is not
applicable to 4.19. Additionally, lld-version.sh was eliminated and
combined into ld-version.sh in commit 02aff8592204 ("kbuild: check the
minimum linker version in Kconfig") and there was a follow up fix in
commit 1f09af062556 ("kbuild: Fix ld-version.sh script if LLD was built
with LLD_VENDOR"), which is a little large to take into
android-4.19-stable for the sake of fixing an LTO issue.
Add scripts/lld-version.sh but based on the upstream version of
ld-version.sh so that we benefit from the fixes but do not have to
backport a ton of patches just to get access to CONFIG_LLD_VERSION.
Change-Id: I686ce6cc5f503540d8336b914f0fe978951c469b
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
This commit is contained in:
@@ -26,6 +26,10 @@ config CLANG_VERSION
|
|||||||
int
|
int
|
||||||
default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
|
default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
|
||||||
|
|
||||||
|
config LLD_VERSION
|
||||||
|
int
|
||||||
|
default $(shell,$(srctree)/scripts/lld-version.sh $(LD))
|
||||||
|
|
||||||
config CC_HAS_ASM_GOTO
|
config CC_HAS_ASM_GOTO
|
||||||
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
|
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
|
||||||
|
|
||||||
|
|||||||
36
scripts/lld-version.sh
Executable file
36
scripts/lld-version.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
#
|
||||||
|
# Print ld.lld's version in a 5 or 6-digit form.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Convert the version string x.y.z to a canonical 5 or 6-digit form.
|
||||||
|
get_canonical_version()
|
||||||
|
{
|
||||||
|
IFS=.
|
||||||
|
set -- $1
|
||||||
|
|
||||||
|
# If the 2nd or 3rd field is missing, fill it with a zero.
|
||||||
|
echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0}))
|
||||||
|
}
|
||||||
|
|
||||||
|
orig_args="$@"
|
||||||
|
|
||||||
|
# Get the first line of the --version output.
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
set -- $(LC_ALL=C "$@" --version)
|
||||||
|
|
||||||
|
# Split the line on spaces.
|
||||||
|
IFS=' '
|
||||||
|
set -- $1
|
||||||
|
|
||||||
|
while [ $# -gt 1 -a "$1" != "LLD" ]; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
if [ "$1" = LLD ]; then
|
||||||
|
echo $(get_canonical_version ${2%-*})
|
||||||
|
else
|
||||||
|
echo 0
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user