Rizin
unix-like reverse engineering framework and cli tools
bin_wasm.c File Reference
#include <rz_types.h>
#include <rz_util.h>
#include <rz_lib.h>
#include <rz_bin.h>
#include "wasm/wasm.h"
#include "../format/wasm/wasm.h"

Go to the source code of this file.

Macros

#define B(x, y)   rz_buf_append_bytes(buf, (const ut8 *)(x), y)
 
#define D(x)   rz_buf_append_ut32(buf, x)
 

Functions

static bool check_buffer (RzBuffer *rbuf)
 
static bool find_export (const ut32 *p, const RzBinWasmExportEntry *q)
 
static bool load_buffer (RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb)
 
static void destroy (RzBinFile *bf)
 
static ut64 baddr (RzBinFile *bf)
 
static RzBinAddrbinsym (RzBinFile *bf, RzBinSpecialSymbol type)
 
static RzListsections (RzBinFile *bf)
 
static RzListentries (RzBinFile *bf)
 
static RzListsymbols (RzBinFile *bf)
 
static RzListimports (RzBinFile *bf)
 
static RzListlibs (RzBinFile *bf)
 
static RzBinInfoinfo (RzBinFile *bf)
 
static ut64 size (RzBinFile *bf)
 
static RzBuffercreate (RzBin *bin, const ut8 *code, int codelen, const ut8 *data, int datalen, RzBinArchOptions *opt)
 

Variables

RzBinPlugin rz_bin_plugin_wasm
 
RZ_API RzLibStruct rizin_plugin
 

Macro Definition Documentation

◆ B

#define B (   x,
 
)    rz_buf_append_bytes(buf, (const ut8 *)(x), y)

◆ D

#define D (   x)    rz_buf_append_ut32(buf, x)

Function Documentation

◆ baddr()

static ut64 baddr ( RzBinFile bf)
static

Definition at line 41 of file bin_wasm.c.

41  {
42  return 0;
43 }

◆ binsym()

static RzBinAddr* binsym ( RzBinFile bf,
RzBinSpecialSymbol  type 
)
static

Definition at line 45 of file bin_wasm.c.

45  {
46  return NULL; // TODO
47 }
#define NULL
Definition: cris-opc.c:27

References NULL.

◆ check_buffer()

static bool check_buffer ( RzBuffer rbuf)
static

Definition at line 15 of file bin_wasm.c.

15  {
16  ut8 buf[4] = { 0 };
17  return rbuf && rz_buf_read_at(rbuf, 0, buf, 4) == 4 && !memcmp(buf, RZ_BIN_WASM_MAGIC_BYTES, 4);
18 }
#define RZ_BIN_WASM_MAGIC_BYTES
Definition: wasm.h:15
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
Definition: buf.c:1136

References RZ_BIN_WASM_MAGIC_BYTES, and rz_buf_read_at().

Referenced by load_buffer().

◆ create()

static RzBuffer* create ( RzBin bin,
const ut8 code,
int  codelen,
const ut8 data,
int  datalen,
RzBinArchOptions opt 
)
static

Definition at line 316 of file bin_wasm.c.

316  {
318 #define B(x, y) rz_buf_append_bytes(buf, (const ut8 *)(x), y)
319 #define D(x) rz_buf_append_ut32(buf, x)
320  B("\x00"
321  "asm",
322  4);
323  B("\x01\x00\x00\x00", 4);
324  return buf;
325 }
#define B(x, y)
RZ_API RZ_OWN RzBuffer * rz_buf_new_with_bytes(RZ_NULLABLE RZ_BORROW const ut8 *bytes, ut64 len)
Creates a new buffer with a bytes array.
Definition: buf.c:465

References B, NULL, and rz_buf_new_with_bytes().

◆ destroy()

static void destroy ( RzBinFile bf)
static

Definition at line 37 of file bin_wasm.c.

37  {
39 }
void rz_bin_wasm_destroy(RzBinFile *bf)
Definition: wasm.c:789

References rz_bin_wasm_destroy().

◆ entries()

static RzList* entries ( RzBinFile bf)
static

Definition at line 51 of file bin_wasm.c.

