Rizin
unix-like reverse engineering framework and cli tools
asm_x86_as.c File Reference
#include <rz_lib.h>
#include <rz_asm.h>
#include "../binutils_as.h"

Go to the source code of this file.

Macros

#define ASSEMBLER   "RZ_X86_AS"
 

Functions

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

Variables

RzAsmPlugin rz_asm_plugin_x86_as
 
RZ_API RzLibStruct rizin_plugin
 

Macro Definition Documentation

◆ ASSEMBLER

#define ASSEMBLER   "RZ_X86_AS"

Definition at line 8 of file asm_x86_as.c.

Function Documentation

◆ assemble()

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

Definition at line 10 of file asm_x86_as.c.

10  {
11 #if __i386__ || __x86_64__
12  const char *as = "as";
13 #else
14  const char *as = "";
15 #endif
16  const char *syntaxstr = "";
17 
18  switch (a->syntax) {
20  syntaxstr = ".intel_syntax noprefix\n";
21  break;
22  case RZ_ASM_SYNTAX_ATT:
23  syntaxstr = ".att_syntax\n";
24  break;
25  }
26 
27  char header[4096];
28  snprintf(header, sizeof(header), "%s.code%i\n", // .org 0x%"PFMT64x"\n"
29  syntaxstr, a->bits);
30  return binutils_assemble(a, op, buf, as, ASSEMBLER, header, "");
31 }
#define ASSEMBLER
Definition: asm_x86_as.c:8
int binutils_assemble(RzAsm *a, RzAsmOp *op, const char *buf, const char *as, const char *env, const char *header, const char *cmd_opt)
Definition: binutils_as.c:7
voidpf void * buf
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
#define header(is_bt, len_min, ret_op)
@ RZ_ASM_SYNTAX_ATT
Definition: rz_asm.h:51
@ RZ_ASM_SYNTAX_INTEL
Definition: rz_asm.h:50
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32

References a, ASSEMBLER, binutils_assemble(), header, RZ_ASM_SYNTAX_ATT, RZ_ASM_SYNTAX_INTEL, and snprintf.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_x86_as
Definition: asm_x86_as.c:33
@ 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 45 of file asm_x86_as.c.

◆ rz_asm_plugin_x86_as

RzAsmPlugin rz_asm_plugin_x86_as
Initial value:
= {
.name = "x86.as",
.desc = "Intel X86 GNU Assembler (Use " ASSEMBLER " env)",
.arch = "x86",
.license = "LGPL3",
.bits = 16 | 32 | 64,
.assemble = &assemble,
}
static int assemble(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: asm_x86_as.c:10
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526

Definition at line 33 of file asm_x86_as.c.