[commit: ghc] master: rts: Fix bss initialization on Windows (06a09a5)
git at git.haskell.org
git at git.haskell.org
Thu Nov 22 18:43:49 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/06a09a5b5764717121be41d32f7b30f58ae33e08/ghc
>---------------------------------------------------------------
commit 06a09a5b5764717121be41d32f7b30f58ae33e08
Author: Tamar Christina <tamar at zhox.com>
Date: Thu Nov 22 11:43:15 2018 -0500
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
>---------------------------------------------------------------
06a09a5b5764717121be41d32f7b30f58ae33e08
rts/linker/PEi386.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index ab4583d..fbd1264 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);
More information about the ghc-commits
mailing list