Rizin
unix-like reverse engineering framework and cli tools
asm_ppc_as.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 eagleoflqj <liumeo@pku.edu.cn>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_lib.h>
5 #include "../binutils_as.h"
6 
7 #define ASSEMBLER "RZ_PPC_AS"
8 
9 static int assemble(RzAsm *a, RzAsmOp *op, const char *buf) {
10 #if __powerpc__
11  char *as = "as";
12 #else
13  char *as = "";
14 #endif
15  char cmd_opt[4096];
16  snprintf(cmd_opt, sizeof(cmd_opt), "-mregnames -a%d %s",
17  a->bits, a->big_endian ? "-be" : "-le");
18  return binutils_assemble(a, op, buf,
19  as, ASSEMBLER, "", cmd_opt);
20 }
21 
23  .name = "ppc.as",
24  .desc = "as PPC Assembler (use " ASSEMBLER " environment)",
25  .arch = "ppc",
26  .author = "eagleoflqj",
27  .license = "LGPL3",
28  .bits = 32 | 64,
30  .assemble = &assemble,
31 };
32 
33 #ifndef RZ_PLUGIN_INCORE
36  .data = &rz_asm_plugin_ppc_as,
38 };
39 #endif
RZ_API RzLibStruct rizin_plugin
Definition: asm_ppc_as.c:34
RzAsmPlugin rz_asm_plugin_ppc_as
Definition: asm_ppc_as.c:22
#define ASSEMBLER
Definition: asm_ppc_as.c:7
static int assemble(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: asm_ppc_as.c:9
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
#define RZ_API
voidpf void * buf
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define RZ_SYS_ENDIAN_BIG
Definition: rz_types.h:527
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
const char * name
Definition: rz_asm.h:130
const char * version
Definition: rz_asm.h:133
Definition: dis.c:32