Skip to content

[RemoveImports] Support specifying imports to remove with arguments - #9395

Open
jeremy-code wants to merge 1 commit into
WebAssembly:mainfrom
jeremy-code:dev/remove-imports-arguments
Open

jeremy-code wants to merge 1 commit into
WebAssembly:mainfrom
jeremy-code:dev/remove-imports-arguments

Conversation

@jeremy-code

Copy link
Copy Markdown

If passed with no arguments, the current behavior where all imports are removed is preserved. If passed with a comma-separated list of imports (with format module.base or wildcards) or a response file, only the specified imports will be removed.

This might be useful if, for example, you are compiling a WebAssembly module with WASI, but do not want certain functions (e.g. filesystem, pthreads) to be implemented. There may also be niche usage with wasm-merge (e.g. merging with an upstream WebAssembly binary where you don't want to provide all imports).

@tlively
tlively self-requested a review November 14, 2026 10:33
toRemove.insert(func->name);
return;
}
auto full = func->module.toString() + '.' + func->base.toString();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same syntax as the Asyncify pass:

static std::string getFullImportName(Name module, Name base) {
return module.toString() + '.' + base.toString();
}
. There might be weird behavior since both module and function names can be any valid UTF-8 strings. At the very least, WebAssembly ESM integration imports should be fine (the only periods that such exist are at the beginning for relative files and the file extension).

If passed with no arguments, the current behavior where all imports are removed is preserved. If passed with a comma-separated list of imports (with format module.base or wildcards) or a response file, only the specified imports will be removed.
@jeremy-code
jeremy-code force-pushed the dev/remove-imports-arguments branch from 30705c3 to 9902962 Compare November 14, 2026 10:40
@jeremy-code jeremy-code changed the title [Remove imports] Support specifying imports to remove with arguments [RemoveImports] Support specifying imports to remove with arguments Nov 14, 2026

This branch has not been deployed

No deployments
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