* Merge heads

This commit is contained in:
pancake 2009-03-09 13:13:44 +00:00
commit 13e9da6c79
13 changed files with 75 additions and 37 deletions

View file

@ -9,7 +9,7 @@
#include "../config.h"
static struct r_asm_handle_t *asm_static_plugins[] =
{ R_ASM_STATIC_PLUGINS, 0 };
{ R_ASM_STATIC_PLUGINS };
struct r_asm_t *r_asm_new()
{

View file

@ -2,22 +2,18 @@ CFLAGS=-I../../include -I../arch/ -I../arch/include -Wall -fPIC -shared -Wl,-R..
# XXX
CFLAGS+=-DLIL_ENDIAN=1 -D__UNIX__
CFLAGS_IMP=-I../../include -I../arch/ -I../arch/include -w -fPIC -shared -Wl,-R..
# XXX
CFLAGS_IMP+=-DLIL_ENDIAN=1 -D__UNIX__
foo: all
ALL_TARGETS=
ARCHS=dummy.mk mips.mk sparc.mk java.mk bf.mk arm.mk m68k.mk ppc.mk x86bea.mk x86olly.mk x86.mk
ARCHS=dummy.mk mips.mk sparc.mk java.mk bf.mk arm.mk m68k.mk ppc.mk x86bea.mk x86olly.mk x86.mk csr.mk
include $(ARCHS)
all: ${ALL_TARGETS}
@true
clean:
-rm -f *.so *.o ${STATIC_OBJ} \
${OBJ_X86} ${OBJ_X86_OLLY} ${OBJ_ARM} \
-rm -f *.so *.o \
${OBJ_X86} ${OBJ_X86_OLLY} ${OBJ_X86_BEA} ${OBJ_ARM} \
${OBJ_MIPS} ${OBJ_SPARC} ${OBJ_PPC} \
${OBJ_BF} ${OBJ_CSR} ${OBJ_M68K} ${OBJ_JAVA}

View file

@ -6,10 +6,6 @@ TARGET_X86_BEA=asm_x86_bea.so
ALL_TARGETS+=${TARGET_X86_BEA}
#${TARGET_X86_BEA}: ${OBJ_X86_BEA}
asm_x86_bea.so: ${OBJ_X86_BEA}
${CC} ${CFLAGS_IMP} -o asm_x86_bea.so \
asm_x86_bea.o ../arch/x86/bea/BeaEngine.o
@#strip -s asm_x86_bea.so
${TARGET_X86_BEA}: ${OBJ_X86_BEA}
${CC} ${CFLAGS} -o ${TARGET_X86_BEA} ${OBJ_X86_BEA}
@#strip -s asm_x86.so
@#strip -s asm_x86_bea.so

View file

@ -1,5 +1,20 @@
NAME=r_bin
DEPS=r_lib r_util
OBJ=bin.o
foo: pre libr_bin.so plugins
CFLAGS+=-DCORELIB -Iarch/include -Iarch
#XXX
CFLAGS+=-D__UNIX__=1 -DLIL_ENDIAN=1
include ../config.mk
include ${STATIC_BIN_PLUGINS}
STATIC_OBJS=$(subst ./,p/,$(STATIC_OBJ))
OBJ=bin.o ${STATIC_OBJS}
pre:
if [ ! -e libr_bin.so ]; then rm -f ${STATIC_OBJS} ; fi
plugins:
cd p && ${MAKE} all
include ../rules.mk

View file

@ -9,16 +9,15 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <r_types.h>
#include <r_lib.h>
#include <r_bin.h>
#include "../config.h"
static struct r_bin_handle_t *bin_static_plugins[] =
{ R_BIN_STATIC_PLUGINS };
struct r_bin_t *r_bin_new(char *file, int rw)
{
@ -34,9 +33,11 @@ void r_bin_free(struct r_bin_t *bin)
int r_bin_init(struct r_bin_t *bin)
{
int i;
bin->user = NULL;
INIT_LIST_HEAD(&bin->bins);
for(i=0;bin_static_plugins[i];i++)
r_bin_add(bin, bin_static_plugins[i]);
return R_TRUE;
}

View file

@ -2,24 +2,16 @@ CFLAGS=-I../../include -Wall -fPIC -shared -Wl,-R..
# XXX
CFLAGS+=-DLIL_ENDIAN=1 -D__UNIX__ -g
OBJ_ELF=bin_elf.o elf/elf.o
OBJ_ELF64=bin_elf64.o elf/elf64.o
OBJ_PE=bin_pe.o pe/pe.o
foo: all
all: bin_elf.so bin_elf64.so bin_pe.so
ALL_TARGETS=
FORMATS=elf.mk elf64.mk pe.mk
include $(FORMATS)
all: ${ALL_TARGETS}
@true
bin_elf.so: ${OBJ_ELF}
${CC} ${CFLAGS} -o bin_elf.so ${OBJ_ELF}
@#strip -s bin_elf.so
bin_elf64.so: ${OBJ_ELF64}
${CC} ${CFLAGS} -o bin_elf64.so ${OBJ_ELF64}
@#strip -s bin_elf64.so
bin_pe.so: ${OBJ_PE}
${CC} ${CFLAGS} -o bin_pe.so ${OBJ_PE}
@#strip -s bin_pe.so
clean:
-rm -f *.so *.o ${OBJ_ELF} ${OBJ_ELF64} ${OBJ_PE}
.PHONY: all clean foo

11
libr/bin/p/elf.mk Normal file
View file

@ -0,0 +1,11 @@
OBJ_ELF=./bin_elf.o ./elf/elf.o
STATIC_OBJ+=${OBJ_ELF}
TARGET_ELF=bin_elf.so
ALL_TARGETS+=${TARGET_ELF}
${TARGET_ELF}: ${OBJ_ELF}
${CC} ${CFLAGS} -o ${TARGET_ELF} ${OBJ_ELF}
@#strip -s ${TARGET_ELF}

11
libr/bin/p/elf64.mk Normal file
View file

@ -0,0 +1,11 @@
OBJ_ELF64=./bin_elf64.o ./elf/elf64.o
STATIC_OBJ+=${OBJ_ELF64}
TARGET_ELF64=bin_elf64.so
ALL_TARGETS+=${TARGET_ELF64}
${TARGET_ELF64}: ${OBJ_ELF64}
${CC} ${CFLAGS} -o ${TARGET_ELF64} ${OBJ_ELF64}
@#strip -s ${TARGET_ELF64}

11
libr/bin/p/pe.mk Normal file
View file

@ -0,0 +1,11 @@
OBJ_PE=./bin_pe.o ./pe/pe.o
STATIC_OBJ+=${OBJ_PE}
TARGET_PE=bin_pe.so
ALL_TARGETS+=${TARGET_PE}
${TARGET_PE}: ${OBJ_PE}
${CC} ${CFLAGS} -o ${TARGET_PE} ${OBJ_PE}
@#strip -s ${TARGET_PE}

View file

@ -3,5 +3,7 @@
#define R_ASM_STATIC_PLUGINS \
&r_asm_plugin_java, &r_asm_plugin_mips, 0
#define R_BIN_STATIC_PLUGINS \
0
#endif

View file

@ -7,3 +7,4 @@ USE_RIO=1
# static plugins
STATIC_ASM_PLUGINS=p/java.mk p/mips.mk
STATIC_BIN_PLUGINS=

View file

@ -126,4 +126,6 @@ u64 r_bin_get_section_offset(struct r_bin_t *bin, char *name);
u64 r_bin_get_section_rva(struct r_bin_t *bin, char *name);
u64 r_bin_get_section_size(struct r_bin_t *bin, char *name);
/* plugin pointers */
#endif

View file

@ -142,7 +142,7 @@ int r_lib_open(struct r_lib_t *lib, const char *file)
}
stru = (struct r_lib_struct_t *) r_lib_dl_sym(handler, lib->symname);
if (stru == NULL) {
fprintf(stderr, "No root symbol '%s' found in library '%s'\n", lib->symname, file);
IFDBG fprintf(stderr, "No root symbol '%s' found in library '%s'\n", lib->symname, file);
return -1;
}
struct r_lib_plugin_t *p = MALLOC_STRUCT(struct r_lib_plugin_t);