[PATCH RFC] backends: Add RISC-V object attribute printing

Mark Wielaard mark@klomp.org
Thu Oct 13 14:53:30 GMT 2022


Hi Andreas,

On Wed, 2022-08-10 at 11:27 +0200, Andreas Schwab via Elfutils-devel
wrote:
> This does not work yet.  The RISC-V attribute tags use the same
> convention as the GNU attributes: odd numbered tags take a string
> value,
> even numbered ones an integer value, but print_attributes assumes the
> ARM numbering scheme by default for non-GNU attributes.

Yeah, I see this comment in print_attributes:

         /* GNU style tags have either a uleb128 value,
            when lowest bit is not set, or a string
            when the lowest bit is set.
            "compatibility" (32) is special.  It has
            both a string and a uleb128 value.  For
            non-gnu we assume 6 till 31 only take ints.
            XXX see arm backend, do we need a separate
            hook?  */

Maybe we need a flag in the backend to tell whether attributes follow
the "gnu_vendor" convention? So that could be checked at:

          bool gnu_vendor = (q - name == sizeof "gnu"
                             && !memcmp (name, "gnu", sizeof "gnu"));
          gnu_vendor |= ebl->has_gnu_attributes;

Or something similar?

Cheers,

Mark


More information about the Elfutils-devel mailing list