* Rename r2rc to rarc2
- Moved into binr/rarc2 - Integrated with symstall - rarc2-tool now support -xc and -cx combo - Add rarc2.1 manpage * Add some bugs to review in TODO --HG-- rename : r2rc/Makefile => binr/rarc2/Makefile rename : r2rc/README => binr/rarc2/README rename : r2rc/TODO => binr/rarc2/TODO rename : r2rc/emit_arm.c => binr/rarc2/emit_arm.c rename : r2rc/emit_x64.c => binr/rarc2/emit_x64.c rename : r2rc/emit_x86.c => binr/rarc2/emit_x86.c rename : r2rc/i/libc.r => binr/rarc2/i/libc.r rename : r2rc/i/socket.r => binr/rarc2/i/socket.r rename : r2rc/out.c => binr/rarc2/out.c rename : r2rc/r2rc-tool => binr/rarc2/rarc2-tool rename : r2rc/r2rc.c => binr/rarc2/rarc2.c rename : r2rc/rcc.h => binr/rarc2/rarc2.h rename : r2rc/t/Makefile => binr/rarc2/t/Makefile rename : r2rc/t/argv.r => binr/rarc2/t/argv.r rename : r2rc/t/bytedump.r => binr/rarc2/t/bytedump.r rename : r2rc/t/data.r => binr/rarc2/t/data.r rename : r2rc/t/dump.r => binr/rarc2/t/dump.r rename : r2rc/t/hello.r => binr/rarc2/t/hello.r rename : r2rc/t/if.r => binr/rarc2/t/if.r rename : r2rc/t/inline.r => binr/rarc2/t/inline.r rename : r2rc/t/input.r => binr/rarc2/t/input.r rename : r2rc/t/loop.r => binr/rarc2/t/loop.r rename : r2rc/t/ptr.r => binr/rarc2/t/ptr.r rename : r2rc/t/rawsys.r => binr/rarc2/t/rawsys.r rename : r2rc/t/rawsys64.r => binr/rarc2/t/rawsys64.r rename : r2rc/t/regs.r => binr/rarc2/t/regs.r rename : r2rc/t/ret.r => binr/rarc2/t/ret.r rename : r2rc/t/room.r => binr/rarc2/t/room.r rename : r2rc/t/segfault.r => binr/rarc2/t/segfault.r rename : r2rc/t/shell.r => binr/rarc2/t/shell.r rename : r2rc/t/sub.r => binr/rarc2/t/sub.r rename : r2rc/t/syscall.r => binr/rarc2/t/syscall.r rename : r2rc/test.r => binr/rarc2/test.r
This commit is contained in:
parent
236d78295d
commit
affbba8aa2
12
Makefile
12
Makefile
|
@ -1,7 +1,7 @@
|
|||
include config-user.mk
|
||||
include global.mk
|
||||
|
||||
all: plugins.cfg libr binr r2rc
|
||||
all: plugins.cfg libr binr
|
||||
|
||||
plugins.cfg:
|
||||
./configure-plugins
|
||||
|
@ -12,9 +12,6 @@ libr:
|
|||
binr:
|
||||
cd binr && ${MAKE} all
|
||||
|
||||
r2rc:
|
||||
cd r2rc && ${MAKE} all
|
||||
|
||||
w32dist:
|
||||
rm -rf radare2-w32-${VERSION} w32dist
|
||||
mkdir w32dist
|
||||
|
@ -26,12 +23,10 @@ w32dist:
|
|||
clean:
|
||||
cd libr && ${MAKE} clean
|
||||
cd binr && ${MAKE} clean
|
||||
cd r2rc && ${MAKE} clean
|
||||
|
||||
mrproper:
|
||||
cd libr && ${MAKE} mrproper
|
||||
cd binr && ${MAKE} mrproper
|
||||
cd r2rc && ${MAKE} mrproper
|
||||
rm -f config-user.mk plugins.cfg libr/config.h libr/include/r_userconf.h libr/config.mk
|
||||
rm -f pkgcfg/*.pc
|
||||
|
||||
|
@ -53,12 +48,10 @@ install: install-man
|
|||
for a in doc/* ; do ${INSTALL_DATA} $$a ${DESTDIR}/${PREFIX}/share/doc/radare2 ; done
|
||||
cd libr && ${MAKE} install PARENT=1 PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
cd binr && ${MAKE} install PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
cd r2rc && ${MAKE} install PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
|
||||
symstall install-symlink: install-man-symlink
|
||||
cd libr && ${MAKE} install-symlink PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
cd binr && ${MAKE} install-symlink PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
cd r2rc && ${MAKE} install-symlink PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
|
||||
uninstall:
|
||||
rm -rf prefix
|
||||
|
@ -66,7 +59,6 @@ uninstall:
|
|||
deinstall: uninstall
|
||||
cd libr && ${MAKE} uninstall PARENT=1 PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
cd binr && ${MAKE} uninstall PARENT=1 PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
cd r2rc && ${MAKE} uninstall PARENT=1 PREFIX=${PREFIX} DESTDIR=${DESTDIR}
|
||||
|
||||
swig-dist:
|
||||
cd swig && ${MAKE} dist
|
||||
|
@ -90,4 +82,4 @@ shot:
|
|||
|
||||
include ${MKPLUGINS}
|
||||
|
||||
.PHONY: all clean mrproper install symstall uninstall deinstall dist shot pkgcfg swig libr binr r2rc install-man
|
||||
.PHONY: all clean mrproper install symstall uninstall deinstall dist shot pkgcfg swig libr binr install-man
|
||||
|
|
21
TODO
21
TODO
|
@ -14,10 +14,20 @@ Questions:
|
|||
* imports from PE doesnt works with /a because there's an indirect call
|
||||
* rabin2 doesnt works for osx-x86 mach0 bins..so io.va=1 fails
|
||||
|
||||
Bugs:
|
||||
-----
|
||||
* if we use objcopy --stripsymbols on a library..the stripped symbols are not
|
||||
listed by nm or rabin..but objcopy is able to see them O_O
|
||||
* anal bug: (fixed??)
|
||||
[0x08048eec]> pd 2
|
||||
0x08048eec 0 c20400 ret 0x4
|
||||
-> this opcodes increments the stack 8 bytes (4+4) . it is not handled correctly
|
||||
|
||||
|
||||
TODO:
|
||||
-----
|
||||
* rarc2 : choose syntax in runtime
|
||||
* Store version information in libraries ? debian claims for it
|
||||
* Write manpages for r2rc, r2rc-tool .. find better name rarc2?
|
||||
* nibble: trace counts after step..thats not correct!
|
||||
* implement grep{col,row}
|
||||
* pancake: dietline.c : do not show all options at first tab if matches
|
||||
|
@ -53,6 +63,7 @@ TODO:
|
|||
0.6
|
||||
===
|
||||
* rasign2 : must be done, write manpage
|
||||
* distribute 'spp' with 'rarc2' ?
|
||||
|
||||
Transaction notes
|
||||
=================
|
||||
|
@ -131,3 +142,11 @@ Future
|
|||
- load the program using r_bin in virtual space
|
||||
- initialize vm and set regs
|
||||
- debug backend should use the vm
|
||||
|
||||
.------------------------.
|
||||
| ___ ___ ____ |
|
||||
| | - ) _ _ | _ |/ _/ | please!
|
||||
| | - \| | |\_ |\_ \ |___. report! :)
|
||||
| |___/'___'|___'|___/ ___/
|
||||
| |
|
||||
`------------------------'
|
||||
|
|
|
@ -4,7 +4,7 @@ include ../config-user.mk
|
|||
|
||||
PFX=${DESTDIR}${PREFIX}
|
||||
|
||||
BINS=rax2 rasm2 rabin2 rahash2 radiff2 radare2 rafind2
|
||||
BINS=rax2 rasm2 rabin2 rahash2 radiff2 radare2 rafind2 rarc2
|
||||
|
||||
all:
|
||||
@for a in ${BINS} ; do (cd $$a && ${MAKE} all); done
|
||||
|
@ -12,16 +12,21 @@ all:
|
|||
install:
|
||||
mkdir -p ${PFX}/bin
|
||||
for a in ${BINS} ; do ${INSTALL_PROGRAM} $$a/$$a ${PFX}/bin ; done
|
||||
# rarc2
|
||||
cp rarc2/rarc2 ${PFX}/bin
|
||||
cp rarc2/rarc2-tool ${PFX}/bin
|
||||
# shortcut
|
||||
-cd ${PFX}/bin && rm -f r2 ; ln -fs radare2 r2
|
||||
|
||||
install-symlink:
|
||||
mkdir -p ${PFX}/bin
|
||||
for a in ${BINS} ; do ln -fs ${PWD}/$$a/$$a ${PFX}/bin/$$a ; done
|
||||
ln -fs ${PWD}/rarc2/rarc2-tool ${PFX}/bin/rarc2-tool
|
||||
-ln -fs ${PFX}/bin/radare2 ${PFX}/bin/r2
|
||||
|
||||
deinstall uninstall:
|
||||
for a in ${BINS} ; do rm -f ${PFX}/bin/$$a ; done
|
||||
rm -f ${PFX}/bin/rarc2-tool
|
||||
-rm -f ${PFX}/bin/r2
|
||||
|
||||
clean mrproper:
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
include ../../config-user.mk
|
||||
|
||||
CFLAGS+=-g -Wall
|
||||
PFX=${DESTDIR}${PREFIX}
|
||||
|
||||
OBJS=rarc2.o emit_x86.o emit_x64.o emit_arm.o out.o
|
||||
|
||||
all: config.h rarc2${EXT_EXE}
|
||||
|
||||
config.h:
|
||||
cp -f config.def.h config.h
|
||||
|
||||
rarc2${EXT_EXE}: ${OBJS}
|
||||
${CC} ${LDFLAGS} -I. ${OBJS} -o rarc2${EXT_EXE}
|
||||
|
||||
test:
|
||||
# only works with att mode
|
||||
./rarc2 t/hello.r > t/hello.S
|
||||
gcc t/hello.S -o t/hello
|
||||
# cat t/hello.S
|
||||
t/hello
|
||||
#spp test.r | ./rarc2
|
||||
#./rarc2 test.r
|
||||
|
||||
install:
|
||||
chmod +x rarc2
|
||||
mkdir -p ${PFX}/bin
|
||||
cp rarc2 ${PFX}/bin
|
||||
chmod +x rarc2-tool
|
||||
cp rarc2-tool ${PFX}/bin
|
||||
|
||||
install-symlink:
|
||||
mkdir -p ${PFX}/bin
|
||||
ln -fs ${PWD}/rarc2 ${PFX}/bin/rarc2
|
||||
ln -fs ${PWD}/rarc2-tool ${PFX}/bin/rarc2-tool
|
||||
|
||||
deinstall uninstall:
|
||||
rm -f ${PFX}/bin/rarc2 ${PFX}/bin/rarc2-tool
|
||||
|
||||
clean mrproper:
|
||||
cd t && ${MAKE} clean
|
||||
-rm -f rarc2 rarc2.o out.o emit*.o
|
||||
|
||||
.PHONY: all clean install install-symlink deinstall uninstall test mrproper
|
|
@ -1,3 +1,4 @@
|
|||
* specify syntax and arch with envvars or args
|
||||
* Add support for rasm2
|
||||
* Add preprocessing support to compile 32/64 bit specific code.. or OS-dependent
|
||||
* Rename to r_rcc
|
|
@ -0,0 +1 @@
|
|||
#define SYNTAX_ATT 1
|
|
@ -1,7 +1,7 @@
|
|||
/* TODO */
|
||||
/* pancake // nopcode.org 2010 -- emit module for rcc */
|
||||
|
||||
#include "rcc.h"
|
||||
#include "rarc2.h"
|
||||
|
||||
#define EMIT_NAME emit_arm
|
||||
#define R_ARCH "arm"
|
|
@ -1,6 +1,6 @@
|
|||
/* pancake // nopcode.org 2010 -- emit module for rcc */
|
||||
|
||||
#include "rcc.h"
|
||||
#include "rarc2.h"
|
||||
|
||||
#ifdef ARCH_X86_64
|
||||
# define EMIT_NAME emit_x64
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/sh
|
||||
# pancake / nopcode.org
|
||||
|
||||
[ -z "${ARCH}" ] && ARCH=`r2rc -a`
|
||||
[ -z "${ARCH}" ] && ARCH=`rarc2 -a`
|
||||
|
||||
compile() {
|
||||
spp -h 2>&1 >/dev/null
|
||||
if [ $? = 0 ]; then
|
||||
spp -Darch=${ARCH} $@ | r2rc -${ARCH} > .a.S || exit $?
|
||||
spp -Darch=${ARCH} $@ | rarc2 -${ARCH} > .a.S || exit $?
|
||||
else
|
||||
r2rc -${ARCH} $@ > .a.S || exit $?
|
||||
rarc2 -${ARCH} $@ > .a.S || exit $?
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -26,29 +26,33 @@ case "$flg" in
|
|||
"-S")
|
||||
compile $@
|
||||
;;
|
||||
"-cx"|"-xc")
|
||||
compile $@
|
||||
gcc .a.S -o .a.out
|
||||
[ -e .a.out ] && ./.a.out
|
||||
rm -f .a.S .a.out
|
||||
;;
|
||||
"-c")
|
||||
compile $@
|
||||
gcc .a.S -o .a.out
|
||||
if [ -e .a.out ]; then
|
||||
cp .a.out $1.out
|
||||
fi
|
||||
[ -e .a.out ] && cp .a.out $1.out
|
||||
rm -f .a.S .a.out
|
||||
;;
|
||||
"-x")
|
||||
compile $@
|
||||
gcc -nostdlib .a.S -o .a.out
|
||||
if [ -e .a.out ]; then
|
||||
bytes=`rabin -o d/S/.text .a.out`
|
||||
bytes=`rabin2 -o d/S/.text .a.out`
|
||||
rasc -s $bytes -X
|
||||
fi
|
||||
rm -f .a.S .a.out
|
||||
;;
|
||||
*)
|
||||
echo "Usage: r2rc-tool [-flag] [file]"
|
||||
echo "Usage: rarc2-tool [-flag] [file]"
|
||||
echo " -b dump bytes"
|
||||
echo " -x execute"
|
||||
echo " -c compile against libc"
|
||||
echo " -S only generate .S file"
|
||||
echo "ARCH: environ to set architecture: x86, x64"
|
||||
echo "ARCH: environ to set architecture: arm, x86, x64"
|
||||
;;
|
||||
esac
|
|
@ -6,7 +6,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include "rcc.h"
|
||||
#include "rarc2.h"
|
||||
|
||||
static int parsechar(char c);
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define SYNTAX_ATT 0
|
||||
#include "config.h"
|
||||
|
||||
enum {
|
||||
NORMAL = 0,
|
|
@ -46,6 +46,7 @@ Show usage help message.
|
|||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <pancake@nopcode.org>
|
||||
|
|
|
@ -62,6 +62,7 @@ path to the current working file
|
|||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <@nopcode.org>
|
||||
|
|
|
@ -33,6 +33,7 @@ Show usage help message.
|
|||
.Xr rahash2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
@ -45,6 +45,7 @@ Specify the target adddress
|
|||
.Xr rabin2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
@ -42,6 +42,8 @@ Show usage help message.
|
|||
.Xr rabin2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <pancake@nopcode.org>
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
.Dd Jun 28, 2010
|
||||
.Dt RARC2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm rarc2
|
||||
.Nd radare2 relocatable compiler
|
||||
.Sh SYNOPSIS
|
||||
.Nm rarc2
|
||||
.Op < source
|
||||
.Op > assembly
|
||||
.Nm rarc2-tool
|
||||
.Op -b
|
||||
.Op -x
|
||||
.Op -c
|
||||
.Op -S
|
||||
.Op file
|
||||
.Sh DESCRIPTION
|
||||
This command is part of the radare project.
|
||||
.Pp
|
||||
This compiler parses a syntax-free language similar to C and generates assembly code for various architectures.
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width Fl
|
||||
.It Fl b
|
||||
Dump bytes of compiled code
|
||||
.It Fl x
|
||||
Execute code instead
|
||||
.It Fl c
|
||||
Link with libc
|
||||
.It Fl S
|
||||
Generate .S assembly file instead of executable
|
||||
.El
|
||||
.Sh USAGE
|
||||
.Pp
|
||||
Using rarc2:
|
||||
$ echo 'main(64){printf("hello world\n");}' | rarc2 > hello.S
|
||||
$ gcc hello.S
|
||||
$ ./a.out
|
||||
hello world
|
||||
.Pp
|
||||
Using rarc2-tool:
|
||||
$ cat test.r
|
||||
main(64){ printf("hello world\n"); }
|
||||
$ rarc2-tool -x test.r
|
||||
hello world
|
||||
.Sh SEE ALSO
|
||||
.Pp
|
||||
.Xr radare2(1) ,
|
||||
.Xr rahash2(1) ,
|
||||
.Xr rafind2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <pancake@nopcode.org>
|
||||
.Pp
|
|
@ -38,6 +38,7 @@ Show usage help message.
|
|||
.Xr rahash2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
@ -56,6 +56,7 @@ Available variable types are:
|
|||
.Xr rafind2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
CFLAGS+=-g -Wall
|
||||
PREFIX?=/usr
|
||||
DESTDIR?=
|
||||
PFX=${DESTDIR}${PREFIX}
|
||||
|
||||
all: r2rc
|
||||
|
||||
r2rc: r2rc.o emit_x86.o emit_x64.o emit_arm.o out.o
|
||||
gcc -I. out.o r2rc.o emit*.o -o r2rc
|
||||
|
||||
test:
|
||||
./rcc t/hello.r > t/hello.S
|
||||
gcc t/hello.S -o t/hello
|
||||
# cat t/hello.S
|
||||
t/hello
|
||||
#spp test.r | ./rcc
|
||||
#./rcc test.r
|
||||
|
||||
install:
|
||||
chmod +x r2rc
|
||||
mkdir -p ${PFX}/bin
|
||||
cp r2rc ${PFX}/bin
|
||||
chmod +x r2rc-tool
|
||||
cp r2rc-tool ${PFX}/bin
|
||||
|
||||
install-symlink:
|
||||
mkdir -p ${PFX}/bin
|
||||
ln -fs ${PWD}/r2rc ${PFX}/bin/r2rc
|
||||
ln -fs ${PWD}/r2rc-tool ${PFX}/bin/r2rc-tool
|
||||
|
||||
deinstall uninstall:
|
||||
rm -f ${PFX}/bin/r2rc ${PFX}/bin/r2rc-tool
|
||||
|
||||
clean mrproper:
|
||||
cd t && ${MAKE} clean
|
||||
-rm -f r2rc r2rc.o out.o emit*.o
|
||||
|
||||
|
||||
.PHONY: all clean install install-symlink deinstall uninstall r2rc test mrproper
|
Loading…
Reference in New Issue