svn commit: r352034 - head/sys/conf

Mitchell Horne mhorne at FreeBSD.org
Sun Sep 8 19:44:22 UTC 2019


Author: mhorne
Date: Sun Sep  8 19:44:21 2019
New Revision: 352034
URL: https://svnweb.freebsd.org/changeset/base/352034

Log:
  RISC-V: fix kernel CFLAGS with clang
  
  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

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==============================================================================
--- head/sys/conf/kern.mk	Sun Sep  8 19:40:52 2019	(r352033)
+++ head/sys/conf/kern.mk	Sun Sep  8 19:44:21 2019	(r352034)
@@ -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
 


More information about the svn-src-head mailing list