Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Nov 2019 22:49:20 +0000
From:      Dennis Clarke <dclarke@blastwave.org>
To:        Ruslan Bukin <ruslan.bukin@cl.cam.ac.uk>, Bruce Hoult <brucehoult@sifive.com>
Cc:        RISC-V SW Dev <sw-dev@groups.riscv.org>, freebsd-riscv <freebsd-riscv@freebsd.org>
Subject:   Re: [sw-dev] GCC 8.x or 9.x for FreeBSD rv64imafdc ??
Message-ID:  <11917081-1ce7-182d-d6a8-3d88fd58b153@blastwave.org>
In-Reply-To: <20191127135941.GA20804@bsdpad.com>
References:  <5bca6745-1c09-3ba7-3b4a-2456ea2e1081@blastwave.org> <CAP8PnuRf0MnN=Lik7MjUsJ_tETNkx7zrBk0GgQ=WZSSqsBSdFw@mail.gmail.com> <20191127135941.GA20804@bsdpad.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/27/19 1:59 PM, Ruslan Bukin wrote:
> The gcc we use is not old, but 8.3.0:
> http://svn.freebsd.org/ports/head/devel/riscv64-gcc/Makefile
> 

Thank you for the reply here as I was hoping to hear from you.

> We have an official way of cross building native toolchain using base/gcc port and instructions: http://svn.freebsd.org/ports/head/base/README.
> This port is outdated a bit (GCC 6.4) and requires an update (won't work for riscv currently).
>

I have tried a few methods with varying degrees of success and more
recently with consistent success.

However the absence of a native compiler may as well reduce the whole
idea to nothing but ashes. However I may be wrong as I am told that
clang is now being built in the buildworld process. I can tell you that
I have tried the RISC-V projects gnu-toolchain gcc and the results are
promising :

vesta#
vesta# uname -apKU
FreeBSD vesta 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 GENERIC  amd64 
amd64 1201000 1201000
vesta# /opt/rv64/tools/bin/riscv64-unknown-elf-gcc --version
riscv64-unknown-elf-gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

vesta#

So that is 9.2.0 from https://github.com/riscv/riscv-gnu-toolchain and
we can buildworld but not build the kernel.  I find that curious.

However I do see in my $DESTDIR a clang :

vesta# ls -lap $DESTDIR/usr/bin/cl*
-r-xr-xr-x  3 root  wheel  63383544 Nov 26 08:00 
/opt/rv64/rootfs/usr/bin/clang
-r-xr-xr-x  3 root  wheel  63383544 Nov 26 08:00 
/opt/rv64/rootfs/usr/bin/clang-cpp
-r-xr-xr-x  1 root  wheel    865912 Nov 26 08:00 
/opt/rv64/rootfs/usr/bin/clang-tblgen
-r-xr-xr-x  3 root  wheel  63383544 Nov 26 08:00 
/opt/rv64/rootfs/usr/bin/clang++
-r-xr-xr-x  1 root  wheel      1750 Nov 26 08:00 
/opt/rv64/rootfs/usr/bin/clear
vesta#
vesta# file /opt/rv64/rootfs/usr/bin/clang
/opt/rv64/rootfs/usr/bin/clang: ELF 64-bit LSB executable, UCB RISC-V, 
version 1 (SYSV), dynamically linked, interpreter /libexec/ld-elf.so.1, 
FreeBSD-style, for FreeBSD 13.0 (1300061), stripped
vesta#

vesta#
vesta# readelf -delV /opt/rv64/rootfs/usr/bin/clang
ELF Header:
   Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
   Class:                             ELF64
   Data:                              2's complement, little endian
   Version:                           1 (current)
   OS/ABI:                            UNIX - System V
   ABI Version:                       0
   Type:                              EXEC (Executable file)
   Machine:                           RISC-V
   Version:                           0x1
   Entry point address:               0x6d48a
   Start of program headers:          64 (bytes into file)
   Start of section headers:          63381560 (bytes into file)
   Flags:                             0x5, RVC, double-float ABI
   Size of this header:               64 (bytes)
   Size of program headers:           56 (bytes)
   Number of program headers:         8
   Size of section headers:           64 (bytes)
   Number of section headers:         31
   Section header string table index: 30

.
.
.

etc etc.

However for the kernel I must use the cross tools from ports :

vesta#
vesta# /usr/local/bin/riscv64-unknown-freebsd12.0-gcc --version
riscv64-unknown-freebsd12.0-gcc (FreeBSD Ports Collection for riscv64) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

vesta#


However the only gcc that I have in the native RISC-V FreeBSD world
is the one you cooked up in your homedir a while ago.

I will try for a bootstrap of 9.2.0 natively today or tomorrow and
with some effort maybe report back a result of some value.

> On Tue, Nov 26, 2019 at 02:18:35AM -0800, Bruce Hoult wrote:
>> I think there are very few people who have experience with the
>> intersection of FreeBSD and RISC-V.

So very true and yet I have had good results on RISC-V with FreeBSD
and even ZFS ZPools however what the world desperately needs is a
machine with real DDR4 memory slots and some SAS/SATA ports or at
the very least a few PCI slots for storage controllers. We just are
not there and the money needed for a 9nm solution is $300M or so.

I don't think a FPGA is the way to go here.


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11917081-1ce7-182d-d6a8-3d88fd58b153>