@@ -67,8 +67,15 @@ let self =
67
67
, useLdGold ?
68
68
# might be better check to see if cc is clang/llvm?
69
69
# 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 )
72
79
73
80
, ghc-version ? src-spec . version
74
81
, ghc-version-date ? null
246
253
then "ghc928"
247
254
else "ghc962" ;
248
255
in
249
- buildPackages . pinned- haskell-nix. tool compiler-nix-name "hadrian" {
256
+ buildPackages . haskell-nix . tool compiler-nix-name "hadrian" {
250
257
compilerSelection = p : p . haskell . compiler ;
251
258
index-state = buildPackages . haskell-nix . internalHackageIndexState ;
252
259
# Verions of hadrian that comes with 9.6 depends on `time`
261
268
then ../../materialized/${ compiler-nix-name } /hadrian-ghc98
262
269
else ../../materialized/${ compiler-nix-name } /hadrian-ghc99 ;
263
270
modules = [ {
271
+ reinstallableLibGhc = false ;
264
272
# Apply the patches in a way that does not require using something
265
273
# like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run
266
274
# on a platform at eval time.
314
322
# `-fexternal-dynamic-refs` causes `undefined reference` errors when building GHC cross compiler for windows
315
323
+ lib . optionalString ( enableRelocatedStaticLibs && targetPlatform . isx86_64 && ! targetPlatform . isWindows )
316
324
" '*.*.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'"
317
330
# The following is required if we build on aarch64-darwin for aarch64-iOS. Otherwise older
318
331
# iPhones/iPads/... won't understand the compiled code, as the compiler will emit LDSETALH
319
332
# + lib.optionalString (targetPlatform.???) "'*.rts.ghc.c.opts += -optc-mcpu=apple-a7 -optc-march=armv8-a+norcpc'"
0 commit comments