diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-21 00:22:00 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-21 00:22:00 +0200 |
| commit | 3fcc2d265f1521c2dcae0734de355962cc6cd7a0 (patch) | |
| tree | 9f914b554fa9af110fda60e6a3962fe9e3a40423 /src/stm8 | |
| parent | a2a263dd383d76e4ee0ed62f393376ef2ae49171 (diff) | |
| download | sdcc-gas-3fcc2d265f1521c2dcae0734de355962cc6cd7a0.tar.gz | |
More work on GNU as generation
On _gas_mapping, label definitions do not allow "::". ":" must be
used instead.
gasOutput is now part of "options".
Unneeded sections, such as HOME/GSINIT/etc., are no longer declared
and/or defined. GNU as just does not need them.
Startup function name must equal "_start" for GNU ld.
The value of some macros, such as CODE_NAME or DATA_NAME, must change
according to options.gasOutput, as "CODE" or "DATA" (among many others)
are not understood by GNU as.
STM8 port now selects GNU as format on --gas switch enabled.
Diffstat (limited to 'src/stm8')
| -rw-r--r-- | src/stm8/main.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/stm8/main.c b/src/stm8/main.c index 49731a0..c183137 100644 --- a/src/stm8/main.c +++ b/src/stm8/main.c @@ -30,6 +30,7 @@ #include "dbuf_string.h" #include "peep.h" #include "SDCCgas.h" +#include "SDCCglobl.h" #define OPTION_MEDIUM_MODEL "--model-medium" #define OPTION_LARGE_MODEL "--model-large" @@ -154,7 +155,6 @@ stm8_genAssemblerEnd (FILE *of) static void stm8_init (void) { - asm_addTree (&asm_asxxxx_mapping); } @@ -187,6 +187,8 @@ stm8_parseOptions (int *pargc, char **argv, int *i) static void stm8_finaliseOptions (void) { + asm_addTree (options.gasOutput ? &asm_gas_mapping : &asm_asxxxx_mapping); + port->mem.default_local_map = data; port->mem.default_globl_map = data; @@ -238,7 +240,11 @@ stm8_genExtraArea (FILE *of, bool hasMain) static void stm8_genInitStartup (FILE *of) { - fprintf (of, "__sdcc_gs_init_startup:\n"); + const char *const startup = options.gasOutput ? + "_start" + : "__sdcc_gs_init_startup"; + + tfprintf (of, "!labeldef\n", startup); if (options.stack_loc >= 0) { @@ -247,7 +253,7 @@ stm8_genInitStartup (FILE *of) } /* Init static & global variables */ - fprintf (of, "__sdcc_init_data:\n"); + tfprintf (of, "!labeldef\n", "__sdcc_init_data"); fprintf (of, "; stm8_genXINIT() start\n"); /* Zeroing memory (required by standard for static & global variables) */ @@ -277,7 +283,13 @@ int stm8_genIVT(struct dbuf_s * oBuf, symbol ** intTable, int intCount) { int i; - dbuf_tprintf (oBuf, "\tint s_GSINIT ; reset\n"); + + if (options.gasOutput) + { + dbuf_tprintf(oBuf, "!area , \"ax\", @progbits\n", ".text.__interrupt"); + } + + dbuf_tprintf(oBuf, "\tint s_GSINIT ; reset\n"); if(intCount > STM8_INTERRUPTS_COUNT) { |
