-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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.
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.