[PATCH v2] MIPS: Make MIPS32_O32 depends on !CC_IS_CLANG

4 views
Skip to first unread message

Tiezhu Yang

unread,
Mar 4, 2021, 1:19:50 AM3/4/21
to Thomas Bogendoerfer, Nathan Chancellor, Nick Desaulniers, linux...@vger.kernel.org, linux-...@vger.kernel.org, clang-bu...@googlegroups.com, Xuefeng Li
When build kernel with Clang [1]:

$ make CC=clang loongson3_defconfig
$ make CC=clang

there exists the following error:

Checking missing-syscalls for O32
CALL scripts/checksyscalls.sh
error: ABI 'o32' is not supported on CPU 'mips64r2'
make[1]: *** [Kbuild:48: missing-syscalls] Error 1
make: *** [arch/mips/Makefile:419: archprepare] Error 2

This is a known bug [2] with Clang, as Simon Atanasyan said,
"There is no plan on support O32 for MIPS64 due to lack of
resources".

It is not a good idea to remove CONFIG_MIPS32_O32=y directly
in defconfig due to GCC works well, as Nathan said, the config
should not even be selectable when build kernel with Clang, so
just make MIPS32_O32 depends on !CC_IS_CLANG.

[1] https://www.kernel.org/doc/html/latest/kbuild/llvm.html
[2] https://bugs.llvm.org/show_bug.cgi?id=38063

Signed-off-by: Tiezhu Yang <yangt...@loongson.cn>
---
arch/mips/Kconfig | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3a38d27..f6ba59f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3318,6 +3318,8 @@ config SYSVIPC_COMPAT
config MIPS32_O32
bool "Kernel support for o32 binaries"
depends on 64BIT
+ # https://bugs.llvm.org/show_bug.cgi?id=38063
+ depends on !CC_IS_CLANG
select ARCH_WANT_OLD_COMPAT_IPC
select COMPAT
select MIPS32_COMPAT
--
2.1.0

Nathan Chancellor

unread,
Mar 4, 2021, 1:45:58 AM3/4/21
to Tiezhu Yang, Thomas Bogendoerfer, Nick Desaulniers, linux...@vger.kernel.org, linux-...@vger.kernel.org, clang-bu...@googlegroups.com, Xuefeng Li
On Thu, Mar 04, 2021 at 02:19:38PM +0800, Tiezhu Yang wrote:
> When build kernel with Clang [1]:

Sorry I did not catch this in the first revision but I think this would
sound better as:

When building with Clang [1]:

I think the kernel part is obvious :) couple more comments about the
commit message inline.

>
> $ make CC=clang loongson3_defconfig
> $ make CC=clang
>
> there exists the following error:
>
> Checking missing-syscalls for O32
> CALL scripts/checksyscalls.sh
> error: ABI 'o32' is not supported on CPU 'mips64r2'
> make[1]: *** [Kbuild:48: missing-syscalls] Error 1
> make: *** [arch/mips/Makefile:419: archprepare] Error 2
>
> This is a known bug [2] with Clang, as Simon Atanasyan said,
> "There is no plan on support O32 for MIPS64 due to lack of
> resources".
>
> It is not a good idea to remove CONFIG_MIPS32_O32=y directly
> in defconfig due to GCC works well, as Nathan said, the config

in defconfig because GCC works, as...

> should not even be selectable when build kernel with Clang, so

building with Clang

> just make MIPS32_O32 depends on !CC_IS_CLANG.
>
> [1] https://www.kernel.org/doc/html/latest/kbuild/llvm.html
> [2] https://bugs.llvm.org/show_bug.cgi?id=38063
>
> Signed-off-by: Tiezhu Yang <yangt...@loongson.cn>

I don't know if Nick will have any comments but for me:

Acked-by: Nathan Chancellor <nat...@kernel.org>

I have added this patch and the LLVM bug to our issue tracker:

https://github.com/ClangBuiltLinux/linux/issues/884

Tiezhu Yang

unread,
Mar 4, 2021, 3:04:14 AM3/4/21
to Thomas Bogendoerfer, Nathan Chancellor, Nick Desaulniers, linux...@vger.kernel.org, linux-...@vger.kernel.org, clang-bu...@googlegroups.com, Xuefeng Li
When building with Clang [1]:

$ make CC=clang loongson3_defconfig
$ make CC=clang

there exists the following error:

Checking missing-syscalls for O32
CALL scripts/checksyscalls.sh
error: ABI 'o32' is not supported on CPU 'mips64r2'
make[1]: *** [Kbuild:48: missing-syscalls] Error 1
make: *** [arch/mips/Makefile:419: archprepare] Error 2

This is a known bug [2] with Clang, as Simon Atanasyan said,
"There is no plan on support O32 for MIPS64 due to lack of
resources".

It is not a good idea to remove CONFIG_MIPS32_O32=y directly
in defconfig because GCC works, as Nathan said, the config
should not even be selectable when building with Clang, so
just make MIPS32_O32 depends on !CC_IS_CLANG.

[1] https://www.kernel.org/doc/html/latest/kbuild/llvm.html
[2] https://bugs.llvm.org/show_bug.cgi?id=38063

Signed-off-by: Tiezhu Yang <yangt...@loongson.cn>
Acked-by: Nathan Chancellor <nat...@kernel.org>
---

v3: Update the commit message suggested by Nathan, thank you!

Nick Desaulniers

unread,
Mar 4, 2021, 12:37:51 PM3/4/21
to Tiezhu Yang, Thomas Bogendoerfer, Nathan Chancellor, linux...@vger.kernel.org, LKML, clang-built-linux, Xuefeng Li
On Thu, Mar 4, 2021 at 12:04 AM Tiezhu Yang <yangt...@loongson.cn> wrote:
>
> When building with Clang [1]:
>
> $ make CC=clang loongson3_defconfig
> $ make CC=clang
>
> there exists the following error:
>
> Checking missing-syscalls for O32
> CALL scripts/checksyscalls.sh
> error: ABI 'o32' is not supported on CPU 'mips64r2'
> make[1]: *** [Kbuild:48: missing-syscalls] Error 1
> make: *** [arch/mips/Makefile:419: archprepare] Error 2
>
> This is a known bug [2] with Clang, as Simon Atanasyan said,
> "There is no plan on support O32 for MIPS64 due to lack of
> resources".

It's my hope we will fix the resourcing issue. I'm working on that;
it's a non-technical challenge though.
Acked-by: Nick Desaulniers <ndesau...@google.com>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/1614845040-12995-1-git-send-email-yangtiezhu%40loongson.cn.



--
Thanks,
~Nick Desaulniers
Reply all
Reply to author
Forward
0 new messages