[RFC PATCH 3/5] RISC-V: Mapping symbols with ISA string on assembler

Jan Beulich jbeulich@suse.com
Thu Aug 11 12:12:07 GMT 2022


On 11.08.2022 13:43, Tsukasa OI wrote:
> On 2022/08/11 16:31, Jan Beulich wrote:
>> On 11.08.2022 09:00, Tsukasa OI via Binutils wrote:
>>> @@ -3855,11 +3887,15 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
>>>    if (strcmp (name, "rvc") == 0)
>>>      {
>>>        riscv_update_subset (&riscv_rps_as, "+c");
>>> +      updated_riscv_subsets = true;
>>> +      riscv_opts.arch_is_default = false;
>>>        riscv_set_rvc (true);
>>>      }
>>>    else if (strcmp (name, "norvc") == 0)
>>>      {
>>>        riscv_update_subset (&riscv_rps_as, "-c");
>>> +      updated_riscv_subsets = true;
>>> +      riscv_opts.arch_is_default = false;
>>>        riscv_set_rvc (false);
>>>      }
>>>    else if (strcmp (name, "pic") == 0)
>>> @@ -3880,6 +3916,8 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
>>>        if (ISSPACE (*name) && *name != '\0')
>>>  	name++;
>>>        riscv_update_subset (&riscv_rps_as, name);
>>> +      updated_riscv_subsets = true;
>>> +      riscv_opts.arch_is_default = false;
>>
>> Seeing that all three call sites of riscv_update_subset() gain the
>> same extra code - wouldn't these assignments better move into that
>> function? (The function living in bfd may make this difficult, but
>> it being used by gas only suggests it might better be moved over. Or
>> otherwise maybe add a local helper function doing all three things?)
> 
> Adding a local helper function would be the best.

Just out of curiosity, could you explain to me why the function is
to remain in bfd when gas is its only user?

Jan


More information about the Binutils mailing list