[riscv][toolchain] fix clang test of -misa switch which is not present

The test inside riscv/rules.mk was assuming gcc and that the CC variable
isn't passed in from the user. This is not a very clean solution and
acts like a bandaid over the problem. Added some todos for a potential
solution.
This commit is contained in:
Travis Geiselbrecht
2025-10-05 13:54:11 -07:00
parent 48d331f144
commit e0b5008641
3 changed files with 10 additions and 0 deletions

View File

@@ -183,7 +183,12 @@ endif
# test to see if -misa-spec=2.2 is a valid switch.
# misa-spec is added to make sure the compiler picks up the zicsr extension by default.
# If CC is being overridden by the user, use that instead of the toolchain gcc.
ifdef CC
MISA_SPEC := $(shell $(CC) $(ARCH_COMPILEFLAGS) -misa-spec=2.2 -E - < /dev/null > /dev/null 2>1 && echo supported)
else
MISA_SPEC := $(shell $(TOOLCHAIN_PREFIX)gcc $(ARCH_COMPILEFLAGS) -misa-spec=2.2 -E - < /dev/null > /dev/null 2>1 && echo supported)
endif
$(info MISA_SPEC = $(MISA_SPEC))
ifeq ($(MISA_SPEC),supported)
ARCH_COMPILEFLAGS += -misa-spec=2.2