Use the -march and -mabi flags for both gcc and clang as they are
compatible. Specify the "medium" code model separately as it goes by the
name "medany" under gcc, although they are equivalent.
Reviewed by: markj
Approved by: markj (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21436
INLINE_LIMIT?= 8000
.endif
+#
+# For RISC-V we specify the soft-float ABI (lp64) to avoid the use of floating
+# point registers within the kernel. We also specify the "medium" code model,
+# which generates code suitable for a 2GiB addressing range located at any
+# offset, allowing modules to be located anywhere in the 64-bit address space.
+# Note that clang and GCC refer to this code model as "medium" and "medany"
+# respectively.
+#
.if ${MACHINE_CPUARCH} == "riscv"
-CFLAGS.gcc+= -mcmodel=medany -march=rv64imafdc -mabi=lp64
+CFLAGS+= -march=rv64imafdc -mabi=lp64
+CFLAGS.clang+= -mcmodel=medium
+CFLAGS.gcc+= -mcmodel=medany
INLINE_LIMIT?= 8000
.endif