riscv: fix riscv64 unrecognized opcode build error
authorMarek Szulc <m.szulc3@samsung.com>
Fri, 19 Aug 2022 10:29:48 +0000 (12:29 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 24 Jul 2023 23:24:47 +0000 (08:24 +0900)
Considering older gcc version, "imafd" has to be changed
to "g", in order for asm to handle "zicsr" and "zifencei"
extensions.

Support for the mentioned extensions has been added
in GCC 11.1, hence this commit may be removed
after GCC update.

The lack of this causes following errors:
Error: unrecognized opcode `csrr a5,0xc01'
Error: unrecognized opcode `csrr a2,0xc01'

Change-Id: I0768a7b1255c828c4fc319f74f2783bc7e1581bf
Signed-off-by: Marek Szulc <m.szulc3@samsung.com>
Signed-off-by: Ɓukasz Stelmach <l.stelmach@samsung.com>
arch/riscv/Makefile

index 3cb876f..4114bda 100644 (file)
@@ -55,6 +55,7 @@ endif
 riscv-march-$(CONFIG_ARCH_RV32I)       := rv32ima
 riscv-march-$(CONFIG_ARCH_RV64I)       := rv64ima
 riscv-march-$(CONFIG_FPU)              := $(riscv-march-y)fd
+riscv-march-y                          := $(subst imafd,g,$(riscv-march-y))
 riscv-march-$(CONFIG_RISCV_ISA_C)      := $(riscv-march-y)c
 
 ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC