Browse Source

Gate debug builtins behind a Cargo feature (#7305)

This doesn't shave off much but can help tidy up some symbols from
exported objects if they aren't needed.
pull/7314/head
Alex Crichton 1 year ago
committed by GitHub
parent
commit
5565b93508
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Cargo.toml
  2. 5
      crates/runtime/Cargo.toml
  3. 1
      crates/runtime/src/lib.rs
  4. 5
      crates/wasmtime/Cargo.toml
  5. 5
      crates/wasmtime/src/engine.rs

2
Cargo.toml

@ -302,6 +302,7 @@ default = [
"profiling",
"coredump",
"addr2line",
"debug-builtins",
]
# ========================================
@ -339,6 +340,7 @@ cranelift = ["wasmtime-cli-flags/cranelift", "dep:wasmtime-cranelift"]
profiling = ["wasmtime/profiling"]
coredump = ["wasmtime-cli-flags/coredump"]
addr2line = ["wasmtime/addr2line"]
debug-builtins = ["wasmtime/debug-builtins"]
# CLI subcommands for the `wasmtime` executable. See `wasmtime $cmd --help`
# for more information on each subcommand.

5
crates/runtime/Cargo.toml

@ -58,10 +58,7 @@ wasmtime-versioned-export-macros = { workspace = true }
[features]
async = ["wasmtime-fiber"]
# Enables support for the pooling instance allocator
pooling-allocator = []
component-model = ["wasmtime-environ/component-model", "dep:encoding_rs"]
wmemcheck = []
debug-builtins = []

1
crates/runtime/src/lib.rs

@ -29,6 +29,7 @@ mod table;
mod traphandlers;
mod vmcontext;
#[cfg(feature = "debug-builtins")]
pub mod debug_builtins;
pub mod libcalls;
pub mod mpk;

5
crates/wasmtime/Cargo.toml

@ -84,6 +84,7 @@ default = [
'demangle',
'addr2line',
'coredump',
'debug-builtins',
]
# An on-by-default feature enabling runtime compilation of WebAssembly modules
@ -154,3 +155,7 @@ coredump = ["dep:wasm-encoder"]
# Support address-to-file/line information in traps when wasm files have DWARF
# debugging information.
addr2line = ["wasmtime-jit/addr2line"]
# Export some symbols from the final binary to assist in debugging
# Cranelift-generated code with native debuggers like GDB and LLDB.
debug-builtins = ["wasmtime-runtime/debug-builtins"]

5
crates/wasmtime/src/engine.rs

@ -14,7 +14,7 @@ use wasmtime_cache::CacheConfig;
use wasmtime_environ::obj;
use wasmtime_environ::{FlagValue, ObjectKind};
use wasmtime_jit::{profiling::ProfilingAgent, CodeMemory};
use wasmtime_runtime::{debug_builtins, CompiledModuleIdAllocator, InstanceAllocator, MmapVec};
use wasmtime_runtime::{CompiledModuleIdAllocator, InstanceAllocator, MmapVec};
mod serialization;
@ -78,7 +78,8 @@ impl Engine {
// is the per-program initialization required for handling traps, such
// as configuring signals, vectored exception handlers, etc.
wasmtime_runtime::init_traps(crate::module::is_wasm_trap_pc, config.macos_use_mach_ports);
debug_builtins::ensure_exported();
#[cfg(feature = "debug-builtins")]
wasmtime_runtime::debug_builtins::ensure_exported();
let registry = SignatureRegistry::new();
let config = config.clone();

Loading…
Cancel
Save