From 788e6540176da43908037ab751e805eb1be107ed Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Thu, 3 Oct 2024 21:24:06 +0300 Subject: [PATCH] Enable LTO by default on all platforms 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 on Darwin, this old default may be restored. The reported upstream issue (https://github.com/NixOS/nixpkgs/issues/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. --- ext/extconf.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ext/extconf.rb b/ext/extconf.rb index 6d925dab..259bdcfd 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -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'