1 /* SPARC specific symbolic name handling.
2 Copyright (C) 2002, 2003, 2005, 2007, 2008 Red Hat, Inc.
3 This file is part of Red Hat elfutils.
4 Written by Jakub Jelinek <jakub@redhat.com>, 2002.
6 Red Hat elfutils is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by the
8 Free Software Foundation; version 2 of the License.
10 Red Hat elfutils is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with Red Hat elfutils; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
19 Red Hat elfutils is an included package of the Open Invention Network.
20 An included package of the Open Invention Network is a package for which
21 Open Invention Network licensees cross-license their patents. No patent
22 license is granted, either expressly or impliedly, by designation as an
23 included package. Should you wish to participate in the Open Invention
24 Network licensing program, please visit www.openinventionnetwork.com
25 <http://www.openinventionnetwork.com>. */
34 #define BACKEND sparc_
35 #include "libebl_CPU.h"
37 /* Check for the simple reloc types. */
39 sparc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
59 /* Check whether machine flags are valid. */
61 sparc_machine_flag_check (GElf_Word flags)
63 return ((flags &~ (EF_SPARCV9_MM
67 | EF_SPARC_SUN_US3)) == 0);
71 sparc_check_special_section (Ebl *ebl,
72 int ndx __attribute__ ((unused)),
73 const GElf_Shdr *shdr,
74 const char *sname __attribute__ ((unused)))
76 if ((shdr->sh_flags & (SHF_WRITE | SHF_EXECINSTR))
77 == (SHF_WRITE | SHF_EXECINSTR))
79 /* This is ordinarily flagged, but is valid for a PLT on SPARC.
81 Look for the SHT_DYNAMIC section and the DT_PLTGOT tag in it.
82 Its d_ptr should match the .plt section's sh_addr. */
85 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
88 if (likely (gelf_getshdr (scn, &scn_shdr) != NULL)
89 && scn_shdr.sh_type == SHT_DYNAMIC
90 && scn_shdr.sh_entsize != 0)
92 Elf_Data *data = elf_getdata (scn, NULL);
94 for (size_t i = 0; i < data->d_size / scn_shdr.sh_entsize; ++i)
97 if (unlikely (gelf_getdyn (data, i, &dyn) == NULL))
99 if (dyn.d_tag == DT_PLTGOT)
100 return dyn.d_un.d_ptr == shdr->sh_addr;
111 sparc_symbol_type_name (int type,
112 char *buf __attribute__ ((unused)),
113 size_t len __attribute__ ((unused)))
117 case STT_SPARC_REGISTER:
118 return "SPARC_REGISTER";
124 sparc_dynamic_tag_name (int64_t tag,
125 char *buf __attribute__ ((unused)),
126 size_t len __attribute__ ((unused)))
130 case DT_SPARC_REGISTER:
131 return "SPARC_REGISTER";
137 sparc_dynamic_tag_check (int64_t tag)
141 case DT_SPARC_REGISTER: