@@ -67,8 +67,15 @@ let self =
6767, useLdGold ?
6868 # might be better check to see if cc is clang/llvm?
6969 # use gold as the linker on linux to improve link times
70- # do not use it on musl due to a ld.gold bug. See: <https://sourceware.org/bugzilla/show_bug.cgi?id=22266>.
71- ( stdenv . targetPlatform . isLinux && ! stdenv . targetPlatform . isAndroid && ! stdenv . targetPlatform . isMusl )
70+ # do not use ld.gold 2.3 with musl due to a ld.gold bug.
71+ # See: <https://sourceware.org/bugzilla/show_bug.cgi?id=22266>.
72+ # Note that this bug was resolved in 2017.
73+ ( stdenv . targetPlatform . isLinux
74+ # don't use gold on android.
75+ && ! stdenv . targetPlatform . isAndroid
76+ # don't use gold with with musl. Still seems to be
77+ # affected by 22266.
78+ && ! stdenv . targetPlatform . isMusl )
7279
7380, ghc-version ? src-spec . version
7481, ghc-version-date ? null
246253 then "ghc928"
247254 else "ghc962" ;
248255 in
249- buildPackages . pinned- haskell-nix. tool compiler-nix-name "hadrian" {
256+ buildPackages . haskell-nix . tool compiler-nix-name "hadrian" {
250257 compilerSelection = p : p . haskell . compiler ;
251258 index-state = buildPackages . haskell-nix . internalHackageIndexState ;
252259 # Verions of hadrian that comes with 9.6 depends on `time`
261268 then ../../materialized/${ compiler-nix-name } /hadrian-ghc98
262269 else ../../materialized/${ compiler-nix-name } /hadrian-ghc99 ;
263270 modules = [ {
271+ reinstallableLibGhc = false ;
264272 # Apply the patches in a way that does not require using something
265273 # like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run
266274 # on a platform at eval time.
314322 # `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows
315323 + lib . optionalString ( enableRelocatedStaticLibs && targetPlatform . isx86_64 && ! targetPlatform . isWindows )
316324 " '*.*.ghc.*.opts += -fexternal-dynamic-refs'"
325+ # The fact that we need to set this here is pretty idiotic. GHC should figure this out on it's own.
326+ # Either have a runtime flag/setting to disable it or if dlopen fails, remember that it failed and
327+ # fall back to non-dynamic. We only have dynamic linker with musl if host and target arch match.
328+ + lib . optionalString ( targetPlatform . isAndroid || ( targetPlatform . isMusl && haskell-nix . haskellLib . isCrossTarget ) )
329+ " '*.ghc.cabal.configure.opts += --flags=-dynamic-system-linker'"
317330 # The following is required if we build on aarch64-darwin for aarch64-iOS. Otherwise older
318331 # iPhones/iPads/... won't understand the compiled code, as the compiler will emit LDSETALH
319332 # + lib.optionalString (targetPlatform.???) "'*.rts.ghc.c.opts += -optc-mcpu=apple-a7 -optc-march=armv8-a+norcpc'"
0 commit comments