Open EnkiSun86 opened 3 months ago
The remaining puzzle is how to bootstrap build this libc32 myself.
I fixed the ld.lld: warning: cannot find entry symbol _start; not setting start address
by linking the crt1.o in libc32 manually. However, the qemu-riscv32 still can not run the a.out since there are some Vortex-specific instructions in the a.out like vx_spilt
. More effort is needed to modify the qemu to support the evaluation of Vortex
I'm trying to bootstrap and compile the toolchains for Vortex. I followed the README.vortex in the pocl source file pulled from https://github.com/vortexgpgpu/pocl/tree/vortex .
And I built the source as follows:
Then I encountered a problem when test my new RISC-V LLVM as the README.vortex says. The error log showed as follows:
As the error reported, I built compiler-rt in llvm standalone to get the libclang_rt.builtins-riscv32.a and rebuilt hello.c :
It returned with new errors:
So I checked the prebuilt toolchains provided by the author of Vortex, and found a file folder named libc32 :
It seems to be a musl libc built standalone. But there is no document showing how to build it. So my first problem is how to bootstrap build this libc32 myself.
Since I do not know how to build this libc32, I use the prebuilt one instead and build hello.c as follows:
However, it still returns with the warning:
So although it generated an a.out, the test with qemu returned a segmentation fault:
Besides I skipped this test and went through the README.vortex to build pocl runtime. Since it needs a library named libvortex.so, I build vortex at first to get it. But build vortex with my self-build riscv32-gnu-toolchain returned with error:
This problem due to the newlib in riscv32-gnu-toolchain changed HAVE_INITFINI_ARRAY to _HAVE_INITFINI_ARRAY according to this commit:
This led to the build of vx_syscalls.c lack of entry of libc_init_array and libc_fini_array. I fixed this by this change: