summaryrefslogtreecommitdiff
path: root/src/SDCCmain.c
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-23 03:57:38 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-23 03:57:38 +0200
commit9c47d08e98953623ceac02c8422863e593deb40e (patch)
tree69c881d20ac0bc878bdd91da8dc2e668374a3dbc /src/SDCCmain.c
parent4df948b3c184864525e7fa7e26ab380a70d644cd (diff)
downloadsdcc-gas-9c47d08e98953623ceac02c8422863e593deb40e.tar.gz
Implemented -c support for --gas
STM8 code generator was generating some instructions in a "ld register, (#%d, register)" way, causing assembling errors on stm8-as. This is because stm8-as does not require the '#' character. A quick and dirty workaround has been implemented for this. Added new warning W_IGNORED_OPT_IN_ASM, which warns the user when both "--no-optsdcc-in-asm" and "--gas" are used (the first is ignored when the latter is active since GNU as does not accept the .optsdcc directive, as opposed to asxxx).
Diffstat (limited to 'src/SDCCmain.c')
-rw-r--r--src/SDCCmain.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/SDCCmain.c b/src/SDCCmain.c
index feb8f5f..015e3c1 100644
--- a/src/SDCCmain.c
+++ b/src/SDCCmain.c
@@ -1512,7 +1512,7 @@ parseCmdLine (int argc, char **argv)
deleteSet (&relFilesSet);
deleteSet (&libFilesSet);
- if (options.cc_only || noAssemble || preProcOnly || options.gasOutput)
+ if (options.cc_only || noAssemble || preProcOnly)
{
werror (W_ILLEGAL_OPT_COMBINATION);
}
@@ -1956,8 +1956,11 @@ assemble (char **envp)
}
else
{
+ const char *const ext = options.gasOutput ?
+ port->linker.o_ext
+ : port->linker.rel_ext;
/* the assembled file gets the name of the first module */
- dbuf_printf (&asmName, "%s%s", dstFileName, port->linker.rel_ext);
+ dbuf_printf (&asmName, "%s%s", dstFileName, ext);
}
if (port->assembler.cmd)
@@ -1966,8 +1969,8 @@ assemble (char **envp)
char *dfn = shell_escape (dstFileName);
char *asmn = shell_escape (dbuf_c_str (&asmName));
- buf = buildCmdLine (port->assembler.cmd, dfn, asmn,
- options.debug ? port->assembler.debug_opts : port->assembler.plain_opts, asmOptionsSet);
+ buf = buildCmdLine (options.gasOutput ? port->assembler.binutils_cmd : port->assembler.cmd,
+ dfn, asmn, options.debug ? port->assembler.debug_opts : port->assembler.plain_opts, asmOptionsSet);
Safe_free (dfn);
Safe_free (asmn);
}
@@ -2684,7 +2687,7 @@ main (int argc, char **argv, char **envp)
if (fatalError)
exit (EXIT_FAILURE);
- if (!options.c1mode && !noAssemble && !options.gasOutput)
+ if (!options.c1mode && !noAssemble)
{
if (options.verbose)
printf ("sdcc: Calling assembler...\n");
@@ -2696,7 +2699,7 @@ main (int argc, char **argv, char **envp)
if (options.debug && debugFile)
debugFile->closeFile ();
- if (!options.cc_only && !fatalError && !noAssemble && !options.gasOutput && !options.c1mode && (fullSrcFileName || peekSet (relFilesSet) != NULL))
+ if (!options.cc_only && !fatalError && !noAssemble && !options.c1mode && (fullSrcFileName || peekSet (relFilesSet) != NULL))
{
if (options.verbose)
printf ("sdcc: Calling linker...\n");