armbian-build/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch
unifreq ab70cb247f
rockchip-rk3588-legacy: kernel patch up to 5.10.72 (#4195)
* scripts: fix modpost & lld-version

* rockchip-rk4588-legacy: patch-5.10.69-70

* rockchip-rk3588-legacy: patch-5.10.70-71

* rockchip-rk3588-legacy: patch-5.10.71-72

* drv: usb: gadget: legacy: fix webcam.c compilation errors

    drv: usb: gadget: legacy: fix webcam.c compilation errors
    drivers/usb/gadget/legacy/webcam.c: In function ‘webcam_bind’:
    drivers/usb/gadget/legacy/webcam.c:386:37: error: ‘UVC_NUM_REQUESTS’ undeclared (first use in this function)
      386 |         uvc_opts->uvc_num_request = UVC_NUM_REQUESTS;
          |                                     ^~~~~~~~~~~~~~~~

* Update config

Co-authored-by: Igor <igor@armbian.com>
2022-09-20 21:34:48 +02:00

47 lines
1.1 KiB
Diff

diff --git a/scripts/lld-version.sh b/scripts/lld-version.sh
index d70edb4d8..f1eeee450 100755
--- a/scripts/lld-version.sh
+++ b/scripts/lld-version.sh
@@ -6,15 +6,32 @@
# 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)"
+set -e
-if ! ( echo $linker_string | grep -q LLD ); then
+# 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}))
+}
+
+# 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
- 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