Skip to content

Commit c3c3ca4

Browse files
shumvgoloveangerman
authored andcommitted
android + ios: missing patches (#1884)
* android: missing patches * ios: missing patches
1 parent 0ca227b commit c3c3ca4

File tree

4 files changed

+65
-3
lines changed

4 files changed

+65
-3
lines changed

compiler/ghc/default.nix

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ let
177177
SplitSections = NO
178178
'' + lib.optionalString (!enableLibraryProfiling) ''
179179
BUILD_PROF_LIBS = NO
180+
'' + lib.optionalString (disableLargeAddressSpace) ''
181+
libraries/base_CONFIGURE_OPTS += --configure-option=--with-libcharset=no
180182
'';
181183

182184
# `--with` flags for libraries needed for RTS linker
@@ -210,7 +212,10 @@ let
210212
# https://gitlab.haskell.org/ghc/ghc/-/issues/23188
211213
# https://github.com/haskell/cabal/issues/8882
212214
"fp_cv_prog_ar_supports_dash_l=no"
213-
] ++ lib.optional (targetPlatform.isGhcjs) "--target=javascript-unknown-ghcjs"; # TODO use configurePlatforms once tripple is updated in nixpkgs
215+
] ++ lib.optionals (targetPlatform.isDarwin) [
216+
"--without-libcharset"
217+
] ++ lib.optional (targetPlatform.isGhcjs) "--target=javascript-unknown-ghcjs" # TODO use configurePlatforms once tripple is updated in nixpkgs
218+
;
214219

215220
# Splicer will pull out correct variations
216221
libDeps = platform: lib.optional (enableTerminfo && !targetPlatform.isGhcjs) [ targetPackages.ncurses targetPackages.ncurses.dev ]
@@ -426,8 +431,8 @@ stdenv.mkDerivation (rec {
426431
export NIX_LDFLAGS+=" -rpath $out/lib/${targetPrefix}ghc-${ghc-version}"
427432
'' + lib.optionalString stdenv.isDarwin ''
428433
export NIX_LDFLAGS+=" -no_dtrace_dof"
429-
'' +
430-
# we really want "+armv7-a,+soft-float,+neon" as features, but llvm will
434+
'' +
435+
# we really want "+armv7-a,+soft-float,+neon" as features, but llvm will
431436
# fail with those :facepalm:
432437
lib.optionalString targetPlatform.useAndroidPrebuilt ''
433438
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets

overlays/bootstrap.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ in {
286286
# Fix the bad fixups: https://gitlab.haskell.org/ghc/ghc/-/commit/2adc050857a9c1b992040fbfd55fbe65b2851b19
287287
++ final.lib.optional (versionAtLeast "9.6" && versionLessThan "9.6.4" && final.stdenv.targetPlatform.isAarch64) ./patches/ghc/2adc050857a9c1b992040fbfd55fbe65b2851b19.patch
288288
++ final.lib.optional (versionAtLeast "8.10.7" && versionLessThan "9.0" && final.stdenv.targetPlatform.isAarch64 && final.stdenv.targetPlatform.isMusl && final.stdenv.targetPlatform != final.stdenv.hostPlatform) ./patches/ghc/ghc-8.10-aarch64-musl-gettimeofday.patch
289+
++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.stdenv.targetPlatform.isAndroid) ./patches/ghc/ghc-8.10.7-weak-symbols-2.patch
290+
++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.stdenv.targetPlatform.isDarwin && final.stdenv.targetPlatform.isAarch64) ./patches/ghc/ghc-8.10.7-rts-aarch64-darwin.patch
289291
++ final.lib.optional (versionAtLeast "8.10.6" && versionLessThan "9.2" && final.stdenv.targetPlatform.isAndroid && final.stdenv.targetPlatform.isAarch32) ./patches/ghc/ghc-8.10-android.patch
290292
++ final.lib.optional (versionAtLeast "8.10.6" && versionLessThan "9.2" && final.stdenv.targetPlatform.isAndroid && final.stdenv.targetPlatform.isAarch32) ./patches/ghc/ghc-8.10.7-android-bionic-symbols.patch
291293
++ final.lib.optional (versionAtLeast "8.10.6" && versionLessThan "9.2" && final.stdenv.targetPlatform.isAndroid && final.stdenv.targetPlatform.isAarch32) ./patches/ghc/ghc-8.10.7-bionic-libc.patch
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/rts/ghc.mk b/rts/ghc.mk
2+
index 6d6ff4bb90..02d3c64ce9 100644
3+
--- a/rts/ghc.mk
4+
+++ b/rts/ghc.mk
5+
@@ -415,6 +415,13 @@ rts_CC_OPTS += -fno-strict-aliasing
6+
7+
rts_CC_OPTS += -fno-common
8+
9+
+
10+
+ifeq "$(TargetArch_CPP)" "aarch64"
11+
+ifeq "$(TargetOS_CPP)" "darwin"
12+
+rts_CC_OPTS += -mcpu=apple-a7 -march=armv8-a+norcpc
13+
+endif
14+
+endif
15+
+
16+
ifeq "$(BeConservative)" "YES"
17+
rts_CC_OPTS += -DBE_CONSERVATIVE
18+
endif
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
diff --git a/rts/Linker.c b/rts/Linker.c
2+
index 727fe74..12a22d7 100644
3+
--- a/rts/Linker.c
4+
+++ b/rts/Linker.c
5+
@@ -1810,6 +1810,8 @@ static HsInt resolveObjs_ (void)
6+
IF_DEBUG(linker, debugBelch("resolveObjs: start\n"));
7+
8+
for (ObjectCode *oc = objects; oc; oc = oc->next) {
9+
+ if(oc->status == OBJECT_RESOLVED)
10+
+ continue;
11+
int r = ocTryLoad(oc);
12+
if (!r)
13+
{
14+
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
15+
index c3f9110..1b497af 100644
16+
--- a/rts/linker/Elf.c
17+
+++ b/rts/linker/Elf.c
18+
@@ -963,10 +963,15 @@ ocGetNames_ELF ( ObjectCode* oc )
19+
stab[j].st_size, stab[j].st_value, nm);
20+
}
21+
*/
22+
- symbol->addr = (SymbolAddr*)(
23+
- (intptr_t) oc->sections[secno].start +
24+
- (intptr_t) symbol->elf_sym->st_value);
25+
- ASSERT(symbol->addr != 0x0);
26+
+ if(shndx == SHN_UNDEF && ELF_ST_BIND(symbol->elf_sym->st_info) == STB_WEAK) {
27+
+ symbol->addr = NULL;
28+
+ } else {
29+
+ symbol->addr = (SymbolAddr*)(
30+
+ (intptr_t) oc->sections[secno].start +
31+
+ (intptr_t) symbol->elf_sym->st_value);
32+
+ ASSERT(symbol->addr != 0x0);
33+
+ }
34+
+
35+
if (ELF_ST_BIND(symbol->elf_sym->st_info) == STB_LOCAL) {
36+
isLocal = true;
37+
isWeak = false;

0 commit comments

Comments
 (0)