summaryrefslogtreecommitdiff
path: root/ld/writex86.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/writex86.c')
-rw-r--r--ld/writex86.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ld/writex86.c b/ld/writex86.c
index 86c3157..70ecdde 100644
--- a/ld/writex86.c
+++ b/ld/writex86.c
@@ -146,6 +146,7 @@ bool_pt argxsym;
curseg = 0; /* text seg, s.b. variable */
symres("__etext");
symres("__segoff");
+ symres("__heap_top");
/* calculate segment and common sizes (sum over loaded modules) */
/* use zero init of segsz[] */
@@ -315,6 +316,11 @@ bool_pt argxsym;
fatalerror("data segment too large for 16bit");
}
+ if( heap_top_value < 0x100 || endoffset > heap_top_value-0x100)
+ heap_top_value = endoffset + 0x8000;
+ if( heap_top_value > 0x10000 && !bits32 ) heap_top_value = 0x10000;
+ setsym("__heap_top", (bin_off_t)heap_top_value);
+
openout(outfilename);
writeheader();
for (modptr = modfirst; modptr != NUL_PTR; modptr = modptr->modnext)
@@ -614,9 +620,6 @@ PRIVATE void writeheader()
if (uzp)
offtocn((char *) &header.a_entry, page_size(),
sizeof header.a_entry);
- if( heap_top_value < 0x100 || endoffset > heap_top_value-0x100)
- heap_top_value = endoffset + 0x8000;
- if( heap_top_value > 0x10000 && !bits32 ) heap_top_value = 0x10000;
offtocn((char *) &header.a_total, (bin_off_t) heap_top_value,
sizeof header.a_total);