Blame libebl/ebl-hooks.h

Packit Service 97d2fb
/* Backend hook signatures internal interface for libebl.
Packit Service 97d2fb
   Copyright (C) 2000-2011, 2013, 2014, 2016, 2017 Red Hat, Inc.
Packit Service 97d2fb
   This file is part of elfutils.
Packit Service 97d2fb
Packit Service 97d2fb
   This file is free software; you can redistribute it and/or modify
Packit Service 97d2fb
   it under the terms of either
Packit Service 97d2fb
Packit Service 97d2fb
     * the GNU Lesser General Public License as published by the Free
Packit Service 97d2fb
       Software Foundation; either version 3 of the License, or (at
Packit Service 97d2fb
       your option) any later version
Packit Service 97d2fb
Packit Service 97d2fb
   or
Packit Service 97d2fb
Packit Service 97d2fb
     * the GNU General Public License as published by the Free
Packit Service 97d2fb
       Software Foundation; either version 2 of the License, or (at
Packit Service 97d2fb
       your option) any later version
Packit Service 97d2fb
Packit Service 97d2fb
   or both in parallel, as here.
Packit Service 97d2fb
Packit Service 97d2fb
   elfutils is distributed in the hope that it will be useful, but
Packit Service 97d2fb
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 97d2fb
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 97d2fb
   General Public License for more details.
Packit Service 97d2fb
Packit Service 97d2fb
   You should have received copies of the GNU General Public License and
Packit Service 97d2fb
   the GNU Lesser General Public License along with this program.  If
Packit Service 97d2fb
   not, see <http://www.gnu.org/licenses/>.  */
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of relocation type.  */
Packit Service 97d2fb
const char *EBLHOOK(reloc_type_name) (int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check relocation type.  */
Packit Service 97d2fb
bool EBLHOOK(reloc_type_check) (int);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check if relocation type is for simple absolute relocations.  */
Packit Service 97d2fb
Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int, int *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check relocation type use.  */
Packit Service 97d2fb
bool EBLHOOK(reloc_valid_use) (Elf *, int);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return true if the symbol type is that referencing the GOT.  */
Packit Service 97d2fb
bool EBLHOOK(gotpc_reloc_check) (Elf *, int);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of segment type.  */
Packit Service 97d2fb
const char *EBLHOOK(segment_type_name) (int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of section type.  */
Packit Service 97d2fb
const char *EBLHOOK(section_type_name) (int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return section name.  */
Packit Service 97d2fb
const char *EBLHOOK(section_name) (int, int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return next machine flag name.  */
Packit Service 97d2fb
const char *EBLHOOK(machine_flag_name) (GElf_Word *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether machine flags are valid.  */
Packit Service 97d2fb
bool EBLHOOK(machine_flag_check) (GElf_Word);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether SHF_MASKPROC flag bits are valid.  */
Packit Service 97d2fb
bool EBLHOOK(machine_section_flag_check) (GElf_Xword);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether the section with the given index, header, and name
Packit Service 97d2fb
   is a special machine section that is valid despite a combination
Packit Service 97d2fb
   of flags or other details that are not generically valid.  */
Packit Service 97d2fb
bool EBLHOOK(check_special_section) (Ebl *, int,
Packit Service 97d2fb
				     const GElf_Shdr *, const char *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of symbol type.  */
Packit Service 97d2fb
const char *EBLHOOK(symbol_type_name) (int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of symbol binding.  */
Packit Service 97d2fb
const char *EBLHOOK(symbol_binding_name) (int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of dynamic tag.  */
Packit Service 97d2fb
const char *EBLHOOK(dynamic_tag_name) (int64_t, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check dynamic tag.  */
Packit Service 97d2fb
bool EBLHOOK(dynamic_tag_check) (int64_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return symbolic representation of OS ABI.  */
Packit Service 97d2fb
const char *EBLHOOK(osabi_name) (int, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Name of a note entry type for core files.  */
Packit Service 97d2fb
const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Name of a note entry type for object files.  */
Packit Service 97d2fb
const char *EBLHOOK(object_note_type_name) (const char *, uint32_t,
Packit Service 97d2fb
					    char *, size_t);
Packit Service 97d2fb
Packit Service 97d2fb
/* Describe core note format.  */
Packit Service 97d2fb
int EBLHOOK(core_note) (const GElf_Nhdr *, const char *,
Packit Service 97d2fb
			GElf_Word *, size_t *, const Ebl_Register_Location **,
Packit Service 97d2fb
			size_t *, const Ebl_Core_Item **);
Packit Service 97d2fb
Packit Service 97d2fb
/* Handle object file note.  */
Packit Service 97d2fb
bool EBLHOOK(object_note) (const char *, uint32_t, uint32_t, const char *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check object attribute.  */
Packit Service 97d2fb
bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t,
Packit Service 97d2fb
				      const char **, const char **);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check reloc target section type.  */
Packit Service 97d2fb
bool EBLHOOK(check_reloc_target_type) (Ebl *, Elf64_Word);
Packit Service 97d2fb
Packit Service 97d2fb
/* Describe auxv element type.  */
Packit Service 97d2fb
int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check section name for being that of a debug informatino section.  */
Packit Service 97d2fb
bool EBLHOOK(debugscn_p) (const char *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether given relocation is a copy relocation.  */
Packit Service 97d2fb
bool EBLHOOK(copy_reloc_p) (int);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether given relocation is a no-op relocation.  */
Packit Service 97d2fb
bool EBLHOOK(none_reloc_p) (int);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether given relocation is a relative relocation.  */
Packit Service 97d2fb
bool EBLHOOK(relative_reloc_p) (int);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether given symbol's value is ok despite normal checks.  */
Packit Service 97d2fb
bool EBLHOOK(check_special_symbol) (Elf *, const GElf_Sym *,
Packit Service 97d2fb
			      const char *, const GElf_Shdr *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check if this is a data marker symbol.  e.g. '$d' symbols for ARM.  */
Packit Service 97d2fb
bool EBLHOOK(data_marker_symbol) (const GElf_Sym *sym, const char *sname);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check whether only valid bits are set on the st_other symbol flag.
Packit Service 97d2fb
   Standard ST_VISIBILITY have already been masked off.  */
Packit Service 97d2fb
bool EBLHOOK(check_st_other_bits) (unsigned char st_other);
Packit Service 97d2fb
Packit Service 97d2fb
/* Check if backend uses a bss PLT in this file.  */
Packit Service 97d2fb
bool EBLHOOK(bss_plt_p) (Elf *);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return location expression to find return value given the
Packit Service 97d2fb
   DW_AT_type DIE of a DW_TAG_subprogram DIE.  */
Packit Service 97d2fb
int EBLHOOK(return_value_location) (Dwarf_Die *functypedie,
Packit Service 97d2fb
				    const Dwarf_Op **locp);
Packit Service 97d2fb
Packit Service 97d2fb
/* Return register name information.  */
Packit Service 97d2fb
ssize_t EBLHOOK(register_info) (Ebl *ebl,
Packit Service 97d2fb
				int regno, char *name, size_t namelen,
Packit Service 97d2fb
				const char **prefix, const char **setname,
Packit Service 97d2fb
				int *bits, int *type);
Packit Service 97d2fb
Packit Service 97d2fb
/* Disassembler function.  */
Packit Service 97d2fb
int EBLHOOK(disasm) (Ebl *ebl, const uint8_t **startp, const uint8_t *end,
Packit Service 97d2fb
		     GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb,
Packit Service 97d2fb
		     DisasmGetSymCB_t symcb, void *outcbarg, void *symcbarg);
Packit Service 97d2fb
Packit Service 97d2fb
/* Supply the machine-specific state of CFI before CIE initial programs.
Packit Service 97d2fb
   Function returns 0 on success and -1 on error.  */
Packit Service 97d2fb
int EBLHOOK(abi_cfi) (Ebl *ebl, Dwarf_CIE *abi_info);
Packit Service 97d2fb
Packit Service 97d2fb
/* Fetch process data from live TID and call SETFUNC one or more times.
Packit Service 97d2fb
   Method should be present only when EBL_FRAME_NREGS > 0, otherwise the
Packit Service 97d2fb
   backend doesn't support unwinding.  */
Packit Service 97d2fb
bool EBLHOOK(set_initial_registers_tid) (pid_t tid,
Packit Service 97d2fb
					 ebl_tid_registers_t *setfunc,
Packit Service 97d2fb
					 void *arg);
Packit Service 97d2fb
Packit Service 97d2fb
/* Convert *REGNO as is in DWARF to a lower range suitable for
Packit Service 97d2fb
   Dwarf_Frame->REGS indexing.  */
Packit Service 97d2fb
bool EBLHOOK(dwarf_to_regno) (Ebl *ebl, unsigned *regno);
Packit Service 97d2fb
Packit Service 97d2fb
/* Optionally modify *PC as fetched from inferior data into valid PC
Packit Service 97d2fb
   instruction pointer.  */
Packit Service 97d2fb
void EBLHOOK(normalize_pc) (Ebl *ebl, Dwarf_Addr *pc);
Packit Service 97d2fb
Packit Service 97d2fb
/* Get previous frame state for an existing frame state.  Method is called only
Packit Service 97d2fb
   if unwinder could not find CFI for current PC.  PC is for the
Packit Service 97d2fb
   existing frame.  SETFUNC sets register in the previous frame.  GETFUNC gets
Packit Service 97d2fb
   register from the existing frame.  Note that GETFUNC vs. SETFUNC act on
Packit Service 97d2fb
   a disjunct set of registers.  READFUNC reads memory.  ARG has to be passed
Packit Service 97d2fb
   for SETFUNC, GETFUNC and READFUNC.  *SIGNAL_FRAMEP is initialized to false,
Packit Service 97d2fb
   it can be set to true if existing frame is a signal frame.  SIGNAL_FRAMEP is
Packit Service 97d2fb
   never NULL.  */
Packit Service 97d2fb
bool EBLHOOK(unwind) (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc,
Packit Service 97d2fb
		      ebl_tid_registers_get_t *getfunc,
Packit Service 97d2fb
		      ebl_pid_memory_read_t *readfunc, void *arg,
Packit Service 97d2fb
		      bool *signal_framep);
Packit Service 97d2fb
Packit Service 97d2fb
/* Returns true if the value can be resolved to an address in an
Packit Service 97d2fb
   allocated section, which will be returned in *ADDR.
Packit Service 97d2fb
   (e.g. function descriptor resolving)  */
Packit Service 97d2fb
bool EBLHOOK(resolve_sym_value) (Ebl *ebl, GElf_Addr *addr);
Packit Service 97d2fb
Packit Service 97d2fb
/* Destructor for ELF backend handle.  */
Packit Service 97d2fb
void EBLHOOK(destr) (struct ebl *);