Skip to content

Commit

Permalink
Enable LTO by default on all platforms
Browse files Browse the repository at this point in the history
Initially, when LTO was first introduced in commit 55a7a94 (Enable LTO and
-march=native, 2019-05-29), it was enabled by default on all platforms. Now
that it is no longer broken in Nix, this old default may be restored.

The reported upstream issue (NixOS/nixpkgs#19098) has
been resolved and the fix is already included in the `nixpkgs-unstable` branch.

This also enables LTO again on platforms other than Darwin, where it was
unintentionally disabled by default due to a programming error.
  • Loading branch information
amiryal committed Oct 3, 2024
1 parent 4fce2b6 commit 030a353
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
$CXXFLAGS << ' -march=native -mtune=native'
end

# darwin nix clang doesn't support lto
# disable -lto flag for darwin + nix
# see: https://github.com/sass/sassc-ruby/issues/148
enable_lto_by_default = (Gem::Platform.local.os == "darwin" && ENV['NIX_CC'].nil?)

if enable_config('lto', enable_lto_by_default)
if enable_config('lto', true)
$CFLAGS << ' -flto'
$CXXFLAGS << ' -flto'
$LDFLAGS << ' -flto'
Expand Down

0 comments on commit 030a353

Please sign in to comment.