* Fix valabind bindings
* Fix Go bindings build for arm, 386 and amd64 * Apply ricky's patch honoring LIBDIR
This commit is contained in:
parent
efb113ce8b
commit
2f84cbe1c4
|
@ -3,7 +3,7 @@ include ../../libr/config.mk
|
|||
.PHONY: all clean
|
||||
|
||||
CFLAGS+=-I../../libr/include
|
||||
CFLAGS+=-DLIBDIR=\"${PREFIX}/lib\"
|
||||
CFLAGS+=-DLIBDIR=\"${LIBDIR}\"
|
||||
|
||||
ifeq ($(WITHPIC),1)
|
||||
LIBS=$(subst r_,-lr_,$(BINDEPS))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include ../../config.mk
|
||||
|
||||
BINDEPS=r_lib r_bin r_flags r_util r_cons
|
||||
CFLAGS+=-DLIBDIR=\"${PREFIX}/lib\"
|
||||
CFLAGS+=-DLIBDIR=\"${LIBDIR}\"
|
||||
LIBS+=${DL_LIBS}
|
||||
|
||||
LDPATH=-L.. -L../../util
|
||||
|
|
|
@ -5,7 +5,7 @@ OBJ=lib.o
|
|||
include ../config.mk
|
||||
|
||||
# XXX only for linux
|
||||
CFLAGS+=-Wall -DLIBR_PLUGINS=\"${PREFIX}/lib/radare2\"
|
||||
CFLAGS+=-Wall -DLIBR_PLUGINS=\"${LIBDIR}/radare2\"
|
||||
|
||||
LDFLAGS+=${DL_LIBS}
|
||||
|
||||
|
|
|
@ -126,9 +126,10 @@ install-lua:
|
|||
fi
|
||||
|
||||
install-go:
|
||||
@if [ -n "${GOROOT}" -a -n "${GOOS}" -a -n "${GOARCH}" ]; then \
|
||||
echo "Installing r2 modules in ${GOROOT}/pkg/${GOOS}_${GOARCH}" ; \
|
||||
cp -f go/*.a go/*.${SOEXT} ${GOROOT}/pkg/${GOOS}_${GOARCH} ; \
|
||||
@. ./go/goenv.sh ; \
|
||||
if [ -n "$${GOROOT}" -a -n "$${GOOS}" -a -n "$${GOARCH}" ]; then \
|
||||
echo "Installing r2 modules in $${GOROOT}/pkg/$${GOOS}_$${GOARCH}" ; \
|
||||
cp -f go/*.a go/*.${SOEXT} $${GOROOT}/pkg/$${GOOS}_$${GOARCH} ; \
|
||||
else \
|
||||
echo "You have to set the following vars: GOROOT, GOOS and GOARCH" ; \
|
||||
fi
|
||||
|
|
|
@ -13,24 +13,25 @@ include ../rules.mk
|
|||
false ; \
|
||||
fi ; \
|
||||
fi ; \
|
||||
if [ "${GOARCH}" = "amd64" ]; then \
|
||||
GO_FLAGS=-D_64BIT ; \
|
||||
GO_N=6 ; \
|
||||
else \
|
||||
if [ "${GOARCH}" = "386" ]; then \
|
||||
GO_N=8 ; \
|
||||
else \
|
||||
GO_N=5 ; \
|
||||
fi ; fi ; \
|
||||
. ./goenv.sh ; \
|
||||
if [ $$? = 0 ]; then \
|
||||
(cd .. && sh do-swig.sh ${LANG} `echo $@ | sed -e s,.so,,`) ; \
|
||||
./fixgoswig.sh `echo $@ | sed -e s,.so,.go,` ; \
|
||||
$${GO_N}g `echo $@ | sed -e s,.so,.go,` ; \
|
||||
$${GO_N}c $${GO_FLAGS} -I ${GOROOT}/pkg/${GOOS}_${GOARCH} `echo $@ | sed -e s,.so,_gc.c,` ; \
|
||||
echo $${GOC} `echo $@ | sed -e s,.so,.go,` ; \
|
||||
$${GOC} `echo $@ | sed -e s,.so,.go,` ; \
|
||||
echo $${GOCC} $${GO_FLAGS} -I ${GOROOT}/pkg/$${GOOS}_$${GOARCH} `echo $@ | sed -e s,.so,_gc.c,` ; \
|
||||
$${GOCC} $${GO_FLAGS} -I ${GOROOT}/pkg/$${GOOS}_$${GOARCH} `echo $@ | sed -e s,.so,_gc.c,` ; \
|
||||
gopack grc `echo $@ | sed -e s,.so,.a,` `echo $@ | sed -e s,.so,.$${GO_N},` `echo $@ | sed -e s,.so,_gc.$${GO_N},` ; \
|
||||
fi
|
||||
|
||||
rbintest:
|
||||
6g test-r_bin.go
|
||||
6l test-r_bin.6
|
||||
./6.out /bin/ls
|
||||
. ./goenv.sh ; \
|
||||
$${GOC} -I. test-r_bin.go ; \
|
||||
$${GOL} -L. test-r_bin.$${GO_N} ; \
|
||||
LD_LIBRARY_PATH=. ./$${GO_N}.out /bin/ls
|
||||
|
||||
ibintest:
|
||||
. ./goenv.sh ; \
|
||||
$${GOC} test-r_bin.go ; \
|
||||
$${GOL} test-r_bin.$${GO_N} ; \
|
||||
./$${GO_N}.out /bin/ls
|
||||
|
|
|
@ -4,20 +4,20 @@ import (
|
|||
"os"
|
||||
"fmt"
|
||||
"r_bin"
|
||||
)
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("Usage:", os.Args[0], "<bin>")
|
||||
os.Exit(1)
|
||||
if len (os.Args) < 2 {
|
||||
fmt.Println ("Usage:", os.Args[0], "<bin>")
|
||||
os.Exit (1)
|
||||
}
|
||||
b := r_bin.NewRBin()
|
||||
b.Load(os.Args[1], false)
|
||||
baddr := b.Get_baddr()
|
||||
fmt.Println("-> Sections")
|
||||
fmt.Printf("baddr=%08x\n", baddr)
|
||||
for _, s:= range b.Get_sections() {
|
||||
fmt.Printf("offset=0x%08x va=0x%08x size=%05d %s\n",
|
||||
b := r_bin.NewRBin ()
|
||||
b.Load (os.Args[1], false)
|
||||
baddr := b.Get_baddr ()
|
||||
fmt.Println ("-> Sections")
|
||||
fmt.Printf ("baddr=%08x\n", baddr)
|
||||
for _, s:= range b.Get_sections () {
|
||||
fmt.Printf ("offset=0x%08x va=0x%08x size=%05d %s\n",
|
||||
s.GetOffset(), baddr+s.GetRva(), s.GetSize(), s.GetName())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Radare {
|
|||
public int wr_output (string filename);
|
||||
|
||||
public int load(string file, bool dummy);
|
||||
public int create(uint8 *code, int codelen, uint8 *data, int datalen);
|
||||
public RBuffer create(uint8 *code, int codelen, uint8 *data, int datalen);
|
||||
public int use_arch(string arch, int bits, string name);
|
||||
public int select(string arch, int bits, string name);
|
||||
public int select_idx(int idx);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class RCore {
|
|||
|
||||
public string op_str(uint64 addr);
|
||||
public RAnal.Op op_anal(uint64 addr);
|
||||
public RAsm.Op disassemble(uint64 addr);
|
||||
public RAsm.Op* disassemble(uint64 addr); // memory leak here
|
||||
|
||||
public unowned string disassemble_instr(uint64 addr, int l);
|
||||
public unowned string disassemble_bytes(uint64 addr, int b);
|
||||
|
@ -125,6 +125,7 @@ public class RCore {
|
|||
// public static RList<RCoreAsmHit> AsmHit.list();
|
||||
}
|
||||
|
||||
[CCode (cname="RCoreSearchCallback")]
|
||||
public delegate int SearchCallback (uint64 from, uint8 *buf, int len);
|
||||
public bool search_cb(uint64 from, uint64 to, SearchCallback cb);
|
||||
|
||||
|
|
Loading…
Reference in New Issue