51  {
52  RzBinWasmObj *bin = bf && bf->o ? bf->o->bin_obj : NULL;
53  // TODO
54  RzList *ret = NULL;
55  RzBinAddr *ptr = NULL;
56  ut64 addr = 0x0;
57 
58  if (!(ret = rz_list_newf((RzListFree)free))) {
59  return NULL;
60  }
61 
63  if (!addr) {
65  if (codes) {
67  RzBinWasmCodeEntry *func;
68  rz_list_foreach (codes, iter, func) {
69  addr = func->code;
70  break;
71  }
72  }
73  if (!addr) {
74  rz_list_free(ret);
75  return NULL;
76  }
77  }
78  if ((ptr = RZ_NEW0(RzBinAddr))) {
79  ptr->paddr = addr;
80  ptr->vaddr = addr;
81  rz_list_append(ret, ptr);
82  }
83  return ret;
84 }
ut32 rz_bin_wasm_get_entrypoint(RzBinWasmObj *bin)
Definition: wasm.c:966
RzList * rz_bin_wasm_get_codes(RzBinWasmObj *bin)
Definition: wasm.c:1168
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
int codes(struct state *s, const struct huffman *lencode, const struct huffman *distcode)
Definition: puff.c:436
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
#define RZ_NEW0(x)
Definition: rz_types.h:284
Definition: malloc.c:26
ut64 vaddr
Definition: rz_bin.h:186
ut64 paddr
Definition: rz_bin.h:187
RzBinObject * o
Definition: rz_bin.h:305
void * bin_obj
Definition: rz_bin.h:293
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58

References addr, rz_bin_object_t::bin_obj, rz_bin_wasm_code_t::code, codes(), free(), NULL, rz_bin_file_t::o, rz_bin_addr_t::paddr, rz_bin_wasm_get_codes(), rz_bin_wasm_get_entrypoint(), rz_list_append(), rz_list_free(), rz_list_newf(), RZ_NEW0, ut64(), and rz_bin_addr_t::vaddr.

◆ find_export()

static bool find_export ( const ut32 p,
const RzBinWasmExportEntry q 
)
static

Definition at line 20 of file bin_wasm.c.

20  {
22  return true;
23  }
24  return q->index != (*p);
25 }
@ RZ_BIN_WASM_EXTERNALKIND_Function
Definition: wasm.h:46

References rz_bin_wasm_export_t::index, rz_bin_wasm_export_t::kind, and RZ_BIN_WASM_EXTERNALKIND_Function.

Referenced by symbols().

◆ imports()

static RzList* imports ( RzBinFile bf)
static

Definition at line 232 of file bin_wasm.c.

232  {
233  RzBinWasmObj *bin = NULL;
234  RzList *imports = NULL;
235  RzBinImport *ptr = NULL;
236 
237  if (!bf || !bf->o || !bf->o->bin_obj) {
238  return NULL;
239  }
240  bin = bf->o->bin_obj;
242  if (!ret) {
243  return NULL;
244  }
245  if (!(imports = rz_bin_wasm_get_imports(bin))) {
246  goto bad_alloc;
247  }
248 
249  RzBinWasmImportEntry *import = NULL;
250  ut32 i = 0;
251  RzListIter *iter;
252  rz_list_foreach (imports, iter, import) {
253  if (!(ptr = RZ_NEW0(RzBinImport))) {
254  goto bad_alloc;
255  }
256  ptr->name = strdup(import->field_str);
257  ptr->classname = strdup(import->module_str);
258  ptr->ordinal = i;
259  ptr->bind = "NONE";
260  switch (import->kind) {
262  ptr->type = "FUNC";
263  break;
265  ptr->type = "TABLE";
266  break;
268  ptr->type = "MEM";
269  break;
271  ptr->type = "GLOBAL";
272  break;
273  }
274  rz_list_append(ret, ptr);
275  }
276  return ret;
277 bad_alloc:
279  rz_list_free(ret);
280  return NULL;
281 }
lzma_index ** i
Definition: index.h:629
RzList * rz_bin_wasm_get_imports(RzBinWasmObj *bin)
Definition: wasm.c:1003
@ RZ_BIN_WASM_EXTERNALKIND_Memory
Definition: wasm.h:48
@ RZ_BIN_WASM_EXTERNALKIND_Global
Definition: wasm.h:49
@ RZ_BIN_WASM_EXTERNALKIND_Table
Definition: wasm.h:47
RZ_API void rz_bin_import_free(RzBinImport *imp)
Definition: bin.c:137
static RzList * imports(RzBinFile *bf)
Definition: bin_wasm.c:232
uint32_t ut32
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
const char * type
Definition: rz_bin.h:704
const char * bind
Definition: rz_bin.h:703
ut32 ordinal
Definition: rz_bin.h:707
char * name
Definition: rz_bin.h:701
char * classname
Definition: rz_bin.h:705

