Making the stubs no_mangle ensures that rustc can't get rid of them before they get to the linker. This is likely the only change necessary to fix the missing symbols linker error in release builds. Just in case, this commit also replaces transmute<_, Func>(&stub) with an extern "C" function declaration because it's not clear what rustc is allowed to assume about &stub and whether that may let it optimize it away again.
Making the stubs
no_mangle
ensures that rustc can't get rid of them before they get to the linker. This is likely the only change necessary to fix the missing symbols linker error in release builds. Just in case, this commit also replacestransmute<_, Func>(&stub)
with an extern "C" function declaration because it's not clear what rustc is allowed to assume about&stub
and whether that may let it optimize it away again.