Adding support for unified rust cage/grate compilation through cargo#627
Adding support for unified rust cage/grate compilation through cargo#627rennergade merged 9 commits intomainfrom
Conversation
- Add cargo-lind_compile global binary - Add lind::epoch_callback in the linker
End-to-End Test ReportTest PreviewTest Report Deterministic TestsSummary
Test Results by Category
Non Deterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is really helpful thanks for putting this up. Would like @qianxichen233 opinions on the callbacks. |
|
See PR#631 for the fix |
|
Removed the |
End-to-End Test ReportTest PreviewTest Report Deterministic TestsSummary
Test Results by Category
Non Deterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This should be good to merge but we should update this doc first: https://github.com/Lind-Project/lind-wasm/blob/main/docs/contribute/compile-with-rust.md Can you make it so it is just an easy how to on using your script at the top but still keeps the details after for people who want to learn more. Also lets link to this from getting-started.md |
|
Updated the docs. |
End-to-End Test ReportTest PreviewTest Report Deterministic TestsSummary
Test Results by Category
Non Deterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
End-to-End Test ReportTest PreviewTest Report Deterministic TestsSummary
Test Results by Category
Non Deterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
End-to-End Test ReportTest PreviewTest Report Deterministic TestsSummary
Test Results by Category
Non Deterministic TestsSummary
Test Results by Category
Fail TestsSummary
Test Results by Category
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rennergade
left a comment
There was a problem hiding this comment.
Looks great now. Approved.
…627) * Add unified cargo compilation support. - Add cargo-lind_compile global binary - Add lind::epoch_callback in the linker * Remove trailing escape sequence * Add symlink to lind-cargo * Handle epoch_callback change in #631 * wasip1-clang.sh: Fix the REPO_ROOT, chmod +x * Update docs: compiling rust, getting started * Remove .DS_Store * Alias => lind-cargo-build * More detailed contrib docs
Basic Changes
From the Rust book https://doc.rust-lang.org/book/ch14-05-extending-cargo.html:
This PR adds the
cargo-lind_compilescript which compiles the crate using all the settings detailed in #577, runswasm-opton the output binary, and places this script in PATH for the docker images. This lets us compile a rust crate into a lind-compatible binary just usingcargo lind_compile, without requiring any extra configurations such as.cargo/config.toml.Non deterministic
--epoch-injectionwith RustDepending on what functions/libraries already exist in the pre-optimized
wasmbinary, thewasm-opt --epoch-injectionstep injects eitherwasi_snapshot_preview1.epoch_callbackorlind.epoch_callbackto the final binary.This issue does not exist with C code.
The linker in
lind-commononly exportswasi_snapshot_preview1.epoch_callbackand therefore, the binaries that havelind.epoch_callbacktrigger runtime errors.Delineating two examples,
Basic Hello World
Compiles to give:
wasm-opts into:Using
std::envCompiles into:
wasm-opts into:To fix this, I added an export to
lind.epoch_callbackwhich does the same thing as thewasi_snapshot_preview1.epoch_callback, and this seems to solve the issue.I could not find any documentation or source on how the
--epoch-injectionflags works, specifically on how it picks the namespace to use, so I wasn't able to investigate this discrepancy further. Tagging @qianxichen233 to help with this.