-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Rust integration to emit a single static library #212
base: main
Are you sure you want to change the base?
Change Rust integration to emit a single static library #212
Conversation
…mpiling multiple crates to static libs and trying to link all of them into the final binary This also replaces linking SpiderMonkey's Rust static library with including the required crates into our own library, achieving an end result of having a single static Rust library to link. And finally, it enables thin-LTO for all libraries: this is in general useful, but even more relevant with more Rust code. Signed-off-by: Till Schneidereit <[email protected]>
@andreiltd it'd be great if you could review this! |
/// Configure a panic hook to redirect rust panics to MFBT's MOZ_Crash. | ||
#[no_mangle] | ||
pub extern "C" fn install_rust_hooks() { | ||
panic::set_hook(Box::new(panic_hook)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we care about potentially already defined custom hooks (or a default hook) and wrapping it with the new one?
E.g.:
let previous_hook = panic::take_hook();
panic::set_hook(Box::new(move |info: &PanicInfo| {
panic_hook(info);
previous_hook(info);
}));
@@ -2,9 +2,6 @@ | |||
resolver = "2" | |||
members = ["fuzz"] | |||
|
|||
[lib] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also strip following from this file?
[profile.release]
lto = true
panic = 'abort'
[profile.dev]
lto = true
panic = 'abort'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected wpt passes are indeed unexpected :)
Initially yes. Took some digging, but I found the cause: the So far, so good. However, the question is if we need a lock file. And if so, how do we even go about getting one? I guess we could keep one in the template crate and copy it over. If it doesn't cover everything, it'll be added to during the build, which seems okay. |
Would it be possible to have a |
It would be, but then we'd spread things out across the template crate and this top-level one, which is why I was shying away from it so far. But yeah, maybe that makes most sense to do. I'll look into it |
… instead of compiling multiple crates to static libs and trying to link all of them into the final binary.
This also replaces linking SpiderMonkey's Rust static library with including the required crates into our own library, achieving an end result of having a single static Rust library to link.
And finally, it enables thin-LTO for all libraries: this is in general useful, but even more relevant with more Rust code.