Rizin
unix-like reverse engineering framework and cli tools
bin_elf64.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2009-2019 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2009-2019 nibble <nibble.ds@gmail.com>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #define RZ_BIN_ELF64 1
6 #include "bin_elf.inc"
7 
8 static bool check_buffer(RzBuffer *buf) {
9  return check_buffer_aux(buf) == ELFCLASS64;
10 }
11 
12 static ut64 get_elf_vaddr64(RzBinFile *bf, ut64 baddr, ut64 paddr, ut64 vaddr) {
13  // NOTE(aaSSfxxx): since RVA is vaddr - "official" image base, we just need to add imagebase to vaddr
14  ELFOBJ *bin = bf->o->bin_obj;
15  return bin->baddr - bin->boffset + vaddr;
16 }
17 
19  .name = "elf64",
20  .desc = "elf64 bin plugin",
21  .license = "LGPL3",
22  .get_sdb = &get_sdb,
23  .check_buffer = &check_buffer,
24  .load_buffer = &load_buffer,
25  .baddr = &baddr,
26  .boffset = &boffset,
27  .binsym = &binsym,
28  .entries = &entries,
29  .virtual_files = &virtual_files,
30  .maps = &maps,
31  .sections = &sections,
32  .symbols = &symbols,
33  .imports = &imports,
34  .strings = &strings,
35  .minstrlen = 4,
36  .info = &info,
37  .fields = &fields,
38  .header = &headers,
39  .size = &size,
40  .libs = &libs,
41  .relocs = &relocs,
42  .create = &create_elf,
43  .get_vaddr = &get_elf_vaddr64,
44  .file_type = &get_file_type,
45  .regstate = &regstate,
46  .section_type_to_string = &Elf_(rz_bin_elf_section_type_to_string),
47  .section_flag_to_rzlist = &Elf_(rz_bin_elf_section_flag_to_rzlist),
48  .destroy = destroy,
49 };
50 
51 #ifndef RZ_PLUGIN_INCORE
54  .data = &rz_bin_plugin_elf64,
56 };
57 #endif
const aarch64_field fields[]
Definition: aarch64-opc.c:205
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb)
Definition: bin_any.c:50
static void destroy(RzBinFile *bf)
Definition: bin_any.c:54
static ut64 baddr(RzBinFile *bf)
Definition: bin_any.c:58
static Sdb * get_sdb(RzBinFile *bf)
Definition: bin_art.c:60
static RzList * maps(RzBinFile *bf)
Definition: bin_bf.c:116
static RzList * virtual_files(RzBinFile *bf)
Definition: bin_bflt.c:167
static RzBinAddr * binsym(RzBinFile *bf, RzBinSpecialSymbol sym)
Definition: bin_coff.c:47
static RzList * libs(RzBinFile *bf)
Definition: bin_coff.c:379
static char * regstate(RzBinFile *bf)
Definition: bin_dmp64.c:252
static bool check_buffer(RzBuffer *buf)
Definition: bin_elf64.c:8
RZ_API RzLibStruct rizin_plugin
Definition: bin_elf64.c:52
static ut64 get_elf_vaddr64(RzBinFile *bf, ut64 baddr, ut64 paddr, ut64 vaddr)
Definition: bin_elf64.c:12
RzBinPlugin rz_bin_plugin_elf64
Definition: bin_elf64.c:18
RzList * entries(RzBinFile *bf)
Definition: bin_ne.c:98
RzBinInfo * info(RzBinFile *bf)
Definition: bin_ne.c:86
RzList * symbols(RzBinFile *bf)
Definition: bin_ne.c:102
RzList * imports(RzBinFile *bf)
Definition: bin_ne.c:106
RzList * sections(RzBinFile *bf)
Definition: bin_ne.c:110
RzList * relocs(RzBinFile *bf)
Definition: bin_ne.c:114
static ut64 boffset(RzBinFile *bf)
Definition: bin_ninds.c:39
#define RZ_API
#define ELFOBJ
Definition: elf.h:24
RZ_OWN char *Elf_() rz_bin_elf_section_type_to_string(ut64 type)
Return a string representing the elf type.
Definition: elf_sections.c:422
RZ_OWN RzList *Elf_() rz_bin_elf_section_flag_to_rzlist(ut64 flag)
Return a list of string representing flag options.
Definition: elf_sections.c:298
#define Elf_(name)
Definition: elf_specs.h:32
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type strings(--mime-type and\n" " --mime-encoding)\n") OPT('s'
voidpf void uLong size
Definition: ioapi.h:138
voidpf void * buf
Definition: ioapi.h:138
#define ELFCLASS64
Definition: common.h:54
@ RZ_LIB_TYPE_BIN
Definition: rz_lib.h:75
#define RZ_VERSION
Definition: rz_version.h:8
Definition: malloc.c:26
XX curplugin == o->plugin.
Definition: rz_bin.h:298
RzBinObject * o
Definition: rz_bin.h:305
void * bin_obj
Definition: rz_bin.h:293
char * name
Definition: rz_bin.h:509
char * version
Definition: rz_bin.h:512
ut64(WINAPI *w32_GetEnabledXStateFeatures)()