From 0d4faf652e9fdaff798b95662ebfd9adc9866b2c Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 19 Jul 2011 00:12:36 +0200 Subject: [PATCH] * Set library version number for plugins - Registers for which version of core was compiled * Use tar --format=posix when GNU tar - Fixes the dependency on BSD systems * Fix in doc/fortunes * Fix this class pointer in asm_java * Re-Fix uglily the bin_elf strtab issue (needs more work) * Fix Vala regression in r_asm.vapi --- Makefile | 9 ++- TODO | 1 + doc/fortunes | 2 +- libr/anal/p/arm.mk | 2 +- libr/anal/p/avr.mk | 3 +- libr/anal/p/csr.mk | 3 +- libr/anal/p/dalvik.mk | 2 +- libr/anal/p/java.mk | 2 +- libr/anal/p/mips.mk | 3 +- libr/anal/p/ppc.mk | 3 +- libr/anal/p/sh.mk | 2 +- libr/anal/p/x86.mk | 3 +- libr/anal/p/x86_simple.mk | 2 +- libr/asm/arch/arm/armthumb.c | 2 +- libr/asm/arch/java/javasm/javasm.c | 2 +- libr/asm/arch/sparc/gnu/sparc-dis.c | 1 + libr/asm/p/arm.mk | 2 +- libr/asm/p/armthumb.mk | 3 +- libr/asm/p/avr.mk | 3 +- libr/asm/p/bf.mk | 2 +- libr/asm/p/csr.mk | 2 +- libr/asm/p/dalvik.mk | 2 +- libr/asm/p/gas.mk | 2 +- libr/asm/p/java.mk | 2 +- libr/asm/p/mips.mk | 2 +- libr/asm/p/msil.mk | 2 +- libr/asm/p/ppc.mk | 2 +- libr/asm/p/psosvm.mk | 2 +- libr/asm/p/sh.mk | 2 +- libr/asm/p/sparc.mk | 2 +- libr/asm/p/x86.mk | 2 +- libr/asm/p/x86_nasm.mk | 2 +- libr/asm/p/x86_olly.mk | 2 +- libr/bin/Makefile | 1 + libr/bin/format/elf/elf.c | 82 ++++++++++++++++++-------- libr/bin/format/elf/elf.h | 3 + libr/bin/p/Makefile | 3 +- libr/bin/p/dex.mk | 3 +- libr/bin/p/dyldcache.mk | 3 +- libr/bin/p/elf.mk | 3 +- libr/bin/p/elf64.mk | 3 +- libr/bin/p/fatmach0.mk | 3 +- libr/bin/p/fs.mk | 2 +- libr/bin/p/java.mk | 3 +- libr/bin/p/mach0.mk | 3 +- libr/bin/p/mach064.mk | 3 +- libr/bin/p/pe.mk | 3 +- libr/bin/p/pe64.mk | 3 +- libr/bp/p/arm.mk | 2 +- libr/bp/p/mips.mk | 2 +- libr/bp/p/ppc.mk | 2 +- libr/bp/p/sh.mk | 2 +- libr/bp/p/x86.mk | 2 +- libr/cmd/p/dummy.mk | 2 +- libr/config.mk.tail | 2 + libr/crypto/p/aes.mk | 2 +- libr/debug/p/gdb.mk | 2 +- libr/debug/p/native.mk | 2 +- libr/debug/p/rap.mk | 2 +- libr/fs/p/cpio.mk | 2 +- libr/fs/p/ext2.mk | 2 +- libr/fs/p/fat.mk | 2 +- libr/fs/p/fb.mk | 2 +- libr/fs/p/hfs.mk | 2 +- libr/fs/p/hfsplus.mk | 2 +- libr/fs/p/iso9660.mk | 2 +- libr/fs/p/jfs.mk | 2 +- libr/fs/p/minix.mk | 2 +- libr/fs/p/ntfs.mk | 2 +- libr/fs/p/posix.mk | 2 +- libr/fs/p/reiserfs.mk | 2 +- libr/fs/p/sfs.mk | 2 +- libr/fs/p/tar.mk | 2 +- libr/fs/p/udf.mk | 2 +- libr/fs/p/ufs.mk | 2 +- libr/fs/p/ufs2.mk | 2 +- libr/fs/p/xfs.mk | 2 +- libr/io/p/debug.mk | 2 +- libr/io/p/gdb.mk | 2 +- libr/io/p/haret.mk | 2 +- libr/io/p/mach.mk | 2 +- libr/io/p/malloc.mk | 2 +- libr/io/p/procpid.mk | 2 +- libr/io/p/ptrace.mk | 2 +- libr/io/p/rap.mk | 3 +- libr/io/p/shm.mk | 2 +- libr/io/p/w32.mk | 2 +- libr/io/p/w32dbg.mk | 2 +- libr/parse/p/mreplace.mk | 3 +- libr/parse/p/parse_mreplace/mreplace.c | 5 +- libr/parse/p/x86_pseudo.mk | 3 +- libr/util/buf.c | 6 +- man/rabin2.1 | 2 +- mk/gcc.mk | 4 +- r2-bindings/Makefile | 7 ++- r2-bindings/vapi/r_asm.vapi | 2 +- 96 files changed, 171 insertions(+), 141 deletions(-) diff --git a/Makefile b/Makefile index 5adb202be9..114f3cf953 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ include config-user.mk include global.mk +ifneq ($(shell tar --help|grep gnu.org),) +TAR=tar -czv --format=posix -f +else +TAR=tar -czvf +endif PWD=$(shell pwd) REMOTE=radare.org:/srv/http/radareorg/get/beta @@ -112,7 +117,7 @@ dist: VERSION=${VERSION} ; \ FILES=`hg st -mc .| cut -c 3-|sed -e s,^,radare2-${VERSION}/, | grep -v r2-bindings | grep -v '/\.'` ; \ cd .. && mv radare2 radare2-${VERSION} && \ - tar czvf radare2-${VERSION}.tar.gz $${FILES} ;\ + ${TAR} radare2-${VERSION}.tar.gz $${FILES} ;\ mv radare2-${VERSION} radare2 pub: @@ -122,7 +127,7 @@ shot: DATE=`date '+%Y%m%d'` ; \ FILES=`hg status -mc|cut -c 3-|sed -e s,^,radare2-$${DATE}/,`; \ cd .. && mv radare2 radare2-$${DATE} && \ - tar czvf radare2-$${DATE}.tar.gz $${FILES} ;\ + ${TAR} radare2-$${DATE}.tar.gz $${FILES} ;\ mv radare2-$${DATE} radare2 && \ scp radare2-$${DATE}.tar.gz radare.org:/srv/http/radareorg/get/shot diff --git a/TODO b/TODO index e503c4bd6a..2e0a94b8b6 100644 --- a/TODO +++ b/TODO @@ -5,6 +5,7 @@ CODENAME: #DRY +* Move mandpage from man/ to binr/*/? * add support for sockets in rarun2 TODO diff --git a/doc/fortunes b/doc/fortunes index 5249e68572..908fd02a2b 100644 --- a/doc/fortunes +++ b/doc/fortunes @@ -29,7 +29,7 @@ Command layout is: @.\ For example: 3x20@0x33 w Press 'c' in visual mode to toggle the cursor mode You can "copy/paste" bytes using the cursor in visual mode 'c' and using the 'y' and 'Y' keys Move around the bytes with hjkl! Arrow keys are not portable and are less productive to use -Seek at relative offsets with 'seek +' or 'seek -' +Seek at relative offsets with 's +' or 's -' Invert the block bytes using the 'I' key in visual mode Switch between print modes using the 'p' and 'P' keys in visual mode In soviet russia radare debugs you! diff --git a/libr/anal/p/arm.mk b/libr/anal/p/arm.mk index eda39fdcb4..a20f325fc7 100644 --- a/libr/anal/p/arm.mk +++ b/libr/anal/p/arm.mk @@ -6,4 +6,4 @@ TARGET_ARM=anal_arm.${EXT_SO} ALL_TARGETS+=${TARGET_ARM} ${TARGET_ARM}: ${OBJ_ARM} - ${CC} ${LDFLAGS} ${CFLAGS} -o anal_arm.${EXT_SO} ${OBJ_ARM} + ${CC} $(call libname,anal_asm) ${LDFLAGS} ${CFLAGS} -o anal_arm.${EXT_SO} ${OBJ_ARM} diff --git a/libr/anal/p/avr.mk b/libr/anal/p/avr.mk index 9f0a6aac17..cc2920144f 100644 --- a/libr/anal/p/avr.mk +++ b/libr/anal/p/avr.mk @@ -6,5 +6,4 @@ TARGET_AVR=anal_avr.${EXT_SO} ALL_TARGETS+=${TARGET_AVR} ${TARGET_AVR}: ${OBJ_AVR} - ${CC} ${CFLAGS} -o anal_avr.${EXT_SO} ${OBJ_AVR} - @#strip -s anal_avr.${EXT_SO} + ${CC} $(call libname,anal_avr) ${CFLAGS} -o anal_avr.${EXT_SO} ${OBJ_AVR} diff --git a/libr/anal/p/csr.mk b/libr/anal/p/csr.mk index 9048fac32e..1a7604f723 100644 --- a/libr/anal/p/csr.mk +++ b/libr/anal/p/csr.mk @@ -6,5 +6,4 @@ TARGET_CSR=anal_csr.${EXT_SO} ALL_TARGETS+=${TARGET_CSR} ${TARGET_CSR}: ${OBJ_CSR} - ${CC} ${CFLAGS} -o anal_csr.${EXT_SO} ${OBJ_CSR} - @#strip -s anal_csr.${EXT_SO} + ${CC} $(call libname,anal_csr) ${CFLAGS} -o anal_csr.${EXT_SO} ${OBJ_CSR} diff --git a/libr/anal/p/dalvik.mk b/libr/anal/p/dalvik.mk index fff1314710..bac22f9faf 100644 --- a/libr/anal/p/dalvik.mk +++ b/libr/anal/p/dalvik.mk @@ -6,4 +6,4 @@ TARGET_DALVIK=anal_dalvik.${EXT_SO} ALL_TARGETS+=${TARGET_DALVIK} ${TARGET_DALVIK}: ${OBJ_DALVIK} - ${CC} ${LDFLAGS} ${CFLAGS} -o anal_dalvik.${EXT_SO} ${OBJ_DALVIK} + ${CC} $(call libname,anal_dalvik) ${LDFLAGS} ${CFLAGS} -o anal_dalvik.${EXT_SO} ${OBJ_DALVIK} diff --git a/libr/anal/p/java.mk b/libr/anal/p/java.mk index 550aa32135..fcce6acf13 100644 --- a/libr/anal/p/java.mk +++ b/libr/anal/p/java.mk @@ -7,4 +7,4 @@ TARGET_JAVA=anal_java.${EXT_SO} ALL_TARGETS+=${TARGET_JAVA} ${TARGET_JAVA}: ${OBJ_JAVA} - ${CC} ${CFLAGS} -o anal_java.${EXT_SO} ${OBJ_JAVA} + ${CC} $(call libname,anal_java) ${CFLAGS} -o anal_java.${EXT_SO} ${OBJ_JAVA} diff --git a/libr/anal/p/mips.mk b/libr/anal/p/mips.mk index a8bc61c247..74c0d606eb 100644 --- a/libr/anal/p/mips.mk +++ b/libr/anal/p/mips.mk @@ -6,5 +6,4 @@ TARGET_MIPS=anal_mips.${EXT_SO} ALL_TARGETS+=${TARGET_MIPS} ${TARGET_MIPS}: ${OBJ_MIPS} - ${CC} ${CFLAGS} -o anal_mips.${EXT_SO} ${OBJ_MIPS} - @#strip -s anal_mips.${EXT_SO} + ${CC} $(call libname,anal_mips) ${CFLAGS} -o anal_mips.${EXT_SO} ${OBJ_MIPS} diff --git a/libr/anal/p/ppc.mk b/libr/anal/p/ppc.mk index f5f902e477..cadc907ae0 100644 --- a/libr/anal/p/ppc.mk +++ b/libr/anal/p/ppc.mk @@ -6,5 +6,4 @@ TARGET_PPC=anal_ppc.${EXT_SO} ALL_TARGETS+=${TARGET_PPC} ${TARGET_PPC}: ${OBJ_PPC} - ${CC} -shared ${CFLAGS} -o anal_ppc.${EXT_SO} ${OBJ_PPC} - @#strip -s anal_ppc.${EXT_SO} + ${CC} $(call libname,anal_ppc) ${CFLAGS} -o anal_ppc.${EXT_SO} ${OBJ_PPC} diff --git a/libr/anal/p/sh.mk b/libr/anal/p/sh.mk index 75d0b93f0a..ead55297d5 100644 --- a/libr/anal/p/sh.mk +++ b/libr/anal/p/sh.mk @@ -6,4 +6,4 @@ TARGET_SH=anal_sh.${EXT_SO} ALL_TARGETS+=${TARGET_SH} ${TARGET_SH}: ${OBJ_SH} - ${CC} ${LDFLAGS} ${CFLAGS} -o anal_sh.${EXT_SO} ${OBJ_SH} + ${CC} $(call libname,anal_sh) ${LDFLAGS} ${CFLAGS} -o anal_sh.${EXT_SO} ${OBJ_SH} diff --git a/libr/anal/p/x86.mk b/libr/anal/p/x86.mk index 11eef16aa4..841ea8169c 100644 --- a/libr/anal/p/x86.mk +++ b/libr/anal/p/x86.mk @@ -8,5 +8,4 @@ ALL_TARGETS+=${TARGET_X86} CFLAGS+=-D__X86IM_USE_FMT__ ${TARGET_X86}: ${OBJ_X86} - ${CC} -shared ${CFLAGS} -o anal_x86.${EXT_SO} ${OBJ_X86} - @#strip -s anal_x86.${EXT_SO} + ${CC} $(call libname,anal_x86) ${CFLAGS} -o anal_x86.${EXT_SO} ${OBJ_X86} diff --git a/libr/anal/p/x86_simple.mk b/libr/anal/p/x86_simple.mk index 29d1386938..7659a4703d 100644 --- a/libr/anal/p/x86_simple.mk +++ b/libr/anal/p/x86_simple.mk @@ -9,4 +9,4 @@ LIBS_X86_SIMPLE=r_anal r_reg r_lib r_syscall r_diff MYLIBS=$(subst r_,-L../../,$(LIBS_X86_SIMPLE)) ${TARGET_X86_SIMPLE}: ${OBJ_X86_SIMPLE} - ${CC} ${MYLIBS} ${LDFLAGS} ${CFLAGS} -o anal_x86_simple.${EXT_SO} ${OBJ_X86_SIMPLE} + ${CC} $(call libname,anal_x86_simple) ${MYLIBS} ${LDFLAGS} ${CFLAGS} -o anal_x86_simple.${EXT_SO} ${OBJ_X86_SIMPLE} diff --git a/libr/asm/arch/arm/armthumb.c b/libr/asm/arch/arm/armthumb.c index 8ddeb21d6b..d493eda5d2 100644 --- a/libr/asm/arch/arm/armthumb.c +++ b/libr/asm/arch/arm/armthumb.c @@ -215,7 +215,7 @@ API int armthumb_disassemble(char *buf, unsigned long pc, unsigned int ins) { case 4: imm *= 2; mask = 0xFFFF; break; default: mask = 0xFF; break; } - sprintf(buf, "%s %s, [%s, #%d]", op, regname(Rd), regname(Rn), imm); + sprintf(buf, "%s %s, [%s, #%d]", op, regname(Rd), regname(Rn), imm&mask); //if (op_code & 1) this->load_reference(r[Rn]+imm, Rd, mask); //else this->store_reference(r[Rn]+imm, r[Rd], mask); // Load & Store, format 2 diff --git a/libr/asm/arch/java/javasm/javasm.c b/libr/asm/arch/java/javasm/javasm.c index 7f5009efda..e15a3b8f90 100644 --- a/libr/asm/arch/java/javasm/javasm.c +++ b/libr/asm/arch/java/javasm/javasm.c @@ -367,7 +367,7 @@ int java_classdump(const char *file, int verbose) { check_eof(fd); V printf("Access flags: 0x%04x\n", cf2.access_flags); this_class = r_ntohs(cf2.this_class); - V printf("This class: %d\n", cf2.this_class); + V printf("This class: %d\n", this_class); check_eof(fd); //printf("This class: %d (%s)\n", ntohs(cf2.this_class), cp_items[ntohs(cf2.this_class)-1].value); // XXX this is a double pointer !!1 //printf("Super class: %d (%s)\n", ntohs(cf2.super_class), cp_items[ntohs(cf2.super_class)-1].value); diff --git a/libr/asm/arch/sparc/gnu/sparc-dis.c b/libr/asm/arch/sparc/gnu/sparc-dis.c index 32ef138ea0..95c2471eee 100644 --- a/libr/asm/arch/sparc/gnu/sparc-dis.c +++ b/libr/asm/arch/sparc/gnu/sparc-dis.c @@ -999,6 +999,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info) if (opcode->flags & (F_UNBR|F_CONDBR|F_JSR)) { /* FIXME -- check is_annulled flag. */ + if (is_annulled) { /* do nothing */ } if (opcode->flags & F_UNBR) info->insn_type = dis_branch; if (opcode->flags & F_CONDBR) diff --git a/libr/asm/p/arm.mk b/libr/asm/p/arm.mk index 9dfd57b646..1fd501818e 100644 --- a/libr/asm/p/arm.mk +++ b/libr/asm/p/arm.mk @@ -8,4 +8,4 @@ TARGET_ARM=asm_arm.${EXT_SO} ALL_TARGETS+=${TARGET_ARM} ${TARGET_ARM}: ${OBJ_ARM} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_arm.${EXT_SO} ${OBJ_ARM} + ${CC} $(call libname,asm_arm) ${LDFLAGS} ${CFLAGS} -o asm_arm.${EXT_SO} ${OBJ_ARM} diff --git a/libr/asm/p/armthumb.mk b/libr/asm/p/armthumb.mk index 57cb20cb63..f70e59b52b 100644 --- a/libr/asm/p/armthumb.mk +++ b/libr/asm/p/armthumb.mk @@ -7,4 +7,5 @@ TARGET_ARMTHUMB=asm_armthumb.${EXT_SO} ALL_TARGETS+=${TARGET_ARMTHUMB} ${TARGET_ARMTHUMB}: ${OBJ_ARMTHUMB} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_armthumb.${EXT_SO} ${OBJ_ARMTHUMB} + ${CC} $(call libname,asm_armthumb) ${LDFLAGS} \ + ${CFLAGS} -o asm_armthumb.${EXT_SO} ${OBJ_ARMTHUMB} diff --git a/libr/asm/p/avr.mk b/libr/asm/p/avr.mk index 717c482559..5d474fcd9b 100644 --- a/libr/asm/p/avr.mk +++ b/libr/asm/p/avr.mk @@ -7,4 +7,5 @@ TARGET_AVR=asm_avr.${EXT_SO} ALL_TARGETS+=${TARGET_AVR} ${TARGET_AVR}: ${OBJ_AVR} - ${CC} ${LDFLAGS} -I../arch/avr ${CFLAGS} -o asm_avr.${EXT_SO} ${OBJ_AVR} + ${CC} $(call libname,asm_avr) ${LDFLAGS} \ + -I../arch/avr ${CFLAGS} -o asm_avr.${EXT_SO} ${OBJ_AVR} diff --git a/libr/asm/p/bf.mk b/libr/asm/p/bf.mk index 4541327ad7..4d17b9be4d 100644 --- a/libr/asm/p/bf.mk +++ b/libr/asm/p/bf.mk @@ -5,4 +5,4 @@ ALL_TARGETS+=${TARGET_BF} STATIC_OBJ+=${OBJ_BF} ${TARGET_BF}: ${OBJ_BF} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_BF} ${OBJ_BF} + ${CC} $(call libname,asm_bf) ${LDFLAGS} ${CFLAGS} -o ${TARGET_BF} ${OBJ_BF} diff --git a/libr/asm/p/csr.mk b/libr/asm/p/csr.mk index 7b370c33b4..f49c4ab2fb 100644 --- a/libr/asm/p/csr.mk +++ b/libr/asm/p/csr.mk @@ -7,4 +7,4 @@ TARGET_CSR=asm_csr.${EXT_SO} ALL_TARGETS+=${TARGET_CSR} ${TARGET_CSR}: ${OBJ_CSR} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_csr.${EXT_SO} ${OBJ_CSR} + ${CC} $(call libname,asm_csr) ${LDFLAGS} ${CFLAGS} -o asm_csr.${EXT_SO} ${OBJ_CSR} diff --git a/libr/asm/p/dalvik.mk b/libr/asm/p/dalvik.mk index a2de16a386..7686bb091f 100644 --- a/libr/asm/p/dalvik.mk +++ b/libr/asm/p/dalvik.mk @@ -6,4 +6,4 @@ TARGET_DALVIK=asm_dalvik.${EXT_SO} ALL_TARGETS+=${TARGET_DALVIK} ${TARGET_DALVIK}: ${OBJ_DALVIK} - ${CC} ${LDFLAGS} -I../arch/dalvik ${CFLAGS} -o asm_dalvik.${EXT_SO} ${OBJ_DALVIK} + ${CC} $(call libname,asm_dalvik) ${LDFLAGS} -I../arch/dalvik ${CFLAGS} -o asm_dalvik.${EXT_SO} ${OBJ_DALVIK} diff --git a/libr/asm/p/gas.mk b/libr/asm/p/gas.mk index 62ab60ffad..51ef0ed54a 100644 --- a/libr/asm/p/gas.mk +++ b/libr/asm/p/gas.mk @@ -6,4 +6,4 @@ TARGET_X86=asm_gas.${EXT_SO} ALL_TARGETS+=${TARGET_X86} ${TARGET_X86}: ${OBJ_X86} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} + ${CC} $(call libname,asm_gas) ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} diff --git a/libr/asm/p/java.mk b/libr/asm/p/java.mk index 1634af8773..bbee48f779 100644 --- a/libr/asm/p/java.mk +++ b/libr/asm/p/java.mk @@ -8,4 +8,4 @@ TARGET_JAVA=asm_java.${EXT_SO} ALL_TARGETS+=${TARGET_JAVA} ${TARGET_JAVA}: ${OBJ_JAVA} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_java.${EXT_SO} ${OBJ_JAVA} + ${CC} $(call libname,asm_java) ${LDFLAGS} ${CFLAGS} -o asm_java.${EXT_SO} ${OBJ_JAVA} diff --git a/libr/asm/p/mips.mk b/libr/asm/p/mips.mk index 18211a64b3..7d0453fce1 100644 --- a/libr/asm/p/mips.mk +++ b/libr/asm/p/mips.mk @@ -9,4 +9,4 @@ ALL_TARGETS+=${TARGET_MIPS} STATIC_OBJ+=${OBJ_MIPS} ${TARGET_MIPS}: ${OBJ_MIPS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_MIPS} ${OBJ_MIPS} + ${CC} $(call libname,asm_mips) ${LDFLAGS} ${CFLAGS} -o ${TARGET_MIPS} ${OBJ_MIPS} diff --git a/libr/asm/p/msil.mk b/libr/asm/p/msil.mk index 4f4250ab3c..ae07a658a5 100644 --- a/libr/asm/p/msil.mk +++ b/libr/asm/p/msil.mk @@ -7,4 +7,4 @@ TARGET_MSIL=asm_msil.${EXT_SO} ALL_TARGETS+=${TARGET_MSIL} ${TARGET_MSIL}: ${OBJ_MSIL} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_msil.${EXT_SO} ${OBJ_MSIL} + ${CC} $(call libname,asm_msil) ${LDFLAGS} ${CFLAGS} -o asm_msil.${EXT_SO} ${OBJ_MSIL} diff --git a/libr/asm/p/ppc.mk b/libr/asm/p/ppc.mk index d0cb00ca89..916ff898c0 100644 --- a/libr/asm/p/ppc.mk +++ b/libr/asm/p/ppc.mk @@ -8,4 +8,4 @@ TARGET_PPC=asm_ppc.${EXT_SO} ALL_TARGETS+=${TARGET_PPC} ${TARGET_PPC}: ${OBJ_PPC} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_ppc.${EXT_SO} ${OBJ_PPC} + ${CC} $(call libname,asm_ppc) ${LDFLAGS} ${CFLAGS} -o asm_ppc.${EXT_SO} ${OBJ_PPC} diff --git a/libr/asm/p/psosvm.mk b/libr/asm/p/psosvm.mk index 69eecb747c..56e868f9f3 100644 --- a/libr/asm/p/psosvm.mk +++ b/libr/asm/p/psosvm.mk @@ -7,4 +7,4 @@ TARGET_PSOSVM=asm_psosvm.${EXT_SO} ALL_TARGETS+=${TARGET_PSOSVM} ${TARGET_PSOSVM}: ${OBJ_PSOSVM} - ${CC} ${LDFLAGS} ${CFLAGS} -o asm_psosvm.${EXT_SO} ${OBJ_PSOSVM} + ${CC} $(call libname,asm_psosvm) ${LDFLAGS} ${CFLAGS} -o asm_psosvm.${EXT_SO} ${OBJ_PSOSVM} diff --git a/libr/asm/p/sh.mk b/libr/asm/p/sh.mk index e2d4af3d99..cb4d0a800a 100644 --- a/libr/asm/p/sh.mk +++ b/libr/asm/p/sh.mk @@ -7,4 +7,4 @@ TARGET_SH=asm_sh.${EXT_SO} ALL_TARGETS+=${TARGET_SH} ${TARGET_SH}: ${OBJ_SH} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_SH} ${OBJ_SH} + ${CC} $(call libname,asm_sh) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SH} ${OBJ_SH} diff --git a/libr/asm/p/sparc.mk b/libr/asm/p/sparc.mk index 3ee60d2127..332e76a077 100644 --- a/libr/asm/p/sparc.mk +++ b/libr/asm/p/sparc.mk @@ -8,4 +8,4 @@ TARGET_SPARC=asm_sparc.${EXT_SO} ALL_TARGETS+=${TARGET_SPARC} ${TARGET_SPARC}: ${OBJ_SPARC} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_SPARC} ${OBJ_SPARC} + ${CC} $(call libname,asm_sparc) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SPARC} ${OBJ_SPARC} diff --git a/libr/asm/p/x86.mk b/libr/asm/p/x86.mk index f1b6a67d12..46c7f289ef 100644 --- a/libr/asm/p/x86.mk +++ b/libr/asm/p/x86.mk @@ -14,4 +14,4 @@ TARGET_X86=asm_x86.${EXT_SO} ALL_TARGETS+=${TARGET_X86} ${TARGET_X86}: ${OBJ_X86} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} + ${CC} $(call libname,asm_x86) ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} diff --git a/libr/asm/p/x86_nasm.mk b/libr/asm/p/x86_nasm.mk index 6cd2201aff..0f83a250b2 100644 --- a/libr/asm/p/x86_nasm.mk +++ b/libr/asm/p/x86_nasm.mk @@ -6,4 +6,4 @@ TARGET_X86_NASM=asm_x86_nasm.${EXT_SO} ALL_TARGETS+=${TARGET_X86_NASM} ${TARGET_X86_NASM}: ${OBJ_X86_NASM} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86_NASM} ${OBJ_X86_NASM} + ${CC} $(call libname,asm_x86_nasm) ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86_NASM} ${OBJ_X86_NASM} diff --git a/libr/asm/p/x86_olly.mk b/libr/asm/p/x86_olly.mk index 0aca95ba20..64f0728e20 100644 --- a/libr/asm/p/x86_olly.mk +++ b/libr/asm/p/x86_olly.mk @@ -9,4 +9,4 @@ TARGET_X86_OLLY=asm_x86_olly.${EXT_SO} ALL_TARGETS+=${TARGET_X86_OLLY} ${TARGET_X86_OLLY}: ${OBJ_X86_OLLY} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86_OLLY} ${OBJ_X86_OLLY} + ${CC} $(call libname,asm_x86_olly) ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86_OLLY} ${OBJ_X86_OLLY} diff --git a/libr/bin/Makefile b/libr/bin/Makefile index b6c7d0aafa..d21a843787 100644 --- a/libr/bin/Makefile +++ b/libr/bin/Makefile @@ -11,6 +11,7 @@ CFLAGS+=-DCORELIB -Iformat -Imangling include ../config.mk include ${STATIC_BIN_PLUGINS} include ${STATIC_BIN_XTR_PLUGINS} + STATIC_OBJS=$(subst ..,p/..,$(subst bin_,p/bin_,$(STATIC_OBJ))) OBJ=bin.o bin_meta.o bin_write.o demangle.o ${STATIC_OBJS} OBJ+=mangling/cxx/cp-demangle.o diff --git a/libr/bin/format/elf/elf.c b/libr/bin/format/elf/elf.c index cbe1d676c1..fa28fb5f8e 100644 --- a/libr/bin/format/elf/elf.c +++ b/libr/bin/format/elf/elf.c @@ -7,7 +7,7 @@ #include #include "elf.h" -static ut64 Elf_(r_bin_elf_get_section_size)(struct Elf_(r_bin_elf_obj_t) *bin, const char *section_name); +static ut64 Elf_(r_bin_elf_get_section_offset)(struct Elf_(r_bin_elf_obj_t) *bin, const char *section_name); static inline int __strnlen(const char *str, int len) { int l = 0; @@ -94,31 +94,73 @@ static int Elf_(r_bin_elf_init_shdr)(struct Elf_(r_bin_elf_obj_t) *bin) { } static int Elf_(r_bin_elf_init_strtab)(struct Elf_(r_bin_elf_obj_t) *bin) { - ut64 size; if (!bin->shdr) - return R_FALSE; + return R_FALSE; + bin->shstrtab_section = bin->strtab_section = &bin->shdr[bin->ehdr.e_shstrndx]; - bin->strtab_size = size = bin->strtab_section->sh_size; - - if ((bin->strtab = (char *)malloc (size)) == NULL) { + bin->shstrtab_size = + bin->strtab_size = bin->strtab_section->sh_size; + if ((bin->strtab = (char *)malloc (bin->strtab_section->sh_size)) == NULL) { perror ("malloc"); return R_FALSE; } - if (r_buf_read_at (bin->b, bin->strtab_section->sh_offset, (ut8*)bin->strtab, size) == -1) { + bin->shstrtab = bin->strtab; + if (r_buf_read_at (bin->b, bin->strtab_section->sh_offset, (ut8*)bin->strtab, + bin->strtab_section->sh_size) == -1) { eprintf ("Error: read (strtab)\n"); R_FREE (bin->strtab); return R_FALSE; } + return R_TRUE; +} + +#if 0 +static ut64 Elf_(r_bin_elf_get_section_size)(struct Elf_(r_bin_elf_obj_t) *bin, const char *section_name) { + int i; + if (!bin->shdr || !bin->strtab) + return -1; + for (i = 0; i < bin->ehdr.e_shnum; i++) { + if (bin->shdr[i].sh_name > bin->shstrtab_section->sh_size) + continue; + if (!strcmp (&bin->shstrtab[bin->shdr[i].sh_name], section_name)) + return (ut64)bin->shdr[i].sh_size; + } + return -1; +} + +static int Elf_(r_bin_elf_init_strtab)(struct Elf_(r_bin_elf_obj_t) *bin) { + ut64 size; + if (!bin->shdr) + return R_FALSE; + bin->shstrtab_section = &bin->shdr[bin->ehdr.e_shstrndx]; + bin->shstrtab_size = size = 4096; //bin->shstrtab_section->sh_size; + + if ((bin->shstrtab = (char *)malloc (size)) == NULL) { + perror ("malloc"); + return R_FALSE; + } +//eprintf ("BUFBUFBUF %p\n", + eprintf ("%p off=%x buf=%p sz=%llx\n", +bin->b, bin->shstrtab_section->sh_offset, (ut8*)bin->shstrtab, size); + if (r_buf_read_at (bin->b, (ut64)bin->shstrtab_section->sh_offset, (ut8*)bin->shstrtab, size) == -1) { + eprintf ("Error: read (strtab)\n"); + R_FREE (bin->strtab); + return R_FALSE; + } +write (1, "\n\n", 2); +write (1, bin->shstrtab, size); +write (1, "\n\n", 2); size = Elf_(r_bin_elf_get_section_size)(bin, ".strtab"); if (size != UT64_MAX) { + ut64 off = Elf_(r_bin_elf_get_section_offset)(bin, ".strtab"); bin->strtab_size = size; free (bin->strtab); - if ((bin->strtab = (char *)malloc (size)) == NULL) { + if ((bin->strtab = (char *)malloc (size+1)) == NULL) { perror ("malloc"); return R_FALSE; } - if (r_buf_read_at (bin->b, bin->strtab_section->sh_offset, (ut8*)bin->strtab, size) == -1) { + if (r_buf_read_at (bin->b, off, (ut8*)bin->strtab, size) == -1) { eprintf ("Error: read (strtab)\n"); R_FREE (bin->strtab); return R_FALSE; @@ -126,6 +168,7 @@ static int Elf_(r_bin_elf_init_strtab)(struct Elf_(r_bin_elf_obj_t) *bin) { } return R_TRUE; } +#endif static int Elf_(r_bin_elf_init)(struct Elf_(r_bin_elf_obj_t) *bin) { bin->phdr = NULL; @@ -148,27 +191,14 @@ static int Elf_(r_bin_elf_init)(struct Elf_(r_bin_elf_obj_t) *bin) { return R_TRUE; } -static ut64 Elf_(r_bin_elf_get_section_size)(struct Elf_(r_bin_elf_obj_t) *bin, const char *section_name) { - int i; - if (!bin->shdr || !bin->strtab) - return -1; - for (i = 0; i < bin->ehdr.e_shnum; i++) { - if (bin->shdr[i].sh_name > bin->strtab_section->sh_size) - continue; - if (!strcmp (&bin->strtab[bin->shdr[i].sh_name], section_name)) - return (ut64)bin->shdr[i].sh_size; - } - return -1; -} - static ut64 Elf_(r_bin_elf_get_section_offset)(struct Elf_(r_bin_elf_obj_t) *bin, const char *section_name) { int i; if (!bin->shdr || !bin->strtab) return -1; for (i = 0; i < bin->ehdr.e_shnum; i++) { - if (bin->shdr[i].sh_name > bin->strtab_section->sh_size) + if (bin->shdr[i].sh_name > bin->shstrtab_section->sh_size) continue; - if (!strcmp (&bin->strtab[bin->shdr[i].sh_name], section_name)) + if (!strcmp (&bin->shstrtab[bin->shdr[i].sh_name], section_name)) return (ut64)bin->shdr[i].sh_offset; } return -1; @@ -722,8 +752,8 @@ struct r_bin_elf_section_t* Elf_(r_bin_elf_get_sections)(struct Elf_(r_bin_elf_o ret[i].size = bin->shdr[i].sh_size; ret[i].align = bin->shdr[i].sh_addralign; ret[i].flags = bin->shdr[i].sh_flags; - strncpy (ret[i].name, bin->strtab? - &bin->strtab[bin->shdr[i].sh_name]: "unknown", ELF_STRING_LENGTH); + strncpy (ret[i].name, bin->shstrtab? + &bin->shstrtab[bin->shdr[i].sh_name]: "unknown", ELF_STRING_LENGTH); ret[i].last = 0; } ret[i].last = 1; diff --git a/libr/bin/format/elf/elf.h b/libr/bin/format/elf/elf.h index 00e0c492ba..fdff4e18ba 100644 --- a/libr/bin/format/elf/elf.h +++ b/libr/bin/format/elf/elf.h @@ -69,6 +69,9 @@ struct Elf_(r_bin_elf_obj_t) { Elf_(Shdr) *strtab_section; ut64 strtab_size; char* strtab; + Elf_(Shdr) *shstrtab_section; + ut64 shstrtab_size; + char* shstrtab; int bss; int size; ut64 baddr; diff --git a/libr/bin/p/Makefile b/libr/bin/p/Makefile index 6982494e3e..13eb88b504 100644 --- a/libr/bin/p/Makefile +++ b/libr/bin/p/Makefile @@ -1,8 +1,7 @@ include ../../config.mk -#include ../../../config-user.mk CFLAGS=-I../../include -I../format/ -Wall -fPIC -CFLAGS+=${LDFLAGS_LIB} +#CFLAGS+=${LDFLAGS_LIB} #CFLAGS=$CCLIB_SHARED CFLAGS+=-L../../util -lr_util diff --git a/libr/bin/p/dex.mk b/libr/bin/p/dex.mk index 1952936ddf..e11d899159 100644 --- a/libr/bin/p/dex.mk +++ b/libr/bin/p/dex.mk @@ -6,5 +6,4 @@ TARGET_DEX=bin_dex.${EXT_SO} ALL_TARGETS+=${TARGET_DEX} ${TARGET_DEX}: ${OBJ_DEX} - ${CC} -shared ${CFLAGS} -o ${TARGET_DEX} ${OBJ_DEX} - @#strip -s ${TARGET_DEX} + ${CC} $(call libname,bin_dex) -shared ${CFLAGS} -o ${TARGET_DEX} ${OBJ_DEX} diff --git a/libr/bin/p/dyldcache.mk b/libr/bin/p/dyldcache.mk index bef612d911..cdd44edd7a 100644 --- a/libr/bin/p/dyldcache.mk +++ b/libr/bin/p/dyldcache.mk @@ -6,5 +6,4 @@ TARGET_DYLDCACHE=bin_xtr_dyldcache.${EXT_SO} ALL_TARGETS+=${TARGET_DYLDCACHE} ${TARGET_DYLDCACHE}: ${OBJ_DYLDCACHE} - ${CC} -shared ${CFLAGS} -o ${TARGET_DYLDCACHE} ${OBJ_DYLDCACHE} - @#strip -s ${TARGET_DYLDCACHE} + ${CC} $(call libname,bin_xtr_dyldcache) -shared ${CFLAGS} -o ${TARGET_DYLDCACHE} ${OBJ_DYLDCACHE} diff --git a/libr/bin/p/elf.mk b/libr/bin/p/elf.mk index a7be41131c..ec1aaf740a 100644 --- a/libr/bin/p/elf.mk +++ b/libr/bin/p/elf.mk @@ -7,5 +7,4 @@ TARGET_ELF=bin_elf.${EXT_SO} ALL_TARGETS+=${TARGET_ELF} ${TARGET_ELF}: ${OBJ_ELF} - ${CC} -shared ${CFLAGS} -o ${TARGET_ELF} ${OBJ_ELF} - @#strip -s ${TARGET_ELF} + ${CC} $(call libname,bin_elf) ${CFLAGS} -o ${TARGET_ELF} ${OBJ_ELF} diff --git a/libr/bin/p/elf64.mk b/libr/bin/p/elf64.mk index 8ae6e9769d..469b4d22a3 100644 --- a/libr/bin/p/elf64.mk +++ b/libr/bin/p/elf64.mk @@ -7,5 +7,4 @@ TARGET_ELF64=bin_elf64.${EXT_SO} ALL_TARGETS+=${TARGET_ELF64} ${TARGET_ELF64}: ${OBJ_ELF64} - ${CC} -shared ${CFLAGS} -o ${TARGET_ELF64} ${OBJ_ELF64} - @#strip -s ${TARGET_ELF64} + ${CC} $(call libname,bin_elf64) -shared ${CFLAGS} -o ${TARGET_ELF64} ${OBJ_ELF64} diff --git a/libr/bin/p/fatmach0.mk b/libr/bin/p/fatmach0.mk index 224ebd9cea..ed15e41cec 100644 --- a/libr/bin/p/fatmach0.mk +++ b/libr/bin/p/fatmach0.mk @@ -6,5 +6,4 @@ TARGET_FATMACH0=bin_xtr_fatmach0.${EXT_SO} ALL_TARGETS+=${TARGET_FATMACH0} ${TARGET_FATMACH0}: ${OBJ_FATMACH0} - ${CC} -shared ${CFLAGS} -o ${TARGET_FATMACH0} ${OBJ_FATMACH0} - @#strip -s ${TARGET_FATMACH0} + ${CC} $(call libname,bin_xtr_fatmach0) -shared ${CFLAGS} -o ${TARGET_FATMACH0} ${OBJ_FATMACH0} diff --git a/libr/bin/p/fs.mk b/libr/bin/p/fs.mk index d2304a6d00..bdbda448f8 100644 --- a/libr/bin/p/fs.mk +++ b/libr/bin/p/fs.mk @@ -6,4 +6,4 @@ TARGET_FS=bin_fs.${EXT_SO} ALL_TARGETS+=${TARGET_FS} ${TARGET_FS}: ${OBJ_FS} - ${CC} -shared ${CFLAGS} -o ${TARGET_FS} ${OBJ_FS} + ${CC} $(call libname,bin_fs) -shared ${CFLAGS} -o ${TARGET_FS} ${OBJ_FS} diff --git a/libr/bin/p/java.mk b/libr/bin/p/java.mk index 48eb16d8cc..15a284b72d 100644 --- a/libr/bin/p/java.mk +++ b/libr/bin/p/java.mk @@ -6,5 +6,4 @@ TARGET_JAVA=bin_java.${EXT_SO} ALL_TARGETS+=${TARGET_JAVA} ${TARGET_JAVA}: ${OBJ_JAVA} - ${CC} -shared ${CFLAGS} -o ${TARGET_JAVA} ${OBJ_JAVA} - @#strip -s ${TARGET_JAVA} + ${CC} $(call libname,bin_java) ${CFLAGS} -o ${TARGET_JAVA} ${OBJ_JAVA} diff --git a/libr/bin/p/mach0.mk b/libr/bin/p/mach0.mk index c24088fb4d..5710efb12c 100644 --- a/libr/bin/p/mach0.mk +++ b/libr/bin/p/mach0.mk @@ -6,5 +6,4 @@ TARGET_MACH0=bin_mach0.${EXT_SO} ALL_TARGETS+=${TARGET_MACH0} ${TARGET_MACH0}: ${OBJ_MACH0} - ${CC} -shared ${CFLAGS} -o ${TARGET_MACH0} ${OBJ_MACH0} - @#strip -s ${TARGET_MACH0} + ${CC} $(call libname,bin_mach0) ${CFLAGS} -o ${TARGET_MACH0} ${OBJ_MACH0} diff --git a/libr/bin/p/mach064.mk b/libr/bin/p/mach064.mk index ba5c884ab5..de953ddd1d 100644 --- a/libr/bin/p/mach064.mk +++ b/libr/bin/p/mach064.mk @@ -6,5 +6,4 @@ TARGET_MACH064=bin_mach064.${EXT_SO} ALL_TARGETS+=${TARGET_MACH064} ${TARGET_MACH064}: ${OBJ_MACH064} - ${CC} -shared ${CFLAGS} -o ${TARGET_MACH064} ${OBJ_MACH064} - @#strip -s ${TARGET_MACH064} + ${CC} $(call libname,bin_mach064) -shared ${CFLAGS} -o ${TARGET_MACH064} ${OBJ_MACH064} diff --git a/libr/bin/p/pe.mk b/libr/bin/p/pe.mk index b2709e8a5d..e348d10c14 100644 --- a/libr/bin/p/pe.mk +++ b/libr/bin/p/pe.mk @@ -6,5 +6,4 @@ TARGET_PE=bin_pe.${EXT_SO} ALL_TARGETS+=${TARGET_PE} ${TARGET_PE}: ${OBJ_PE} - ${CC} -shared ${CFLAGS} -o ${TARGET_PE} ${OBJ_PE} - @#strip -s ${TARGET_PE} + ${CC} $(call libname,bin_pe) ${CFLAGS} -o ${TARGET_PE} ${OBJ_PE} diff --git a/libr/bin/p/pe64.mk b/libr/bin/p/pe64.mk index bf15148afe..f027a52653 100644 --- a/libr/bin/p/pe64.mk +++ b/libr/bin/p/pe64.mk @@ -6,5 +6,4 @@ TARGET_PE64=bin_pe64.${EXT_SO} ALL_TARGETS+=${TARGET_PE64} ${TARGET_PE64}: ${OBJ_PE64} - ${CC} -shared ${CFLAGS} -o ${TARGET_PE64} ${OBJ_PE64} - @#strip -s ${TARGET_PE64} + ${CC} $(call libname,bin_pe64) ${CFLAGS} -o ${TARGET_PE64} ${OBJ_PE64} diff --git a/libr/bp/p/arm.mk b/libr/bp/p/arm.mk index 46991f150e..2661a32033 100644 --- a/libr/bp/p/arm.mk +++ b/libr/bp/p/arm.mk @@ -6,4 +6,4 @@ TARGET_ARM=bp_arm.${EXT_SO} ALL_TARGETS+=${TARGET_ARM} ${TARGET_ARM}: ${OBJ_ARM} - ${CC} -shared ${CFLAGS} -o ${TARGET_ARM} ${OBJ_ARM} + ${CC} $(call libname,bp_arm) ${CFLAGS} -o ${TARGET_ARM} ${OBJ_ARM} diff --git a/libr/bp/p/mips.mk b/libr/bp/p/mips.mk index f6c480e833..41d5b77064 100644 --- a/libr/bp/p/mips.mk +++ b/libr/bp/p/mips.mk @@ -6,4 +6,4 @@ TARGET_MIPS=bp_mips.${EXT_SO} ALL_TARGETS+=${TARGET_MIPS} ${TARGET_MIPS}: ${OBJ_MIPS} - ${CC} -shared ${CFLAGS} -o ${TARGET_MIPS} ${OBJ_MIPS} + ${CC} $(call libname,bp_mips) ${CFLAGS} -o ${TARGET_MIPS} ${OBJ_MIPS} diff --git a/libr/bp/p/ppc.mk b/libr/bp/p/ppc.mk index 07f9e1d98c..22d6c279ee 100644 --- a/libr/bp/p/ppc.mk +++ b/libr/bp/p/ppc.mk @@ -6,4 +6,4 @@ TARGET_PPC=bp_ppc.${EXT_SO} ALL_TARGETS+=${TARGET_PPC} ${TARGET_PPC}: ${OBJ_PPC} - ${CC} -shared ${CFLAGS} -o ${TARGET_PPC} ${OBJ_PPC} + ${CC} $(call libname,bp_ppc) ${CFLAGS} -o ${TARGET_PPC} ${OBJ_PPC} diff --git a/libr/bp/p/sh.mk b/libr/bp/p/sh.mk index cfdbcffb04..85729ff1e6 100644 --- a/libr/bp/p/sh.mk +++ b/libr/bp/p/sh.mk @@ -6,4 +6,4 @@ TARGET_SH=bp_sh.${EXT_SO} ALL_TARGETS+=${TARGET_SH} ${TARGET_SH}: ${OBJ_SH} - ${CC} -shared ${CFLAGS} -o ${TARGET_SH} ${OBJ_SH} + ${CC} $(call libname,bp_sh) ${CFLAGS} -o ${TARGET_SH} ${OBJ_SH} diff --git a/libr/bp/p/x86.mk b/libr/bp/p/x86.mk index e82177cbf6..b093a70d2b 100644 --- a/libr/bp/p/x86.mk +++ b/libr/bp/p/x86.mk @@ -6,4 +6,4 @@ TARGET_X86=bp_x86.${EXT_SO} ALL_TARGETS+=${TARGET_X86} ${TARGET_X86}: ${OBJ_X86} - ${CC} -shared ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} + ${CC} $(call libname,bp_x86) ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} diff --git a/libr/cmd/p/dummy.mk b/libr/cmd/p/dummy.mk index 9fbfbcae68..cc5a274d57 100644 --- a/libr/cmd/p/dummy.mk +++ b/libr/cmd/p/dummy.mk @@ -6,4 +6,4 @@ TARGET_DUMMY=cmd_dummy.${EXT_SO} ALL_TARGETS+=${TARGET_DUMMY} ${TARGET_DUMMY}: ${OBJ_DUMMY} - ${CC} ${CFLAGS} -o ${TARGET_DUMMY} ${OBJ_DUMMY} + ${CC} $(call libname,cmd_dummy) ${CFLAGS} -o ${TARGET_DUMMY} ${OBJ_DUMMY} diff --git a/libr/config.mk.tail b/libr/config.mk.tail index 0051899cf0..519eba6150 100644 --- a/libr/config.mk.tail +++ b/libr/config.mk.tail @@ -84,3 +84,5 @@ endif LIB=lib${NAME} LIBAR=${LIB}.${EXT_AR} LIBSO=${LIB}.${EXT_SO} +libname=-shared ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION} + diff --git a/libr/crypto/p/aes.mk b/libr/crypto/p/aes.mk index 7f2e2e9c56..b2bf5af8a4 100644 --- a/libr/crypto/p/aes.mk +++ b/libr/crypto/p/aes.mk @@ -6,4 +6,4 @@ TARGET_AES=crypto_aes.${EXT_SO} ALL_TARGETS+=${TARGET_AES} ${TARGET_AES}: ${OBJ_AES} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_AES} ${OBJ_AES} + ${CC} $(call libname,crypto_aes) ${LDFLAGS} ${CFLAGS} -o ${TARGET_AES} ${OBJ_AES} diff --git a/libr/debug/p/gdb.mk b/libr/debug/p/gdb.mk index ea7aa47ce1..e686547a1f 100644 --- a/libr/debug/p/gdb.mk +++ b/libr/debug/p/gdb.mk @@ -23,4 +23,4 @@ TARGET_GDB=debug_gdb.${EXT_SO} ALL_TARGETS+=${TARGET_GDB} ${TARGET_GDB}: ${OBJ_GDB} - ${CC} -shared ${OBJ_GDB} ${CFLAGS} ${LDFLAGS} -o ${TARGET_GDB} + ${CC} $(call libname,debug_gdb) ${OBJ_GDB} ${CFLAGS} ${LDFLAGS} -o ${TARGET_GDB} diff --git a/libr/debug/p/native.mk b/libr/debug/p/native.mk index ecde0083af..269bd41888 100644 --- a/libr/debug/p/native.mk +++ b/libr/debug/p/native.mk @@ -6,7 +6,7 @@ TARGET_PTRACE=debug_native.${EXT_SO} ALL_TARGETS+=${TARGET_PTRACE} ${TARGET_PTRACE}: ${OBJ_PTRACE} - ${CC} -shared ${CFLAGS} -o ${TARGET_PTRACE} \ + ${CC} $(call libname,debug_native) ${CFLAGS} -o ${TARGET_PTRACE} \ ${LDFLAGS_LINKPATH}.. -L.. -lr_debug \ ${LDFLAGS_LINKPATH}../../lib -L../../lib -lr_lib \ ${LDFLAGS_LINKPATH}../../io -L../../io -lr_io \ diff --git a/libr/debug/p/rap.mk b/libr/debug/p/rap.mk index e019ee7d14..48079d5c04 100644 --- a/libr/debug/p/rap.mk +++ b/libr/debug/p/rap.mk @@ -18,4 +18,4 @@ TARGET_RAP=debug_rap.${EXT_SO} ALL_TARGETS+=${TARGET_RAP} ${TARGET_RAP}: ${OBJ_RAP} - ${CC} -shared ${OBJ_RAP} ${CFLAGS} ${LDFLAGS} -o ${TARGET_RAP} + ${CC} $(call libname,debug_rap) ${OBJ_RAP} ${CFLAGS} ${LDFLAGS} -o ${TARGET_RAP} diff --git a/libr/fs/p/cpio.mk b/libr/fs/p/cpio.mk index bd9c0decd5..7bdfe6d922 100644 --- a/libr/fs/p/cpio.mk +++ b/libr/fs/p/cpio.mk @@ -9,4 +9,4 @@ TARGET_CPIO=fs_cpio.${EXT_SO} ALL_TARGETS+=${TARGET_CPIO} ${TARGET_CPIO}: ${OBJ_CPIO} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_CPIO} ${OBJ_CPIO} ${EXTRA} + ${CC} $(call libname,fs_cpio) ${LDFLAGS} ${CFLAGS} -o ${TARGET_CPIO} ${OBJ_CPIO} ${EXTRA} diff --git a/libr/fs/p/ext2.mk b/libr/fs/p/ext2.mk index 5b5ad09a73..6947e89ea6 100644 --- a/libr/fs/p/ext2.mk +++ b/libr/fs/p/ext2.mk @@ -9,4 +9,4 @@ TARGET_EXT2=fs_ext2.${EXT_SO} ALL_TARGETS+=${TARGET_EXT2} ${TARGET_EXT2}: ${OBJ_EXT2} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_EXT2} ${OBJ_EXT2} ${EXTRA} + ${CC} $(call libname,fs_ext2) ${LDFLAGS} ${CFLAGS} -o ${TARGET_EXT2} ${OBJ_EXT2} ${EXTRA} diff --git a/libr/fs/p/fat.mk b/libr/fs/p/fat.mk index f157024905..edfe11f98f 100644 --- a/libr/fs/p/fat.mk +++ b/libr/fs/p/fat.mk @@ -9,4 +9,4 @@ TARGET_FAT=fs_fat.${EXT_SO} ALL_TARGETS+=${TARGET_FAT} ${TARGET_FAT}: ${OBJ_FAT} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_FAT} ${OBJ_FAT} ${EXTRA} + ${CC} $(call libname,fs_fat) ${LDFLAGS} ${CFLAGS} -o ${TARGET_FAT} ${OBJ_FAT} ${EXTRA} diff --git a/libr/fs/p/fb.mk b/libr/fs/p/fb.mk index ee3e158cff..f91cfa6353 100644 --- a/libr/fs/p/fb.mk +++ b/libr/fs/p/fb.mk @@ -9,4 +9,4 @@ TARGET_FB=fs_fb.${EXT_SO} ALL_TARGETS+=${TARGET_FB} ${TARGET_FB}: ${OBJ_FB} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_FB} ${OBJ_FB} ${EXTRA} + ${CC} $(call libname,fs_fb) ${LDFLAGS} ${CFLAGS} -o ${TARGET_FB} ${OBJ_FB} ${EXTRA} diff --git a/libr/fs/p/hfs.mk b/libr/fs/p/hfs.mk index 75225d737e..d5fb931a87 100644 --- a/libr/fs/p/hfs.mk +++ b/libr/fs/p/hfs.mk @@ -9,4 +9,4 @@ TARGET_HFS=fs_hfs.${EXT_SO} ALL_TARGETS+=${TARGET_HFS} ${TARGET_HFS}: ${OBJ_HFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_HFS} ${OBJ_HFS} ${EXTRA} + ${CC} $(call libname,fs_hfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_HFS} ${OBJ_HFS} ${EXTRA} diff --git a/libr/fs/p/hfsplus.mk b/libr/fs/p/hfsplus.mk index cd18a952f9..0ad01f807f 100644 --- a/libr/fs/p/hfsplus.mk +++ b/libr/fs/p/hfsplus.mk @@ -9,4 +9,4 @@ TARGET_HFSPLUS=fs_hfsplus.${EXT_SO} ALL_TARGETS+=${TARGET_HFSPLUS} ${TARGET_HFSPLUS}: ${OBJ_HFSPLUS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_HFSPLUS} ${OBJ_HFSPLUS} ${EXTRA} + ${CC} $(call libname,fs_hfsplus) ${LDFLAGS} ${CFLAGS} -o ${TARGET_HFSPLUS} ${OBJ_HFSPLUS} ${EXTRA} diff --git a/libr/fs/p/iso9660.mk b/libr/fs/p/iso9660.mk index cba67d80de..fd287e77cd 100644 --- a/libr/fs/p/iso9660.mk +++ b/libr/fs/p/iso9660.mk @@ -9,4 +9,4 @@ TARGET_ISO9660=fs_iso9660.${EXT_SO} ALL_TARGETS+=${TARGET_ISO9660} ${TARGET_ISO9660}: ${OBJ_ISO9660} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_ISO9660} ${OBJ_ISO9660} ${EXTRA} + ${CC} $(call libname,fs_iso9660) ${LDFLAGS} ${CFLAGS} -o ${TARGET_ISO9660} ${OBJ_ISO9660} ${EXTRA} diff --git a/libr/fs/p/jfs.mk b/libr/fs/p/jfs.mk index 2e8bb79eff..289589aae4 100644 --- a/libr/fs/p/jfs.mk +++ b/libr/fs/p/jfs.mk @@ -9,4 +9,4 @@ TARGET_JFS=fs_jfs.${EXT_SO} ALL_TARGETS+=${TARGET_JFS} ${TARGET_JFS}: ${OBJ_JFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_JFS} ${OBJ_JFS} ${EXTRA} + ${CC} $(call libname,fs_jfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_JFS} ${OBJ_JFS} ${EXTRA} diff --git a/libr/fs/p/minix.mk b/libr/fs/p/minix.mk index 2dae3a7118..efdb1bcff2 100644 --- a/libr/fs/p/minix.mk +++ b/libr/fs/p/minix.mk @@ -9,4 +9,4 @@ TARGET_MINIX=fs_minix.${EXT_SO} ALL_TARGETS+=${TARGET_MINIX} ${TARGET_MINIX}: ${OBJ_MINIX} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_MINIX} ${OBJ_MINIX} ${EXTRA} + ${CC} $(call libname,fs_minix) ${LDFLAGS} ${CFLAGS} -o ${TARGET_MINIX} ${OBJ_MINIX} ${EXTRA} diff --git a/libr/fs/p/ntfs.mk b/libr/fs/p/ntfs.mk index 09da9ed79b..1bb1808aed 100644 --- a/libr/fs/p/ntfs.mk +++ b/libr/fs/p/ntfs.mk @@ -9,4 +9,4 @@ TARGET_NTFS=fs_ntfs.${EXT_SO} ALL_TARGETS+=${TARGET_NTFS} ${TARGET_NTFS}: ${OBJ_NTFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_NTFS} ${OBJ_NTFS} ${EXTRA} + ${CC} $(call libname,fs_ntfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_NTFS} ${OBJ_NTFS} ${EXTRA} diff --git a/libr/fs/p/posix.mk b/libr/fs/p/posix.mk index 59e8729e9e..2e038f9fa4 100644 --- a/libr/fs/p/posix.mk +++ b/libr/fs/p/posix.mk @@ -6,4 +6,4 @@ TARGET_POSIX=fs_posix.${EXT_SO} ALL_TARGETS+=${TARGET_POSIX} ${TARGET_POSIX}: ${OBJ_POSIX} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_POSIX} ${OBJ_POSIX} ${EXTRA} + ${CC} $(call libname,fs_posix) ${LDFLAGS} ${CFLAGS} -o ${TARGET_POSIX} ${OBJ_POSIX} ${EXTRA} diff --git a/libr/fs/p/reiserfs.mk b/libr/fs/p/reiserfs.mk index 491bf17d95..53bf71d52b 100644 --- a/libr/fs/p/reiserfs.mk +++ b/libr/fs/p/reiserfs.mk @@ -9,4 +9,4 @@ TARGET_REISERFS=fs_reiserfs.${EXT_SO} ALL_TARGETS+=${TARGET_REISERFS} ${TARGET_REISERFS}: ${OBJ_REISERFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_REISERFS} ${OBJ_REISERFS} ${EXTRA} + ${CC} $(call libname,fs_reiserfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_REISERFS} ${OBJ_REISERFS} ${EXTRA} diff --git a/libr/fs/p/sfs.mk b/libr/fs/p/sfs.mk index 207388e344..3308bdf7a4 100644 --- a/libr/fs/p/sfs.mk +++ b/libr/fs/p/sfs.mk @@ -9,4 +9,4 @@ TARGET_SFS=fs_sfs.${EXT_SO} ALL_TARGETS+=${TARGET_SFS} ${TARGET_SFS}: ${OBJ_SFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_SFS} ${OBJ_SFS} ${EXTRA} + ${CC} $(call libname,fs_sfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SFS} ${OBJ_SFS} ${EXTRA} diff --git a/libr/fs/p/tar.mk b/libr/fs/p/tar.mk index be2db259fb..e84dde1566 100644 --- a/libr/fs/p/tar.mk +++ b/libr/fs/p/tar.mk @@ -9,4 +9,4 @@ TARGET_TAR=fs_tar.${EXT_SO} ALL_TARGETS+=${TARGET_TAR} ${TARGET_TAR}: ${OBJ_TAR} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_TAR} ${OBJ_TAR} ${EXTRA} + ${CC} $(call libname,fs_tar) ${LDFLAGS} ${CFLAGS} -o ${TARGET_TAR} ${OBJ_TAR} ${EXTRA} diff --git a/libr/fs/p/udf.mk b/libr/fs/p/udf.mk index 6e7a2e7b51..c6b721b7ec 100644 --- a/libr/fs/p/udf.mk +++ b/libr/fs/p/udf.mk @@ -9,4 +9,4 @@ TARGET_UDF=fs_udf.${EXT_SO} ALL_TARGETS+=${TARGET_UDF} ${TARGET_UDF}: ${OBJ_UDF} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_UDF} ${OBJ_UDF} ${EXTRA} + ${CC} $(call libname,fs_udf) ${LDFLAGS} ${CFLAGS} -o ${TARGET_UDF} ${OBJ_UDF} ${EXTRA} diff --git a/libr/fs/p/ufs.mk b/libr/fs/p/ufs.mk index b2e3e75de8..86adfbc797 100644 --- a/libr/fs/p/ufs.mk +++ b/libr/fs/p/ufs.mk @@ -9,4 +9,4 @@ TARGET_UFS=fs_ufs.${EXT_SO} ALL_TARGETS+=${TARGET_UFS} ${TARGET_UFS}: ${OBJ_UFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_UFS} ${OBJ_UFS} ${EXTRA} + ${CC} $(call libname,fs_ufs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_UFS} ${OBJ_UFS} ${EXTRA} diff --git a/libr/fs/p/ufs2.mk b/libr/fs/p/ufs2.mk index f146fee599..9b1e4b3b9a 100644 --- a/libr/fs/p/ufs2.mk +++ b/libr/fs/p/ufs2.mk @@ -9,4 +9,4 @@ TARGET_UFS2=fs_ufs2.${EXT_SO} ALL_TARGETS+=${TARGET_UFS2} ${TARGET_UFS2}: ${OBJ_UFS2} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_UFS2} ${OBJ_UFS2} ${EXTRA} + ${CC} $(call libname,fs_ufs2) ${LDFLAGS} ${CFLAGS} -o ${TARGET_UFS2} ${OBJ_UFS2} ${EXTRA} diff --git a/libr/fs/p/xfs.mk b/libr/fs/p/xfs.mk index 4bd72a81ab..a4a7c03f09 100644 --- a/libr/fs/p/xfs.mk +++ b/libr/fs/p/xfs.mk @@ -9,4 +9,4 @@ TARGET_XFS=fs_xfs.${EXT_SO} ALL_TARGETS+=${TARGET_XFS} ${TARGET_XFS}: ${OBJ_XFS} - ${CC} ${LDFLAGS} ${CFLAGS} -o ${TARGET_XFS} ${OBJ_XFS} ${EXTRA} + ${CC} $(call libname,fs_xfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_XFS} ${OBJ_XFS} ${EXTRA} diff --git a/libr/io/p/debug.mk b/libr/io/p/debug.mk index 20ad9c6bec..94a342f45e 100644 --- a/libr/io/p/debug.mk +++ b/libr/io/p/debug.mk @@ -23,5 +23,5 @@ LINKFLAGS+=${SSL_LDFLAGS} endif ${TARGET_IODBG}: ${OBJ_IODBG} - ${CC} -shared -o ${TARGET_IODBG} ${CFLAGS} ${LDFLAGS_LIB} \ + ${CC} $(call libname,io_debug) -o ${TARGET_IODBG} ${CFLAGS} ${LDFLAGS_LIB} \ ${LINKFLAGS} ${LDFLAGS_LINKPATH}.. -L.. -lr_io ${OBJ_IODBG} diff --git a/libr/io/p/gdb.mk b/libr/io/p/gdb.mk index e4a25f1ff7..3aa04aeaec 100644 --- a/libr/io/p/gdb.mk +++ b/libr/io/p/gdb.mk @@ -38,5 +38,5 @@ endif # TODO : link against gdbwrapper ${TARGET_GDB}: ${OBJ_GDB} - ${CC} -shared -o ${TARGET_GDB} ${OBJ_GDB} ${CFLAGS} ${LDFLAGS} \ + ${CC} $(call libname,io_gdb) -o ${TARGET_GDB} ${OBJ_GDB} ${CFLAGS} ${LDFLAGS} \ ${GDBWRAPFILES} ${LINKFLAGS} ${LDFLAGS_LIB} diff --git a/libr/io/p/haret.mk b/libr/io/p/haret.mk index d7c189c028..e3c70f7a42 100644 --- a/libr/io/p/haret.mk +++ b/libr/io/p/haret.mk @@ -21,4 +21,4 @@ LINKFLAGS+=${SSL_LDFLAGS} endif ${TARGET_HARET}: ${OBJ_HARET} - ${CC} -shared ${CFLAGS} -o ${TARGET_HARET} ${OBJ_HARET} ${LINKFLAGS} + ${CC} $(call libname,io_haret) ${CFLAGS} -o ${TARGET_HARET} ${OBJ_HARET} ${LINKFLAGS} diff --git a/libr/io/p/mach.mk b/libr/io/p/mach.mk index bcf8214550..85175ffdf0 100644 --- a/libr/io/p/mach.mk +++ b/libr/io/p/mach.mk @@ -15,4 +15,4 @@ LINKFLAGS+=-L.. -L../../lib -lr_lib -lr_io endif ${TARGET_MACH}: ${OBJ_MACH} - ${CC} -shared ${CFLAGS} -o ${TARGET_MACH} ${OBJ_MACH} ${LINKFLAGS} + ${CC} $(call libname,io_mach) ${CFLAGS} -o ${TARGET_MACH} ${OBJ_MACH} ${LINKFLAGS} diff --git a/libr/io/p/malloc.mk b/libr/io/p/malloc.mk index 1aaef8fe50..78fcd70bdf 100644 --- a/libr/io/p/malloc.mk +++ b/libr/io/p/malloc.mk @@ -15,4 +15,4 @@ LINKFLAGS+=-L.. -L../../lib -lr_lib -lr_io endif ${TARGET_MALLOC}: ${OBJ_MALLOC} - ${CC} -shared ${CFLAGS} -o ${TARGET_MALLOC} ${OBJ_MALLOC} ${LINKFLAGS} + ${CC} $(call libname,io_malloc) ${CFLAGS} -o ${TARGET_MALLOC} ${OBJ_MALLOC} ${LINKFLAGS} diff --git a/libr/io/p/procpid.mk b/libr/io/p/procpid.mk index 9dc7c4f3f3..1e31bf67b2 100644 --- a/libr/io/p/procpid.mk +++ b/libr/io/p/procpid.mk @@ -6,7 +6,7 @@ ALL_TARGETS+=${TARGET_PROCPID} ${TARGET_PROCPID}: ${OBJ_PROCPID} ${CC} ${CFLAGS} -o ${TARGET_PROCPID} ${LDFLAGS_LIB} \ - -shared \ + $(call libname,io_procpid) \ ${LDFLAGS_LINKPATH}../../util -L../../util -lr_util \ ${LDFLAGS_LINKPATH}.. -L.. -L../../lib -lr_lib -lr_io \ ${OBJ_PROCPID} diff --git a/libr/io/p/ptrace.mk b/libr/io/p/ptrace.mk index 93db40199f..5615274e45 100644 --- a/libr/io/p/ptrace.mk +++ b/libr/io/p/ptrace.mk @@ -6,7 +6,7 @@ ALL_TARGETS+=${TARGET_PTRACE} ${TARGET_PTRACE}: ${OBJ_PTRACE} ${CC} ${CFLAGS} -o ${TARGET_PTRACE} ${LDFLAGS_LIB} \ - -shared \ + $(call libname,io_ptrace) \ ${LDFLAGS_LINKPATH}../../util -L../../util -lr_util \ ${LDFLAGS_LINKPATH}.. -L.. -L../../lib -lr_lib -lr_io \ ${OBJ_PTRACE} diff --git a/libr/io/p/rap.mk b/libr/io/p/rap.mk index e819a09f88..83fdabdd8f 100644 --- a/libr/io/p/rap.mk +++ b/libr/io/p/rap.mk @@ -5,7 +5,8 @@ TARGET_RAP=io_rap.${EXT_SO} ALL_TARGETS+=${TARGET_RAP} ${TARGET_RAP}: ${OBJ_RAP} - ${CC} -shared ${CFLAGS} -o ${TARGET_RAP} ${OBJ_RAP} \ + ${CC} ${CFLAGS} -o ${TARGET_RAP} ${OBJ_RAP} \ + $(call libname,io_rap) \ ${LDFLAGS_LINKPATH}../../socket -L../../socket -lr_socket \ ${LDFLAGS_LINKPATH}../../util -L../../util -lr_util \ ${LDFLAGS_LINKPATH}../../cons -L../../cons -lr_cons \ diff --git a/libr/io/p/shm.mk b/libr/io/p/shm.mk index dac30283fd..0714ff82ac 100644 --- a/libr/io/p/shm.mk +++ b/libr/io/p/shm.mk @@ -15,4 +15,4 @@ LINKFLAGS+=-L.. -L../../lib -lr_lib -lr_io endif ${TARGET_SHM}: ${OBJ_SHM} - ${CC} -shared ${CFLAGS} -o ${TARGET_SHM} ${OBJ_SHM} ${LINKFLAGS} + ${CC} $(call libname,io_shm) ${CFLAGS} -o ${TARGET_SHM} ${OBJ_SHM} ${LINKFLAGS} diff --git a/libr/io/p/w32.mk b/libr/io/p/w32.mk index 1537ced844..08caef268d 100644 --- a/libr/io/p/w32.mk +++ b/libr/io/p/w32.mk @@ -5,4 +5,4 @@ TARGET_W32=io_w32.${EXT_SO} ALL_TARGETS+=${TARGET_W32} ${TARGET_W32}: ${OBJ_W32} - ${CC} -shared ${CFLAGS} -o ${TARGET_W32} ${OBJ_W32} -lr_io + ${CC} $(call libname,io_w32) ${CFLAGS} -o ${TARGET_W32} ${OBJ_W32} -lr_io diff --git a/libr/io/p/w32dbg.mk b/libr/io/p/w32dbg.mk index 648c2182b0..6461f8aefa 100644 --- a/libr/io/p/w32dbg.mk +++ b/libr/io/p/w32dbg.mk @@ -5,4 +5,4 @@ TARGET_W32DBG=io_w32dbg.${EXT_SO} ALL_TARGETS+=${TARGET_W32DBG} ${TARGET_W32DBG}: ${OBJ_W32DBG} - ${CC} -shared ${CFLAGS} -o ${TARGET_W32DBG} ${OBJ_W32DBG} + ${CC} $(call libname,io_w32dbg) ${CFLAGS} -o ${TARGET_W32DBG} ${OBJ_W32DBG} diff --git a/libr/parse/p/mreplace.mk b/libr/parse/p/mreplace.mk index 985a954418..9f7cd3053b 100644 --- a/libr/parse/p/mreplace.mk +++ b/libr/parse/p/mreplace.mk @@ -5,5 +5,4 @@ ALL_TARGETS+=${TARGET_MREPLACE} STATIC_OBJ+=${OBJ_MREPLACE} ${TARGET_MREPLACE}: ${OBJ_MREPLACE} - ${CC} -shared ${CFLAGS} -o ${TARGET_MREPLACE} ${OBJ_MREPLACE} - @#strip -s asm_dummy.${EXT_SO} + ${CC} $(call libname,parse_mreplace) ${CFLAGS} -o ${TARGET_MREPLACE} ${OBJ_MREPLACE} diff --git a/libr/parse/p/parse_mreplace/mreplace.c b/libr/parse/p/parse_mreplace/mreplace.c index 839d62dc98..6856d86973 100644 --- a/libr/parse/p/parse_mreplace/mreplace.c +++ b/libr/parse/p/parse_mreplace/mreplace.c @@ -64,7 +64,6 @@ char *mreplace(char *string, char *se,char *rep) { regex_t re; size_t nmatch = 16; regmatch_t pm[nmatch]; - char *p; unsigned long offset = 0; char field[16]; char *res; @@ -78,7 +77,6 @@ char *mreplace(char *string, char *se,char *rep) { search = memStringReserve(se,INPUTLINE_BUFFER_REPLACE_SIZE); sreplace(search->address,"\\d","[0-9]",1,INPUTLINE_BUFFER_REPLACE_SIZE); - p=(char*)string; #if MDEBUG2 sData=strdup(string); @@ -105,8 +103,7 @@ char *mreplace(char *string, char *se,char *rep) { (int)(size_t)(pm[0].rm_eo - pm[0].rm_so), &string[pm[0].rm_so]);//,&string[pm[0].rm_so]); #if MDEBUG3 printf("------->> found \"%s\" length => %d offset[%d]\n", - found->address, - strlen(temp->address),offset); + found->address, strlen(temp->address),offset); #endif sreplace(temp->address+offset,found->address,rep,0,INPUTLINE_BUFFER_REPLACE_SIZE-offset); for(i=1;icur; - else addr -= b->base; - if (addr > b->length) + addr = (addr==R_BUF_CUR)? b->cur: addr-b->base; + if (dst == NULL || addr > b->length) return -1; end = (int)(addr+len); if (end > b->length) diff --git a/man/rabin2.1 b/man/rabin2.1 index 15dd3e8f9d..b8f269a9a4 100644 --- a/man/rabin2.1 +++ b/man/rabin2.1 @@ -34,7 +34,7 @@ Show output in radare format .It Fl z Show strings inside .data section (like gnu strings does) .It Fl v -Enable verbosity +Display virtual addressing offsets .It Fl h Show usage help message. .El diff --git a/mk/gcc.mk b/mk/gcc.mk index 976aa7be0d..cd5dddffe5 100644 --- a/mk/gcc.mk +++ b/mk/gcc.mk @@ -19,7 +19,9 @@ LDFLAGS_LIB=-dynamiclib LDFLAGS_SONAME=-Wl,-install_name, else LDFLAGS_LIB=-shared -LDFLAGS_LIB+=-Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION} +#ifneq (${NAME},) +#LDFLAGS_LIB+=-Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION} +#endif LDFLAGS_SONAME=-Wl,-soname= endif diff --git a/r2-bindings/Makefile b/r2-bindings/Makefile index c853dc9de9..6304ca1c3d 100644 --- a/r2-bindings/Makefile +++ b/r2-bindings/Makefile @@ -1,4 +1,9 @@ -include config.mk +ifneq ($(shell tar --help|grep gnu.org),) +TAR=tar -czv --format=posix -f +else +TAR=tar -czvf +endif LANGS=python perl ruby lua go java guile gear gir @@ -43,7 +48,7 @@ dist: CXXFILES=`cd .. ; find swig | grep -e cxx$$ -e py$$ | sed -e "s,swig/,$${PKG}/,"` ; \ cd .. && mv swig $${PKG} && \ echo $$FILES ; \ - tar czvf $${PKG}.tar.gz $${FILES} $${CXXFILES} ; \ + ${TAR} $${PKG}.tar.gz $${FILES} $${CXXFILES} ; \ mv $${PKG} swig # TODO: valadoc diff --git a/r2-bindings/vapi/r_asm.vapi b/r2-bindings/vapi/r_asm.vapi index 88c7ba7155..bf0a6f9d84 100644 --- a/r2-bindings/vapi/r_asm.vapi +++ b/r2-bindings/vapi/r_asm.vapi @@ -48,7 +48,7 @@ public class RAsm { } [CCode (cname="RAsmOp", destroy_function="", unref_function="")] - public class Op { + public struct Op { public int inst_len; public uint8 *buf; public string buf_asm;