Skip to content

Commit 9dce500

Browse files
committed
Compilation is working again
Include dependency on riscv toolchain Include small llvm patch
1 parent de242ac commit 9dce500

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

build.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ set -euo pipefail
44

55
source config.sh
66

7+
# Rust requires a custom target file to exist for our custom target as part of the bootstrap build,
8+
# but it doesn't actually look at the contents.
9+
touch /tmp/riscv32em-athena-zkvm-elf.json
10+
711
# Will create component archives (dists) ./rust/build/dist
812
cd rust
9-
CARGO_TARGET_RISCV32EM_ATHENA_ZKVM_ELF_RUSTFLAGS="-Cpasses=loweratomic" ./x build --stage 2
13+
#RUSTFLAGS="-C link-arg=-L$HOME/compiler_rt_build_riscv32em-athena-zkvm-elf/lib/baremetal" \
14+
#LIBRARY_PATH="$HOME/compiler_rt_build_riscv32em-athena-zkvm-elf/lib/baremetal" \
15+
RUST_TARGET_PATH="/tmp" \
16+
CARGO_TARGET_RISCV32EM_ATHENA_ZKVM_ELF_RUSTFLAGS="-Cpasses=loweratomic" \
17+
CFLAGS_riscv32em_athena_zkvm_elf="-ffunction-sections -fdata-sections -fPIC -march=rv32em -mabi=ilp32e" \
18+
./x build --stage 2

patch.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ set -euo pipefail
55
cd rust
66
patch -p1 < ../patches/rust.patch
77
cp ../patches/config.toml ./
8+
9+
cd src/llvm-project
10+
patch -p1 < ../../../patches/llvm.patch

patches/config.ci.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ tools = ["cargo", "cargo-clippy", "clippy", "rustfmt"]
77
configure-args = []
88
cargo-native-static = true
99

10+
[target.riscv32em-athena-zkvm-elf]
11+
cc = "riscv32-unknown-elf-gcc"
12+
cxx = "riscv32-unknown-elf-g++"
13+
1014
[rust]
1115
lld = true
1216
llvm-tools = true

patches/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ extended = true
66
tools = ["cargo", "cargo-clippy", "clippy", "rustfmt"]
77
configure-args = []
88

9+
[target.riscv32em-athena-zkvm-elf]
10+
cc = "riscv32-unknown-elf-gcc"
11+
cxx = "riscv32-unknown-elf-g++"
12+
913
[rust]
1014
lld = true
1115
llvm-tools = true

patches/llvm.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
2+
index 28ded8766..b51ebe8ea 100644
3+
--- a/compiler-rt/lib/builtins/CMakeLists.txt
4+
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
5+
@@ -849,9 +849,9 @@ else ()
6+
7+
# For RISCV32, we must force enable int128 for compiling long
8+
# double routines.
9+
- if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32")
10+
- list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
11+
- endif()
12+
+ #if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32")
13+
+ # list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
14+
+ #endif()
15+
16+
add_compiler_rt_runtime(clang_rt.builtins
17+
STATIC

0 commit comments

Comments
 (0)