From 3fcc2d265f1521c2dcae0734de355962cc6cd7a0 Mon Sep 17 00:00:00 2001 From: Xavier ASUS Date: Mon, 21 Oct 2019 00:22:00 +0200 Subject: 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. --- src/SDCCgas.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/SDCCgas.c') diff --git a/src/SDCCgas.c b/src/SDCCgas.c index b626ee3..8055b99 100644 --- a/src/SDCCgas.c +++ b/src/SDCCgas.c @@ -45,7 +45,7 @@ void gas_glue(void) int clean_dst = 0; const char *dst = fullDstFileName; - if (!gasOutput) + if (!options.gasOutput) { werror(W_ILLEGAL_OPT_COMBINATION, __FILE__, __FUNCTION__, "this function must only be called if GAS" @@ -183,13 +183,21 @@ static void emit_rodata(FILE *const f) printf("%s.%s\n", name, field->name); - if (SPEC_LONG(ft)) + if (IS_LONG(ft)) { - fprintf(f, "\t.long %d\n", ft->select.s.const_val.v_long); + fprintf(f, "\t.long %d\n", SPEC_CVAL(ft).v_long); + } + else if (IS_INT(ft)) + { + fprintf(f, "\t.word %d\n", SPEC_CVAL(ft).v_uint); } else if (SPEC_SHORT(ft)) { - fprintf(f, "\t.hword %d\n", ft->select.s.const_val.v_int); + fprintf(f, "\t.hword %d\n", SPEC_CVAL(ft).v_int); + } + else if (IS_CHAR(ft) || IS_BOOL(ft)) + { + fprintf(f, "\t.byte %d\n", SPEC_CVAL(ft).v_char); } } } -- cgit v1.2.3