Skip to content

Commit 595d54f

Browse files
committed
Fix PEi386
1 parent 926e28c commit 595d54f

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

overlays/patches/ghc/ghc-9.6-0006-Adds-support-for-Hidden-symbols.patch

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ index c3a5b5d..b826af8 100644
2929
+ default: barf("symbolTypeString: unknown symbol type (%d)", type);
3030
}
3131
}
32-
32+
3333
@@ -277,10 +277,19 @@ int ghciInsertSymbolTable(
3434
}
3535
else if (pinfo->type ^ type)
@@ -58,7 +58,7 @@ index c3a5b5d..b826af8 100644
5858
);
5959
+ debugBelch("Address of new symbol: %p, old symbol: %p\n", data, pinfo->value);
6060
+ debugBelch("Type of symbol; new: %d, existing: %d\n", type, pinfo->type);
61-
61+
6262
return 0;
6363
}
6464
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
@@ -72,8 +72,8 @@ index 6cadaa8..3beac1d 100644
7272
+ SYM_TYPE_HIDDEN = 1 << 4, /* the symbol is hidden and should not be exported */
7373
+
7474
} SymType;
75-
76-
75+
76+
7777
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
7878
index 9f56812..05db9b3 100644
7979
--- a/rts/linker/Elf.c
@@ -85,9 +85,9 @@ index 9f56812..05db9b3 100644
8585
+ if(ELF_ST_VISIBILITY(symbol->elf_sym->st_other) == STV_HIDDEN) {
8686
+ sym_type |= SYM_TYPE_HIDDEN;
8787
+ }
88-
88+
8989
/* And the decision is ... */
90-
90+
9191
diff --git a/rts/linker/ElfTypes.h b/rts/linker/ElfTypes.h
9292
index 24e29a1..d3524e1 100644
9393
--- a/rts/linker/ElfTypes.h
@@ -116,7 +116,26 @@ diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
116116
index 010dc8f..c6f82b7 100644
117117
--- a/rts/linker/PEi386.c
118118
+++ b/rts/linker/PEi386.c
119-
@@ -1942,7 +1942,7 @@ static size_t
119+
@@ -1897,6 +1897,9 @@ ocGetNames_PEi386 ( ObjectCode* oc )
120+
sname[size-start]='\0';
121+
stgFree(tmp);
122+
sname = strdup (sname);
123+
+ if(secNumber == IMAGE_SYM_UNDEFINED)
124+
+ type |= SYM_TYPE_HIDDEN;
125+
+
126+
if (!ghciInsertSymbolTable(oc->fileName, symhash, sname,
127+
addr, false, type, oc))
128+
return false;
129+
@@ -1919,6 +1922,8 @@ ocGetNames_PEi386 ( ObjectCode* oc )
130+
if (isWeak) {
131+
setWeakSymbol(oc, sname);
132+
}
133+
+ if(secNumber == IMAGE_SYM_UNDEFINED)
134+
+ type |= SYM_TYPE_HIDDEN;
135+
136+
if (! ghciInsertSymbolTable(oc->fileName, symhash, sname, addr,
137+
isWeak, type, oc))
138+
@@ -1946,7 +1946,7 @@ static size_t
120139
makeSymbolExtra_PEi386( ObjectCode* oc, uint64_t index STG_UNUSED, size_t s, char* symbol STG_UNUSED, SymType type )
121140
{
122141
SymbolExtra *extra;
@@ -125,6 +144,6 @@ index 010dc8f..c6f82b7 100644
125144
case SYM_TYPE_CODE: {
126145
// jmp *-14(%rip)
127146
extra = m32_alloc(oc->rx_m32, sizeof(SymbolExtra), 8);
128-
--
147+
--
129148
2.33.0
130149

0 commit comments

Comments
 (0)