summaryrefslogtreecommitdiff
path: root/src/SDCCglue.c
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-21 03:04:31 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-21 03:04:31 +0200
commit41e45c2e8d8083be3157f2d7e884adf454332358 (patch)
treeda1e5cb9d6495fd79ea0514d57baa4690b5bd6c7 /src/SDCCglue.c
parent3fcc2d265f1521c2dcae0734de355962cc6cd7a0 (diff)
downloadsdcc-gas-41e45c2e8d8083be3157f2d7e884adf454332358.tar.gz
GNU as now assembles successfully
A new (untested) startup routine has been written for GNU as. Section names have been considered from stm8-binutils linker script.
Diffstat (limited to 'src/SDCCglue.c')
-rw-r--r--src/SDCCglue.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/SDCCglue.c b/src/SDCCglue.c
index 77a56ce..e8ea6b9 100644
--- a/src/SDCCglue.c
+++ b/src/SDCCglue.c
@@ -154,7 +154,7 @@ emitRegularMap (memmap *map, bool addPublics, bool arFlag)
if (options.gasOutput && !map->syms)
return;
- if (addPublics)
+ if (addPublics && !options.gasOutput)
{
/* PENDING: special case here - should remove */
if (!strcmp (map->sname, CODE_NAME))
@@ -162,8 +162,7 @@ emitRegularMap (memmap *map, bool addPublics, bool arFlag)
else if (!strcmp (map->sname, DATA_NAME))
{
dbuf_tprintf (&map->oBuf, "\t!areadata\n", map->sname);
- if (options.data_seg && strcmp (DATA_NAME, options.data_seg) && !options.gasOutput)
- /* GNU as only needs .bss. */
+ if (options.data_seg && strcmp (DATA_NAME, options.data_seg))
dbuf_tprintf (&map->oBuf, "\t!area\n", options.data_seg);
}
else if (!strcmp (map->sname, HOME_NAME))
@@ -174,6 +173,15 @@ emitRegularMap (memmap *map, bool addPublics, bool arFlag)
if (map->regsp)
dbuf_tprintf (&map->oBuf, "\t!org\n", 0);
}
+ else if (options.gasOutput)
+ if (map == code)
+ 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))
{
@@ -2497,7 +2505,7 @@ glue (void)
snprintf( section_name, sizeof section_name / sizeof *section_name,
".%s", start_stack);
/* Set alloc/write flags. */
- tfprintf(asmFile, "\t!area , \"aw\", @progbits\n", section_name);
+ tfprintf(asmFile, "\t!area , \"aw\"\n", section_name);
tfprintf(asmFile, "\t!local\n", start_stack);
tfprintf(asmFile, "\t!comm\n\n", start_stack, size, 1);
}
@@ -2686,7 +2694,7 @@ glue (void)
fprintf (asmFile, "%s", iComments2);
fprintf (asmFile, "; code\n");
fprintf (asmFile, "%s", iComments2);
- tfprintf (asmFile, "\t!areacode\n", options.code_seg);
+ tfprintf (asmFile, "\t!areacode\n", CODE_NAME);
dbuf_write_and_destroy (&code->oBuf, asmFile);
if (port->genAssemblerEnd)