mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 22:00:18 +00:00
* Added compilation support for python bindings on Windows
- Documented in doc/windows * Use single linked list pointer in rbin->rcore - Thanks @earada :)
This commit is contained in:
parent
d0e3a3b0e3
commit
9313a158d6
2
TODO
2
TODO
@ -6,6 +6,8 @@
|
||||
|
||||
<{include libr/TODO}>
|
||||
|
||||
* static lang plugins
|
||||
|
||||
TODO 0.6
|
||||
========
|
||||
pancake
|
||||
|
@ -19,3 +19,9 @@ Crosscompilation
|
||||
./configure --without-gmp --without-openssl --with-compiler=i586-mingw32msvc-gcc --with-ostype=windows --host=i586-unknown-windows
|
||||
make
|
||||
make w32dist
|
||||
|
||||
|
||||
Python bindings:
|
||||
----------------
|
||||
wget http://www.python.org/ftp/python/2.7/python-2.7.msi
|
||||
msiexec /i python-2.7.msi
|
||||
|
@ -39,6 +39,7 @@ R_API void r_core_sysenv_update(RCore *core) {
|
||||
|
||||
R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
RBinObj *obj;
|
||||
RList *list;
|
||||
RListIter *iter;
|
||||
ut64 baddr;
|
||||
int va = r->io->va || r->io->debug;
|
||||
@ -73,12 +74,11 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
r->blocksize, 0);
|
||||
|
||||
// e -> Entrypoints
|
||||
RList *entries;
|
||||
RBinAddr *entry;
|
||||
i = 0;
|
||||
|
||||
if ((entries = r_bin_get_entries (r->bin)) != NULL) {
|
||||
r_list_foreach (entries, iter, entry) {
|
||||
if ((list = r_bin_get_entries (r->bin)) != NULL) {
|
||||
r_list_foreach (list, iter, entry) {
|
||||
snprintf (str, R_FLAG_NAME_SIZE, "entry%i", i++);
|
||||
r_flag_set (r->flags, str, va?baddr+entry->rva:entry->offset,
|
||||
r->blocksize, 0);
|
||||
@ -88,11 +88,10 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
}
|
||||
|
||||
// s -> Symbols
|
||||
RList *symbols;
|
||||
RBinSymbol *symbol;
|
||||
|
||||
if ((symbols = r_bin_get_symbols (r->bin)) != NULL) {
|
||||
r_list_foreach (symbols, iter, symbol) {
|
||||
if ((list = r_bin_get_symbols (r->bin)) != NULL) {
|
||||
r_list_foreach (list, iter, symbol) {
|
||||
r_flag_name_filter (symbol->name);
|
||||
snprintf (str, R_FLAG_NAME_SIZE, "fcn.sym.%s", symbol->name);
|
||||
if (!strncmp (symbol->type,"FUNC", 4)) {
|
||||
@ -109,12 +108,11 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
}
|
||||
|
||||
// R -> Relocations
|
||||
RList *relocs;
|
||||
RBinReloc *reloc;
|
||||
|
||||
r_flag_space_set (r->flags, "relocs");
|
||||
if ((relocs = r_bin_get_relocs (r->bin)) != NULL) {
|
||||
r_list_foreach (relocs, iter, reloc) {
|
||||
if ((list = r_bin_get_relocs (r->bin)) != NULL) {
|
||||
r_list_foreach (list, iter, reloc) {
|
||||
snprintf (str, R_FLAG_NAME_SIZE, "reloc.%s", reloc->name);
|
||||
r_flag_set (r->flags, str, va?baddr+reloc->rva:reloc->offset,
|
||||
r->blocksize, 0);
|
||||
@ -122,12 +120,11 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
}
|
||||
|
||||
// z -> Strings
|
||||
RList *strings;
|
||||
RBinString *string;
|
||||
|
||||
r_flag_space_set (r->flags, "strings");
|
||||
if ((strings = r_bin_get_strings (r->bin)) != NULL) {
|
||||
r_list_foreach (strings, iter, string) {
|
||||
if ((list = r_bin_get_strings (r->bin)) != NULL) {
|
||||
r_list_foreach (list, iter, string) {
|
||||
/* Jump the withespaces before the string */
|
||||
for (i=0;*(string->string+i)==' ';i++);
|
||||
r_meta_add (r->meta, R_META_STRING, va?baddr+string->rva:string->offset,
|
||||
@ -140,11 +137,10 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
}
|
||||
|
||||
// i -> Imports
|
||||
RList *imports;
|
||||
RBinImport *import;
|
||||
|
||||
if ((imports = r_bin_get_imports (r->bin)) != NULL) {
|
||||
r_list_foreach (imports, iter, import) {
|
||||
if ((list = r_bin_get_imports (r->bin)) != NULL) {
|
||||
r_list_foreach (list, iter, import) {
|
||||
r_flag_name_filter (import->name);
|
||||
if (import->size)
|
||||
if (!r_anal_fcn_add (r->anal, va?baddr+import->rva:import->offset,
|
||||
@ -161,13 +157,12 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
}
|
||||
|
||||
// S -> Sections
|
||||
RList *sections;
|
||||
RBinSection *section;
|
||||
i = 0;
|
||||
|
||||
if ((sections = r_bin_get_sections (r->bin)) != NULL) {
|
||||
if ((list = r_bin_get_sections (r->bin)) != NULL) {
|
||||
r_flag_space_set (r->flags, "sections");
|
||||
r_list_foreach (sections, iter, section) {
|
||||
r_list_foreach (list, iter, section) {
|
||||
r_flag_name_filter (section->name);
|
||||
snprintf (str, R_FLAG_NAME_SIZE, "section.%s", section->name);
|
||||
r_flag_set (r->flags, str, va?baddr+section->rva:section->offset,
|
||||
|
@ -18,6 +18,13 @@ endif
|
||||
all: ${LANGS}
|
||||
@true
|
||||
|
||||
ifeq ($(OSTYPE),windows)
|
||||
lang_python.${EXT_SO}:
|
||||
${CC} ${CFLAGS} -I${HOME}/.wine/drive_c/Python27/include \
|
||||
-L${HOME}/.wine/drive_c/Python27/libs \
|
||||
-L../../core/ -lr_core \
|
||||
${LDFLAGS_LIB} -shared -o lang_python.${EXT_SO} python.c -lpython27
|
||||
else
|
||||
lang_python.${EXT_SO}:
|
||||
-gcc -lpython >/dev/null 2>&1 ; \
|
||||
if [ $$? = 0 ]; then \
|
||||
@ -28,6 +35,7 @@ lang_python.${EXT_SO}:
|
||||
-fPIC ${LDFLAGS_LIB} -o lang_python.${EXT_SO} python.c \
|
||||
-I/usr/include/python2.6/ -lpython2.6 ; \
|
||||
fi
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIB_TCC),1)
|
||||
lang_tcc.${EXT_SO}: tcc.o
|
||||
|
@ -7,6 +7,7 @@
|
||||
#undef _GNU_SOURCE
|
||||
#undef _XOPEN_SOURCE
|
||||
#undef _POSIX_C_SOURCE
|
||||
#undef PREFIX
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user