@@ -76,7 +76,7 @@ let self =
76
76
# don't use gold with with musl. Still seems to be
77
77
# affected by 22266.
78
78
&& ! stdenv . targetPlatform . isMusl )
79
-
79
+ , useLdLld ? false
80
80
, ghc-version ? src-spec . version
81
81
, ghc-version-date ? null
82
82
, ghc-commit-id ? null
@@ -95,6 +95,8 @@ assert !(enableIntegerSimple || enableNativeBignum) -> gmp != null;
95
95
assert enableNativeBignum -> ! enableIntegerSimple ;
96
96
assert enableIntegerSimple -> ! enableNativeBignum ;
97
97
98
+ assert ! ( useLdGold && useLdLld ) ;
99
+
98
100
let
99
101
src = src-spec . file or ( fetchurl { inherit ( src-spec ) url sha256 ; } ) ;
100
102
212
214
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
213
215
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
214
216
"CONF_LD_LINKER_OPTS_STAGE2=-fuse-ld=gold" # See: <https://gitlab.haskell.org/ghc/ghc/-/issues/22550#note_466656>
217
+ ] ++ lib . optionals useLdLld [
218
+ "LD=${ llvmPackages . bintools } /bin/ld.lld"
219
+ "CFLAGS=-fuse-ld=lld"
220
+ "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=lld"
221
+ "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=lld"
215
222
] ++ lib . optionals enableDWARF [
216
223
"--enable-dwarf-unwind"
217
224
"--with-libdw-includes=${ lib . getDev elfutils } /include"
@@ -467,6 +474,8 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
467
474
# set LD explicitly if we want gold even if we aren't cross compiling
468
475
''
469
476
export LD="${ targetCC . bintools } /bin/ld.gold"
477
+ '' + lib . optionalString useLdLld ''
478
+ export LD="${ llvmPackages . bintools } /bin/ld.lld"
470
479
'' + lib . optionalString ( targetPlatform . isWindows ) ''
471
480
export DllWrap="${ targetCC . bintools . bintools } /bin/${ targetCC . bintools . targetPrefix } dllwrap"
472
481
export Windres="${ targetCC . bintools . bintools } /bin/${ targetCC . bintools . targetPrefix } windres"
@@ -533,6 +542,7 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
533
542
nativeBuildInputs = [
534
543
perl autoconf automake m4 python3 sphinx
535
544
ghc bootPkgs . alex bootPkgs . happy bootPkgs . hscolour
545
+ llvmPackages . bintools
536
546
] ++ lib . optional ( patches != [ ] ) autoreconfHook ;
537
547
538
548
# For building runtime libs
@@ -684,7 +694,7 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
684
694
'' ;
685
695
686
696
passthru = {
687
- inherit bootPkgs targetPrefix libDir llvmPackages enableShared enableTerminfo useLLVM hadrian hadrianProject ;
697
+ inherit bootPkgs targetPrefix libDir llvmPackages enableShared enableTerminfo useLLVM useLdLld hadrian hadrianProject ;
688
698
689
699
# Our Cabal compiler name
690
700
haskellCompilerName = "ghc-${ version } " ;
0 commit comments