Skip to content
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

Add support for -Wunknown-imports-trap to components #9021

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,28 +375,24 @@ impl RunCommand {
// The main module might be allowed to have unknown imports, which
// should be defined as traps:
if self.run.common.wasm.unknown_imports_trap == Some(true) {
#[cfg(feature = "cranelift")]
match linker {
CliLinker::Core(linker) => {
linker.define_unknown_imports_as_traps(module.unwrap_core())?;
}
_ => bail!("cannot use `--trap-unknown-imports` with components"),
CliLinker::Component(linker) => {
linker.define_unknown_imports_as_traps(module.unwrap_component())?;
}
}
#[cfg(not(feature = "cranelift"))]
bail!("support for `unknown-imports-trap` disabled at compile time");
}

// ...or as default values.
if self.run.common.wasm.unknown_imports_default == Some(true) {
#[cfg(feature = "cranelift")]
match linker {
CliLinker::Core(linker) => {
linker.define_unknown_imports_as_default_values(module.unwrap_core())?;
}
_ => bail!("cannot use `--default-values-unknown-imports` with components"),
}
#[cfg(not(feature = "cranelift"))]
bail!("support for `unknown-imports-trap` disabled at compile time");
}

let finish_epoch_handler = self.setup_epoch_handler(store, modules)?;
Expand Down
Loading