Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Feb 2020 13:23:28 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358247 - in head/sys: conf riscv/include
Message-ID:  <202002221323.01MDNSX9063377@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Sat Feb 22 13:23:27 2020
New Revision: 358247
URL: https://svnweb.freebsd.org/changeset/base/358247

Log:
  riscv: Set MACHINE_ARCH correctly
  
  MACHINE_ARCH sets the hw.machine_arch sysctl in the kernel. In userspace
  it sets MACHINE_ARCH in bmake, which bsd.cpu.mk uses to configure the
  target ABI for ports.
  
  For riscv64sf builds (i.e. soft-float) that needs to be riscv64sf, but
  the sysctl didn't reflect that. It is static.
  
  Set the define from the riscv makefile so that we correctly reflect our
  actual build (i.e. riscv64 or riscv64sf), depending on what TARGET_ARCH
  we were built with.
  
  That still doesn't satisfy userspace builds (e.g. bmake), so check if
  we're building with a software-floating point toolchain there. That
  check doesn't work in the kernel, because it never uses floating point.
  
  Reviewed by:	philip (previous version), mhorne
  Sponsored by:	Axiado
  Differential Revision:	https://reviews.freebsd.org/D23741

Modified:
  head/sys/conf/Makefile.riscv
  head/sys/riscv/include/param.h

Modified: head/sys/conf/Makefile.riscv
==============================================================================
--- head/sys/conf/Makefile.riscv	Sat Feb 22 12:10:41 2020	(r358246)
+++ head/sys/conf/Makefile.riscv	Sat Feb 22 13:23:27 2020	(r358247)
@@ -46,6 +46,8 @@ SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T $
 CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
 .endif
 
+CFLAGS += -DMACHINE_ARCH=\"${TARGET_ARCH}\"
+
 # hack because genassym.c includes sys/bus.h which includes these.
 genassym.o: bus_if.h device_if.h
 

Modified: head/sys/riscv/include/param.h
==============================================================================
--- head/sys/riscv/include/param.h	Sat Feb 22 12:10:41 2020	(r358246)
+++ head/sys/riscv/include/param.h	Sat Feb 22 13:23:27 2020	(r358247)
@@ -46,7 +46,11 @@
 #define	MACHINE		"riscv"
 #endif
 #ifndef MACHINE_ARCH
+#ifdef __riscv_float_abi_soft
+#define	MACHINE_ARCH	"riscv64sf"
+#else
 #define	MACHINE_ARCH	"riscv64"
+#endif
 #endif
 
 #ifdef SMP



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