mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-12 07:26:42 +00:00
2e54f45389
- Previously named 'rcc' - Qt bastards has forced us to rename it - Not yet integrated with build system
55 lines
900 B
Bash
Executable File
55 lines
900 B
Bash
Executable File
#!/bin/sh
|
|
# pancake / nopcode.org
|
|
|
|
[ -z "${ARCH}" ] && ARCH=`rcc -a`
|
|
|
|
compile() {
|
|
spp -h 2>&1 >/dev/null
|
|
if [ $? = 0 ]; then
|
|
spp -Darch=${ARCH} $@ | rcc -${ARCH} > .a.S || exit $?
|
|
else
|
|
rcc -${ARCH} $@ > .a.S || exit $?
|
|
fi
|
|
}
|
|
|
|
flg=$1
|
|
shift
|
|
case "$flg" in
|
|
"-b")
|
|
compile $@
|
|
gcc -nostdlib .a.S -o .a.out
|
|
if [ -e .a.out ]; then
|
|
rabin2 -o d/S/.text .a.out
|
|
rm -f .a.S .a.out
|
|
fi
|
|
;;
|
|
"-S")
|
|
compile $@
|
|
;;
|
|
"-c")
|
|
compile $@
|
|
gcc .a.S -o .a.out
|
|
if [ -e .a.out ]; then
|
|
cp .a.out $1.out
|
|
fi
|
|
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`
|
|
rasc -s $bytes -X
|
|
fi
|
|
rm -f .a.S .a.out
|
|
;;
|
|
*)
|
|
echo "Usage: rcc-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"
|
|
;;
|
|
esac
|