Skip to content

Commit e08db6b

Browse files
michiviMichivi
andauthored
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 <[email protected]>
1 parent ee92d68 commit e08db6b

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

builder/comp-builder.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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" ]

0 commit comments

Comments
 (0)