From owner-svn-src-all@freebsd.org Sat Feb 22 13:23:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBA4C23D8BC; Sat, 22 Feb 2020 13:23:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48PptS4wyfz4SPT; Sat, 22 Feb 2020 13:23:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C08F24256; Sat, 22 Feb 2020 13:23:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01MDNSnf063379; Sat, 22 Feb 2020 13:23:28 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01MDNSX9063377; Sat, 22 Feb 2020 13:23:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202002221323.01MDNSX9063377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 22 Feb 2020 13:23:28 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head/sys: conf riscv/include X-SVN-Commit-Revision: 358247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Feb 2020 13:23:29 -0000 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