diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc index cd665edfecbd..27a5879dd24a 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -123,8 +123,11 @@ SRCF+= udivti3 SRCF+= umoddi3 SRCF+= umodti3 -# 128-bit quad precision long double support, only used on arm64 -.if ${MACHINE_CPUARCH} == "aarch64" +# +# 128-bit quad precision long double support, +# only used on arm64 and riscv. +# +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" SRCF+= addtf3 SRCF+= comparetf2 SRCF+= divtf3 diff --git a/lib/msun/riscv/Makefile.inc b/lib/msun/riscv/Makefile.inc index 0ce69db5cdba..97d3302b96da 100644 --- a/lib/msun/riscv/Makefile.inc +++ b/lib/msun/riscv/Makefile.inc @@ -1,6 +1,3 @@ # $FreeBSD$ -# RISCVTODO: should be 113 -# compilation problems: gcc generates bltuz instruction, which is not exists - -LDBL_PREC = 53 +LDBL_PREC = 113 diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index d198c98665bf..6f09463ef49a 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -66,7 +66,7 @@ On all supported architectures, .It mips64hf Ta 8 Ta 8 .It powerpc Ta 4 Ta 8 .It powerpc64 Ta 8 Ta 8 -.It riscv Ta 8 Ta +.It riscv Ta 8 Ta 16 .It sparc64 Ta 8 Ta 16 .El .Ss Endianness and Char Signedness diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 5ccfe548cbc1..32776d6c75ab 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -156,7 +156,7 @@ _CPUCFLAGS = -march=${CPUTYPE} _CPUCFLAGS = -march=${CPUTYPE:S/^mips//} . endif . elif ${MACHINE_CPUARCH} == "riscv" -_CPUCFLAGS = -msoft-float # -march="RV64I" # RISCVTODO +_CPUCFLAGS = -mno-float -march="IMAFD" . elif ${MACHINE_ARCH} == "sparc64" . if ${CPUTYPE} == "v9" _CPUCFLAGS = -mcpu=v9 @@ -337,8 +337,8 @@ CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double .endif .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS += -msoft-float -ACFLAGS += -msoft-float +CFLAGS += -mno-float +ACFLAGS += -mno-float .endif # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk diff --git a/share/mk/bsd.stand.mk b/share/mk/bsd.stand.mk index 965171b9ff67..42e01d451319 100644 --- a/share/mk/bsd.stand.mk +++ b/share/mk/bsd.stand.mk @@ -5,7 +5,12 @@ # CFLAGS+= -ffreestanding -Wformat -CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float -D_STANDALONE +CFLAGS+= ${CFLAGS_NO_SIMD} -D_STANDALONE +.if ${MACHINE_CPUARCH} == "riscv" +CFLAGS+= -mno-float +.else +CFLAGS+= -msoft-float +.endif .if ${MACHINE_CPUARCH} == "i386" CFLAGS.gcc+= -mpreferred-stack-boundary=2 diff --git a/sys/modules/dtrace/dtrace/Makefile b/sys/modules/dtrace/dtrace/Makefile index 3c0812c5ccd7..543be8c20191 100644 --- a/sys/modules/dtrace/dtrace/Makefile +++ b/sys/modules/dtrace/dtrace/Makefile @@ -60,7 +60,7 @@ assym.o: assym.s .if ${MACHINE_CPUARCH} == "riscv" assym.o: assym.s - ${AS} -msoft-float -o assym.o assym.s + ${AS} -mfloat-abi=soft -o assym.o assym.s .endif .include diff --git a/sys/riscv/include/asm.h b/sys/riscv/include/asm.h index adcc23aa9501..5b517322732c 100644 --- a/sys/riscv/include/asm.h +++ b/sys/riscv/include/asm.h @@ -47,7 +47,7 @@ #define _C_LABEL(x) x #define ENTRY(sym) \ - .text; .globl sym; .type sym,@function; .align 2; sym: + .text; .globl sym; .type sym,@function; .align 4; sym: #define END(sym) .size sym, . - sym #define EENTRY(sym) \ diff --git a/sys/riscv/include/float.h b/sys/riscv/include/float.h index 0d6abe1281ac..0829f6f52aa9 100644 --- a/sys/riscv/include/float.h +++ b/sys/riscv/include/float.h @@ -76,22 +76,6 @@ __END_DECLS #define DBL_HAS_SUBNORM 1 #endif /* __ISO_C_VISIBLE >= 2011 */ -#define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON ((long double)DBL_EPSILON) -#define LDBL_DIG DBL_DIG -#define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN ((long double)DBL_MIN) -#define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX ((long double)DBL_MAX) -#define LDBL_MAX_10_EXP DBL_MAX_10_EXP -#if __ISO_C_VISIBLE >= 2011 -#define LDBL_TRUE_MIN ((long double)DBL_TRUE_MIN) -#define LDBL_DECIMAL_DIG DBL_DECIMAL_DIG -#define LDBL_HAS_SUBNORM DBL_HAS_SUBNORM -#endif /* __ISO_C_VISIBLE >= 2011 */ - -#if 0 /* RISCVTODO */ #define LDBL_MANT_DIG 113 #define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L #define LDBL_DIG 33 @@ -106,6 +90,5 @@ __END_DECLS #define LDBL_DECIMAL_DIG 36 #define LDBL_HAS_SUBNORM 1 #endif /* __ISO_C_VISIBLE >= 2011 */ -#endif #endif /* _MACHINE_FLOAT_H_ */