summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-22 17:30:14 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-22 17:31:19 +0200
commitb679eaad41904e797ba27ea0c4c2be0a0ab4b830 (patch)
tree9854206fb09a7981d19f9877ea232b281531224c /src
parent5a0c2910df62b99fee8baec1f4d846217cd9a054 (diff)
.data symbols are now allocated correctly
.data only needs a label with the smybol name and .byte/.word directives defining it. Therefore, INITIALIZED_NAME is ignored since no allocation must be done from emitRegularMap() for .data.
Diffstat (limited to 'src')
-rw-r--r--src/SDCCglue.c34
-rw-r--r--src/SDCCmem.h4
2 files changed, 19 insertions, 19 deletions
diff --git a/src/SDCCglue.c b/src/SDCCglue.c
index 1fc3d6d..7af8bf8 100644
--- a/src/SDCCglue.c
+++ b/src/SDCCglue.c
@@ -178,10 +178,6 @@ emitRegularMap (memmap *map, bool addPublics, bool arFlag)
dbuf_tprintf (&map->oBuf, "\t!area\n", ".text");
else if (map == data)
dbuf_tprintf (&map->oBuf, "\t!area\n", DATA_NAME);
- else if (map == initialized)
- dbuf_tprintf (&map->oBuf, "\t!area\n", INITIALIZED_NAME);
- else if (map == initializer)
- dbuf_tprintf (&map->oBuf, "\t!area\n", INITIALIZER_NAME);
for (sym = setFirstItem (map->syms); sym; sym = setNextItem (map->syms))
{
@@ -264,8 +260,8 @@ emitRegularMap (memmap *map, bool addPublics, bool arFlag)
in the static seg */
newSym = copySymbol (sym);
SPEC_OCLS (newSym->etype) = (SPEC_OCLS (sym->etype) == xidata) ? xinit : initializer;
- SNPRINTF (newSym->name, sizeof (newSym->name), "__xinit_%s", sym->name);
- SNPRINTF (newSym->rname, sizeof (newSym->rname), "__xinit_%s", sym->rname);
+ SNPRINTF (newSym->name, sizeof (newSym->name), options.gasOutput ? "%s" : "__xinit_%s", sym->name);
+ SNPRINTF (newSym->rname, sizeof (newSym->rname), options.gasOutput ? "%s" : "__xinit_%s", sym->rname);
/* find the first non-array link */
t = newSym->type;
@@ -386,18 +382,22 @@ emitRegularMap (memmap *map, bool addPublics, bool arFlag)
else
dbuf_printf (&map->oBuf, "==.\n");
}
- if (IS_STATIC (sym->etype) || sym->level)
- if (options.gasOutput)
- dbuf_tprintf (&map->oBuf, "\t!local\n", sym->rname);
- else
- dbuf_tprintf (&map->oBuf, "!slabeldef\n", sym->rname);
- else
- if (options.gasOutput)
- dbuf_tprintf (&map->oBuf, "!global\n", sym->rname);
- else
- dbuf_tprintf (&map->oBuf, "!labeldef\n", sym->rname);
- emit_ds_comm(&map->oBuf, sym->rname, size & 0xffff, 1/* TBD */);
+ if ((map != initialized && options.gasOutput) || !options.gasOutput)
+ {
+ if (IS_STATIC (sym->etype) || sym->level)
+ if (options.gasOutput)
+ dbuf_tprintf (&map->oBuf, "\t!local\n", sym->rname);
+ else
+ dbuf_tprintf (&map->oBuf, "!slabeldef\n", sym->rname);
+ else
+ if (options.gasOutput)
+ dbuf_tprintf (&map->oBuf, "!global\n", sym->rname);
+ else
+ dbuf_tprintf (&map->oBuf, "!labeldef\n", sym->rname);
+
+ emit_ds_comm(&map->oBuf, sym->rname, size & 0xffff, 1/* TBD */);
+ }
}
sym->ival = NULL;
diff --git a/src/SDCCmem.h b/src/SDCCmem.h
index 7ee2728..b706da7 100644
--- a/src/SDCCmem.h
+++ b/src/SDCCmem.h
@@ -50,8 +50,8 @@ extern FILE *junkFile;
#define ISTACK_NAME port->mem.istack_name
#define CODE_NAME (options.gasOutput ? ".text" : port->mem.code_name)
#define DATA_NAME (options.gasOutput ? ".bss" : port->mem.data_name)
-#define INITIALIZED_NAME (options.gasOutput ? ".data" : port->mem.data_name)
-#define INITIALIZER_NAME (options.gasOutput ? ".data.rodata" : port->mem.data_name)
+#define INITIALIZED_NAME port->mem.data_name
+#define INITIALIZER_NAME (options.gasOutput ? ".data" : port->mem.data_name)
#define IDATA_NAME port->mem.idata_name
#define PDATA_NAME port->mem.pdata_name
#define XDATA_NAME port->mem.xdata_name