overdrivenpotato / rust-psp

Rust on PSP. Panic and allocation support. Access PSP system libraries.
Other
588 stars 31 forks source link

Make stub names `no_mangle` to fix release builds #144

Closed ayrtonm closed 1 year ago

ayrtonm commented 1 year ago

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.

overdrivenpotato commented 1 year ago

Thanks, great find!