This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] sparc: support for the check_object_attribute ebl hook.


On Mon, Oct 05, 2015 at 05:36:31PM +0200, Jose E. Marchesi wrote:
> This makes elfutils based utilities to be aware of the ELF attribute
> tags defined in sparc targets.

Are the hwcap values specified somewhere?
If so it would be good to add an URL to the specification.

> +bool
> +sparc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
> +			      const char *vendor, int tag, uint64_t value,
> +			      const char **tag_name, const char **value_name)
> +{
> +  if (!strcmp (vendor, "gnu"))
> +    switch (tag)
> +      {
> +      case 4:
> +	*tag_name = "GNU_Sparc_HWCAPS";
> +	static const char *hwcaps[32] =
> +	  {
> +	    "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
> +	    "asi_blk_init", "fmaf", NULL, "vis3", "hpc", "random", "trans", "fjfmau",
> +	    "ima", "asi_cache_sparing", "aes", "des", "kasumi", "camellia",
> +	    "md5", "sha1", "sha256", "sha512", "mpmul", "mont", "pause",
> +	    "cbcond", "crc32c", NULL, NULL
> +	  };
> +	if (value < 32 && hwcaps[value] != NULL)
> +	  *value_name = hwcaps[value];
> +	return true;
> +
> +      case 8:
> +	*tag_name = "GNU_Sparc_HWCAPS2";
> +	static const char *hwcaps2[32] =
> +	  {
> +	    "fjathplus", "vis3b", "adp", "sparc5", "mwait", "xmpmul",
> +	    "xmont", "nsec", "fjathhpc", "fjdes", "fjaes"
> +	  };
> +	if (value < 32 && hwcaps2[value] != NULL)
> +	  *value_name = hwcaps2[value];
> +	return true;
> +      }
> +
> +  return false;
> +}

I assume only values 0-31 are valid, even if there isn't currently any
name specified. It would be slightly more efficient to only define the
actually used values so we don't have these large empty arrays.

Thanks,

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]