summaryrefslogtreecommitdiff
path: root/ld/writex86.c
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1997-02-25 20:42:19 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:38:07 +0200
commit4c36e9a0c125ccfff37aa440dab2cf58c4152fff (patch)
treea5d9c84ba2661029ddb2223dacd50529a361c3d5 /ld/writex86.c
parentf8de35da65c5d93bb733073cf40da154bc1c0748 (diff)
parent9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (diff)
downloaddev86-4c36e9a0c125ccfff37aa440dab2cf58c4152fff.tar.gz
Import Dev86src-0.0.11.tar.gzv0.0.11
Diffstat (limited to 'ld/writex86.c')
-rw-r--r--ld/writex86.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ld/writex86.c b/ld/writex86.c
index 2b0f00a..5dd3e8d 100644
--- a/ld/writex86.c
+++ b/ld/writex86.c
@@ -263,9 +263,9 @@ bool_pt arguzp;
if( headerless ) setsym("__segoff", (bin_off_t)(segadj[1]-segadj[0])/0x10);
if( !bits32 )
{
- if( etextoffset > 65535L )
+ if( etextoffset > 65536L )
fatalerror("text segment too large for 16bit");
- if( endoffset > 65535L )
+ if( endoffset > 65536L )
fatalerror("data segment too large for 16bit");
}
@@ -528,9 +528,11 @@ PRIVATE void writeheader()
if (uzp)
offtocn((char *) &header.a_entry, page_size(),
sizeof header.a_entry);
- offtocn((char *) &header.a_total, (bin_off_t)
- (endoffset < 0x00008000L ? endoffset+0x8000L :
- (endoffset < 0x00010000L ? 0x00010000L : endoffset + 0x0008000L)),
+ 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);
if( FILEHEADERLENGTH )
writeout((char *) &header, FILEHEADERLENGTH);