on iko/ghcjs-patch-master help sign in
fix: don't use fast-llvm for aarch32 (#555)

* fix: don't use fast-llvm for aarch32 fast-llvm bypasses the GHC LLVM mangler and the GNU assembler. The latter is currently required when using the gold linker for valid relocation sections. * feat: remove usage of the fast-llvm flag The fast-llvm flag was intented to avoid potential incompatibilities between LLVM and the assembler/linker toolchain by making LLVM responsible for machine-code generation. It bypasses necessary code transformation and prevents valid program generation in some cases (e.g. cross-compilation to armv6l). It is planned for removal from GHC. References: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3120 Co-authored-by: Michivi <webmaster@michvi.com>

commite08db6b66f7ce8afe6f642a1c7e8f0498ef0d78f authorLe Tuan <webmaster@michivi.com> dateMon 27 Apr 2020, 05:27 (7 years ago) parentee92d68
2 files changed+6−12
builder/comp-builder.nix+1−2 compiler/ghc/default.nix+5−10
builder/comp-builder.nix+1−2
@@ -75,9 +75,8 @@ let
7575 [ "--with-gcc=${stdenv.cc.targetPrefix}cc"
7676 ] ++
7777 # BINTOOLS
78− (if stdenv.hostPlatform.isLinux && !stdenv.targetPlatform.isAarch32
78+ (if stdenv.hostPlatform.isLinux
7979 # use gold as the linker on linux to improve link times
80− # Causes segfaults on Aarch32 though.
8180 then [
8281 "--with-ld=${stdenv.cc.bintools.targetPrefix}ld.gold"
8382 "--ghc-option=-optl-fuse-ld=gold"
compiler/ghc/default.nix+5−10
@@ -98,9 +98,6 @@ let
9898 GhcRtsHcOpts += -fPIC
9999 '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
100100 EXTRA_CC_OPTS += -std=gnu99
101− '' + stdenv.lib.optionalString useLLVM ''
102− GhcStage2HcOpts += -fast-llvm
103− GhcLibHcOpts += -fast-llvm
104101 '' + stdenv.lib.optionalString (!enableTerminfo) ''
105102 WITH_TERMINFO=NO
106103 ''
@@ -214,13 +211,11 @@ in let configured-src = stdenv.mkDerivation (rec {
214211 "--enable-bootstrap-with-devel-snapshot"
215212 ] ++ stdenv.lib.optionals (disableLargeAddressSpace) [
216213 "--disable-large-address-space"
217− ];
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− # ] ;
214+ ] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [
215+ "CFLAGS=-fuse-ld=gold"
216+ "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
217+ "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
218+ ] ;
224219
225220 outputs = [ "out" ];
226221 phases = [ "unpackPhase" "patchPhase" ]