summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-22 17:53:04 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-22 17:53:04 +0200
commited26eb00026800d1d2ff6289627216c7d1f0d459 (patch)
treeca4541d51c38453f614d6a9793e451781b8dfe13 /src
parentb679eaad41904e797ba27ea0c4c2be0a0ab4b830 (diff)
downloadsdcc-gas-ed26eb00026800d1d2ff6289627216c7d1f0d459.tar.gz
Ignored options.const_seg and initializer->sname
options.gasOutput is not defined yet when these options above are assigned, so they hold invalid values.
Diffstat (limited to 'src')
-rw-r--r--src/SDCCglue.c5
-rw-r--r--src/SDCCmem.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/SDCCglue.c b/src/SDCCglue.c
index 7af8bf8..dfb988b 100644
--- a/src/SDCCglue.c
+++ b/src/SDCCglue.c
@@ -260,6 +260,7 @@ 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), options.gasOutput ? "%s" : "__xinit_%s", sym->name);
SNPRINTF (newSym->rname, sizeof (newSym->rname), options.gasOutput ? "%s" : "__xinit_%s", sym->rname);
@@ -2074,7 +2075,7 @@ emitMaps (void)
emitRegularMap (code, TRUE, FALSE);
if (options.const_seg)
- dbuf_tprintf (&code->oBuf, "\t!area\n", options.const_seg);
+ dbuf_tprintf (&code->oBuf, "\t!area\n", CONST_NAME);
emitStaticSeg (statsg, &code->oBuf);
if (port->genXINIT)
@@ -2084,7 +2085,7 @@ emitMaps (void)
}
if (initializer)
{
- dbuf_tprintf (&code->oBuf, "\t!area\n", initializer->sname);
+ dbuf_tprintf (&code->oBuf, "\t!area\n", INITIALIZER_NAME);
emitStaticSeg (initializer, &code->oBuf);
}
dbuf_tprintf (&code->oBuf, "\t!area\n", c_abs->sname);
diff --git a/src/SDCCmem.h b/src/SDCCmem.h
index b706da7..feddcba 100644
--- a/src/SDCCmem.h
+++ b/src/SDCCmem.h
@@ -62,7 +62,7 @@ extern FILE *junkFile;
#define STATIC_NAME port->mem.static_name
#define HOME_NAME (options.gasOutput ? ".vectors" : port->mem.home_name)
#define OVERLAY_NAME port->mem.overlay_name
-#define CONST_NAME (options.gasOutput ? ".rodata" : port->mem.const_name)
+#define CONST_NAME (options.gasOutput ? ".text.rodata" : port->mem.const_name)
#define CABS_NAME port->mem.cabs_name
#define XABS_NAME port->mem.xabs_name
#define IABS_NAME port->mem.iabs_name