-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
The first component in coreclr port is the abstraction layer located at src/coreclr/pal. That enables us to port other components of coreclr such as src/coreclr/vm, src/coreclr/unwinder and ultimately src/coreclr/jit.
We have riscv64 cross-toolchain with prerequisites set up for building the runtime. Some initial strokes to port coreclr are checked into the main branch (cmake configurations, libunwind, a few definitions in pal.h etc.).
Here is a gist for cross compilation:
#!/bin/sh
# on Ubuntu amd64 - with curl, jq and docker installed
tag="$(curl -sSL "https://raw.githubusercontent.com/dotnet/versions/main/build-info/docker/image-info.dotnet-dotnet-buildtools-prereqs-docker-main.json" |\
jq -r '.repos[] | .images[] | .platforms [] | select(.dockerfile | contains("riscv64")).simpleTags[0]')"
URN="mcr.microsoft.com/dotnet-buildtools/prereqs:$tag"
cd runtime # current main branch of dotnet/runtime
# Only build coreclr PAL and its tests:
docker run --rm -e ROOTFS_DIR=/crossrootfs/riscv64 -v"$(pwd)":/runtime "$URN" \
/runtime/src/coreclr/build-runtime.sh -cross -a riscv64 -component paltests
# note: /crossrootfs/riscv64 has Debian sid bootstrap environment with llvm 14 and few other dependencies
# and the host has llvm 15 toolchain, which will be used by cmake for compilation with
# -sysroot=/crossrootfs/riscv64
#
# the relevant code to build this prerequisites docker image are:
# * https://github.com/dotnet/arcade/blob/2e7521a/eng/common/cross/build-rootfs.sh#L155
# * https://github.com/dotnet/arcade/blob/2e7521a/eng/common/cross/toolchain.cmake#L64
# * https://github.com/dotnet/dotnet-buildtools-prereqs-docker/tree/main/src/ubuntu/22.04/cross/riscv64The missing parts are architecture-specific assembly code under src/coreclr/pal/src/arch/riscv64, src/coreclr/pal/inc/unixasmmacrosriscv64.inc among other things. We added placeholder assembly files with #error TODO-RISCV64 which can be reviewed and deleted as part of the port.
Once PAL port is completed, we can copy artifacts/bin to riscv64 machine (or virtual machine) and run its tests to verify the state of port:
$ artifacts/bin/coreclr/Linux.riscv64.Debug/paltests/runpaltests.sh \
$(pwd)/artifacts/bin/coreclr/Linux.riscv64.Debug/paltests