On Tue, Nov 1, 2016 at 10:48 AM, Ben Gamari <
bga...@gmail.com> wrote:
> I actually looked at this last weekend and have some LLVM [1] and GHC [2]
> patches which I'm waiting to test but I suspect a long debugging session
> will ensue when this happens. Unfortunately after spending an hour on the
> patches themselves I spent the rest of the weekend going down a rabbit-hole
> trying to bring up a riscv toolchain in Nix. This lead to [3] which sadly
> doesn't quite work yet due to toolchain incompatibilities (the kernel tree I
> found still seems to refer to the stime CSR whereas it has already been
> removed from my toolchain). This should all get much easier when the
> binutils and gcc ports are upstreamed.
We discussed this a bit on IRC but the binutils have moved past 1.9.0;
if you want to use a current (1.9.0) kernel you'll need a binutils
from a month or two ago; the sifive/freedom-u-sdk repo has submodules
for linux and binutils (via gnu-toolchain) which I know work together.
>> > The question is if LLVM is enough ready. GHC is quite a beast and
>> > although it supports cross-compilation it is always better to use
>> > native-compilation to be able to run testsuite. Hence question of how
>> > emulators are fast or how the fastest hardware available is fast...
>>
>> Well, LLVM doesn't need to be ready at the moment since first step may
>> be to get GHC unregisterised build working.
>
>
> I was able to prepare an unregisterised stage1 cross-compiler inside of
> sbate's Docker image without much trouble on Friday. The "hello world"
> executable that it produced ran successfully on the emulator.
If you want to test "native compilation" scenarios without fussing
with kernels, (and the current system-level emulation is missing
enough features that it's painful to use even when it is working),
qemu-user works very well. I have a docker image
sorear/fedora-riscv-wip which produces an emulated user-level
environment, can install various tools from our local dnf repository,
can do a 3-stage gcc bootstrap in 8 hours on a laptop.
(It breaks from time to time due to incompatible changes in the dnf
repository. Let me know if that happens.)
-s