Rizin
unix-like reverse engineering framework and cli tools
coff.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2014 Fedor Sakharov <fedor.sakharov@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #ifndef COFF_H
5 #define COFF_H
6 
7 #include <rz_types.h>
8 #include <rz_util.h>
9 #include <rz_lib.h>
10 #include <rz_bin.h>
11 #include <ht_up.h>
12 #include <ht_uu.h>
13 
14 #define COFF_IS_BIG_ENDIAN 1
15 #define COFF_IS_LITTLE_ENDIAN 0
16 
17 #include "coff_specs.h"
18 
20  struct coff_hdr hdr;
21  struct coff_opt_hdr opt_hdr;
22  struct coff_scn_hdr *scn_hdrs;
23  struct coff_symbol *symbols;
24 
25  ut16 target_id; /* TI COFF specific */
26 
28  size_t size;
30  Sdb *kv;
31  bool verbose;
32  HtUP /*<symidx, RzBinSymbol>*/ *sym_ht;
33  HtUP /*<symidx, RzBinImport>*/ *imp_ht;
34  HtUU /*<symidx, ut64>*/ *imp_index;
40 };
41 
42 RZ_API bool rz_coff_supported_arch(const ut8 *buf); /* Reads two bytes from buf. */
45 RZ_API void rz_bin_coff_free(struct rz_bin_coff_obj *obj);
47 RZ_API char *rz_coff_symbol_name(struct rz_bin_coff_obj *obj, void *ptr);
48 
54 
55 #define RZ_COFF_RELOC_TARGET_SIZE 8
56 
57 #endif /* COFF_H */
RZ_API struct rz_bin_coff_obj * rz_bin_coff_new_buf(RzBuffer *buf, bool verbose)
Definition: coff.c:278
RZ_API ut64 rz_coff_get_reloc_targets_vfile_size(struct rz_bin_coff_obj *obj)
size of the artificial reloc target vfile
Definition: coff_reloc.c:206
RZ_API void rz_bin_coff_free(struct rz_bin_coff_obj *obj)
Definition: coff.c:266
RZ_API ut64 rz_coff_perms_from_section_flags(ut32 flags)
Definition: coff.c:36
RZ_API ut64 rz_coff_get_reloc_targets_map_base(struct rz_bin_coff_obj *obj)
base vaddr where to map the artificial reloc target vfile
Definition: coff_reloc.c:9
RZ_API RZ_BORROW RzBuffer * rz_coff_get_patched_buf(struct rz_bin_coff_obj *bin)
Definition: coff_reloc.c:219
RZ_API RzBinAddr * rz_coff_get_entry(struct rz_bin_coff_obj *obj)
Definition: coff.c:89
RZ_API bool rz_coff_supported_arch(const ut8 *buf)
Definition: coff.c:9
RZ_API RzList * rz_coff_get_relocs(struct rz_bin_coff_obj *bin)
Definition: coff_reloc.c:195
RZ_API char * rz_coff_symbol_name(struct rz_bin_coff_obj *obj, void *ptr)
Definition: coff.c:50
RZ_API ut64 rz_coff_import_index_addr(struct rz_bin_coff_obj *obj, ut64 imp_index)
Definition: coff_reloc.c:32
#define RZ_API
uint16_t ut16
uint32_t ut32
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
#define RZ_BORROW
Definition: rz_types.h:63
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
Definition: malloc.c:26
RzBuffer * buf_patched
overlay over the original file with relocs patched
Definition: coff.h:38
ut8 endian
Definition: coff.h:29
ut64 reloc_targets_map_base
Definition: coff.h:36
ut64 * scn_va
Definition: coff.h:35
bool relocs_patched
Definition: coff.h:39
HtUP * sym_ht
Definition: coff.h:32
ut16 target_id
Definition: coff.h:25
HtUP * imp_ht
Definition: coff.h:33
Sdb * kv
Definition: coff.h:30
struct coff_symbol * symbols
Definition: coff.h:23
size_t size
Definition: coff.h:28
struct coff_hdr hdr
Definition: coff.h:20
struct coff_scn_hdr * scn_hdrs
Definition: coff.h:22
HtUU * imp_index
locally-generated indices for imports, in particular for deterministically assigning reloc targets
Definition: coff.h:34
bool verbose
Definition: coff.h:31
bool reloc_targets_map_base_calculated
Definition: coff.h:37
struct coff_opt_hdr opt_hdr
Definition: coff.h:21
RzBuffer * b
Definition: coff.h:27
Definition: sdb.h:63
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int verbose
Definition: z80asm.c:73