on iko/ghcjs-patch-master help sign in
use ld.gold by default on linux (#324)
commit096a6a66e6ac1758b081081ce72b6e39722aeb20 authorRichard Wallace <rwallace@thewallacepack.net> dateSat 23 Nov 2019, 05:48 (7 years ago) parent24669a4
1 file changed+17−6
builder/comp-builder.nix+17−6
builder/comp-builder.nix+17−6
@@ -66,13 +66,24 @@ let
6666 "--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg"
6767 "--with-hsc2hs=${ghc.targetPrefix}hsc2hs"
6868 ] ++ lib.optionals (stdenv.cc != null)
69− [ # CC
70− "--with-gcc=${stdenv.cc.targetPrefix}cc"
69+ ( # CC
70+ [ "--with-gcc=${stdenv.cc.targetPrefix}cc"
71+ ] ++
7172 # BINTOOLS
72− "--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
73− "--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
74− "--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
75− ] ++ [ # other flags
73+ (if stdenv.hostPlatform.isLinux
74+ # use gold as the linker on linux to improve link times
75+ then [
76+ "--with-ld=${stdenv.cc.bintools.targetPrefix}ld.gold"
77+ "--ghc-option=-optl-fuse-ld=gold"
78+ "--ld-option=-fuse-ld=gold"
79+ ] else [
80+ "--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
81+ ]
82+ ) ++ [
83+ "--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
84+ "--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
85+ ]
86+ ) ++ [ # other flags
7687 (if dontStrip then "--disable-executable-stripping" else "--enable-executable-stripping")
7788 (if dontStrip then "--disable-library-stripping" else "--enable-library-stripping")
7889 (if enableLibraryProfiling then "--enable-library-profiling" else "--disable-library-profiling" )