[PATCH 1/1] RISC-V: Correct as --dump-config output for --target=rv64*

Xiao Zeng zengxiao@eswincomputing.com
Tue Jan 7 01:09:32 GMT 2025


2025-01-06 17:29  Jan Beulich <jbeulich@suse.com> wrote:
>
>On 06.01.2025 02:15, Xiao Zeng wrote:
>> --- a/gas/config/tc-riscv.c
>> +++ b/gas/config/tc-riscv.c
>> @@ -734,6 +734,18 @@ riscv_check_mapping_symbols (bfd *abfd ATTRIBUTE_UNUSED,
>>  const char *
>>  riscv_target_format (void)
>>  {
>> +  /* When as --dump-config is used, xlen is not initialized, resulting in
>> +     bfd-target being set to elf32-*riscv even with --target=rv64*.  */
>> +  if (xlen == 0)
>> +    {
>> +      if (strcmp (default_arch, "riscv32") == 0)
>> +	xlen = 32;
>> +      else if (strcmp (default_arch, "riscv64") == 0)
>> +	xlen = 64;
>> +      else
>> +	as_bad ("unknown default architecture `%s'", default_arch);
>
>My take is that as_bad() is inappropriate here. The function is used to
>signal user mistakes. Whereas here we'd really deal with a bug in the
>implementation. I expect you want to use e.g. as_abort() instead. 
Yes, I will fix this issue in v2, thank you~

>
>Jan
Thanks
Xiao Zeng



More information about the Binutils mailing list