References rz_bin_object_t::bin_obj, rz_bin_import_t::bind, rz_bin_import_t::classname, i, rz_bin_import_t::name, NULL, rz_bin_file_t::o, rz_bin_import_t::ordinal, rz_bin_import_free(), RZ_BIN_WASM_EXTERNALKIND_Function, RZ_BIN_WASM_EXTERNALKIND_Global, RZ_BIN_WASM_EXTERNALKIND_Memory, RZ_BIN_WASM_EXTERNALKIND_Table, rz_bin_wasm_get_imports(), rz_list_append(), rz_list_free(), rz_list_newf(), RZ_NEW0, strdup(), and rz_bin_import_t::type.

Referenced by symbols().

◆ info()

static RzBinInfo* info ( RzBinFile bf)
static

Definition at line 287 of file bin_wasm.c.

287  {
288  RzBinInfo *ret = NULL;
289 
290  if (!(ret = RZ_NEW0(RzBinInfo))) {
291  return NULL;
292  }
293  ret->file = strdup(bf->file);
294  ret->bclass = strdup("module");
295  ret->rclass = strdup("wasm");
296  ret->os = strdup("WebAssembly");
297  ret->arch = strdup("wasm");
298  ret->machine = strdup(ret->arch);
299  ret->subsystem = strdup("wasm");
300  ret->type = strdup("EXEC");
301  ret->bits = 32;
302  ret->has_va = 0;
303  ret->big_endian = false;
304  ret->dbg_info = 0;
305  return ret;
306 }
char * file
Definition: rz_bin.h:299
int has_va
Definition: rz_bin.h:228
char * type
Definition: rz_bin.h:211
char * os
Definition: rz_bin.h:219
char * subsystem
Definition: rz_bin.h:220
char * machine
Definition: rz_bin.h:216
char * bclass
Definition: rz_bin.h:212
char * file
Definition: rz_bin.h:210
ut64 dbg_info
Definition: rz_bin.h:240
char * rclass
Definition: rz_bin.h:213
char * arch
Definition: rz_bin.h:214
int big_endian
Definition: rz_bin.h:235

References rz_bin_info_t::arch, rz_bin_info_t::bclass, rz_bin_info_t::big_endian, rz_bin_info_t::bits, rz_bin_info_t::dbg_info, rz_bin_info_t::file, rz_bin_file_t::file, rz_bin_info_t::has_va, rz_bin_info_t::machine, NULL, rz_bin_info_t::os, rz_bin_info_t::rclass, RZ_NEW0, strdup(), rz_bin_info_t::subsystem, and rz_bin_info_t::type.

◆ libs()

static RzList* libs ( RzBinFile bf)
static

Definition at line 283 of file bin_wasm.c.

283  {
284  return NULL;
285 }

References NULL.

◆ load_buffer()

static bool load_buffer ( RzBinFile bf,
RzBinObject obj,
RzBuffer buf,
Sdb sdb 
)
static

Definition at line 27 of file bin_wasm.c.

27  {
28  rz_return_val_if_fail(bf && buf && rz_buf_size(buf) != UT64_MAX, false);
29 
30  if (check_buffer(buf)) {
31  obj->bin_obj = rz_bin_wasm_init(bf, buf);
32  return true;
33  }
34  return false;
35 }
RzBinWasmObj * rz_bin_wasm_init(RzBinFile *bf, RzBuffer *buf)
Definition: wasm.c:761
static bool check_buffer(RzBuffer *rbuf)
Definition: bin_wasm.c:15
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
Definition: buf.c:1225
#define UT64_MAX
Definition: rz_types_base.h:86

