[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnJ9p+iGYP31TJcaCLBqk2gOes4=5z=K8Tv_jytn6+RgA@mail.gmail.com>
Date: Thu, 14 May 2020 16:25:42 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Yuxuan Shui <yshuiv7@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] kbuild: compile_h: fix compiler version detection with clang
On Thu, May 14, 2020 at 3:43 PM Yuxuan Shui <yshuiv7@...il.com> wrote:
>
>
> In some setup clang will print a line about CUDA version it detects,
> like this:
>
> Found CUDA installation: /opt/cuda, version 10.1
>
> So grepping ' version ' matches 2 lines, and results in a broken string in
> compiler.h, which doesn't compile.
>
> This commit adds a "head -n1" to fix this problem.
>
> Signed-off-by: Yuxuan Shui <yshuiv7@...il.com>
Hi Yuxuan, thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
Might be worthwhile for Masahiro to add
Cc: stable@...r.kernel.org
if/when picked up?
> ---
> scripts/mkcompile_h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
> index 5b80a4699740..8e6b4fc6fdd9 100755
> --- a/scripts/mkcompile_h
> +++ b/scripts/mkcompile_h
> @@ -62,7 +62,7 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
> printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY"
> echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\"
>
> - CC_VERSION=$($CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//')
> + CC_VERSION=$($CC -v 2>&1 | grep ' version ' | head -n1 | sed 's/[[:space:]]*$//')
> LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
> | sed 's/[[:space:]]*$//')
> printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"
> --
> 2.26.2
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists