Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Enable `cfg(gc_zeal)` when fuzzing (#13053)

Nick Fitzgeralddfe5de4da6fc
diff --git a/Cargo.toml b/Cargo.toml
index d4ce5bf294..f78ee008ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -214,6 +214,9 @@ check-cfg = [
'cfg(pulley_disable_interp_simd)',
'cfg(arc_try_new)',
+ # Activated by `cargo fuzz` when building for fuzzing.
+ 'cfg(fuzzing)',
+
# When enabled, `cfg(gc_zeal)` activates aggressive GC debugging assertions.
'cfg(gc_zeal)',
]
diff --git a/crates/cranelift/build.rs b/crates/cranelift/build.rs
new file mode 100644
index 0000000000..20153fe6fa
--- /dev/null
+++ b/crates/cranelift/build.rs
@@ -0,0 +1,5 @@
+fn main() {
+ if cfg!(fuzzing) {
+ println!("cargo:rustc-cfg=gc_zeal");
+ }
+}
diff --git a/crates/wasmtime/build.rs b/crates/wasmtime/build.rs
index c5c3b63850..9b783f93ee 100644
--- a/crates/wasmtime/build.rs
+++ b/crates/wasmtime/build.rs
@@ -34,6 +34,7 @@ fn main() {
custom_cfg("has_virtual_memory", has_virtual_memory);
custom_cfg("has_custom_sync", has_custom_sync);
custom_cfg("has_host_compiler_backend", has_host_compiler_backend);
+ custom_cfg("gc_zeal", cfg!(fuzzing));
// If this OS isn't supported and no debug-builtins or if Cranelift doesn't support
// the host or there's no need to build these helpers.