ring icon indicating copy to clipboard operation
ring copied to clipboard

build.rs: Disable LTO if enabled implictly

Open t-8ch opened this issue 11 months ago • 4 comments

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

t-8ch avatar Jan 26 '25 17:01 t-8ch

How would the user enable LTO, with this patch?

briansmith avatar Jan 26 '25 17:01 briansmith

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.

t-8ch avatar Jan 28 '25 21:01 t-8ch

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.

codecov[bot] avatar Feb 11 '25 04:02 codecov[bot]

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.

briansmith avatar Feb 20 '25 18:02 briansmith

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.

briansmith avatar Jul 11 '25 23:07 briansmith