kendryte / k230_sdk

Kendryte K230 SDK
BSD 2-Clause "Simplified" License
170 stars 38 forks source link

src/common/opensbi/Makefile: fix build with binutils 2.38 #57

Closed xypron closed 7 months ago

xypron commented 7 months ago

From version 2.38, binutils default to ISA spec version 20191213. This means that the csr read/write (csrr/csrw) instructions and fence.i instruction has separated from the I extension, become two standalone extensions: Zicsr and Zifencei. As the kernel uses those instruction, this causes the following build failure:

CC lib/sbi/sbi_tlb.o <>/lib/sbi/sbi_tlb.c: Assembler messages: <>/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i' make: *** [src/common/opensbi/Makefile:431: <>/build/lib/sbi/sbi_tlb.o] Error 1

The fix is to specify those extensions explicitly in -march. However as older binutils version do not support this, we first need to detect that.

Reviewed-by: Bin Meng bmeng.cn@gmail.com Tested-by: Alexandre Ghiti alexandre.ghiti@canonical.com Reviewed-by: Anup Patel anup@brainfault.org

wuwentao commented 7 months ago

Thank you very much for your PR and your contribution to the K230 open source project, we have merged your PR now.