Fall back to cabi_realloc in the main module - #2606
Open
alexcrichton wants to merge 1 commit into
Open
Conversation
This commit updates the behavior of `wasm-tools component link` to search for the `cabi_realloc` function in the main module, if present. This behavior fixes an issue when linking shared libraries where each shared library was required to export its own `cabi_realloc` which otherwise doesn't happen by default when using wasi-sdk for example. By falling back to the main module that preserves the originally intended semantics, one definition of `cabi_realloc`, and these situations should work by default now.
alexcrichton
force-pushed
the
maybe-more-realloc
branch
from
August 17, 2026 19:55
6f90ee3 to
a4eaeeb
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit updates the behavior of
wasm-tools component linktosearch for the
cabi_reallocfunction in the main module, if present.This behavior fixes an issue when linking shared libraries where each
shared library was required to export its own
cabi_reallocwhichotherwise doesn't happen by default when using wasi-sdk for example. By
falling back to the main module that preserves the originally intended
semantics, one definition of
cabi_realloc, and these situations shouldwork by default now.