Refactoring core parts of toolchain_kelvin_v2
The following changes were made to upgrade dependencies and
refactor the build process.
* Upgrade RISC-V GNU Toolchian to git-branch `2025.08.29`
* Upgrade LLVM project to version `20.1.0`
* Simplify the build by removing the separate build step for `riscv-newlib`
and update submodules.
* Update toolchain url and sha256 in `WORKSPACE` file to support new toolchain
* Update c++ toolchain configuration to include paths for GCC 15.1.0
Change-Id: I52b5cc37d47c2d672bd6c2b0f2b280883b37ac42
diff --git a/WORKSPACE b/WORKSPACE
index 187ab52..eb26098 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -141,9 +141,9 @@
srcs = glob(["**"]),
)
""",
- sha256 = "1940ed35120ecf76eec74b85d95b06dedb93771d9974d1647eabdf5931002c41",
+ sha256 = "c9c85f8361e9d02d64474c51e3b3730ba09807cf4610d6d002c49a270458b49c",
urls = [
- "https://storage.googleapis.com/shodan-public-artifacts/toolchain_kelvin_tar_files/toolchain_kelvin_v2-2025-04-01.tar.gz",
+ "https://storage.googleapis.com/shodan-public-artifacts/toolchain_kelvin_tar_files/toolchain_kelvin_v2-2025-09-11.tar.gz",
],
strip_prefix = "toolchain_kelvin_v2",
)
diff --git a/toolchain/build_scripts/kelvin_v2_toolchain_build.sh b/toolchain/build_scripts/kelvin_v2_toolchain_build.sh
index 370c7e9..5cb2bdc 100644
--- a/toolchain/build_scripts/kelvin_v2_toolchain_build.sh
+++ b/toolchain/build_scripts/kelvin_v2_toolchain_build.sh
@@ -7,15 +7,11 @@
TOOLCHAIN_OUT_DIR="$(pwd)"/rv32_out
# Build gcc
-git clone --branch 2025.01.20 https://github.com/riscv-collab/riscv-gnu-toolchain.git
+git clone --branch 2025.08.29 https://github.com/riscv-collab/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain/ || exit
-git submodule update --init
-git submodule update gcc
-
+git submodule update --init --recursive
# Update gcc
cd gcc || exit
-git fetch
-git checkout origin/master
contrib/download_prerequisites
cd .. || exit
@@ -31,7 +27,7 @@
cd .. || exit
# Build LLVM + compiler-rt
-git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-19.1.7
+git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-20.1.0
cd llvm-project/ || exit
# Build LLVM
@@ -89,25 +85,6 @@
exit 1
fi
-# Build newlib
-git clone --depth=1 https://github.com/riscvarchive/riscv-newlib -b newlib-4.1.0
-cd riscv-newlib/ || exit
-./configure \
- --target=riscv32-unknown-elf \
- --prefix="${TOOLCHAIN_OUT_DIR}" \
- --enable-newlib-io-long-double \
- --enable-newlib-io-long-long \
- --enable-newlib-io-float \
- --enable-newlib-io-c99-formats \
- --enable-newlib-register-fini \
- CC_FOR_TARGET=riscv32-unknown-elf-gcc \
- CXX_FOR_TARGET=riscv32-unknown-elf-g++ \
- CFLAGS_FOR_TARGET="-march=rv32im_zve32x_zicsr -O2 -D_POSIX_MODE -mno-relax -Wno-error=implicit-function-declaration -Wno-error=int-conversion" \
- CXXFLAGS_FOR_TARGET="-march=rv32im_zve32x_zicsr -O2 -D_POSIX_MODE -mno-relax -Wno-error=implicit-function-declaration -Wno-error=int-conversion"
-make -j 32
-make install
-cd .. || exit
-
git clone --depth=1 https://github.com/ucb-bar/libgloss-htif
cd libgloss-htif || exit
git checkout 39234a16247ab1fa234821b251f1f1870c3de343
diff --git a/toolchain/cc_toolchain_config.bzl b/toolchain/cc_toolchain_config.bzl
index b86d290..b55194b 100644
--- a/toolchain/cc_toolchain_config.bzl
+++ b/toolchain/cc_toolchain_config.bzl
@@ -134,13 +134,13 @@
flags = [
"-nostdinc",
"-isystem",
- "external/toolchain_kelvin_v2/riscv32-unknown-elf/include/c++/15.0.1",
+ "external/toolchain_kelvin_v2/riscv32-unknown-elf/include/c++/15.1.0",
"-isystem",
- "external/toolchain_kelvin_v2/riscv32-unknown-elf/include/c++/15.0.1/backward",
+ "external/toolchain_kelvin_v2/riscv32-unknown-elf/include/c++/15.1.0/backward",
"-isystem",
- "external/toolchain_kelvin_v2/riscv32-unknown-elf/include/c++/15.0.1/riscv32-unknown-elf",
+ "external/toolchain_kelvin_v2/riscv32-unknown-elf/include/c++/15.1.0/riscv32-unknown-elf",
"-isystem",
- "external/toolchain_kelvin_v2/lib/gcc/riscv32-unknown-elf/15.0.1/include",
+ "external/toolchain_kelvin_v2/lib/gcc/riscv32-unknown-elf/15.1.0/include",
"-isystem",
"external/toolchain_kelvin_v2/riscv32-unknown-elf/include",
],