build.rs: Disable LTO if enabled implictly
LTO between Rust and C is complicated. It requires clang and specific invocations configurations for both Rust and C compilations. If the CFLAGS from the environment enable LTO, for example from distribution build tools this can lead to errors. Instead always disable LTO for the C compilation. There is not much to optimize away anyways.
Closes #1444
How would the user enable LTO, with this patch?
In it's current form not at all.
Instead we could use -ffat-lto-objects. LTO with GCC won't work, but with clang it can.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.75%. Comparing base (
dcc7784) to head (aff02df). Report is 1014 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2289 +/- ##
=======================================
Coverage 96.75% 96.75%
=======================================
Files 173 173
Lines 20882 20882
Branches 487 487
=======================================
+ Hits 20204 20205 +1
Misses 575 575
+ Partials 103 102 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I think the best way forward with this is to just run the ed25519/x25519 benchmarks with and without C LTO enabled and see if it matters.
Closing this. I don't think we should be overriding the build configuration in build.rs. The person who requested LTO can disable LTO if they wish.