Force 1 CGU when release mode is enabled #215
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We've locally started setting up OSS fuzz and Rust recently, but we're
unfortunately getting a lot of timeouts where tests are taking much
longer than expected. After some investigation one cause of the issue
seems to be that although we're compiling the fuzzers in release mode
they're still performing quite badly at runtime.
One cause of this appears to be that functions are not being inlined
across CGUs within a crate, and digging even further seems to show that
functions are tagged with
notEligibleToImport
which presumably meansthat ThinLTO cannot import them across CGUs.
Poking around in LLVM it looks like the sancov passes add mutations of a
private
__sancov_gen_
global in all functions in a CGU, and then thatglobal itself is listed as not importable. Any function referencing
something not importable is then also considered not importable, hence
nothing in any CGU is importable.
With this change, however, the performance of optimized-Rust being
sanitized is unfortunately still ~100x slower than non-sanitized Rust. I
don't think the overhead is supposed to be that high so I'm still
looking into other causes of slowness.