-
Notifications
You must be signed in to change notification settings - Fork 102
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
Allow building for wasm32-wasi target. #42
Conversation
Signed-off-by: Piotr Sikora <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense but I'm just not sure whether we need to do anything about ABI compatibility if we want to use this function instead of malloc.
#[no_mangle] | ||
pub extern "C" fn malloc(size: usize) -> *mut u8 { | ||
pub extern "C" fn proxy_on_memory_allocate(size: usize) -> *mut u8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall which version of the ABI this is in -- if we change this now will it affect compatibility? Or do we need to bump the ABI version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of the updated-not-yet-finalized ABI (proxy-wasm/spec#1), and it's already enabled as a fallback in Envoy (proxy-wasm/proxy-wasm-cpp-host#80).
Note that this is still exported as malloc
when using wasm32-unknown-unknown
target, and it's only exported as proxy_on_memory_allocate
when using wasm32-wasi
and other non-WebAssembly targets, which previously were impossible to use at all, so we're not breaking any existing compatibility.
It's not perfect, but it's the best we can do without making huge changes (and I'd rather avoid those now, since I want to finalize the ABI over the next week or two, and them upgrade the SDK straight to that version).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it -- there is a usage of "cfg_attr" that I didn't know about. Makes sense!
Signed-off-by: Piotr Sikora <[email protected]>
* Use Rust toolchains with working components. (#16) Signed-off-by: Piotr Sikora <[email protected]> * Split licenses check into a separate test target. (#17) Signed-off-by: Piotr Sikora <[email protected]> * Help other developers get started using this SDK. (#15) Signed-off-by: DazWilkin <[email protected]> * Add Bazel support. (#18) Signed-off-by: Shikugawa <[email protected]> Signed-off-by: Piotr Sikora <[email protected]> * Add support for setting HTTP bodies. (#2) Signed-off-by: Gregory Brail <[email protected]> * Release v0.1.1. (#20) Signed-off-by: Piotr Sikora <[email protected]> * Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (#7) Signed-off-by: Yaroslav Skopets <[email protected]> * Release v0.1.2. (#21) Signed-off-by: Piotr Sikora <[email protected]> * Update hashbrown to v0.8.2. (#22) Signed-off-by: Piotr Sikora <[email protected]> * Add cargo audit and cargo outdated checks. (#23) Signed-off-by: Piotr Sikora <[email protected]> * Update chrono to v0.4.15. (proxy-wasm#33) Signed-off-by: Piotr Sikora <[email protected]> * Move optional checks to the end. (proxy-wasm#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora <[email protected]> * Move Bazel to //bazel. (proxy-wasm#29) Signed-off-by: Piotr Sikora <[email protected]> * Fix HTTP body example. (proxy-wasm#32) Signed-off-by: Piotr Sikora <[email protected]> * Add support for setting network buffers. (proxy-wasm#31) Signed-off-by: Piotr Sikora <[email protected]> * Add metrics. (proxy-wasm#30) Fixes #4. Signed-off-by: Piotr Sikora <[email protected]> * Update hashbrown and transitive dependencies. (proxy-wasm#45) Signed-off-by: Piotr Sikora <[email protected]> * Allow building for wasm32-wasi target. (proxy-wasm#42) Signed-off-by: Piotr Sikora <[email protected]> * Make wee-alloc an optional feature. (proxy-wasm#38) Signed-off-by: Yuval Kohavi <[email protected]> * Update rules_rust to latest. (proxy-wasm#46) Signed-off-by: Piotr Sikora <[email protected]> * Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Signed-off-by: Piotr Sikora <[email protected]> * Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <[email protected]> * Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Signed-off-by: Piotr Sikora <[email protected]> * Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Signed-off-by: Piotr Sikora <[email protected]> * Add support for nested HTTP callouts. (proxy-wasm#56) Signed-off-by: Svetlin Zarev <[email protected]> * Allow RootContext to create child contexts for streams. (proxy-wasm#34) Fixes #6. Signed-off-by: Daniel Grimm <[email protected]> * Fix warnings from Clippy v1.50.0 (nightly). (proxy-wasm#58) Signed-off-by: Piotr Sikora <[email protected]> * Release v0.1.3. (proxy-wasm#59) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup instructions for updating dependencies. (proxy-wasm#60) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup WORKSPACE. (proxy-wasm#61) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup examples. (proxy-wasm#62) Signed-off-by: Piotr Sikora <[email protected]> * Update libc (transitive dependency) to v0.2.81. (proxy-wasm#63) Signed-off-by: Piotr Sikora <[email protected]> * Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki <[email protected]> * Update the examples so that they use the latest API Signed-off-by: Takaya Saeki <[email protected]> * Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki <[email protected]> * Bump the version to 0.0.8 Signed-off-by: Takaya Saeki <[email protected]> * Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki <[email protected]> * Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki <[email protected]> * Update dependencies Signed-off-by: Takaya Saeki <[email protected]> * Fix Cargo.toml Signed-off-by: Takaya Saeki <[email protected]> * outdated should check only root deps Signed-off-by: Takaya Saeki <[email protected]> * Fix inconsistent derived traits Signed-off-by: Takaya Saeki <[email protected]> Co-authored-by: Piotr Sikora <[email protected]> Co-authored-by: Daz Wilkin <[email protected]> Co-authored-by: Greg Brail <[email protected]> Co-authored-by: Yaroslav Skopets <[email protected]> Co-authored-by: Yuval Kohavi <[email protected]> Co-authored-by: SvetlinZarev-SAP <[email protected]> Co-authored-by: Daniel Grimm <[email protected]>
* Use Rust toolchains with working components. (#16) Signed-off-by: Piotr Sikora <[email protected]> * Split licenses check into a separate test target. (#17) Signed-off-by: Piotr Sikora <[email protected]> * Help other developers get started using this SDK. (#15) Signed-off-by: DazWilkin <[email protected]> * Add Bazel support. (#18) Signed-off-by: Shikugawa <[email protected]> Signed-off-by: Piotr Sikora <[email protected]> * Add support for setting HTTP bodies. (#2) Signed-off-by: Gregory Brail <[email protected]> * Release v0.1.1. (#20) Signed-off-by: Piotr Sikora <[email protected]> * Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (#7) Signed-off-by: Yaroslav Skopets <[email protected]> * Release v0.1.2. (#21) Signed-off-by: Piotr Sikora <[email protected]> * Update hashbrown to v0.8.2. (#22) Signed-off-by: Piotr Sikora <[email protected]> * Add cargo audit and cargo outdated checks. (#23) Signed-off-by: Piotr Sikora <[email protected]> * Update chrono to v0.4.15. (proxy-wasm#33) Signed-off-by: Piotr Sikora <[email protected]> * Move optional checks to the end. (proxy-wasm#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora <[email protected]> * Move Bazel to //bazel. (proxy-wasm#29) Signed-off-by: Piotr Sikora <[email protected]> * Fix HTTP body example. (proxy-wasm#32) Signed-off-by: Piotr Sikora <[email protected]> * Add support for setting network buffers. (proxy-wasm#31) Signed-off-by: Piotr Sikora <[email protected]> * Add metrics. (proxy-wasm#30) Fixes #4. Signed-off-by: Piotr Sikora <[email protected]> * Update hashbrown and transitive dependencies. (proxy-wasm#45) Signed-off-by: Piotr Sikora <[email protected]> * Allow building for wasm32-wasi target. (proxy-wasm#42) Signed-off-by: Piotr Sikora <[email protected]> * Make wee-alloc an optional feature. (proxy-wasm#38) Signed-off-by: Yuval Kohavi <[email protected]> * Update rules_rust to latest. (proxy-wasm#46) Signed-off-by: Piotr Sikora <[email protected]> * Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Signed-off-by: Piotr Sikora <[email protected]> * Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <[email protected]> * Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Signed-off-by: Piotr Sikora <[email protected]> * Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Signed-off-by: Piotr Sikora <[email protected]> * Add support for nested HTTP callouts. (proxy-wasm#56) Signed-off-by: Svetlin Zarev <[email protected]> * Allow RootContext to create child contexts for streams. (proxy-wasm#34) Fixes #6. Signed-off-by: Daniel Grimm <[email protected]> * Fix warnings from Clippy v1.50.0 (nightly). (proxy-wasm#58) Signed-off-by: Piotr Sikora <[email protected]> * Release v0.1.3. (proxy-wasm#59) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup instructions for updating dependencies. (proxy-wasm#60) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup WORKSPACE. (proxy-wasm#61) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup examples. (proxy-wasm#62) Signed-off-by: Piotr Sikora <[email protected]> * Update libc (transitive dependency) to v0.2.81. (proxy-wasm#63) Signed-off-by: Piotr Sikora <[email protected]> * Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki <[email protected]> * Update the examples so that they use the latest API Signed-off-by: Takaya Saeki <[email protected]> * Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki <[email protected]> * Bump the version to 0.0.8 Signed-off-by: Takaya Saeki <[email protected]> * Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki <[email protected]> * Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki <[email protected]> * Update dependencies Signed-off-by: Takaya Saeki <[email protected]> * Fix Cargo.toml Signed-off-by: Takaya Saeki <[email protected]> * outdated should check only root deps Signed-off-by: Takaya Saeki <[email protected]> * Fix inconsistent derived traits Signed-off-by: Takaya Saeki <[email protected]> Co-authored-by: Piotr Sikora <[email protected]> Co-authored-by: Daz Wilkin <[email protected]> Co-authored-by: Greg Brail <[email protected]> Co-authored-by: Yaroslav Skopets <[email protected]> Co-authored-by: Yuval Kohavi <[email protected]> Co-authored-by: SvetlinZarev-SAP <[email protected]> Co-authored-by: Daniel Grimm <[email protected]>
…opets#19) * Use Rust toolchains with working components. (yskopets#16) Signed-off-by: Piotr Sikora <[email protected]> * Split licenses check into a separate test target. (yskopets#17) Signed-off-by: Piotr Sikora <[email protected]> * Help other developers get started using this SDK. (yskopets#15) Signed-off-by: DazWilkin <[email protected]> * Add Bazel support. (yskopets#18) Signed-off-by: Shikugawa <[email protected]> Signed-off-by: Piotr Sikora <[email protected]> * Add support for setting HTTP bodies. (yskopets#2) Signed-off-by: Gregory Brail <[email protected]> * Release v0.1.1. (yskopets#20) Signed-off-by: Piotr Sikora <[email protected]> * Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (yskopets#7) Signed-off-by: Yaroslav Skopets <[email protected]> * Release v0.1.2. (yskopets#21) Signed-off-by: Piotr Sikora <[email protected]> * Update hashbrown to v0.8.2. (yskopets#22) Signed-off-by: Piotr Sikora <[email protected]> * Add cargo audit and cargo outdated checks. (yskopets#23) Signed-off-by: Piotr Sikora <[email protected]> * Update chrono to v0.4.15. (proxy-wasm#33) Signed-off-by: Piotr Sikora <[email protected]> * Move optional checks to the end. (proxy-wasm#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora <[email protected]> * Move Bazel to //bazel. (proxy-wasm#29) Signed-off-by: Piotr Sikora <[email protected]> * Fix HTTP body example. (proxy-wasm#32) Signed-off-by: Piotr Sikora <[email protected]> * Add support for setting network buffers. (proxy-wasm#31) Signed-off-by: Piotr Sikora <[email protected]> * Add metrics. (proxy-wasm#30) Fixes yskopets#4. Signed-off-by: Piotr Sikora <[email protected]> * Update hashbrown and transitive dependencies. (proxy-wasm#45) Signed-off-by: Piotr Sikora <[email protected]> * Allow building for wasm32-wasi target. (proxy-wasm#42) Signed-off-by: Piotr Sikora <[email protected]> * Make wee-alloc an optional feature. (proxy-wasm#38) Signed-off-by: Yuval Kohavi <[email protected]> * Update rules_rust to latest. (proxy-wasm#46) Signed-off-by: Piotr Sikora <[email protected]> * Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Signed-off-by: Piotr Sikora <[email protected]> * Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <[email protected]> * Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Signed-off-by: Piotr Sikora <[email protected]> * Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Signed-off-by: Piotr Sikora <[email protected]> * Add support for nested HTTP callouts. (proxy-wasm#56) Signed-off-by: Svetlin Zarev <[email protected]> * Allow RootContext to create child contexts for streams. (proxy-wasm#34) Fixes yskopets#6. Signed-off-by: Daniel Grimm <[email protected]> * Fix warnings from Clippy v1.50.0 (nightly). (proxy-wasm#58) Signed-off-by: Piotr Sikora <[email protected]> * Release v0.1.3. (proxy-wasm#59) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup instructions for updating dependencies. (proxy-wasm#60) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup WORKSPACE. (proxy-wasm#61) Signed-off-by: Piotr Sikora <[email protected]> * Cleanup examples. (proxy-wasm#62) Signed-off-by: Piotr Sikora <[email protected]> * Update libc (transitive dependency) to v0.2.81. (proxy-wasm#63) Signed-off-by: Piotr Sikora <[email protected]> * Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki <[email protected]> * Update the examples so that they use the latest API Signed-off-by: Takaya Saeki <[email protected]> * Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki <[email protected]> * Bump the version to 0.0.8 Signed-off-by: Takaya Saeki <[email protected]> * Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki <[email protected]> * Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki <[email protected]> * Update dependencies Signed-off-by: Takaya Saeki <[email protected]> * Fix Cargo.toml Signed-off-by: Takaya Saeki <[email protected]> * outdated should check only root deps Signed-off-by: Takaya Saeki <[email protected]> * Fix inconsistent derived traits Signed-off-by: Takaya Saeki <[email protected]> Co-authored-by: Piotr Sikora <[email protected]> Co-authored-by: Daz Wilkin <[email protected]> Co-authored-by: Greg Brail <[email protected]> Co-authored-by: Yaroslav Skopets <[email protected]> Co-authored-by: Yuval Kohavi <[email protected]> Co-authored-by: SvetlinZarev-SAP <[email protected]> Co-authored-by: Daniel Grimm <[email protected]>
Signed-off-by: Piotr Sikora [email protected]