1 /* Backend hook signatures internal interface for libebl.
2 Copyright (C) 2000-2011, 2013, 2014, 2016, 2017 Red Hat, Inc.
3 This file is part of elfutils.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
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
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
18 or both in parallel, as here.
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.
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/>. */
29 /* Return symbolic representation of relocation type. */
30 const char *EBLHOOK(reloc_type_name) (int, char *, size_t);
32 /* Check relocation type. */
33 bool EBLHOOK(reloc_type_check) (int);
35 /* Check if relocation type is for simple absolute relocations. */
36 Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int, int *);
38 /* Check relocation type use. */
39 bool EBLHOOK(reloc_valid_use) (Elf *, int);
41 /* Return true if the symbol type is that referencing the GOT. */
42 bool EBLHOOK(gotpc_reloc_check) (Elf *, int);
44 /* Return symbolic representation of segment type. */
45 const char *EBLHOOK(segment_type_name) (int, char *, size_t);
47 /* Return symbolic representation of section type. */
48 const char *EBLHOOK(section_type_name) (int, char *, size_t);
50 /* Return section name. */
51 const char *EBLHOOK(section_name) (int, int, char *, size_t);
53 /* Return next machine flag name. */
54 const char *EBLHOOK(machine_flag_name) (GElf_Word *);
56 /* Check whether machine flags are valid. */
57 bool EBLHOOK(machine_flag_check) (GElf_Word);
59 /* Check whether SHF_MASKPROC flag bits are valid. */
60 bool EBLHOOK(machine_section_flag_check) (GElf_Xword);
62 /* Check whether the section with the given index, header, and name
63 is a special machine section that is valid despite a combination
64 of flags or other details that are not generically valid. */
65 bool EBLHOOK(check_special_section) (Ebl *, int,
66 const GElf_Shdr *, const char *);
68 /* Return symbolic representation of symbol type. */
69 const char *EBLHOOK(symbol_type_name) (int, char *, size_t);
71 /* Return symbolic representation of symbol binding. */
72 const char *EBLHOOK(symbol_binding_name) (int, char *, size_t);
74 /* Return symbolic representation of dynamic tag. */
75 const char *EBLHOOK(dynamic_tag_name) (int64_t, char *, size_t);
77 /* Check dynamic tag. */
78 bool EBLHOOK(dynamic_tag_check) (int64_t);
80 /* Return symbolic representation of OS ABI. */
81 const char *EBLHOOK(osabi_name) (int, char *, size_t);
83 /* Name of a note entry type for core files. */
84 const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t);
86 /* Name of a note entry type for object files. */
87 const char *EBLHOOK(object_note_type_name) (const char *, uint32_t,
90 /* Describe core note format. */
91 int EBLHOOK(core_note) (const GElf_Nhdr *, const char *,
92 GElf_Word *, size_t *, const Ebl_Register_Location **,
93 size_t *, const Ebl_Core_Item **);
95 /* Handle object file note. */
96 bool EBLHOOK(object_note) (const char *, uint32_t, uint32_t, const char *);
98 /* Check object attribute. */
99 bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t,
100 const char **, const char **);
102 /* Check reloc target section type. */
103 bool EBLHOOK(check_reloc_target_type) (Ebl *, Elf64_Word);
105 /* Describe auxv element type. */
106 int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **);
108 /* Check section name for being that of a debug informatino section. */
109 bool EBLHOOK(debugscn_p) (const char *);
111 /* Check whether given relocation is a copy relocation. */
112 bool EBLHOOK(copy_reloc_p) (int);
114 /* Check whether given relocation is a no-op relocation. */
115 bool EBLHOOK(none_reloc_p) (int);
117 /* Check whether given relocation is a relative relocation. */
118 bool EBLHOOK(relative_reloc_p) (int);
120 /* Check whether given symbol's value is ok despite normal checks. */
121 bool EBLHOOK(check_special_symbol) (Elf *, const GElf_Sym *,
122 const char *, const GElf_Shdr *);
124 /* Check if this is a data marker symbol. e.g. '$d' symbols for ARM. */
125 bool EBLHOOK(data_marker_symbol) (const GElf_Sym *sym, const char *sname);
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);
131 /* Check if backend uses a bss PLT in this file. */
132 bool EBLHOOK(bss_plt_p) (Elf *);
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);
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);
145 /* Return system call ABI registers. */
146 int EBLHOOK(syscall_abi) (Ebl *ebl, int *sp, int *pc,
147 int *callno, int args[6]);
149 /* Disassembler function. */
150 int EBLHOOK(disasm) (Ebl *ebl, 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);
154 /* Supply the machine-specific state of CFI before CIE initial programs.
155 Function returns 0 on success and -1 on error. */
156 int EBLHOOK(abi_cfi) (Ebl *ebl, Dwarf_CIE *abi_info);
158 /* Fetch process data from live TID and call SETFUNC one or more times.
159 Method should be present only when EBL_FRAME_NREGS > 0, otherwise the
160 backend doesn't support unwinding. */
161 bool EBLHOOK(set_initial_registers_tid) (pid_t tid,
162 ebl_tid_registers_t *setfunc,
165 /* Convert *REGNO as is in DWARF to a lower range suitable for
166 Dwarf_Frame->REGS indexing. */
167 bool EBLHOOK(dwarf_to_regno) (Ebl *ebl, unsigned *regno);
169 /* Optionally modify *PC as fetched from inferior data into valid PC
170 instruction pointer. */
171 void EBLHOOK(normalize_pc) (Ebl *ebl, Dwarf_Addr *pc);
173 /* Get previous frame state for an existing frame state. Method is called only
174 if unwinder could not find CFI for current PC. PC is for the
175 existing frame. SETFUNC sets register in the previous frame. GETFUNC gets
176 register from the existing frame. Note that GETFUNC vs. SETFUNC act on
177 a disjunct set of registers. READFUNC reads memory. ARG has to be passed
178 for SETFUNC, GETFUNC and READFUNC. *SIGNAL_FRAMEP is initialized to false,
179 it can be set to true if existing frame is a signal frame. SIGNAL_FRAMEP is
181 bool EBLHOOK(unwind) (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc,
182 ebl_tid_registers_get_t *getfunc,
183 ebl_pid_memory_read_t *readfunc, void *arg,
184 bool *signal_framep);
186 /* Returns true if the value can be resolved to an address in an
187 allocated section, which will be returned in *ADDR.
188 (e.g. function descriptor resolving) */
189 bool EBLHOOK(resolve_sym_value) (Ebl *ebl, GElf_Addr *addr);
191 /* Destructor for ELF backend handle. */
192 void EBLHOOK(destr) (struct ebl *);