References rz_bin_object_t::bin_obj, check_buffer(), rz_bin_wasm_init(), rz_buf_size(), rz_return_val_if_fail, and UT64_MAX.

◆ sections()

static RzList* sections ( RzBinFile bf)
static

Definition at line 86 of file bin_wasm.c.

86  {
87  RzBinWasmObj *bin = bf && bf->o ? bf->o->bin_obj : NULL;
88  RzList *ret = NULL;
89  RzList *secs = NULL;
90  RzBinSection *ptr = NULL;
91  RzBinWasmSection *sec;
92 
93  if (!(ret = rz_list_newf((RzListFree)free))) {
94  return NULL;
95  }
96  if (!(secs = rz_bin_wasm_get_sections(bin))) {
97  rz_list_free(ret);
98  return NULL;
99  }
100  RzListIter *iter;
101  rz_list_foreach (secs, iter, sec) {
102  if (!(ptr = RZ_NEW0(RzBinSection))) {
103  rz_list_free(secs);
104  rz_list_free(ret);
105  return NULL;
106  }
107  ptr->name = strdup((char *)sec->name);
108  if (sec->id == RZ_BIN_WASM_SECTION_DATA || sec->id == RZ_BIN_WASM_SECTION_MEMORY) {
109  ptr->is_data = true;
110  }
111  ptr->size = sec->payload_len;
112  ptr->vsize = sec->payload_len;
113  ptr->vaddr = sec->offset;
114  ptr->paddr = sec->offset;
115  // TODO permissions
116  ptr->perm = 0;
117  rz_list_append(ret, ptr);
118  }
119  return ret;
120 }
RzList * rz_bin_wasm_get_sections(RzBinWasmObj *bin)
Definition: wasm.c:846
#define RZ_BIN_WASM_SECTION_MEMORY
Definition: wasm.h:26
#define RZ_BIN_WASM_SECTION_DATA
Definition: wasm.h:32
char * name
Definition: rz_bin.h:619
char name[RZ_BIN_WASM_STRING_LENGTH]
Definition: wasm.h:78

References rz_bin_object_t::bin_obj, free(), rz_bin_wasm_section_t::id, rz_bin_section_t::is_data, rz_bin_wasm_section_t::name, rz_bin_section_t::name, NULL, rz_bin_file_t::o, rz_bin_wasm_section_t::offset, rz_bin_section_t::paddr, rz_bin_wasm_section_t::payload_len, rz_bin_section_t::perm, rz_bin_wasm_get_sections(), RZ_BIN_WASM_SECTION_DATA, RZ_BIN_WASM_SECTION_MEMORY, rz_list_append(), rz_list_free(), rz_list_newf(), RZ_NEW0, rz_bin_section_t::size, strdup(), rz_bin_section_t::vaddr, and rz_bin_section_t::vsize.

◆ size()

static ut64 size ( RzBinFile bf)
static

Definition at line 308 of file bin_wasm.c.

308  {
309  if (!bf || !bf->buf) {
310  return 0;
311  }
312  return rz_buf_size(bf->buf);
313 }
RzBuffer * buf
Definition: rz_bin.h:303

References rz_bin_file_t::buf, and rz_buf_size().

◆ symbols()

static RzList* symbols ( RzBinFile bf)
static

Definition at line 122 of file bin_wasm.c.

