diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index f7d387bbb..967fa7613 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -120,15 +120,35 @@ mod macros; #[no_mangle] pub static _fltused: () = (); -// FIXME: Is there any way to avoid this stub? See https://github.com/rust-lang/rust/issues/101134 +// FIXME: Is there any way to avoid these stubs? See https://github.com/rust-lang/rust/issues/101134 #[cfg(panic = "abort")] #[allow(missing_docs)] -#[allow(clippy::missing_const_for_fn)] // const extern is not yet supported: https://github.com/rust-lang/rust/issues/64926 #[no_mangle] -pub extern "system" fn __CxxFrameHandler3() -> i32 { +pub const extern "system" fn __CxxFrameHandler3() -> i32 { 0 } +#[cfg(panic = "abort")] +#[allow(missing_docs)] +#[no_mangle] +pub const extern "system" fn __CxxFrameHandler4() -> i32 { + // This is a stub for the C++ exception handling frame handler. It's never + // called but it needs to be distinct from __CxxFrameHandler3 to not confuse + // binary analysis tools. We return a different value to prevent folding. + 1 +} + +#[cfg(panic = "abort")] +#[allow(missing_docs)] +#[no_mangle] +pub const extern "system" fn __GSHandlerCheck_EH4() -> i32 { + // This is a stub for the C++ exception handling frame handler. It's never + // called but it needs to be distinct from __CxxFrameHandler3 and + // __CxxFrameHandler4 to not confuse binary analysis tools. We return a + // different value to prevent folding. + 2 +} + #[cfg(any( driver_model__driver_type = "WDM", driver_model__driver_type = "KMDF",