From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0485433543902656838==" MIME-Version: 1.0 From: Jose E. Marchesi To: elfutils-devel@lists.fedorahosted.org Subject: Re: [PATCH][SPARC] Fix GNU_Sparc_HWCAPS and GNU_Sparc_HWCAPS2 tag values Date: Thu, 09 Jun 2016 17:42:31 +0200 Message-ID: <87bn3afjx4.fsf@oracle.com> In-Reply-To: 1465484795.11520.83.camel@redhat.com --===============0485433543902656838== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Wed, 2016-06-08 at 16:29 +0200, Jose E. Marchesi wrote: > Hi people! Just a little patch to make readelf -A to print a nice li= st > of comma-separated hwcap names, instead of rubbish :) > = > 2016-06-08 Jose E. Marchesi > = > * sparc_attrs.c (sparc_check_object_attribute): Fix the > calculation of GNU_Sparc_HWCAPS and GNU_Sparc_HWCAPS2 tags values. = A simple testcase for inclusion into tests/run-readelf-A.sh would be appreciated. I will add a test. = > diff --git a/backends/sparc_attrs.c b/backends/sparc_attrs.c > index e95b577..505a01d 100644 > --- a/backends/sparc_attrs.c > +++ b/backends/sparc_attrs.c > @@ -41,33 +41,60 @@ sparc_check_object_attribute (Ebl *ebl __attribut= e__ ((unused)), > const char *vendor, int tag, uint64_t value, > const char **tag_name, const char **value_name) > { > + static const char *hwcaps[30] =3D > + { > + "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" > + }; > + > + static const char *hwcaps2[11] =3D > + { > + "fjathplus", "vis3b", "adp", "sparc5", "mwait", "xmpmul", > + "xmont", "nsec", "fjathhpc", "fjdes", "fjaes" > + }; > + > + /* NAME must be large enough to contain up to N comma-separated li= st > + of atributes in the arrays defined above. */ > + static char name [30 * 16 + 30]; > + name[0] =3D '\0'; = This approach is not thread-safe. But if we keep the current interface (which expects it can return a pointer to a non-mutable static string in value_name) I don't see a good alternative. Given that it is only used in readelf, which isn't multi-threaded, I think it is fine for now. Ok. I will drop a note in the code so we don't forget that. = Given that you have made more than 10 commits now we probably should give you commit access and appoint you sparc maintainer. Do you have a FAS account? https://admin.fedoraproject.org/accounts Yes, I am jemarch there. --===============0485433543902656838==--