]> xenbits.xensource.com Git - freebsd.git/commitdiff
RISC-V: fix kernel CFLAGS with clang
authormhorne <mhorne@FreeBSD.org>
Sun, 8 Sep 2019 19:44:21 +0000 (19:44 +0000)
committermhorne <mhorne@FreeBSD.org>
Sun, 8 Sep 2019 19:44:21 +0000 (19:44 +0000)
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

sys/conf/kern.mk

index 5f97f20f34e86ee864ea2f6eb6065fccac6ac241..941bbe93c4630b95d964030cc62e87a0eb5f1dc3 100644 (file)
@@ -128,8 +128,18 @@ CFLAGS += -ffixed-x18
 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