Imported Upstream version 0.155
[platform/upstream/elfutils.git] / libebl / ebl-hooks.h
1 /* Backend hook signatures internal interface for libebl.
2    Copyright (C) 2000-2011 Red Hat, 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 /* Return symbol representaton of object file type.  */
30 const char *EBLHOOK(object_type_name) (int, char *, size_t);
31
32 /* Return symbolic representation of relocation type.  */
33 const char *EBLHOOK(reloc_type_name) (int, char *, size_t);
34
35 /* Check relocation type.  */
36 bool EBLHOOK(reloc_type_check) (int);
37
38 /* Check if relocation type is for simple absolute relocations.  */
39 Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int);
40
41 /* Check relocation type use.  */
42 bool EBLHOOK(reloc_valid_use) (Elf *, int);
43
44 /* Return true if the symbol type is that referencing the GOT.  */
45 bool EBLHOOK(gotpc_reloc_check) (Elf *, int);
46
47 /* Return symbolic representation of segment type.  */
48 const char *EBLHOOK(segment_type_name) (int, char *, size_t);
49
50 /* Return symbolic representation of section type.  */
51 const char *EBLHOOK(section_type_name) (int, char *, size_t);
52
53 /* Return section name.  */
54 const char *EBLHOOK(section_name) (int, int, char *, size_t);
55
56 /* Return next machine flag name.  */
57 const char *EBLHOOK(machine_flag_name) (GElf_Word *);
58
59 /* Check whether machine flags are valid.  */
60 bool EBLHOOK(machine_flag_check) (GElf_Word);
61
62 /* Check whether SHF_MASKPROC flag bits are valid.  */
63 bool EBLHOOK(machine_section_flag_check) (GElf_Xword);
64
65 /* Check whether the section with the given index, header, and name
66    is a special machine section that is valid despite a combination
67    of flags or other details that are not generically valid.  */
68 bool EBLHOOK(check_special_section) (Ebl *, int,
69                                      const GElf_Shdr *, const char *);
70
71 /* Return symbolic representation of symbol type.  */
72 const char *EBLHOOK(symbol_type_name) (int, char *, size_t);
73
74 /* Return symbolic representation of symbol binding.  */
75 const char *EBLHOOK(symbol_binding_name) (int, char *, size_t);
76
77 /* Return symbolic representation of dynamic tag.  */
78 const char *EBLHOOK(dynamic_tag_name) (int64_t, char *, size_t);
79
80 /* Check dynamic tag.  */
81 bool EBLHOOK(dynamic_tag_check) (int64_t);
82
83 /* Combine section header flags values.  */
84 GElf_Word EBLHOOK(sh_flags_combine) (GElf_Word, GElf_Word);
85
86 /* Return symbolic representation of OS ABI.  */
87 const char *EBLHOOK(osabi_name) (int, char *, size_t);
88
89 /* Name of a note entry type for core files.  */
90 const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t);
91
92 /* Name of a note entry type for object files.  */
93 const char *EBLHOOK(object_note_type_name) (const char *, uint32_t,
94                                             char *, size_t);
95
96 /* Describe core note format.  */
97 int EBLHOOK(core_note) (const GElf_Nhdr *, const char *,
98                         GElf_Word *, size_t *, const Ebl_Register_Location **,
99                         size_t *, const Ebl_Core_Item **);
100
101 /* Handle object file note.  */
102 bool EBLHOOK(object_note) (const char *, uint32_t, uint32_t, const char *);
103
104 /* Check object attribute.  */
105 bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t,
106                                       const char **, const char **);
107
108 /* Describe auxv element type.  */
109 int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **);
110
111 /* Check section name for being that of a debug informatino section.  */
112 bool EBLHOOK(debugscn_p) (const char *);
113
114 /* Check whether given relocation is a copy relocation.  */
115 bool EBLHOOK(copy_reloc_p) (int);
116
117 /* Check whether given relocation is a no-op relocation.  */
118 bool EBLHOOK(none_reloc_p) (int);
119
120 /* Check whether given relocation is a relative relocation.  */
121 bool EBLHOOK(relative_reloc_p) (int);
122
123 /* Check whether given symbol's value is ok despite normal checks.  */
124 bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *,
125                               const char *, const GElf_Shdr *);
126
127 /* Check whether only valid bits are set on the st_other symbol flag.
128    Standard ST_VISIBILITY have already been masked off.  */
129 bool EBLHOOK(check_st_other_bits) (unsigned char st_other);
130
131 /* Check if backend uses a bss PLT in this file.  */
132 bool EBLHOOK(bss_plt_p) (Elf *, GElf_Ehdr *);
133
134 /* Return location expression to find return value given the
135    DW_AT_type DIE of a DW_TAG_subprogram DIE.  */
136 int EBLHOOK(return_value_location) (Dwarf_Die *functypedie,
137                                     const Dwarf_Op **locp);
138
139 /* Return register name information.  */
140 ssize_t EBLHOOK(register_info) (Ebl *ebl,
141                                 int regno, char *name, size_t namelen,
142                                 const char **prefix, const char **setname,
143                                 int *bits, int *type);
144
145 /* Return system call ABI registers.  */
146 int EBLHOOK(syscall_abi) (Ebl *ebl, int *sp, int *pc,
147                           int *callno, int args[6]);
148
149 /* Disassembler function.  */
150 int EBLHOOK(disasm) (const uint8_t **startp, const uint8_t *end,
151                      GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb,
152                      DisasmGetSymCB_t symcb, void *outcbarg, void *symcbarg);
153
154 /* Supply the machine-specific state of CFI before CIE initial programs.  */
155 int EBLHOOK(abi_cfi) (Ebl *ebl, Dwarf_CIE *abi_info);
156
157 /* Destructor for ELF backend handle.  */
158 void EBLHOOK(destr) (struct ebl *);