Skip to content

Fall back to cabi_realloc in the main module - #2606

Open
alexcrichton wants to merge 1 commit into
bytecodealliance:mainfrom
alexcrichton:maybe-more-realloc
Open

Fall back to cabi_realloc in the main module #2606
alexcrichton wants to merge 1 commit into
bytecodealliance:mainfrom
alexcrichton:maybe-more-realloc

Conversation

@alexcrichton

@alexcrichton alexcrichton commented Aug 14, 2026

Copy link
Copy Markdown
Member

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.

Note: this is built on #2605

@alexcrichton
alexcrichton requested a review from a team as a code owner August 14, 2026 20:07
@alexcrichton
alexcrichton requested review from fitzgen and removed request for a team August 14, 2026 20:07
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant