Re: [PATCH 4/5] MIPS: Detect toolchain support of o32 ABI with 64 bit CPU

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

 




> 2023年4月7日 23:19,Nick Desaulniers <ndesaulniers@xxxxxxxxxx> 写道:
> 
> On Fri, Apr 7, 2023 at 3:27 AM Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> wrote:
>> 
>> LLVM is not happy with using o32 ABI on 64 bit CPU, thus build 32 bit
>> kernel is unsupported.
>> 
>> Detect this in Kconfig to prevent user select 32 bit kernel with
>> unsupported toolchain.
>> 
>> Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
> 
> I suspect this may fix:
> Link: https://github.com/ClangBuiltLinux/linux/issues/884
> 
>> ---
>> arch/mips/Kconfig | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index d896af492da6..5e399a5ac3b3 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -2016,6 +2016,7 @@ choice
>> config 32BIT
>>        bool "32-bit kernel"
>>        depends on CPU_SUPPORTS_32BIT_KERNEL && SYS_SUPPORTS_32BIT_KERNEL
>> +       depends on CC_HAS_O32_ABI
> 
> Does this disable 32b mips builds with clang?

It disable 32bit kernel build for 64bit CPU with clang.

i.e.: 32bit kernel for R4000, 32bit kernel for MIPS64R2 is disabled, but you can still build 32 bit
kernel for mips32r2.

> 
>>        select TRAD_SIGNALS
>>        help
>>          Select this option if you want to build a 32-bit kernel.
>> @@ -3136,7 +3137,7 @@ config COMPAT
>> 
>> config MIPS32_O32
>>        bool "Kernel support for o32 binaries"
>> -       depends on 64BIT
>> +       depends on 64BIT && CC_HAS_O32_ABI
>>        select ARCH_WANT_OLD_COMPAT_IPC
>>        select COMPAT
>>        select MIPS32_COMPAT
>> @@ -3184,6 +3185,10 @@ config CC_HAS_DADDI_WORKAROUNDS
>> config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH
>>        def_bool y if CC_IS_CLANG
>> 
>> +config CC_HAS_O32_ABI
>> +       def_bool y
>> +       depends on !CPU_SUPPORTS_64BIT_KERNEL || $(cc-option,-march=mips3 -mabi=32)
> 
> Should this be
> def_bool $(cc-option,-march=mips3 -mabi=32)
> depends on !CPU_SUPPORTS_64BIT_KERNEL

Hmm, the logic is to enable CC_HAS_O32_ABI if CPU is 32bit only (!CPU_SUPPORTS_64BIT_KERNEL)
or toolchain supports 64bit CPU with o32 ABI combination.

Thanks
Jiaxun

> 
> ?
> 
>> +
>> config AS_HAS_MSA
>>        def_bool $(cc-option,-Wa$(comma)-mmsa)
>> 
>> --
>> 2.39.2 (Apple Git-143)
>> 
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers






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

  Powered by Linux