Skip to content

Commit 58fa076

Browse files
committed
Merge remote-tracking branch 'origin/master' into hkm/embed-file
2 parents e650170 + 98830ce commit 58fa076

27 files changed

+2529
-98
lines changed

Diff for: compiler/ghc/default.nix

+16-3
Original file line numberDiff line numberDiff line change
@@ -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
@@ -246,7 +253,7 @@ let
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`
@@ -261,6 +268,7 @@ let
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.
@@ -314,6 +322,11 @@ let
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'"

Diff for: flake.lock

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/call-cabal-project-to-nix.nix

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ let
9999
(compilerSelection pkgs)."${compiler-nix-name}";
100100

101101
in let
102-
ghc = ghc';
102+
ghc = if ghc' ? latestVersion
103+
then __trace "WARNING: ${ghc'.version} is out of date, consider using upgrading to ${ghc'.latestVersion}." ghc'
104+
else ghc';
103105
subDir' = src.origSubDir or "";
104106
subDir = pkgs.lib.strings.removePrefix "/" subDir';
105107

Diff for: modules/cabal-project.nix

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ in {
1818
type = str;
1919
description = "The name of the ghc compiler to use eg. \"ghc884\"";
2020
# Map short version names to the latest GHC version.
21-
# TODO: perhaps combine this with the `latestVer` mapping in `overlays/boostrap.nix`.
2221
apply = name: pkgs.haskell-nix.resolve-compiler-name name;
2322
};
2423
compilerSelection = mkOption {

0 commit comments

Comments
 (0)