Fixed to work with lates CDB format. Needs more work though...
[fw/sdcc] / as / mcs51 / lkrloc.c
index f6ac50bfff39e80a0d1e8091a034137fc20740de..baa056496fe455baa649ef505d3340fa5d790c1e 100644 (file)
@@ -16,9 +16,6 @@
 
 #include <stdio.h>
 #include <string.h>
-//#if !defined(_MSC_VER)
-//#include <alloc.h>
-//#endif
 #include "aslink.h"
 
 /*)Module      lkrloc.c
 /* Global which holds the upper 16 bits of the last 32 bit area adress
  * output. Useful only for iHex mode.
  */
-int    lastExtendedAddress;
+int    lastExtendedAddress=-1;
+
+/* Static variable which holds the index of last processed area.
+ * Useful only for iHex mode.
+ */
+static int lastAreaIndex = -1;
 
 /*)Function    VOID    reloc(c)
  *
@@ -531,15 +533,21 @@ relr()
                 * This is another reason why we can't have areas greater
                 * than 64K yet, even in flat24 mode.
                 */
-               extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
+       //      extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
+       //      commented out by jr 
+               
+               if (lastAreaIndex != aindex) {
+                       lastAreaIndex = aindex;
+                       newArea();
+               }
                
                if (extendedAddress != lastExtendedAddress)
                {
                
-                   #if 0
-                   printf("output extended linear address record 0x%x\n",
-                           extendedAddress);
-                   #endif
+                   if (lastExtendedAddress!=-1) {
+                     printf("output extended linear address record 0x%x 0x%x\n",
+                            extendedAddress, lastExtendedAddress);
+                   }
                    
                    if (rflag)
                    {