122  {
123  RzBinWasmObj *bin = NULL;
124  RzList *ret = NULL, *codes = NULL, *imports = NULL, *exports = NULL;
125  RzBinSymbol *ptr = NULL;
126 
127  if (!bf || !bf->o || !bf->o->bin_obj) {
128  return NULL;
129  }
130  bin = bf->o->bin_obj;
131  if (!(ret = rz_list_newf((RzListFree)rz_bin_symbol_free))) {
132  return NULL;
133  }
134  if (!(codes = rz_bin_wasm_get_codes(bin))) {
135  goto bad_alloc;
136  }
137  if (!(imports = rz_bin_wasm_get_imports(bin))) {
138  goto bad_alloc;
139  }
140  if (!(exports = rz_bin_wasm_get_exports(bin))) {
141  goto bad_alloc;
142  }
143 
144  ut32 fcn_idx = 0,
145  table_idx = 0,
146  mem_idx = 0,
147  global_idx = 0;
148 
149  ut32 i = 0;
151  RzListIter *iter;
152  rz_list_foreach (imports, iter, imp) {
153  if (!(ptr = RZ_NEW0(RzBinSymbol))) {
154  goto bad_alloc;
155  }
156  ptr->name = strdup(imp->field_str);
157  ptr->libname = strdup(imp->module_str);
158  ptr->is_imported = true;
159  ptr->forwarder = "NONE";
160  ptr->bind = "NONE";
161  switch (imp->kind) {
163  ptr->type = RZ_BIN_TYPE_FUNC_STR;
164  fcn_idx++;
165  break;
167  ptr->type = "TABLE";
168  table_idx++;
169  break;
171  ptr->type = "MEMORY";
172  mem_idx++;
173  break;
176  global_idx++;
177  break;
178  }
179  ptr->size = 0;
180  ptr->vaddr = -1;
181  ptr->paddr = -1;
182  ptr->ordinal = i;
183  i += 1;
184  rz_list_append(ret, ptr);
185  }
186 
187  RzListIter *is_exp = NULL;
188  RzBinWasmCodeEntry *func;
189  // RzBinWasmExportEntry *export = NULL;
190  rz_list_foreach (codes, iter, func) {
191  if (!(ptr = RZ_NEW0(RzBinSymbol))) {
192  goto bad_alloc;
193  }
194 
195  const char *fcn_name = rz_bin_wasm_get_function_name(bin, fcn_idx);
196  if (fcn_name) {
197  ptr->name = strdup(fcn_name);
198 
199  is_exp = rz_list_find(exports, &fcn_idx, (RzListComparator)find_export);
200  if (is_exp) {
202  }
203  } else {
204  // fallback if symbol is not found.
205  ptr->name = rz_str_newf("fcn.%d", fcn_idx);
206  }
207 
208  ptr->forwarder = "NONE";
209  if (!ptr->bind) {
210  ptr->bind = "NONE";
211  }
212  ptr->type = RZ_BIN_TYPE_FUNC_STR;
213  ptr->size = func->len;
214  ptr->vaddr = (ut64)func->code;
215  ptr->paddr = (ut64)func->code;
216  ptr->ordinal = i;
217  i++;
218  fcn_idx++;
219  rz_list_append(ret, ptr);
220  }
221 
222  // TODO: globals, tables and memories
223  return ret;
224 bad_alloc:
225  // not so sure if imports should be freed.
226  rz_list_free(exports);
228  rz_list_free(ret);
229  return NULL;
230 }
const char * rz_bin_wasm_get_function_name(RzBinWasmObj *bin, ut32 idx)
Definition: wasm.c:1237
RzList * rz_bin_wasm_get_exports(RzBinWasmObj *bin)
Definition: wasm.c:1026
RZ_API void rz_bin_symbol_free(RzBinSymbol *sym)
Definition: bin.c:175
static bool find_export(const ut32 *p, const RzBinWasmExportEntry *q)
Definition: bin_wasm.c:20
RZ_API RZ_BORROW RzListIter * rz_list_find(RZ_NONNULL const RzList *list, const void *p, RZ_NONNULL RzListComparator cmp)
Returns RzListIter element which matches via the RzListComparator.
Definition: list.c:620
#define RZ_BIN_BIND_GLOBAL_STR
Definition: rz_bin.h:107
#define RZ_BIN_TYPE_FUNC_STR
Definition: rz_bin.h:119
int(* RzListComparator)(const void *value, const void *list_data)
Definition: rz_list.h:33
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
const char * bind
Definition: rz_bin.h:681
bool is_imported
Definition: rz_bin.h:684
const char * type
Definition: rz_bin.h:682
char * name
Definition: rz_bin.h:675
ut32 ordinal
Definition: rz_bin.h:692
const char * forwarder
Definition: rz_bin.h:680
char * libname
Definition: rz_bin.h:677
char field_str[RZ_BIN_WASM_STRING_LENGTH]
Definition: wasm.h:113
char module_str[RZ_BIN_WASM_STRING_LENGTH]
Definition: wasm.h:111

References rz_bin_object_t::bin_obj, rz_bin_symbol_t::bind, rz_bin_wasm_code_t::code, codes(), rz_bin_wasm_import_t::field_str, find_export(), rz_bin_symbol_t::forwarder, i, imports(), rz_bin_symbol_t::is_imported, rz_bin_wasm_import_t::kind, rz_bin_wasm_code_t::len, rz_bin_symbol_t::libname, rz_bin_wasm_import_t::module_str, rz_bin_symbol_t::name, NULL, rz_bin_file_t::o, rz_bin_symbol_t::ordinal, rz_bin_symbol_t::paddr, RZ_BIN_BIND_GLOBAL_STR, rz_bin_symbol_free(), RZ_BIN_TYPE_FUNC_STR, RZ_BIN_WASM_EXTERNALKIND_Function, RZ_BIN_WASM_EXTERNALKIND_Global, RZ_BIN_WASM_EXTERNALKIND_Memory, RZ_BIN_WASM_EXTERNALKIND_Table, rz_bin_wasm_get_codes(), rz_bin_wasm_get_exports(), rz_bin_wasm_get_function_name(), rz_bin_wasm_get_imports(), rz_list_append(), rz_list_find(), rz_list_free(), rz_list_newf(), RZ_NEW0, rz_str_newf(), rz_bin_symbol_t::size, strdup(), rz_bin_symbol_t::type, ut64(), and rz_bin_symbol_t::vaddr.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_BIN,
}
RzBinPlugin rz_bin_plugin_wasm
Definition: bin_wasm.c:327
@ RZ_LIB_TYPE_BIN
Definition: rz_lib.h:75
#define RZ_VERSION
Definition: rz_version.h:8
char * version
Definition: rz_bin.h:512

Definition at line 348 of file bin_wasm.c.

◆ rz_bin_plugin_wasm

RzBinPlugin rz_bin_plugin_wasm
Initial value:
= {
.name = "wasm",
.desc = "WebAssembly bin plugin",
.license = "MIT",
.load_buffer = &load_buffer,
.size = &size,
.destroy = &destroy,
.check_buffer = &check_buffer,
.baddr = &baddr,
.binsym = &binsym,
.entries = &entries,
.sections = &sections,
.symbols = &symbols,
.imports = &imports,
.info = &info,
.libs = &libs,
.create = &create,
}
RZ_API RZ_OWN RzList * rz_bin_maps_of_file_sections(RZ_NONNULL RzBinFile *binfile)
Create a list of RzBinMap from RzBinSections queried from the given file.
Definition: bin.c:1040
static RzBuffer * create(RzBin *bin, const ut8 *code, int codelen, const ut8 *data, int datalen, RzBinArchOptions *opt)
Definition: bin_wasm.c:316
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb)
Definition: bin_wasm.c:27
static RzList * symbols(RzBinFile *bf)
Definition: bin_wasm.c:122
static RzBinAddr * binsym(RzBinFile *bf, RzBinSpecialSymbol type)
Definition: bin_wasm.c:45
static ut64 size(RzBinFile *bf)
Definition: bin_wasm.c:308
static RzList * libs(RzBinFile *bf)
Definition: bin_wasm.c:283
static void destroy(RzBinFile *bf)
Definition: bin_wasm.c:37
static RzBinInfo * info(RzBinFile *bf)
Definition: bin_wasm.c:287
static ut64 baddr(RzBinFile *bf)
Definition: bin_wasm.c:41
static RzList * entries(RzBinFile *bf)
Definition: bin_wasm.c:51
static RzList * sections(RzBinFile *bf)
Definition: bin_wasm.c:86

Definition at line 327 of file bin_wasm.c.