Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Sep 2019 19:44:22 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352034 - head/sys/conf
Message-ID:  <201909081944.x88JiMFM004161@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909081944.x88JiMFM004161>