* sebugger/mcs51/sdcdb.c: replaced isblank() with isspace()
[fw/sdcc] / src / SDCCglue.c
index be6d80e76d1bda3ecf1403788b99c12efdc5e01d..a4b8d4f8cf7a9891105d0afb1d8857bce73949db 100644 (file)
@@ -1276,8 +1276,8 @@ emitStaticSeg (memmap * map, FILE * out)
         fprintf (out, "%s$%d$%d", sym->name, sym->level, sym->block);
       }
       
-      /* if it has an absolute address */
-      if (SPEC_ABSA (sym->etype))
+      /* if it has an absolute address and no initializer */
+      if (SPEC_ABSA (sym->etype) && !sym->ival)
         {
           if (options.debug)
             fprintf (out, " == 0x%04x\n", SPEC_ADDR (sym->etype));
@@ -1294,6 +1294,10 @@ emitStaticSeg (memmap * map, FILE * out)
           /* if it has an initial value */
           if (sym->ival)
             {
+              if (SPEC_ABSA (sym->etype))
+                {
+                  tfprintf (out, "\t!org\n", SPEC_ADDR (sym->etype));
+                }
               fprintf (out, "%s:\n", sym->rname);
               noAlloc++;
               resolveIvalSym (sym->ival, sym->type);
@@ -1361,6 +1365,8 @@ emitMaps (void)
     tfprintf (code->oFile, "\t!area\n", xinit->sname);
     emitStaticSeg (xinit, code->oFile);
   }
+  tfprintf (code->oFile, "\t!area\n", c_abs->sname);
+  emitStaticSeg (c_abs, code->oFile);
   inInitMode--;
 }
 
@@ -1960,7 +1966,7 @@ glue (void)
 /** Creates a temporary file with unique file name
     Scans, in order:
     - TMP, TEMP, TMPDIR env. variables
-    - if Un*x system: /usr/tmp and /tmp
+    - if Un*x system: /tmp and /var/tmp
     - root directory using mkstemp() if available
     - default location using tempnam()
 */
@@ -1993,14 +1999,14 @@ tempfileandname(char *fname, size_t len)
   }
 #else
   {
-    /* try with /usr/tmp and /tmp on Un*x systems */
+    /* try with /tmp and /var/tmp on Un*x systems */
     struct stat statbuf;
 
     if (tmpdir == NULL) {
-      if (stat("/usr/tmp", &statbuf) != -1)
-        tmpdir = "/usr/tmp";
-      else if (stat("/tmp", &statbuf) != -1)
+      if (stat("/tmp", &statbuf) != -1)
         tmpdir = "/tmp";
+      else if (stat("/var/tmp", &statbuf) != -1)
+        tmpdir = "/var/tmp";
     }
   }
 #endif