I have installed riscv-gnu-toolchain with the following settings, which works as expected:
./configure --prefix=/opt/riscv --enable-multilib --with-arch=rv32i --with-abi=ilp32
Now I am trying to build a version of spike that is capable of running executables compiled with this toolchain.
riscv-fesvr doesn't seem to have any ISA-specific settings. I compiled it with
../configure --prefix=/opt/riscv
riscv-isa-sim offers --with-isa, so I set that:
../configure --prefix=/opt/riscv --with-isa=RV32I
This builds fine, aside from some problems with missing include paths to fesvr that I had to fix manually in the makefile.riscv-pk I built with
../configure --prefix=/opt/riscv --host=riscv32-unknown-elf
, also no problems compiling.
Unfortunately, if I try to run the resulting spike executable, it segmentation faults. If I don't put in any arguments, I do get the "usage" print, but nothing else works.
$ echo -e '#include <stdio.h>\n int main(void) { printf("Hello world!\\n"); return 0; }' > hello.c
$ riscv32-unknown-elf-gcc -o hello hello.c
$ spike pk hello
$ Segmentation fault (core dumped)
$ spike pk
$ Segmentation fault (core dumped)
$ spike hello
$ Segmentation fault (core dumped)
$ spike --isa=RV32 pk hello
$ Segmentation fault (core dumped)
$ spike --isa=RV32 pk
$ Segmentation fault (core dumped)
$ spike --isa=RV32 hello
$ Segmentation fault (core dumped)
I'm not sure where to even start debugging this.