Skip to content

Commit c1c0e62

Browse files
authored
contracts: Update to Polkavm 0.5 (#2945)
This will allow us to change to the target supporting atomics and makes the linker file no longer necessary.
1 parent 8b28031 commit c1c0e62

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

Cargo.lock

Lines changed: 25 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/frame/contracts/fixtures/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ parity-wasm = "0.45.0"
2121
tempfile = "3.8.1"
2222
toml = "0.8.2"
2323
twox-hash = "1.6.3"
24-
polkavm-linker = { version = "0.4.0", optional = true }
24+
polkavm-linker = { version = "0.5.0", optional = true }
2525
anyhow = "1.0.0"
2626

2727
[features]

substrate/frame/contracts/fixtures/build.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,12 @@ fn post_process_wasm(input_path: &Path, output_path: &Path) -> Result<()> {
234234
/// Build contracts for RISC-V.
235235
#[cfg(feature = "riscv")]
236236
fn invoke_riscv_build(current_dir: &Path) -> Result<()> {
237-
let encoded_rustflags =
238-
["-Crelocation-model=pie", "-Clink-arg=--emit-relocs", "-Clink-arg=-Tmemory.ld"]
239-
.join("\x1f");
240-
241-
fs::write(current_dir.join("memory.ld"), include_bytes!("./build/riscv_memory_layout.ld"))?;
237+
let encoded_rustflags = [
238+
"-Crelocation-model=pie",
239+
"-Clink-arg=--emit-relocs",
240+
"-Clink-arg=--export-dynamic-symbol=__polkavm_symbol_export_hack__*",
241+
]
242+
.join("\x1f");
242243

243244
let build_res = Command::new(env::var("CARGO")?)
244245
.current_dir(current_dir)
@@ -247,7 +248,7 @@ fn invoke_riscv_build(current_dir: &Path) -> Result<()> {
247248
.env("CARGO_ENCODED_RUSTFLAGS", encoded_rustflags)
248249
.env("RUSTUP_TOOLCHAIN", "rve-nightly")
249250
.env("RUSTUP_HOME", env::var("RUSTUP_HOME").unwrap_or_default())
250-
.args(["build", "--release", "--target=riscv32em-unknown-none-elf"])
251+
.args(["build", "--release", "--target=riscv32ema-unknown-none-elf"])
251252
.output()
252253
.expect("failed to execute process");
253254

@@ -288,7 +289,7 @@ fn write_output(build_dir: &Path, out_dir: &Path, entries: Vec<Entry>) -> Result
288289

289290
#[cfg(feature = "riscv")]
290291
post_process_riscv(
291-
&build_dir.join("target/riscv32em-unknown-none-elf/release").join(entry.name()),
292+
&build_dir.join("target/riscv32ema-unknown-none-elf/release").join(entry.name()),
292293
&out_dir.join(entry.out_riscv_filename()),
293294
)?;
294295

substrate/frame/contracts/fixtures/build/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010
[dependencies]
1111
uapi = { package = 'pallet-contracts-uapi', path = "", default-features = false }
1212
common = { package = 'pallet-contracts-fixtures-common', path = "" }
13-
polkavm-derive = '0.4.0'
13+
polkavm-derive = '0.5.0'
1414

1515
[profile.release]
1616
opt-level = 3

substrate/frame/contracts/fixtures/build/riscv_memory_layout.ld

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)