From 036eef1d1e5d902486ca6a3f7c48f0a31e3c053c Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Tue, 8 Jun 2021 14:17:38 +0200 Subject: [PATCH] haskell.compiler.*: use gold based on targetPlatform.linker useLdGold previously just checked for useLLVM which (currently) implies `linker == "lld"`. However more accurate is to check the `linker` of the `targetPlatform` as it actually tells us which bintools package we can expect. `linker == "bfd"` implies that we are using the `binutils` package, so gold is available, so we can use it unless musl is the libc. `linker == "gold"` implies that gold is the default linker already and we should absolutely use it. --- pkgs/development/compilers/ghc/8.10.4.nix | 5 +++-- pkgs/development/compilers/ghc/8.8.4.nix | 5 +++-- pkgs/development/compilers/ghc/9.0.1.nix | 5 +++-- pkgs/development/compilers/ghc/head.nix | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.4.nix b/pkgs/development/compilers/ghc/8.10.4.nix index da957f93520..6787e8e591b 100644 --- a/pkgs/development/compilers/ghc/8.10.4.nix +++ b/pkgs/development/compilers/ghc/8.10.4.nix @@ -89,9 +89,10 @@ let targetCC = builtins.head toolsForTarget; - # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 + # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues. + # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 # see #84670 and #49071 for more background. - useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl; + useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl); in stdenv.mkDerivation (rec { diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index b0336ad3992..14e48de475a 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -98,9 +98,10 @@ let targetCC = builtins.head toolsForTarget; - # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 + # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues. + # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 # see #84670 and #49071 for more background. - useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl; + useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl); in stdenv.mkDerivation (rec { diff --git a/pkgs/development/compilers/ghc/9.0.1.nix b/pkgs/development/compilers/ghc/9.0.1.nix index 58beef5d688..ab9356656ee 100644 --- a/pkgs/development/compilers/ghc/9.0.1.nix +++ b/pkgs/development/compilers/ghc/9.0.1.nix @@ -90,9 +90,10 @@ let targetCC = builtins.head toolsForTarget; - # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 + # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues. + # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 # see #84670 and #49071 for more background. - useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl; + useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl); in stdenv.mkDerivation (rec { diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index a0ca13270a2..3d571597268 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -100,9 +100,10 @@ let targetCC = builtins.head toolsForTarget; - # ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 + # Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues. + # But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856 # see #84670 and #49071 for more background. - useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl; + useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl); in stdenv.mkDerivation (rec {