-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filestore: add example WASM unknown module written in Rust
Signed-off-by: deadprogram <[email protected]>
- Loading branch information
1 parent
cc3de1e
commit 8487cd7
Showing
7 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[target."wasm32-unknown-unknown"] | ||
rustflags = ["-C", "target-feature=+atomics,+bulk-memory", | ||
"-C", "link-arg=--initial-memory=65536", | ||
"-C", "link-arg=--max-memory=65536", | ||
"-C", "link-arg=-zstack-size=4096"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "pingrs" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# pingrs | ||
|
||
WASM unknown module written in Rust | ||
|
||
## How to install | ||
|
||
- Install Rust. | ||
|
||
- Install the `wasm32-unknown-unknown` target. | ||
|
||
```bash | ||
rustup target add wasm32-unknown-unknown | ||
``` | ||
|
||
## How to build module | ||
|
||
```bash | ||
cd modules/pingrs | ||
cargo build --target wasm32-unknown-unknown --release | ||
cd ../.. | ||
cp ./modules/pingrs/target/wasm32-unknown-unknown/release/pingrs.wasm ./modules/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![no_std] | ||
|
||
#[panic_handler] | ||
fn handle_panic(_: &core::panic::PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[no_mangle] | ||
pub extern fn ping() { | ||
unsafe {pong()}; | ||
} | ||
|
||
#[link(wasm_import_module = "hosted")] | ||
extern { | ||
fn pong(); | ||
} |