Updated README
This commit is contained in:
parent
0e3e11e387
commit
fdc1f0591d
|
|
@ -19,9 +19,9 @@ checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
|
|||
|
||||
[[package]]
|
||||
name = "parity-wasm"
|
||||
version = "0.42.2"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92"
|
||||
checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
parity-wasm = "0.42"
|
||||
parity-wasm = { version = "0.45", features = ["sign_ext"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Read import- and exported function symbols from [fugg-fetch](https://git.noest.dev/gijs/fugg-fetch) and applies them to a specified `client.wasm`.
|
||||
22
src/main.rs
22
src/main.rs
|
|
@ -13,7 +13,7 @@ struct FunctionFile {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let directory = Path::new("../fugg-fetch/out/55");
|
||||
let directory = Path::new("../fugg-fetch/out/134");
|
||||
|
||||
let input = directory.join("client-original.wasm");
|
||||
let output = directory.join("client.wasm");
|
||||
|
|
@ -28,8 +28,6 @@ fn main() {
|
|||
|
||||
let functions: FunctionFile = serde_json::from_str(&data).expect("JSON was not well-formatted");
|
||||
|
||||
println!("Functions: {:?}", functions);
|
||||
|
||||
const MODULE: &str = "env";
|
||||
|
||||
{
|
||||
|
|
@ -65,6 +63,24 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
let code_section = module.code_section_mut().unwrap();
|
||||
|
||||
println!("Got {} function bodies", code_section.bodies().len());
|
||||
|
||||
// for entry in function_section.entries_mut() {
|
||||
// let nice_name = functions.exports.get(entry.field());
|
||||
|
||||
// if let Some(nice_name) = nice_name {
|
||||
// println!("Export: Renaming {} to {}", entry.field(), nice_name);
|
||||
|
||||
// *entry.field_mut() = String::from(nice_name);
|
||||
// } else {
|
||||
// println!("Export: Unable to find nice name for {}", entry.field());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
let output_bytes = parity_wasm::serialize(module).unwrap();
|
||||
let mut file = OpenOptions::new()
|
||||
.write(true)
|
||||
|
|
|
|||
Reference in New Issue