[PATCH] RISC-V: Clear EF_RISCV_RVC/EF_RISCV_TSO when RVC/TSO is disabled using .attribute arch
Nelson Chu
nelson@rivosinc.com
Tue Nov 12 01:36:52 GMT 2024
Yes, "used anywhere in the object" is correct, so we should enable flags as
long as they are ever enabled. I think the comment and code "elf_flags |=
value" in the riscv_set_rvc/tso should be clear enough to understand.
Nelson
On Mon, Nov 11, 2024 at 5:17 PM Jan Beulich <jbeulich@suse.com> wrote:
> On 11.11.2024 09:49, Yu-Cheng Liang wrote:
> > If we enable RVC/TSO using -march and disable RVC/TSO using .attribute
> > arch, EF_RISCV_RVC/EF_RISCV_TSO won't be cleared in the current
> > implementation.
>
> Right, but isn't that what is wanted? Don't the flags have the meaning
> "used anywhere in the object" rather than "used throughout the object"?
>
> Jan
>
> > --- a/gas/config/tc-riscv.c
> > +++ b/gas/config/tc-riscv.c
> > @@ -5666,7 +5666,13 @@ s_riscv_attribute (int ignored ATTRIBUTE_UNUSED)
> > old_xlen = xlen;
> > attr = elf_known_obj_attributes_proc (stdoutput);
> > if (!start_assemble)
> > - riscv_set_arch (attr[Tag_RISCV_arch].s);
> > + {
> > + riscv_set_arch (attr[Tag_RISCV_arch].s);
> > + if (!riscv_opts.rvc)
> > + elf_flags &= ~(EF_RISCV_RVC);
> > + if (!riscv_subset_supports (&riscv_rps_as, "ztso"))
> > + elf_flags &= ~(EF_RISCV_TSO);
> > + }
> > else
> > as_fatal (_("architecture elf attributes must set before "
> > "any instructions"));
> > --
> > 2.45.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20241112/ff96a267/attachment.htm>
More information about the Binutils
mailing list