From cf1d3aec552ebaea437935e74e5eabda4bd989e7 Mon Sep 17 00:00:00 2001 From: Xavi Del Campo Date: Wed, 6 Nov 2019 04:10:53 +0100 Subject: Fixed github sdcc-gas issues #1, #2 and #4 Issue #1 was caused because code_name and data_name had been incorrectly defined as const-qualified pointers, but this must be an exception for the z80 backend, as stated by the comments. Issue #2 has been solved by removing the --gas switch from SDCCmain.c, renaming it to "--asm=" (as requested by PKK) and moved to STM8's main.c, so the option is limited to those targets supporting it. Issue #4 was because of SDCCglue.c, that generated local labels using "!labeldef" instead of "!slabeldef", causing those __str_%d labels to be printed as "__str_%d::" (the double colons stand for globa label according to asxxx documentation) instead of "__str_%d":". I ran the regression tests and most of them passed, but "wchar" returned another "Multiple definition of..." error that I cannot explain so far. It is better than nothing, though. --- src/stm8/main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/stm8') diff --git a/src/stm8/main.c b/src/stm8/main.c index 3226aae..b8c91a5 100644 --- a/src/stm8/main.c +++ b/src/stm8/main.c @@ -36,6 +36,7 @@ #define OPTION_CODE_SEG "--codeseg" #define OPTION_CONST_SEG "--constseg" #define OPTION_ELF "--out-fmt-elf" +#define OPTION_ASM "--asm=" extern DEBUGFILE dwarf2DebugFile; extern int dwarf2FinalizeFile(FILE *); @@ -46,6 +47,7 @@ static OPTION stm8_options[] = { {0, OPTION_CODE_SEG, &options.code_seg, " use this name for the code segment", CLAT_STRING}, {0, OPTION_CONST_SEG, &options.const_seg, " use this name for the const segment", CLAT_STRING}, {0, OPTION_ELF, NULL, "Output executable in ELF format (deprecated)"}, + {0, OPTION_ASM, NULL, "Define assembler name (asxxxx/gas)"}, {0} }; @@ -179,6 +181,21 @@ stm8_parseOptions (int *pargc, char **argv, int *i) debugFile = &dwarf2DebugFile; return TRUE; } + else if (!strncmp (argv[*i], OPTION_ASM, sizeof (OPTION_ASM) - 1)) + { + char *asmblr = getStringArg (OPTION_ASM, argv, i, *pargc); + + if (!strcmp (asmblr, "gas")) + { + options.gasOutput = true; + return TRUE; + } + else if (!strcmp (asmblr, "asxxxx")) + { + options.gasOutput = false; + return TRUE; + } + } return FALSE; } -- cgit v1.2.3