Skip to content

Commit e8be530

Browse files
NonerKaopalmer-dabbelt
authored andcommitted
Cleanup ISA string setting
This patch cleanup the MARCH string passing to both compiler and assembler. Note that the CFLAGS should not contain "fd" before we have mechnisms like kernel_fpu_begin/end in other architectures. Signed-off-by: Alan Kao <alankao@andestech.com> Cc: Greentime Hu <greentime@andestech.com> Cc: Vincent Chen <vincentc@andestech.com> Cc: Zong Li <zong@andestech.com> Cc: Nick Hu <nickhu@andestech.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
1 parent 007f5c3 commit e8be530

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

arch/riscv/Makefile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,27 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
2828

2929
KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
3030

31-
KBUILD_MARCH = rv64im
3231
KBUILD_LDFLAGS += -melf64lriscv
3332
else
3433
BITS := 32
3534
UTS_MACHINE := riscv32
3635

3736
KBUILD_CFLAGS += -mabi=ilp32
3837
KBUILD_AFLAGS += -mabi=ilp32
39-
KBUILD_MARCH = rv32im
4038
KBUILD_LDFLAGS += -melf32lriscv
4139
endif
4240

4341
KBUILD_CFLAGS += -Wall
4442

45-
ifeq ($(CONFIG_RISCV_ISA_A),y)
46-
KBUILD_ARCH_A = a
47-
endif
48-
ifeq ($(CONFIG_RISCV_ISA_C),y)
49-
KBUILD_ARCH_C = c
50-
endif
51-
52-
KBUILD_AFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)fd$(KBUILD_ARCH_C)
43+
# ISA string setting
44+
riscv-march-$(CONFIG_ARCH_RV32I) := rv32im
45+
riscv-march-$(CONFIG_ARCH_RV64I) := rv64im
46+
riscv-march-$(CONFIG_RISCV_ISA_A) := $(riscv-march-y)a
47+
riscv-march-y := $(riscv-march-y)fd
48+
riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
49+
KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
50+
KBUILD_AFLAGS += -march=$(riscv-march-y)
5351

54-
KBUILD_CFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)$(KBUILD_ARCH_C)
5552
KBUILD_CFLAGS += -mno-save-restore
5653
KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
5754

0 commit comments

Comments
 (0)