[PATCH] gas: z80: allow -c option for compatibility

Zeal8bit contact@zeal8bit.com
Thu Jun 26 13:43:59 GMT 2025


Hello,
I encountered an issue when making a CMake-based project that uses `z80-elf-as` as the assembler.
The option `-c` is always generated to assemble a file, and it triggers the following error:

    z80-elf-as: option '-c' is ambiguous; possibilities: '-compress-debug-sections' '-colonless'
    
However, providing `-c` when assembling files using x86_64-target or RISC-V-target versions of GAS don't trigger any issue, thus it seems like there is a compatibility issue for the Z80-target version.
This patch will make the latter accept (and ignore) the `-c` option. 

---
 gas/config/tc-z80.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 3abc0268..da05ee0e 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -56,6 +56,7 @@ enum options
   OPTION_FP_DOUBLE_FORMAT,
   OPTION_COMPAT_LL_PREFIX,
   OPTION_COMPAT_COLONLESS,
+  OPTION_COMPAT_C_IGNORE,
   OPTION_COMPAT_SDCC
 };
 
@@ -96,6 +97,7 @@ const struct option md_longopts[] =
   { "Wnins",     required_argument, NULL, OPTION_MACH_INST},
   { "without-inst", required_argument, NULL, OPTION_MACH_NO_INST},
   { "local-prefix", required_argument, NULL, OPTION_COMPAT_LL_PREFIX},
+  { "c" ,        no_argument, NULL, OPTION_COMPAT_C_IGNORE},
   { "colonless", no_argument, NULL, OPTION_COMPAT_COLONLESS},
   { "sdcc",      no_argument, NULL, OPTION_COMPAT_SDCC},
   { "Fins",      required_argument, NULL, OPTION_MACH_NO_INST},
@@ -391,6 +393,9 @@ md_parse_option (int c, const char* arg)
     case OPTION_COMPAT_COLONLESS:
       colonless_labels = 1;
       break;
+    case OPTION_COMPAT_C_IGNORE:
+      /* Ignore, only here for compatibility reasons */
+      break;
     }
 
   return 1;
-- 
2.34.1







More information about the Binutils mailing list