From c246117510a10c1b05f82be0ce5309c7d13eafeb Mon Sep 17 00:00:00 2001 From: Marek Szulc Date: Fri, 19 Aug 2022 12:29:48 +0200 Subject: [PATCH] riscv: fix riscv64 unrecognized opcode build error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Łukasz Stelmach --- arch/riscv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 0eb4568..c103be5 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -51,6 +51,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 KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y)) KBUILD_AFLAGS += -march=$(riscv-march-y) -- 2.7.4