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

Go to the source code of this file.

Macros

#define ASSEMBLER32   "RZ_ARM32_AS"
 
#define ASSEMBLER64   "RZ_ARM64_AS"
 

Functions

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

Variables

RzAsmPlugin rz_asm_plugin_arm_as
 
RZ_API RzLibStruct rizin_plugin
 

Macro Definition Documentation

◆ ASSEMBLER32

#define ASSEMBLER32   "RZ_ARM32_AS"

Definition at line 10 of file asm_arm_as.c.

◆ ASSEMBLER64

#define ASSEMBLER64   "RZ_ARM64_AS"

Definition at line 11 of file asm_arm_as.c.

Function Documentation

◆ assemble()

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

Definition at line 13 of file asm_arm_as.c.

13  {
14  int bits = a->bits;
15  char *as = "";
16 #if __arm__
17  if (bits <= 32) {
18  as = "as";
19  }
20 #elif __aarch64__
21  if (bits == 64) {
22  as = "as";
23  }
24 #endif
25  char cmd_opt[4096];
26  snprintf(cmd_opt, sizeof(cmd_opt), "%s %s",
27  bits == 16 ? "-mthumb" : "",
28  a->big_endian ? "-EB" : "-EL");
29  return binutils_assemble(a, op, buf, as,
30  bits == 64 ? ASSEMBLER64 : ASSEMBLER32,
31  bits <= 32 ? ".syntax unified\n" : "", cmd_opt);
32 }
#define ASSEMBLER64
Definition: asm_arm_as.c:11
#define ASSEMBLER32
Definition: asm_arm_as.c:10
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
int bits(struct state *s, int need)
Definition: blast.c:72
voidpf void * buf
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32

References a, ASSEMBLER32, ASSEMBLER64, binutils_assemble(), bits(), and snprintf.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_ASM,
}
RzAsmPlugin rz_asm_plugin_arm_as
Definition: asm_arm_as.c:34
@ 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 46 of file asm_arm_as.c.

◆ rz_asm_plugin_arm_as

RzAsmPlugin rz_asm_plugin_arm_as
Initial value:
= {
.name = "arm.as",
.desc = "as ARM Assembler (use " ASSEMBLER32 " and " ASSEMBLER64 " environment)",
.arch = "arm",
.author = "pancake",
.license = "LGPL3",
.bits = 16 | 32 | 64,
.assemble = &assemble,
}
static int assemble(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: asm_arm_as.c:13
#define RZ_SYS_ENDIAN_BIG
Definition: rz_types.h:527
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526

Definition at line 34 of file asm_arm_as.c.