on iko/ghcjs-patch-master help sign in
fix: not use ld.gold on aarch32 (#548)

It seems that using ld.gold for cross-compilation to aarch32 results in Haskell programs segfaulting when launched. Co-authored-by: Michivi <webmaster@michvi.com>

commitdc3d1a7bfc4ee43d97864179727f80a527307a90 authorLe Tuan <webmaster@michivi.com> dateFri 17 Apr 2020, 13:54 (7 years ago) parent0ff5dd3
2 files changed+9−12
builder/comp-builder.nix+2−1 compiler/ghc/default.nix+7−11
builder/comp-builder.nix+2−1
@@ -75,8 +75,9 @@ let
7575 [ "--with-gcc=${stdenv.cc.targetPrefix}cc"
7676 ] ++
7777 # BINTOOLS
78− (if stdenv.hostPlatform.isLinux
78+ (if stdenv.hostPlatform.isLinux && !stdenv.targetPlatform.isAarch32
7979 # use gold as the linker on linux to improve link times
80+ # Causes segfaults on Aarch32 though.
8081 then [
8182 "--with-ld=${stdenv.cc.bintools.targetPrefix}ld.gold"
8283 "--ghc-option=-optl-fuse-ld=gold"
compiler/ghc/default.nix+7−11
@@ -42,13 +42,7 @@
4242 # specific flavour and falls back to ghc default values.
4343 ghcFlavour ? stdenv.lib.optionalString haskell-nix.haskellLib.isCrossTarget (
4444 if useLLVM
45− then (
46− # TODO check if the issues with qemu and Aarch32 persist. See
47− # https://github.com/input-output-hk/haskell.nix/pull/411/commits/1986264683067198e7fdc1d665351622b664712e
48− if stdenv.targetPlatform.isAarch32
49− then "quick-cross"
50− else "perf-cross"
51− )
45+ then "perf-cross"
5246 else "perf-cross-ncg"
5347 )
5448
@@ -218,13 +212,15 @@ in let configured-src = stdenv.mkDerivation (rec {
218212 "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
219213 ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
220214 "--enable-bootstrap-with-devel-snapshot"
221− ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [
222− "CFLAGS=-fuse-ld=gold"
223− "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
224− "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
225215 ] ++ stdenv.lib.optionals (disableLargeAddressSpace) [
226216 "--disable-large-address-space"
227217 ];
218+ # FIXME Currently causes segfaults on armv6l cross-compilation.
219+ # ++ stdenv.lib.optionals (targetPlatform.isAarch32) [
220+ # "CFLAGS=-fuse-ld=gold"
221+ # "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
222+ # "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
223+ # ] ;
228224
229225 outputs = [ "out" ];
230226 phases = [ "unpackPhase" "patchPhase" ]