mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-26 22:50:48 +00:00
* Many more fixes for the mingw32 port
This commit is contained in:
parent
61480f889e
commit
eb99dd1203
5
INSTALL
5
INSTALL
@ -15,6 +15,11 @@ And install
|
||||
|
||||
If you regret about it, just 'make deinstall' :)
|
||||
|
||||
WINDOWS
|
||||
=======
|
||||
|
||||
$ ./configure --with-compiler=i486-mingw32-gcc --with-ostype=windows
|
||||
$ make
|
||||
|
||||
CONFIGURATION
|
||||
=============
|
||||
|
1
Makefile
1
Makefile
@ -27,6 +27,7 @@ vdoc_pkg:
|
||||
|
||||
clean:
|
||||
cd libr && make clean
|
||||
cd swig && make clean
|
||||
|
||||
mrproper:
|
||||
cd libr && make mrproper
|
||||
|
6
TODO.refactoring
Normal file
6
TODO.refactoring
Normal file
@ -0,0 +1,6 @@
|
||||
TODO refactoring
|
||||
================
|
||||
|
||||
* Remove some unnecesary libraries for the core
|
||||
- r_th is fun.. but not useful anymore.. we should use glib or any other threading library
|
||||
- move the source of r_th oustide r2
|
@ -16,8 +16,10 @@ INSTALL_DATA=@INSTALL_DATA@
|
||||
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
||||
|
||||
VERSION=@VERSION@
|
||||
# ./configure --with-ostype=[linux,osx,w32]
|
||||
# ./configure --with-ostype=[linux,osx,solaris,windows] # TODO: rename to w32, w64?
|
||||
OSTYPE?=@USEROSTYPE@
|
||||
HOST_OS=@HOST_OS@
|
||||
DL_LIBS=@DL_LIBS@
|
||||
|
||||
HAVE_LIB_TCC=@HAVE_LIB_TCC@
|
||||
HAVE_VALASWIG=@HAVE_VALASWIG@
|
||||
|
27
configure
vendored
27
configure
vendored
@ -189,7 +189,7 @@ case $flag in
|
||||
echo "PKGNAME: radare2"
|
||||
echo "VERSION: 0.3b"
|
||||
echo "LANGS: c"
|
||||
echo "REQUIRED: lib>=vala-1.0 libvala-1.0>=0.5.0"
|
||||
echo "REQUIRED: libdl lib>=vala-1.0 libvala-1.0>=0.5.0"
|
||||
echo "OPTIONAL: libewf"
|
||||
echo "FLAGS: --without-debugger --without-ewf --with-compiler=gcc --with-ostype=gnulinux --without-valaswig --without-vala"
|
||||
exit 0
|
||||
@ -198,12 +198,12 @@ echo "FLAGS: --without-debugger --without-ewf --with-compiler=gcc --with-ost
|
||||
# ignored: acr have no cache
|
||||
;;
|
||||
"--build")
|
||||
BUILD="$value"; ;;
|
||||
BUILD="$value"; split_host BUILD ; ;;
|
||||
"--host")
|
||||
CROSSBUILD=1
|
||||
HOST="$value"; ;;
|
||||
CROSSBUILD=1 # XXX
|
||||
HOST="$value"; split_host HOST ; ;;
|
||||
"--target")
|
||||
TARGET="$value"; ;;
|
||||
TARGET="$value"; split_host TARGET ; ;;
|
||||
"--prefix")
|
||||
PREFIX="$value"; ;;
|
||||
"--exec-prefix")
|
||||
@ -256,7 +256,7 @@ parse_options $1
|
||||
shift
|
||||
done
|
||||
|
||||
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS LDFLAGS HAVE_LANG_C DEBUGGER LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_EWF HAVE_EWF HAVE_LIB_TCC USERCC USEROSTYPE WANT_VALASWIG HAVE_VALASWIG VALASWIG HAVE_SWIG SWIG WANT_VALA HAVE_VALAC VALAC HAVE_VALA_1_0_VERSION_0_5_0"
|
||||
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_EWF HAVE_EWF HAVE_LIB_TCC USERCC USEROSTYPE WANT_VALASWIG HAVE_VALASWIG VALASWIG HAVE_SWIG SWIG WANT_VALA HAVE_VALAC VALAC HAVE_VALA_1_0_VERSION_0_5_0"
|
||||
|
||||
create_environ
|
||||
|
||||
@ -289,6 +289,21 @@ if [ $? = 0 ]; then echo ${CC}; else
|
||||
do_remove
|
||||
echo "ERROR: ${CC} cannot create executables" >&2 ;
|
||||
exit 1 ; fi
|
||||
printf "checking for dynamic library... "
|
||||
HAVE_LIB_DL=0
|
||||
for OS in linux syllable sunos darwin beos solaris ; do
|
||||
if [ "${HOST_OS}" = "${OS}" ]; then
|
||||
HAVE_LIB_DL=1
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ "${HAVE_LIB_DL}" = 1 ]; then
|
||||
DL_LIBS="-ldl"
|
||||
echo "required"
|
||||
else
|
||||
DL_LIBS=""
|
||||
echo "libc"
|
||||
fi
|
||||
printf "checking host endianness... "
|
||||
echo 'main(){int a=1;char *b=(char*)&a;printf("%d",b[0]);}' > test.c
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o a.out test.c >/dev/null 2>&1
|
||||
|
@ -6,6 +6,9 @@ LANG_C!
|
||||
|
||||
ARG_WITHOUT DEBUGGER debugger disable native debugger features ;
|
||||
|
||||
(( -ldl -dynamic ... ))
|
||||
USE_DL
|
||||
|
||||
CHECK_ENDIAN
|
||||
CHKLIB ewf
|
||||
ARG_WITHOUT HAVE_EWF ewf disable EWF dependency ;
|
||||
|
@ -1,5 +1,5 @@
|
||||
WINDOWS
|
||||
=======
|
||||
|
||||
./configure --with-compiler=i486-mingw32-gcc --with-ostype=windows
|
||||
./configure --with-compiler=i486-mingw32-gcc --with-ostype=windows --host=i486-unknown-windows
|
||||
make
|
||||
|
@ -25,8 +25,8 @@ libs:
|
||||
|
||||
libr: .objs libr.a libr.so
|
||||
|
||||
libr.a:
|
||||
ar -r libr.a .objs/*.o
|
||||
libr.${LIBAR}:
|
||||
ar -r libr.${LIBAR} .objs/*.o
|
||||
|
||||
libr.so:
|
||||
${CC} -shared -fPIC .objs/*.o -o libr.so
|
||||
|
@ -8,6 +8,7 @@
|
||||
* ./mach0 <mach0 file> */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
#include "mach0.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include ../../config.mk
|
||||
include ../../config.mk
|
||||
#include ../../../config-user.mk
|
||||
CFLAGS=-I../../include -I../format/ -Wall -fPIC -shared -Wl,-R..
|
||||
# XXX
|
||||
|
@ -1,18 +1,19 @@
|
||||
NAME=r_bininfo
|
||||
DEPS=r_lib r_util
|
||||
|
||||
foo: pre libr_bininfo.so plugins
|
||||
|
||||
include ../config.mk
|
||||
foo: pre libr_bininfo.${EXT_SO} plugins
|
||||
|
||||
CFLAGS+=-DCORELIB -Iformat
|
||||
#XXX
|
||||
CFLAGS+=-D__UNIX__=1 -DLIL_ENDIAN=1
|
||||
include ../config.mk
|
||||
CFLAGS+=-DLIL_ENDIAN=1
|
||||
include ${STATIC_BININFO_PLUGINS}
|
||||
STATIC_OBJS=$(subst ..,p/..,$(subst bininfo_,p/bininfo_,$(STATIC_OBJ)))
|
||||
OBJ=bininfo.o ${STATIC_OBJS}
|
||||
|
||||
pre:
|
||||
if [ ! -e libr_bininfo.so ]; then rm -f ${STATIC_OBJS} ; fi
|
||||
if [ ! -e libr_bininfo.${EXT_SO} ]; then rm -f ${STATIC_OBJS} ; fi
|
||||
|
||||
plugins:
|
||||
cd p && ${MAKE} all
|
||||
|
@ -1,11 +1,13 @@
|
||||
include ../../config.mk
|
||||
|
||||
CFLAGS=-I../../include -Wall
|
||||
BINDEPS=
|
||||
|
||||
all: bininfo_addr2line.so
|
||||
all: bininfo_addr2line.${EXT_SO}
|
||||
@true
|
||||
|
||||
bininfo_addr2line.so: bininfo_addr2line.o
|
||||
${CC} ${CFLAGS} -fPIC -shared -o bininfo_addr2line.so bininfo_addr2line.c
|
||||
bininfo_addr2line.${EXT_SO}: bininfo_addr2line.o
|
||||
${CC} ${CFLAGS} -fPIC -shared -o bininfo_addr2line.${EXT_SO} bininfo_addr2line.c
|
||||
|
||||
clean:
|
||||
-rm -f *.so *.o
|
||||
|
@ -1,7 +1,22 @@
|
||||
#-include ../../config-user.mk
|
||||
#-include ../../mk/${COMPILER}.mk
|
||||
#-include ../../../config-user.mk
|
||||
#-include ../../../mk/${COMPILER}.mk
|
||||
|
||||
ifneq (${BINDEPS},)
|
||||
include ../../../config-user.mk
|
||||
include ../../../global.mk
|
||||
include ../../../mk/${COMPILER}.mk
|
||||
else
|
||||
-include ../../config-user.mk
|
||||
-include ../../global.mk
|
||||
-include ../../mk/${COMPILER}.mk
|
||||
|
||||
-include ../../../config-user.mk
|
||||
-include ../../../global.mk
|
||||
-include ../../../mk/${COMPILER}.mk
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS+=-DUSE_RIO=${USE_RIO}
|
||||
CFLAGS+=${CFLAGS_APPEND}
|
||||
@ -41,13 +56,3 @@ endif
|
||||
LIB=lib${NAME}
|
||||
LIBAR=${LIB}.${EXT_AR}
|
||||
LIBSO=${LIB}.${EXT_SO}
|
||||
|
||||
ifneq (${BINDEPS},)
|
||||
include ../../../config-user.mk
|
||||
include ../../../global.mk
|
||||
include ../../../mk/${COMPILER}.mk
|
||||
else
|
||||
include ../../config-user.mk
|
||||
include ../../global.mk
|
||||
include ../../mk/${COMPILER}.mk
|
||||
endif
|
||||
|
@ -1,8 +1,10 @@
|
||||
all: test
|
||||
include ../../config.mk
|
||||
|
||||
test:
|
||||
all: test${EXT_EXE}
|
||||
|
||||
test${EXT_EXE}:
|
||||
${CC} -g -I ../../include test.c ../*.o \
|
||||
../../util/*.o -o test
|
||||
../../util/*.o -o test${EXT_EXE}
|
||||
|
||||
clean:
|
||||
rm -f test
|
||||
|
@ -9,8 +9,10 @@
|
||||
#include "r_bp.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdarg.h>
|
||||
#if __UNIX__
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
static int cmd_io_system(void *data, const char *input);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
include ../../config.mk
|
||||
# XXX
|
||||
CFLAGS=-I../../include -I../arch/ -I../arch/include -Wall -fPIC -shared -Wl,-R..
|
||||
|
||||
@ -11,6 +12,6 @@ all: ${ALL_TARGETS}
|
||||
@true
|
||||
|
||||
clean:
|
||||
-rm -f *.so *.o ${STATIC_OBJ}
|
||||
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
|
||||
|
||||
.PHONY: all clean foo
|
||||
|
@ -1,7 +1,7 @@
|
||||
OBJ_AES=crypto_aes.o crypto_aes_algo.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_AES}
|
||||
TARGET_AES=crypto_aes.so
|
||||
TARGET_AES=crypto_aes.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_AES}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <r_lib.h>
|
||||
#include <r_crypto.h>
|
||||
|
||||
struct r_crypto_handle_t raes_crypto_plugin_aes = {
|
||||
struct r_crypto_handle_t r_crypto_plugin_aes = {
|
||||
.name = "crypto_aes",
|
||||
/* TODO */
|
||||
};
|
||||
|
@ -12,6 +12,15 @@
|
||||
|
||||
#define R_LIB_ENV "LIBR_PLUGINS"
|
||||
|
||||
/* XXX : This must depend on HOST_OS */
|
||||
#if __WINDOWS__
|
||||
#define R_LIB_EXT "dll"
|
||||
#elif __APPLE__
|
||||
#define R_LIB_EXT "dylib"
|
||||
#else
|
||||
#define R_LIB_EXT "so"
|
||||
#endif
|
||||
|
||||
/* store list of loaded plugins */
|
||||
typedef struct r_lib_plugin_t {
|
||||
int type;
|
||||
|
@ -5,17 +5,19 @@
|
||||
|
||||
#define HAVE_PTHREAD 1
|
||||
|
||||
#if HAVE_PTHREAD
|
||||
#if __WINDOWS__
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define R_TH_TID HANDLE
|
||||
#define R_TH_LOCK_T CRITICAL_SECTION
|
||||
|
||||
#elif HAVE_PTHREAD
|
||||
#define __GNU
|
||||
#include <pthread.h>
|
||||
#define R_TH_TID pthread_t
|
||||
#define R_TH_LOCK_T pthread_mutex_t
|
||||
|
||||
#elif __WIN32__
|
||||
#include <windows.h>
|
||||
#define R_TH_TID HANDLE
|
||||
#define R_TH_LOCK_T CRITICAL_SECTION
|
||||
|
||||
#else
|
||||
#error Threading library only supported for ptrace and w32
|
||||
#endif
|
||||
@ -28,7 +30,7 @@ typedef struct r_th_lock_t {
|
||||
} rThreadLock;
|
||||
|
||||
typedef struct r_th_t {
|
||||
pthread_t tid;
|
||||
R_TH_TID tid;
|
||||
struct r_th_lock_t lock;
|
||||
R_TH_FUNCTION(fun);
|
||||
void *user; // user pointer
|
||||
|
@ -15,7 +15,7 @@ OBJ=${STATIC_OBJS} io.o handle.o map.o section.o desc.o cache.o undo.o
|
||||
|
||||
pre:
|
||||
@echo STATICOBJS: ${STATIC_OBJS}
|
||||
@if [ ! -e libr_io.so ]; then rm -f ${STATIC_OBJS} ; fi
|
||||
@if [ ! -e libr_io.${EXT_SO} ]; then rm -f ${STATIC_OBJS} ; fi
|
||||
|
||||
tests:
|
||||
cd t && ${MAKE} all
|
||||
|
@ -95,9 +95,14 @@ R_API int r_io_open(struct r_io_t *io, const char *file, int flags, int mode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fd == -2)
|
||||
if (fd == -2) {
|
||||
#if __WINDOWS__
|
||||
fd = open (file, 0);
|
||||
#else
|
||||
// XXX RDONLY; READ; WRITE AND MORE SOO...
|
||||
fd = open(file, O_RDONLY, mode); // XXX drop posix depz here
|
||||
fd = open (file, O_RDONLY, mode); // XXX drop posix depz here
|
||||
#endif
|
||||
}
|
||||
if (fd >= 0) {
|
||||
r_io_set_fd(io, fd);
|
||||
r_io_desc_add(io, fd, file, flags, io->plugin);
|
||||
|
@ -1,5 +1,7 @@
|
||||
CFLAGS=-I../../include -Wall -DWORDSIZE=64 -fPIC -shared -Wl,-R.. -DCORELIB
|
||||
|
||||
include ../../config.mk
|
||||
|
||||
foo: all
|
||||
|
||||
ALL_TARGETS=
|
||||
|
@ -1,7 +1,7 @@
|
||||
OBJ_IODBG=io_debug.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_IODBG}
|
||||
TARGET_IODBG=io_debug.so
|
||||
TARGET_IODBG=io_debug.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_IODBG}
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
/* radare - LGPL - Copyright 2007-2009 pancake<nopcode.org> */
|
||||
|
||||
#if __linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__
|
||||
|
||||
#include <r_io.h>
|
||||
#include <r_lib.h>
|
||||
#include <r_util.h>
|
||||
|
||||
#if __linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/types.h>
|
||||
@ -127,7 +128,7 @@ static int __init(struct r_io_t *io)
|
||||
|
||||
struct r_io_handle_t r_io_plugin_debug = {
|
||||
//void *handle;
|
||||
.name = "io_dbg",
|
||||
.name = "io.debug",
|
||||
.desc = "Debug a program or pid. dbg:///bin/ls, dbg://1388",
|
||||
.open = __open,
|
||||
.handle_open = __handle_open,
|
||||
@ -143,11 +144,22 @@ struct r_io_handle_t r_io_plugin_debug = {
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
|
||||
struct r_io_handle_t r_io_plugin_debug = {
|
||||
//void *handle;
|
||||
.name = "io.debug",
|
||||
.desc = "Debug a program or pid. (NOT SUPPORTED FOR THIS PLATFORM)",
|
||||
.debug = (void *)1,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CORELIB
|
||||
struct r_lib_struct_t radare_plugin = {
|
||||
.type = R_LIB_TYPE_IO,
|
||||
.data = &r_io_plugin_debug
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -2,17 +2,18 @@
|
||||
|
||||
#include <r_userconf.h>
|
||||
|
||||
#if DEBUGGER
|
||||
|
||||
#include <r_io.h>
|
||||
#include <r_lib.h>
|
||||
#include <r_cons.h>
|
||||
#include <errno.h>
|
||||
|
||||
//#if DEBUGGER
|
||||
|
||||
#if __linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__
|
||||
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#if __linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__
|
||||
#include <errno.h>
|
||||
|
||||
#undef R_IO_NFDS
|
||||
#define R_IO_NFDS 2
|
||||
@ -251,12 +252,18 @@ struct r_io_handle_t r_io_plugin_ptrace = {
|
||||
*/
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
struct r_io_handle_t r_io_plugin_ptrace = {
|
||||
.name = "io.ptrace",
|
||||
.desc = "ptrace io (NOT SUPPORTED FOR THIS PLATFORM)",
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef CORELIB
|
||||
struct r_lib_struct_t radare_plugin = {
|
||||
.type = R_LIB_TYPE_IO,
|
||||
.data = &r_io_plugin_ptrace
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
OBJ_MALLOC=io_malloc.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_MALLOC}
|
||||
TARGET_MALLOC=io_malloc.so
|
||||
TARGET_MALLOC=io_malloc.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_MALLOC}
|
||||
|
||||
${TARGET_MALLOC}: ${OBJ_MALLOC}
|
||||
|
@ -1,7 +1,7 @@
|
||||
OBJ_PTRACE=io_ptrace.o
|
||||
|
||||
STATIC_OBJ+=${OBJ_PTRACE}
|
||||
TARGET_PTRACE=io_ptrace.so
|
||||
TARGET_PTRACE=io_ptrace.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_PTRACE}
|
||||
|
||||
${TARGET_PTRACE}: ${OBJ_PTRACE}
|
||||
|
@ -1,8 +1,11 @@
|
||||
NAME=r_lib
|
||||
OBJ=lib.o
|
||||
|
||||
include ../config.mk
|
||||
|
||||
# XXX only for linux
|
||||
CFLAGS+=-Wall -DLIBR_PLUGINS=\"${PREFIX}/lib/radare2\"
|
||||
LDFLAGS+=-ldl
|
||||
|
||||
LDFLAGS+=${DL_LIBS}
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -16,7 +16,8 @@
|
||||
#include <windows.h>
|
||||
#define DLOPEN(x) LoadLibrary(x)
|
||||
#define DLSYM(x,y) GetProcAddress(x,y)
|
||||
#define DLCLOSE(x) CloseLibrary(x)
|
||||
#define DLCLOSE(x) 0//(x)
|
||||
//CloseLibrary(x)
|
||||
#else
|
||||
#define DLOPEN(x) NULL
|
||||
#define DLSYM(x,y) NULL
|
||||
@ -43,7 +44,11 @@ R_API void *r_lib_dl_open(const char *libname)
|
||||
IFRTDBG fprintf(stderr, "Opening '%s'\n", libname);
|
||||
ret = DLOPEN(libname);
|
||||
if (ret == NULL)
|
||||
IFDBG fprintf(stderr, "dlerror: %s\n", dlerror());
|
||||
#if __UNIX__
|
||||
IFDBG eprintf("dlerror: %s\n", dlerror());
|
||||
#else
|
||||
eprintf ("r_lib_dl_open: Cannot open '%s'\n", libname);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
all: plugin.so test-plugin
|
||||
include ../../config.mk
|
||||
|
||||
all: plugin.${EXT_SO} test-plugin${EXT_EXE}
|
||||
@true
|
||||
|
||||
plugin.so:
|
||||
gcc -Wall -o plugin.so -shared plugin.c -I../../include
|
||||
plugin.${EXT_SO}:
|
||||
${CC} -Wall -o plugin.${EXT_SO} -shared plugin.c -I../../include
|
||||
|
||||
test-plugin:
|
||||
gcc -Wall -o test-plugin test-plugin.c -I ../../include ../../lib/*.o -ldl
|
||||
test-plugin${EXT_EXE}:
|
||||
${CC} -Wall -o test-plugin${EXT_EXE} test-plugin.c -I ../../include ../../lib/*.o ${DL_LIBS}
|
||||
|
||||
clean:
|
||||
-rm -f plugin.so test-plugin
|
||||
-rm -f plugin.${EXT_SO} test-plugin${EXT_EXE}
|
||||
|
@ -44,7 +44,7 @@ int main(int argc, char **argv)
|
||||
r_lib_add_handler(lib, 1, "example plugin handler", &cb_1, &cb_1_end, &ptr);
|
||||
r_lib_add_handler(lib, 2, "disassembler plugin handler", &cb_2, &cb_2_end, &ptr);
|
||||
r_lib_add_handler(lib, 3, "file headers parser plugin handler", &cb_2, &cb_2_end, &ptr);
|
||||
ret = r_lib_open(lib, "./plugin.so");
|
||||
ret = r_lib_open(lib, "./plugin."R_LIB_EXT);
|
||||
if (ret == -1) printf("Cannot open plugin\n");
|
||||
else printf("Plugin opened correctly\n");
|
||||
r_lib_list(lib);
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_macro
|
||||
DEPS=r_util
|
||||
OBJ=macro.o
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -1,6 +1,9 @@
|
||||
include ../../config.mk
|
||||
|
||||
CFLAGS=-I../../include -Wall -fPIC -shared -Wl,-R..
|
||||
# XXX
|
||||
CFLAGS+=-DLIL_ENDIAN=1 -D__UNIX__
|
||||
CFLAGS+=-DLIL_ENDIAN=1
|
||||
# -D__UNIX__
|
||||
CFLAGS+=-DCORELIB
|
||||
|
||||
foo: all
|
||||
@ -13,29 +16,6 @@ all: ${ALL_TARGETS}
|
||||
@true
|
||||
|
||||
clean:
|
||||
-rm -f *.so *.o ${STATIC_OBJ}
|
||||
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
|
||||
|
||||
.PHONY: all clean foo
|
||||
|
||||
|
||||
#CFLAGS=-I../../include -I../arch/ -I../arch/include -Wall -fPIC -shared -Wl,-R..
|
||||
#CFLAGS_IMP=-I../../include -I../arch/ -I../arch/include -w -fPIC -shared -Wl,-R..
|
||||
#
|
||||
#all: parse_dummy.so parse_x86_pseudo.so parse_mreplace.so
|
||||
# @true
|
||||
#
|
||||
#parse_dummy.so: parse_dummy.o
|
||||
# ${CC} ${CFLAGS} -o parse_dummy.so parse_dummy.o
|
||||
# @#strip -s parse_dummy.so
|
||||
#
|
||||
#parse_x86_pseudo.so: parse_x86_pseudo.o
|
||||
# ${CC} ${CFLAGS} -o parse_x86_pseudo.so parse_x86_pseudo.o
|
||||
# @#strip -s parse_x86_pseudo.so
|
||||
#
|
||||
#parse_mreplace.so: parse_mreplace.o
|
||||
# ${CC} ${CFLAGS_IMP} -o parse_mreplace.so \
|
||||
# mreplace/mreplace.c mreplace/mmemory.c parse_mreplace.o
|
||||
# @#strip -s parse_mreplace.so
|
||||
#
|
||||
#clean:
|
||||
# -rm -f *.so *.o
|
||||
|
@ -1,10 +1,9 @@
|
||||
OBJ_DUMMY+=parse_dummy.o
|
||||
|
||||
TARGET_DUMMY=parse_dummy.so
|
||||
TARGET_DUMMY=parse_dummy.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_DUMMY}
|
||||
STATIC_OBJ+=${OBJ_DUMMY}
|
||||
|
||||
${TARGET_DUMMY}: ${OBJ_DUMMY}
|
||||
${CC} ${CFLAGS} -o ${TARGET_DUMMY} ${OBJ_DUMMY}
|
||||
@#strip -s asm_dummy.so
|
||||
|
||||
@#strip -s asm_dummy.${EXT_SO}
|
||||
|
@ -1,10 +1,9 @@
|
||||
OBJ_MREPLACE+=parse_mreplace.o parse_mreplace/mreplace.o parse_mreplace/mmemory.o
|
||||
|
||||
TARGET_MREPLACE=parse_mreplace.so
|
||||
TARGET_MREPLACE=parse_mreplace.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_MREPLACE}
|
||||
STATIC_OBJ+=${OBJ_MREPLACE}
|
||||
|
||||
${TARGET_MREPLACE}: ${OBJ_MREPLACE}
|
||||
${CC} ${CFLAGS} -o ${TARGET_MREPLACE} ${OBJ_MREPLACE}
|
||||
@#strip -s asm_dummy.so
|
||||
|
||||
@#strip -s asm_dummy.${EXT_SO}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <r_lib.h>
|
||||
#include <r_parse.h>
|
||||
|
||||
#if __UNIX__
|
||||
|
||||
struct mreplace_t {
|
||||
char *data;
|
||||
@ -34,6 +35,13 @@ struct r_parse_handle_t r_parse_plugin_mreplace = {
|
||||
.parse = &parse,
|
||||
};
|
||||
|
||||
#else
|
||||
struct r_parse_handle_t r_parse_plugin_mreplace = {
|
||||
.name = "mreplace",
|
||||
.desc = "mreplace parsing plugin (NOT SUPPORTED FOR THIS PLATFORM)",
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CORELIB
|
||||
struct r_lib_struct_t radare_plugin = {
|
||||
|
@ -31,7 +31,7 @@ void memFree(memChunk *chunk){
|
||||
}
|
||||
void memInit(){
|
||||
mInfo=(memInfo*)malloc(sizeof(memInfo));
|
||||
bzero(mInfo,sizeof(memInfo));
|
||||
memset(mInfo,0,sizeof(memInfo));
|
||||
mInfo->state=MEM_STATE_OK;
|
||||
mInfo->allocated+=sizeof(memInfo);
|
||||
}
|
||||
@ -60,7 +60,7 @@ memChunk *memReserve(long size){
|
||||
}
|
||||
//printf("- reservando %d bytes\n",size);
|
||||
buffer->size=size;
|
||||
bzero(buffer->address,buffer->size);
|
||||
memset(buffer->address,0,buffer->size);
|
||||
mInfo->allocated+=buffer->size;
|
||||
return buffer;
|
||||
}
|
||||
@ -74,11 +74,7 @@ memChunk *memString(char *string){
|
||||
static memChunk *buffer;
|
||||
memCheckState();
|
||||
buffer=memReserve(strlen(string)+1);
|
||||
#if USE_BCOPY
|
||||
bcopy(string,buffer->address,strlen(string));
|
||||
#else
|
||||
memcpy(buffer->address,string,strlen(string));
|
||||
#endif
|
||||
memcpy(buffer->address,string,strlen(string));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -93,11 +89,7 @@ void memCopy(memChunk *dest,memChunk *source){
|
||||
#if DEBUG3
|
||||
printf("Copying %d bytes to dest (size %d)\n",nbytes,dest->address,dest->size);
|
||||
#endif
|
||||
#if USE_BCOPY
|
||||
bcopy(source->address,dest->address,nbytes);
|
||||
#else
|
||||
memcpy(dest->address,source->address,nbytes);
|
||||
#endif
|
||||
memcpy(dest->address,source->address,nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
functions by Mandingo, Copyleft, 2009-02-20
|
||||
*/
|
||||
|
||||
#if __UNIX__
|
||||
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -260,3 +262,6 @@ int main(char argc,char **argv){
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#warning NOT SUPPPORTED FOR THIS PLATFORM
|
||||
#endif
|
||||
|
@ -1,10 +1,9 @@
|
||||
OBJ_X86PSEUDO+=parse_x86_pseudo.o
|
||||
|
||||
TARGET_X86PSEUDO=parse_x86_pseudo.so
|
||||
TARGET_X86PSEUDO=parse_x86_pseudo.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_X86PSEUDO}
|
||||
STATIC_OBJ+=${OBJ_X86PSEUDO}
|
||||
|
||||
${TARGET_X86PSEUDO}: ${OBJ_X86PSEUDO}
|
||||
${CC} ${CFLAGS} -o ${TARGET_X86PSEUDO} ${OBJ_X86PSEUDO}
|
||||
@#strip -s asm_dummy.so
|
||||
|
||||
@#strip -s asm_dummy.${EXT_SO}
|
||||
|
@ -1,6 +1,6 @@
|
||||
OBJ=parse.o
|
||||
BIN=parse
|
||||
BINDEPS=r_util r_lib r_parse
|
||||
LIBS+=-ldl
|
||||
LIBS+=${DL_LIBS}
|
||||
|
||||
include ../../rules.mk
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_range
|
||||
DEPS=r_util
|
||||
OBJ=range.o
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -86,11 +86,13 @@ include ../../../mk/${COMPILER}.mk
|
||||
|
||||
CFLAGS+=-I../../include -DVERSION=\"${VERSION}\"
|
||||
|
||||
ifneq ($(BIN),)
|
||||
all: ${BIN}${EXT_EXE}
|
||||
|
||||
${BIN}${EXT_EXE}: ${OBJ}
|
||||
@echo BIN=${BIN}
|
||||
${CC} ${LDFLAGS} ${LIBS} ${OBJ} -o ${BIN}${EXT_EXE}
|
||||
endif
|
||||
|
||||
#Dummy myclean rule that can be overriden by the t/ Makefile
|
||||
myclean:
|
||||
|
@ -1,6 +1,7 @@
|
||||
NAME=r_th
|
||||
DEPS=
|
||||
|
||||
## XXX only for linux
|
||||
LDFLAGS=-lpthread
|
||||
|
||||
OBJ=th.o lock.o
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_util
|
||||
include ../config.mk
|
||||
OBJ=mem.o pool.o num.o str.o re.o hex.o file.o alloca.o
|
||||
OBJ+=float.o prof.o cache.o sys.o btree.o iter.o buf.o list.o
|
||||
|
||||
|
@ -3,7 +3,7 @@ OSTYPE=windows
|
||||
LINK=
|
||||
CC_AR=echo ar -r ${LIBAR}
|
||||
PICFLAGS=
|
||||
CFLAGS+=${PICFLAGS} -MD
|
||||
CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1
|
||||
CC_LIB=${CC} -shared -o ${LIBSO}
|
||||
CFLAGS_INCLUDE=-I
|
||||
LDFLAGS_LINK=-l
|
||||
|
@ -13,8 +13,9 @@ all: ${LIBS}
|
||||
test:
|
||||
-${LANG} test-r_bp.${LANG_EXT}
|
||||
-${LANG} test-r_asm.${LANG_EXT}
|
||||
-${LANG} test-r_hash.${LANG_EXT}
|
||||
|
||||
clean:
|
||||
rm -f *.so
|
||||
rm -f *.so r_*
|
||||
|
||||
.PHONY: all test clean
|
||||
|
Loading…
Reference in New Issue
Block a user