[PATCH v2] riscv: Handle zicsr/zifencei issue between gcc and binutils

Mingzheng Xing xingmingzheng at iscas.ac.cn
Mon Jul 31 03:16:16 PDT 2023


On 7/30/23 01:48, Conor Dooley wrote:
> On Sun, Jul 30, 2023 at 01:36:49AM +0800, Mingzheng Xing wrote:
>
>> I reproduced the error with gcc-12.2.0 and binutils-2.35. I tried a
>> different solution, which I think makes the logic easier. Showing
>> the new patch code:
> It is indeed simpler, neat.
>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 4c07b9189c86..a6fa1eed895c 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -569,25 +569,24 @@ config TOOLCHAIN_HAS_ZIHINTPAUSE
>>
>>   config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
>>          def_bool y
>> -       # https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
>> -       depends on AS_IS_GNU && AS_VERSION >= 23800
>> +       depends on AS_IS_GNU && AS_VERSION >= 23600
>>          help
>> -         Newer binutils versions default to ISA spec version 20191213 which
>> -         moves some instructions from the I extension to the Zicsr and Zifencei
>> -         extensions.
>> +         Binutils has supported zicsr and zifencei extensions since version 2.36,
>> +         try to adapt to the changes by using explicit zicsr and zifencei via
>> +         -march.
> This sentence no longer makes sense to me, the motivation for why we are
> doing this is lost. Please preserve the link & explanation about the
> 20191213 version of the spec, adding to it the commentary about how we
> can relax the check to 2.36, since that makes our lives easier.
>
> The rest of this looks fine to me, if you resubmit I'll look at it
> further on Monday.

I updated it in v3 [1]. Thanks for your review.

[1] https://lore.kernel.org/all/20230731095936.23397-1-xingmingzheng@iscas.ac.cn

> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv




More information about the linux-riscv mailing list