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

Zeal contact@zeal8bit.com
Thu Jun 26 15:26:32 GMT 2025


Hello Jan,

> For x86 and RISC-V there simply is no other conflicting option, so -c
> is shorthand for -compress-debug-sections.
Now, I see why it works on x86/RISC-V then, it's more a side-effect of 
not having any other option that starts with `c` rather than `-c` option 
itself being supported.

> But then other architectures also aren't overly relevant here. What's
> more relevant is what Z80 assembler(s) support -c, and what the option
> is meaning there.

My build system was treating GAS as a C compiler rather than an 
assembler, from what I understand, hence the `-c` option for "compile or 
assemble but don't link". It happened to work for x86 GAS, but by 
"mistake" as said above.

In that case, please ignore this patch, I need to fix this behavior in 
my build system.

Thanks!

On 26/06/2025 22:23, Jan Beulich wrote:
> On 26.06.2025 15:43, Zeal8bit wrote:
>> 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.
> For x86 and RISC-V there simply is no other conflicting option, so -c
> is shorthand for -compress-debug-sections.
>
> But then other architectures also aren't overly relevant here. What's
> more relevant is what Z80 assembler(s) support -c, and what the option
> is meaning there.
>
>> @@ -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},
> That's odd - why don't you add to md_shortopts[]? You don't want to also
> permit --c, do you?
>
> Jan
>
>






More information about the Binutils mailing list