[PATCH 0/2] RISC-V: Fix the conflicting priv spec problems

Palmer Dabbelt palmer@dabbelt.com
Mon Jun 8 20:27:51 GMT 2020


On Thu, 04 Jun 2020 22:41:19 PDT (-0700), nelson.chu@sifive.com wrote:
> On Fri, Jun 5, 2020 at 6:23 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>> These fix the obvious problem, so consider them approved,
>
> Thank you very much :)
>
>> Specifically, I don't think it's reasonable to expect
>> the linker to be able to determine whether or not objects that are built for
>> different version of the privelege spec are compatible with each other.  At any rate
>> minimum we'd need a way to force linking, but I think we should start by just
>> annotating
>
> Kito had discussed with me that we might need a linker option to
> choose the link compatibility levels.  And supporting three levels
> might be enough,
>
> -Wl,--link-attrs-mode=[strict? median? loose?]
> * Strict: the linked objects must have the same privilege version.
> * Median: Allow compatibility, but consider all conflicts  when we
> link objects with different versions of specs.
> * Loose: Force to link all objects without checking attrs.  Users must
> be responsible when they use this option.
> (The naming is just temporary.)

I'm not sure the middle version actually has any value for the privilege spec.
For the user spec it could make sense, as old programs run on newer specs, but
that's not the case for the privileged spec.  I'd start with just "strict" and
"permissive", if we need a third we can add one.

It's also probably best to split out the privileged and user specs for this
sort of argument, as they really have different constraints.

>> Presumably the other priv instructions should also be triggering the attribute?
>
> Thanks for the reminder.  This looks good.  I will add it in the future patches.
>
> Nelson


More information about the Binutils mailing list