From 36a3e759ffd650d55c53732337b28429b116e448 Mon Sep 17 00:00:00 2001 From: Mark Goncharov Date: Tue, 2 May 2023 16:42:47 +0300 Subject: [PATCH] [GCC]: Fix fence.i bug There are many issues: 260, 285, 287 has to be solved This workaround helps to add neccessary zicsr and zifencei for cssr and fence.i accordingly. --- Makefile.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 05e3a4d4..cdb6007f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,16 +57,27 @@ endif # *** If --with-abi is given but --with-arch is not, then the ISA uses the # compiler's default. + +ifneq (@WITH_ARCH@,) + is_32bit := $(findstring 32,@WITH_ARCH@) +else +ifneq (@host_alias@,) + is_32bit := $(findstring 32,@host_alias@) +else + is_32bit := "" +endif +endif + ifneq (@WITH_ARCH@,) march := -march=@WITH_ARCH@ - is_32bit := $(findstring 32,$(march)) - ifeq (@WITH_ABI@,) - mabi := -mabi=$(if $(is_32bit),ilp32,lp64) - endif +else + march := -march=$(if $(is_32bit),rv32,rv64)im_zicsr_zifencei endif ifneq (@WITH_ABI@,) mabi := -mabi=@WITH_ABI@ +else + mabi := -mabi=$(if $(is_32bit),ilp32,lp64) endif # Installation directories