mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
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:
committed by
GitHub
parent
8b28031d16
commit
c1c0e62d33
@@ -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]
|
||||
|
||||
@@ -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)) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user