Ignored options.const_seg and initializer->sname

options.gasOutput is not defined yet when these options above are assigned, so they hold invalid values.
This commit is contained in:
Xavier ASUS 2019-10-22 17:53:04 +02:00
parent b679eaad41
commit ed26eb0002
2 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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