-
Notifications
You must be signed in to change notification settings - Fork 16
Adding support for unified rust cage/grate compilation through cargo #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5220c3f
Add unified cargo compilation support.
stupendoussuperpowers 5642f3b
Remove trailing escape sequence
stupendoussuperpowers 3f0c3b1
Add symlink to lind-cargo
stupendoussuperpowers de6d765
Handle epoch_callback change in #631
stupendoussuperpowers 99aa259
wasip1-clang.sh: Fix the REPO_ROOT, chmod +x
stupendoussuperpowers f650e53
Update docs: compiling rust, getting started
stupendoussuperpowers 155e773
Remove .DS_Store
stupendoussuperpowers b399cde
Alias => lind-cargo-build
stupendoussuperpowers 203be80
More detailed contrib docs
stupendoussuperpowers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,49 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| shift | ||
|
|
||
| # Determine profile from arguments | ||
| PROFILE="debug" | ||
| CARGO_ARGS=("--target" "wasm32-wasip1") | ||
|
|
||
| for arg in "$@"; do | ||
| if [ "$arg" = "--release" ] || [ "$arg" = "-r" ]; then | ||
| PROFILE="release" | ||
| fi | ||
| CARGO_ARGS+=("$arg") | ||
| done | ||
|
|
||
| # Set linker (allow override via environment variable) | ||
| LINKER="${LIND_WASM_LINKER:-/home/lind/lind-wasm/scripts/wasip1-clang.sh}" | ||
| export CARGO_TARGET_WASM32_WASIP1_LINKER="$LINKER" | ||
|
|
||
| # Set rustflags for wasm32-wasip1 target | ||
| export CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS="\ | ||
| -C link-self-contained=no \ | ||
| -C target-feature=+crt-static,+atomics,+bulk-memory \ | ||
| -C link-arg=-Wl,--import-memory \ | ||
| -C link-arg=-Wl,--export-memory \ | ||
| -C link-arg=-Wl,--shared-memory \ | ||
| -C link-arg=-Wl,--max-memory=67108864 \ | ||
| -C link-arg=-Wl,--export=__stack_pointer \ | ||
| -C link-arg=-Wl,--export=__stack_low \ | ||
| -C link-arg=-Wl,--export=pass_fptr_to_wt" | ||
|
|
||
| # Set wasm-opt and wasmtime paths (allow override via environment variables) | ||
| WASM_OPT_BIN="${WASM_OPT_BIN:-wasm-opt}" | ||
| WASMTIME_BIN="${WASMTIME_BIN:-wasmtime}" | ||
|
|
||
| echo "Building with profile: $PROFILE" | ||
| cargo +nightly build -Z build-std=std,panic_abort "${CARGO_ARGS[@]}" | ||
|
|
||
| # Find the wasm file in the appropriate profile directory | ||
| OUT_WASM=$(find "target/wasm32-wasip1/$PROFILE" -maxdepth 1 -name "*.wasm" ! -name "*deps*" 2>/dev/null | head -n1) | ||
|
|
||
| if [ -z "$OUT_WASM" ]; then | ||
| echo "Error: No wasm file found in target/wasm32-wasip1/$PROFILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "----------------" | ||
| exec lind_compile --opt-only "$OUT_WASM" |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.