Re: [PATCH] Fix ld-version.sh script if LLD was built with LLD_VENDOR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 10, 2021 at 02:09:02AM +0900, Masahiro Yamada wrote:
> On Thu, Mar 4, 2021 at 12:34 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > On Thu, Mar 4, 2021 at 9:18 AM Bernhard Rosenkränzer <bero@xxxxxxxxx> wrote:
> > >
> > > 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.
> > >
> > > Signed-off-by: Bernhard Rosenkränzer <bero@xxxxxxxxx>
> > > ---
> >
> >
> > Bernhard,
> >
> > Could you senv v2
> > with the suggested code change?
> >
> > Please make sure to add
> > linux-kbuild@xxxxxxxxxxxxxxx
> > in the To:
> 
> 
> I did not get v2, but never mind.
> I locally modified the code and applied.
> 
> I added Link: to your original patch
> just in case I make some mistake in the
> code refactoring.
> 
> 
> The final one looks as follows:
> 
> 
> 
> 
> 
> commit 0b2813ba7b0f0a9ff273177e85cbc93d92e76212
> Author: Bernhard Rosenkränzer <bero@xxxxxxxxx>
> Date:   Tue Mar 2 23:12:11 2021 +0100
> 
>     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@xxxxxxxxx/
>     Signed-off-by: Bernhard Rosenkränzer <bero@xxxxxxxxx>
>     [masahiro yamada: refactor the code]

If it is not too late:

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
Tested-by: Nathan Chancellor <nathan@xxxxxxxxxx>

>     Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> 
> diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
> index a463273509b5..30debf78aa09 100755
> --- a/scripts/ld-version.sh
> +++ b/scripts/ld-version.sh
> @@ -44,14 +44,20 @@ 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
> -       version=$2
> -       min_version=$lld_min_version
> -       name=LLD
> -       disp_name=LLD
>  else
> -       echo "$orig_args: unknown linker" >&2
> -       exit 1
> +       while [ $# -gt 1 -a "$1" != "LLD" ]; do
> +               shift
> +       done
> +
> +       if [ "$1" = LLD ]; then
> +               version=$2
> +               min_version=$lld_min_version
> +               name=LLD
> +               disp_name=LLD
> +       else
> +               echo "$orig_args: unknown linker" >&2
> +               exit 1
> +       fi
>  fi
> 
>  # Some distributions append a package release number, as in 2.34-4.fc32
> 
> 
> 
> 
> --
> Best Regards
> Masahiro Yamada



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux