ghc: make disableLargeAddressSpace configurable

Even on Linux/NixOS, it can be useful to have a compiler without the
large address space as it creates issues in some contexts.
This commit is contained in:
Luis Pedro Coelho 2019-03-29 16:02:08 +01:00 committed by Peter Simons
parent 2017158b53
commit da402892dc
2 changed files with 10 additions and 4 deletions

View file

@ -32,6 +32,10 @@
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) "perf-cross"
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
}:
assert !enableIntegerSimple -> gmp != null;
@ -162,8 +166,7 @@ stdenv.mkDerivation (rec {
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
] ++ stdenv.lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];

View file

@ -30,6 +30,10 @@
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) "perf-cross"
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64
}:
assert !enableIntegerSimple -> gmp != null;
@ -157,8 +161,7 @@ stdenv.mkDerivation (rec {
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
] ++ stdenv.lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];