summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorKyrill Briantsev <kyrab@mail.ru>2014-02-04 05:00:33 -0600
committerAustin Seipp <austin@well-typed.com>2014-02-04 05:00:33 -0600
commit2b33f6e8045fcd00f19883bb5e8895cbaf1bf81e (patch)
tree3c3ad5ff03b38a3f4774c283f12b0cc34eea19fc /rts/Linker.c
parentdba9bf6723472eaf4be4813a6ca5ed910e33395d (diff)
downloadhaskell-2b33f6e8045fcd00f19883bb5e8895cbaf1bf81e.tar.gz
Final fix to #7134 (and #8717 as well.)
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 9bb377c492..b9c8fd001a 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -3491,8 +3491,8 @@ allocateImageAndTrampolines (
/* For 32-bit case we don't need this, hence we use macro PEi386_IMAGE_OFFSET,
which equals to 4 for 64-bit case and 0 for 32-bit case. */
/* We allocate trampolines area for all symbols right behind
- image data, aligned on 16. */
- size = ((PEi386_IMAGE_OFFSET + size + 0xf) & ~0xf)
+ image data, aligned on 8. */
+ size = ((PEi386_IMAGE_OFFSET + size + 0x7) & ~0x7)
+ hdr.NumberOfSymbols * sizeof(SymbolExtra);
#endif
image = VirtualAlloc(NULL, size,
@@ -4147,7 +4147,7 @@ static int
ocAllocateSymbolExtras_PEi386 ( ObjectCode* oc )
{
oc->symbol_extras = (SymbolExtra*)(oc->image - PEi386_IMAGE_OFFSET
- + ((PEi386_IMAGE_OFFSET + oc->fileSize + 0xf) & ~0xf));
+ + ((PEi386_IMAGE_OFFSET + oc->fileSize + 0x7) & ~0x7));
oc->first_symbol_extra = 0;
oc->n_symbol_extras = ((COFF_header*)oc->image)->NumberOfSymbols;
@@ -4161,7 +4161,7 @@ makeSymbolExtra_PEi386( ObjectCode* oc, size_t s, char* symbol )
SymbolExtra *extra;
curr_thunk = oc->first_symbol_extra;
- if (curr_thunk > oc->n_symbol_extras) {
+ if (curr_thunk >= oc->n_symbol_extras) {
barf("Can't allocate thunk for %s", symbol);
}
@@ -4172,14 +4172,6 @@ makeSymbolExtra_PEi386( ObjectCode* oc, size_t s, char* symbol )
extra->addr = (uint64_t)s;
memcpy(extra->jumpIsland, jmp, 6);
- /* DLL-imported symbols are inserted here.
- Others are inserted in ocGetNames_PEi386.
- */
- if(lookupStrHashTable(symhash, symbol) == NULL) {
- ghciInsertSymbolTable(oc->fileName, symhash, symbol, extra->jumpIsland,
- HS_BOOL_FALSE, oc);
- }
-
oc->first_symbol_extra++;
return (size_t)extra->jumpIsland;