Skip to content

Commit 89c3417

Browse files
committed
Create ghc-8.10.7-weak-symbols-2.diff
1 parent 044c767 commit 89c3417

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

overlays/bootstrap.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ in {
228228
++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.targetPlatform.isAndroid) ./patches/ghc/ghc-8.10.7-linker-weak-and-common.patch
229229
++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.targetPlatform.isAndroid) ./patches/ghc/libc-memory-symbols.patch
230230
++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.targetPlatform.isAndroid) ./patches/ghc/android-base-needs-iconv.patch
231+
++ final.lib.optional (versionAtLeast "8.10" && versionLessThan "9.0" && final.targetPlatform.isAndroid) ./patches/ghc/ghc-8.10.7-weak-symbols-2.patch
231232
;
232233
in ({
233234
ghc844 = final.callPackage ../compiler/ghc (traceWarnOld "8.4" {
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)