• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
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 symbolic representation of relocation type.  */
30 const char *EBLHOOK(reloc_type_name) (int, char *, size_t);
31 
32 /* Check relocation type.  */
33 bool EBLHOOK(reloc_type_check) (int);
34 
35 /* Check if relocation type is for simple absolute relocations.  */
36 Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int, int *);
37 
38 /* Check relocation type use.  */
39 bool EBLHOOK(reloc_valid_use) (Elf *, int);
40 
41 /* Return true if the symbol type is that referencing the GOT.  */
42 bool EBLHOOK(gotpc_reloc_check) (Elf *, int);
43 
44 /* Return symbolic representation of segment type.  */
45 const char *EBLHOOK(segment_type_name) (int, char *, size_t);
46 
47 /* Return symbolic representation of section type.  */
48 const char *EBLHOOK(section_type_name) (int, char *, size_t);
49 
50 /* Return section name.  */
51 const char *EBLHOOK(section_name) (int, int, char *, size_t);
52 
53 /* Return next machine flag name.  */
54 const char *EBLHOOK(machine_flag_name) (GElf_Word *);
55 
56 /* Check whether machine flags are valid.  */
57 bool EBLHOOK(machine_flag_check) (GElf_Word);
58 
59 /* Check whether SHF_MASKPROC flag bits are valid.  */
60 bool EBLHOOK(machine_section_flag_check) (GElf_Xword);
61 
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 *);
67 
68 /* Return symbolic representation of symbol type.  */
69 const char *EBLHOOK(symbol_type_name) (int, char *, size_t);
70 
71 /* Return symbolic representation of symbol binding.  */
72 const char *EBLHOOK(symbol_binding_name) (int, char *, size_t);
73 
74 /* Return symbolic representation of dynamic tag.  */
75 const char *EBLHOOK(dynamic_tag_name) (int64_t, char *, size_t);
76 
77 /* Check dynamic tag.  */
78 bool EBLHOOK(dynamic_tag_check) (int64_t);
79 
80 /* Return symbolic representation of OS ABI.  */
81 const char *EBLHOOK(osabi_name) (int, char *, size_t);
82 
83 /* Name of a note entry type for core files.  */
84 const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t);
85 
86 /* Name of a note entry type for object files.  */
87 const char *EBLHOOK(object_note_type_name) (const char *, uint32_t,
88 					    char *, size_t);
89 
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 **);
94 
95 /* Handle object file note.  */
96 bool EBLHOOK(object_note) (const char *, uint32_t, uint32_t, const char *);
97 
98 /* Check object attribute.  */
99 bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t,
100 				      const char **, const char **);
101 
102 /* Check reloc target section type.  */
103 bool EBLHOOK(check_reloc_target_type) (Ebl *, Elf64_Word);
104 
105 /* Describe auxv element type.  */
106 int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **);
107 
108 /* Check section name for being that of a debug informatino section.  */
109 bool EBLHOOK(debugscn_p) (const char *);
110 
111 /* Check whether given relocation is a copy relocation.  */
112 bool EBLHOOK(copy_reloc_p) (int);
113 
114 /* Check whether given relocation is a no-op relocation.  */
115 bool EBLHOOK(none_reloc_p) (int);
116 
117 /* Check whether given relocation is a relative relocation.  */
118 bool EBLHOOK(relative_reloc_p) (int);
119 
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 *);
123 
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);
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 *);
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) (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);
153 
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);
157 
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,
163 					 void *arg);
164 
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);
168 
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);
172 
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
180    never NULL.  */
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);
185 
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);
190 
191 /* Destructor for ELF backend handle.  */
192 void EBLHOOK(destr) (struct ebl *);
193