From 8ad63788c7f57564dd1c17d270e42c5518cb9d6e Mon Sep 17 00:00:00 2001
From: nickysn <nickysn@gmail.com>
Date: Sat, 14 Jun 2014 15:56:44 +0000
Subject: [PATCH] - do not emit a stack segment in the tiny memory model - rm
 the reference to the top of the stack segment from the startup code in tiny  
 model

git-svn-id: trunk@27956 -
---
 compiler/i8086/n8086util.pas | 3 ++-
 rtl/msdos/prt0comn.asm       | 8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/compiler/i8086/n8086util.pas b/compiler/i8086/n8086util.pas
index da19bfebf9..7b64a99632 100644
--- a/compiler/i8086/n8086util.pas
+++ b/compiler/i8086/n8086util.pas
@@ -47,7 +47,8 @@ implementation
   class procedure ti8086nodeutils.InsertMemorySizes;
     begin
       inherited;
-      InsertStackSegment;
+      if current_settings.x86memorymodel<>mm_tiny then
+        InsertStackSegment;
     end;
 
 
diff --git a/rtl/msdos/prt0comn.asm b/rtl/msdos/prt0comn.asm
index c968eb5a16..c7bc3010d7 100644
--- a/rtl/msdos/prt0comn.asm
+++ b/rtl/msdos/prt0comn.asm
@@ -53,11 +53,13 @@
         extern __nearheap_start
         extern __nearheap_end
 
-%ifdef __FAR_DATA__
+%ifndef __TINY__
+    %ifdef __FAR_DATA__
         extern ___stack
-%endif
-%ifdef __NEAR_DATA__
+    %endif
+    %ifdef __NEAR_DATA__
         extern ___stacktop
+    %endif
 %endif
 
         extern __SaveInt00