1 /* SPARC specific symbolic name handling.
2 Copyright (C) 2002, 2003, 2005, 2007, 2008 Red Hat, Inc.
3 This file is part of elfutils.
4 Written by Jakub Jelinek <jakub@redhat.com>, 2002.
6 This file is free software; you can redistribute it and/or modify
7 it under the terms of either
9 * the GNU Lesser General Public License as published by the Free
10 Software Foundation; either version 3 of the License, or (at
11 your option) any later version
15 * the GNU General Public License as published by the Free
16 Software Foundation; either version 2 of the License, or (at
17 your option) any later version
19 or both in parallel, as here.
21 elfutils is distributed in the hope that it will be useful, but
22 WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 General Public License for more details.
26 You should have received copies of the GNU General Public License and
27 the GNU Lesser General Public License along with this program. If
28 not, see <http://www.gnu.org/licenses/>. */
37 #define BACKEND sparc_
38 #include "libebl_CPU.h"
40 /* Check for the simple reloc types. */
42 sparc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
62 /* Check whether machine flags are valid. */
64 sparc_machine_flag_check (GElf_Word flags)
66 return ((flags &~ (EF_SPARCV9_MM
70 | EF_SPARC_SUN_US3)) == 0);
74 sparc_check_special_section (Ebl *ebl,
75 int ndx __attribute__ ((unused)),
76 const GElf_Shdr *shdr,
77 const char *sname __attribute__ ((unused)))
79 if ((shdr->sh_flags & (SHF_WRITE | SHF_EXECINSTR))
80 == (SHF_WRITE | SHF_EXECINSTR))
82 /* This is ordinarily flagged, but is valid for a PLT on SPARC.
84 Look for the SHT_DYNAMIC section and the DT_PLTGOT tag in it.
85 Its d_ptr should match the .plt section's sh_addr. */
88 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
91 if (likely (gelf_getshdr (scn, &scn_shdr) != NULL)
92 && scn_shdr.sh_type == SHT_DYNAMIC
93 && scn_shdr.sh_entsize != 0)
95 Elf_Data *data = elf_getdata (scn, NULL);
97 for (size_t i = 0; i < data->d_size / scn_shdr.sh_entsize; ++i)
100 if (unlikely (gelf_getdyn (data, i, &dyn) == NULL))
102 if (dyn.d_tag == DT_PLTGOT)
103 return dyn.d_un.d_ptr == shdr->sh_addr;
114 sparc_symbol_type_name (int type,
115 char *buf __attribute__ ((unused)),
116 size_t len __attribute__ ((unused)))
120 case STT_SPARC_REGISTER:
121 return "SPARC_REGISTER";
127 sparc_dynamic_tag_name (int64_t tag,
128 char *buf __attribute__ ((unused)),
129 size_t len __attribute__ ((unused)))
133 case DT_SPARC_REGISTER:
134 return "SPARC_REGISTER";
140 sparc_dynamic_tag_check (int64_t tag)
144 case DT_SPARC_REGISTER: