Rizin
unix-like reverse engineering framework and cli tools
asm_gas.c File Reference
#include <rz_types.h>
#include <rz_util.h>
#include <rz_lib.h>
#include <rz_asm.h>

Go to the source code of this file.

Functions

static int assemble (RzAsm *a, RzAsmOp *op, const char *buf)
 

Variables

RzAsmPlugin rz_asm_plugin_x86_gas
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ assemble()

static int assemble ( RzAsm a,
RzAsmOp op,
const char *  buf 
)
static

Definition at line 9 of file asm_gas.c.

9  {
10  int len = 0;
11  ut8 *out;
12  char *cmd = rz_str_newf(
13  "gas /dev/stdin -o /dev/stdout <<__\n"
14  "BITS %i\nORG 0x%" PFMT64x "\n%s\n__",
15  a->bits, a->pc, buf);
16  ut8 *out = (ut8 *)rz_sys_cmd_str(cmd, "", &len);
17  if (out) {
19  free(out);
20  }
21  op->size = len;
22  free(cmd);
23  return len;
24 }
size_t len
Definition: 6502dis.c:15
RZ_API void rz_asm_op_set_buf(RzAsmOp *op, const ut8 *buf, int len)
Definition: aop.c:83
const lzma_allocator const uint8_t size_t uint8_t * out
Definition: block.h:528
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
Definition: sflib.h:79
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API int RZ_API char * rz_sys_cmd_str(const char *cmd, const char *input, int *len)
Definition: sys.c:669
#define PFMT64x
Definition: rz_types.h:393
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32

References a, cmd, free(), len, out, PFMT64x, rz_asm_op_set_buf(), rz_str_newf(), and rz_sys_cmd_str().

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_x86_gas
Definition: asm_gas.c:26
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define RZ_VERSION
Definition: rz_version.h:8
const char * version
Definition: rz_asm.h:133

Definition at line 36 of file asm_gas.c.

◆ rz_asm_plugin_x86_gas

RzAsmPlugin rz_asm_plugin_x86_gas
Initial value:
= {
.name = "x86.gas",
.license = "LGPL3",
.desc = "GNU Assembler (gas)",
.bits = 16 | 32 | 64,
.assemble = &assemble
}
static int assemble(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: asm_gas.c:9
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526

Definition at line 26 of file asm_gas.c.