1/* Object attribute tags for SPARC.
2   Copyright (C) 2015 Oracle, Inc.
3   This file is part of elfutils.
4
5   This file is free software; you can redistribute it and/or modify
6   it under the terms of either
7
8     * the GNU Lesser General Public License as published by the Free
9       Software Foundation; either version 3 of the License, or (at
10       your option) any later version
11
12   or
13
14     * the GNU General Public License as published by the Free
15       Software Foundation; either version 2 of the License, or (at
16       your option) any later version
17
18   or both in parallel, as here.
19
20   elfutils is distributed in the hope that it will be useful, but
21   WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   General Public License for more details.
24
25   You should have received copies of the GNU General Public License and
26   the GNU Lesser General Public License along with this program.  If
27   not, see <http://www.gnu.org/licenses/>.  */
28
29#ifdef HAVE_CONFIG_H
30# include <config.h>
31#endif
32
33#include <string.h>
34#include <dwarf.h>
35
36#define BACKEND sparc_
37#include "libebl_CPU.h"
38
39bool
40sparc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
41			      const char *vendor, int tag, uint64_t value,
42			      const char **tag_name, const char **value_name)
43{
44  if (!strcmp (vendor, "gnu"))
45    switch (tag)
46      {
47      case 4:
48	*tag_name = "GNU_Sparc_HWCAPS";
49	static const char *hwcaps[30] =
50	  {
51	    "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
52	    "asi_blk_init", "fmaf", NULL, "vis3", "hpc", "random", "trans", "fjfmau",
53	    "ima", "asi_cache_sparing", "aes", "des", "kasumi", "camellia",
54	    "md5", "sha1", "sha256", "sha512", "mpmul", "mont", "pause",
55	    "cbcond", "crc32c"
56	  };
57	if (value < 30 && hwcaps[value] != NULL)
58	  *value_name = hwcaps[value];
59	return true;
60
61      case 8:
62	*tag_name = "GNU_Sparc_HWCAPS2";
63	static const char *hwcaps2[11] =
64	  {
65	    "fjathplus", "vis3b", "adp", "sparc5", "mwait", "xmpmul",
66	    "xmont", "nsec", "fjathhpc", "fjdes", "fjaes"
67	  };
68	if (value < 11)
69	  *value_name = hwcaps2[value];
70	return true;
71      }
72
73  return false;
74}
75
76