[PATCH 8/9] Makefile: Add loongarch target flag for Clang compilation

WANG Xuerui posted 9 patches 2 years, 7 months ago
There is a newer version of this series
[PATCH 8/9] Makefile: Add loongarch target flag for Clang compilation
Posted by WANG Xuerui 2 years, 7 months ago
From: WANG Xuerui <git@xen0n.name>

The LoongArch kernel is 64-bit and built with the soft-float ABI,
hence the loongarch64-linux-gnusf target. (The "libc" part doesn't
matter.)

Signed-off-by: WANG Xuerui <git@xen0n.name>
---
 scripts/Makefile.clang | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 058a4c0f864e..6c23c6af797f 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -4,6 +4,7 @@
 CLANG_TARGET_FLAGS_arm		:= arm-linux-gnueabi
 CLANG_TARGET_FLAGS_arm64	:= aarch64-linux-gnu
 CLANG_TARGET_FLAGS_hexagon	:= hexagon-linux-musl
+CLANG_TARGET_FLAGS_loongarch	:= loongarch64-linux-gnusf
 CLANG_TARGET_FLAGS_m68k		:= m68k-linux-gnu
 CLANG_TARGET_FLAGS_mips		:= mipsel-linux-gnu
 CLANG_TARGET_FLAGS_powerpc	:= powerpc64le-linux-gnu
-- 
2.40.0
Re: [PATCH 8/9] Makefile: Add loongarch target flag for Clang compilation
Posted by Nick Desaulniers 2 years, 7 months ago
On Fri, Jun 23, 2023 at 6:44 AM WANG Xuerui <kernel@xen0n.name> wrote:
>
> From: WANG Xuerui <git@xen0n.name>
>
> The LoongArch kernel is 64-bit and built with the soft-float ABI,
> hence the loongarch64-linux-gnusf target. (The "libc" part doesn't
> matter.)

Technically, IIRC llvm may make different decisions on libcall
optimizations based on the libc part of the target triple.  For
instance, is bcmp defined in that libc or not?  That's why we specify
-gnu or -musl (I forgot we did that for hexagon) explicitly rather
than leave that part of the triple blank.  Minutia that doesn't need
to be in this commit message, but now it's explicitly documented on
LKML and linkable-to.

>
> Signed-off-by: WANG Xuerui <git@xen0n.name>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  scripts/Makefile.clang | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
> index 058a4c0f864e..6c23c6af797f 100644
> --- a/scripts/Makefile.clang
> +++ b/scripts/Makefile.clang
> @@ -4,6 +4,7 @@
>  CLANG_TARGET_FLAGS_arm         := arm-linux-gnueabi
>  CLANG_TARGET_FLAGS_arm64       := aarch64-linux-gnu
>  CLANG_TARGET_FLAGS_hexagon     := hexagon-linux-musl
> +CLANG_TARGET_FLAGS_loongarch   := loongarch64-linux-gnusf
>  CLANG_TARGET_FLAGS_m68k                := m68k-linux-gnu
>  CLANG_TARGET_FLAGS_mips                := mipsel-linux-gnu
>  CLANG_TARGET_FLAGS_powerpc     := powerpc64le-linux-gnu
> --
> 2.40.0
>
>


-- 
Thanks,
~Nick Desaulniers
Re: [PATCH 8/9] Makefile: Add loongarch target flag for Clang compilation
Posted by Huacai Chen 2 years, 7 months ago
Hi, Xuerui,

This is the enablement patch, I think moving it to the last is better.

Huacai

On Fri, Jun 23, 2023 at 9:44 PM WANG Xuerui <kernel@xen0n.name> wrote:
>
> From: WANG Xuerui <git@xen0n.name>
>
> The LoongArch kernel is 64-bit and built with the soft-float ABI,
> hence the loongarch64-linux-gnusf target. (The "libc" part doesn't
> matter.)
>
> Signed-off-by: WANG Xuerui <git@xen0n.name>
> ---
>  scripts/Makefile.clang | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
> index 058a4c0f864e..6c23c6af797f 100644
> --- a/scripts/Makefile.clang
> +++ b/scripts/Makefile.clang
> @@ -4,6 +4,7 @@
>  CLANG_TARGET_FLAGS_arm         := arm-linux-gnueabi
>  CLANG_TARGET_FLAGS_arm64       := aarch64-linux-gnu
>  CLANG_TARGET_FLAGS_hexagon     := hexagon-linux-musl
> +CLANG_TARGET_FLAGS_loongarch   := loongarch64-linux-gnusf
>  CLANG_TARGET_FLAGS_m68k                := m68k-linux-gnu
>  CLANG_TARGET_FLAGS_mips                := mipsel-linux-gnu
>  CLANG_TARGET_FLAGS_powerpc     := powerpc64le-linux-gnu
> --
> 2.40.0
>
>