change to initialized data segment before emitting the segment
[fw/sdcc] / src / SDCCmem.c
index 29fcc84093ee7fb5892fd63f5271e9cfcad77669..7e6c60b7349601954f95e6d2e08b3501a2fe88b5 100644 (file)
@@ -264,11 +264,16 @@ void
 allocIntoSeg (symbol * sym)
 {
   memmap *segment = SPEC_OCLS (sym->etype);
+  // should we move this to the initialized data segment?
+  if (port->genXINIT && segment==xdata &&
+      sym->ival && sym->level==0 && !SPEC_ABSA(sym->etype)) {
+    segment=SPEC_OCLS(sym->etype)=xidata;
+  }
   addSet (&segment->syms, sym);
 }
 
 /*-----------------------------------------------------------------*/
-/* allocGlobal - aassigns the output segment to a global var       */
+/* allocGlobal - assigns the output segment to a global var       */
 /*-----------------------------------------------------------------*/
 void 
 allocGlobal (symbol * sym)