[PATCH 2/2] RISC-V: The object without priv spec attributes can be linked with any object.

Jim Wilson jimw@sifive.com
Thu Jun 4 17:23:14 GMT 2020


On Sat, May 30, 2020 at 1:44 AM Nelson Chu <nelson.chu@sifive.com> wrote:
>         bfd/
>         * elfnn-riscv.c (riscv_merge_attributes): Add new boolean
>         priv_may_conflict, in_priv_zero and out_priv_zero to decide whether
>        ...

This looks good with a few minor comments.

> +       /* We check the priv version conflict when parsing the
> +          revision version.  */
> +       if (i != Tag_RISCV_priv_spec_revision)
> +         break;

It looks like there is an ordering assumption here.  That is, it looks
like you are assuming that priv_spec and priv_spec_minor always come
before priv_spec_revision, and hence all of the variables you need
will be set when handling priv_spec_revision.  Binutils does indeed do
this, but I'm not sure if the spec requires this order.  I think this
is OK for now, but we should watch for problems if someone emits them
in a different order.

> +       /* Allow to link the object wihtout the priv setting.  */

Typo wihtout -> without

> +             (_("error: %pB use privilege spec version %u.%u.%u but "
> +                "the output use version %u.%u.%u."),
> +              ibfd,
> +              in_attr[Tag_RISCV_priv_spec].i,
> +              in_attr[Tag_RISCV_priv_spec_minor].i,
> +              in_attr[i].i,
> +              out_attr[Tag_RISCV_priv_spec].i,
> +              out_attr[Tag_RISCV_priv_spec_minor].i,
> +              out_attr[i].i);

We might need to change the error to a warning if this causes problems
for people, but I think this is OK for now.

Jim


More information about the Binutils mailing list