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.
This commit is contained in:
Alexander Theißen
2024-01-17 12:39:33 +01:00
committed by GitHub
parent 8b28031d16
commit c1c0e62d33
5 changed files with 35 additions and 18 deletions
Generated
+25 -5
View File
@@ -3294,7 +3294,7 @@ dependencies = [
"gimli 0.27.3",
"hashbrown 0.13.2",
"log",
"regalloc2",
"regalloc2 0.6.1",
"smallvec",
"target-lexicon",
]
@@ -13793,6 +13793,12 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fecd2caacfc4a7ee34243758dd7348859e6dec73f5e5df059890f5742ee46f0e"
[[package]]
name = "polkavm-common"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88b4e215c80fe876147f3d58158d5dfeae7dabdd6047e175af77095b78d0035c"
[[package]]
name = "polkavm-derive"
version = "0.4.0"
@@ -13809,7 +13815,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c99f4e7a9ff434ef9c885b874c99d824c3a5693bf5e3e8569bb1d2245a8c1b7f"
dependencies = [
"polkavm-common",
"polkavm-common 0.4.0",
"proc-macro2",
"quote",
"syn 2.0.48",
@@ -13817,15 +13823,16 @@ dependencies = [
[[package]]
name = "polkavm-linker"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "550738c1b49b9279fa19d8ebed81f551b911b869227a20a190f85f6db45d5d0e"
checksum = "a5a668bb33c7f0b5f4ca91adb1e1e71cf4930fef5e6909f46c2180d65cce37d0"
dependencies = [
"gimli 0.28.0",
"hashbrown 0.14.3",
"log",
"object 0.32.2",
"polkavm-common",
"polkavm-common 0.5.0",
"regalloc2 0.9.3",
"rustc-demangle",
]
@@ -14597,6 +14604,19 @@ dependencies = [
"smallvec",
]
[[package]]
name = "regalloc2"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6"
dependencies = [
"hashbrown 0.13.2",
"log",
"rustc-hash",
"slice-group-by",
"smallvec",
]
[[package]]
name = "regex"
version = "1.10.2"
@@ -21,7 +21,7 @@ parity-wasm = "0.45.0"
tempfile = "3.8.1"
toml = "0.8.2"
twox-hash = "1.6.3"
polkavm-linker = { version = "0.4.0", optional = true }
polkavm-linker = { version = "0.5.0", optional = true }
anyhow = "1.0.0"
[features]
+8 -7
View File
@@ -234,11 +234,12 @@ fn post_process_wasm(input_path: &Path, output_path: &Path) -> Result<()> {
/// Build contracts for RISC-V.
#[cfg(feature = "riscv")]
fn invoke_riscv_build(current_dir: &Path) -> Result<()> {
let encoded_rustflags =
["-Crelocation-model=pie", "-Clink-arg=--emit-relocs", "-Clink-arg=-Tmemory.ld"]
.join("\x1f");
fs::write(current_dir.join("memory.ld"), include_bytes!("./build/riscv_memory_layout.ld"))?;
let encoded_rustflags = [
"-Crelocation-model=pie",
"-Clink-arg=--emit-relocs",
"-Clink-arg=--export-dynamic-symbol=__polkavm_symbol_export_hack__*",
]
.join("\x1f");
let build_res = Command::new(env::var("CARGO")?)
.current_dir(current_dir)
@@ -247,7 +248,7 @@ fn invoke_riscv_build(current_dir: &Path) -> Result<()> {
.env("CARGO_ENCODED_RUSTFLAGS", encoded_rustflags)
.env("RUSTUP_TOOLCHAIN", "rve-nightly")
.env("RUSTUP_HOME", env::var("RUSTUP_HOME").unwrap_or_default())
.args(["build", "--release", "--target=riscv32em-unknown-none-elf"])
.args(["build", "--release", "--target=riscv32ema-unknown-none-elf"])
.output()
.expect("failed to execute process");
@@ -288,7 +289,7 @@ fn write_output(build_dir: &Path, out_dir: &Path, entries: Vec<Entry>) -> Result
#[cfg(feature = "riscv")]
post_process_riscv(
&build_dir.join("target/riscv32em-unknown-none-elf/release").join(entry.name()),
&build_dir.join("target/riscv32ema-unknown-none-elf/release").join(entry.name()),
&out_dir.join(entry.out_riscv_filename()),
)?;
@@ -10,7 +10,7 @@ edition = "2021"
[dependencies]
uapi = { package = 'pallet-contracts-uapi', path = "", default-features = false }
common = { package = 'pallet-contracts-fixtures-common', path = "" }
polkavm-derive = '0.4.0'
polkavm-derive = '0.5.0'
[profile.release]
opt-level = 3
@@ -1,4 +0,0 @@
SECTIONS {
.text : { KEEP(*(.text.polkavm_export)) }
}