summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2018-11-22 11:43:15 -0500
committerBen Gamari <ben@smart-cactus.org>2018-11-22 12:11:16 -0500
commit06a09a5b5764717121be41d32f7b30f58ae33e08 (patch)
treeaaac71ea28f28e1fa52d1d411a0f61ec99df5c32 /rts
parent86f6890e3689f2f75ecca8172eda0338fe3e9769 (diff)
downloadhaskell-06a09a5b5764717121be41d32f7b30f58ae33e08.tar.gz
rts: Fix bss initialization on Windows
This patch fixes BSS initialization such that it is initialized to 0 as you'd expect. Test Plan: ./validate, test T7040_ghci Reviewers: bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15669 Differential Revision: https://phabricator.haskell.org/D5364
Diffstat (limited to 'rts')
-rw-r--r--rts/linker/PEi386.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index ab4583da7c..fbd12644fd 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -1437,8 +1437,8 @@ ocGetNames_PEi386 ( ObjectCode* oc )
{
bool has_code_section = false;
- SymbolName* sname;
- SymbolAddr* addr;
+ SymbolName* sname = NULL;
+ SymbolAddr* addr = NULL;
unsigned int i;
COFF_HEADER_INFO *info = oc->info->ch_info;
@@ -1567,11 +1567,10 @@ ocGetNames_PEi386 ( ObjectCode* oc )
Allocate zeroed space for it */
bss_sz = section.info->virtualSize;
if (bss_sz < section.size) { bss_sz = section.size; }
- bss_sz = section.info->alignment;
zspace = stgCallocBytes(1, bss_sz, "ocGetNames_PEi386(anonymous bss)");
- oc->sections[i].start = getAlignedMemory(zspace, section);
+ oc->sections[i].start = zspace;
oc->sections[i].size = bss_sz;
- addProddableBlock(oc, zspace, bss_sz);
+ section = oc->sections[i];
/* debugBelch("BSS anon section at 0x%x\n", zspace); */
}
@@ -1592,9 +1591,9 @@ ocGetNames_PEi386 ( ObjectCode* oc )
if (sz < section.info->virtualSize) sz = section.info->virtualSize;
start = section.start;
- end = start + sz - 1;
+ end = start + sz;
- if (kind != SECTIONKIND_OTHER && end >= start) {
+ if (kind != SECTIONKIND_OTHER && end > start) {
/* See Note [Section alignment]. */
addCopySection(oc, &oc->sections[i], kind, SECTION_NOMEM, start, sz);
addProddableBlock(oc, oc->sections[i].start, sz);