Firefox currently builds all its Rust code into a static artifact called gkrust which is then statically linked, with cross-language LTO, with C++ artifacts to form the shippable libxul.so/dylib/dll.
Upon examining the exported symbols of libxul, the FFI functions that are meant for internal glue between Rust and C++ show up.
This is a problem for two reasons:
- It's a binary size issue, because cross-language LTO is supposed to inline the FFI functions into their callers. However, having them exported means also keeping those copies around. Also, unused FFI functions can't be eliminated as dead code.
- It gives problematic third-party software more opportunities to hook into
libxul in unsupported ways.
Since there's a variety of third-party crates that go into libxul, it wouldn't be practical to reannotate each FFI function. Therefore, please add a way from the top level of the Rust compilation to turn off the shared library export metadata generation for #[no_mangle] items.
Firefox currently builds all its Rust code into a static artifact called
gkrustwhich is then statically linked, with cross-language LTO, with C++ artifacts to form the shippablelibxul.so/dylib/dll.Upon examining the exported symbols of
libxul, the FFI functions that are meant for internal glue between Rust and C++ show up.This is a problem for two reasons:
libxulin unsupported ways.Since there's a variety of third-party crates that go into
libxul, it wouldn't be practical to reannotate each FFI function. Therefore, please add a way from the top level of the Rust compilation to turn off the shared library export metadata generation for#[no_mangle]items.