csmith_gen: add COMPILE_CMD option
This commit is contained in:
parent
2b2d44c18e
commit
5d6929f84c
|
@ -1,6 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
USAGE="$0 output_dir nb_tests"
|
USAGE="$0 output_dir nb_tests
|
||||||
|
You may also set COMPILE_CMD to eg. 'gcc -O2' if you want to override the
|
||||||
|
default command."
|
||||||
|
|
||||||
|
if [ -z "$COMPILE_CMD" ] ; then
|
||||||
|
COMPILE_CMD='gcc -O2'
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$#" -lt 2 ] ; then
|
if [ "$#" -lt 2 ] ; then
|
||||||
>&2 echo -e "Missing argument(s). Usage:\n$USAGE"
|
>&2 echo -e "Missing argument(s). Usage:\n$USAGE"
|
||||||
|
@ -28,7 +34,7 @@ for _num in $(seq 1 $NB_TESTS); do
|
||||||
csmith > "$path.c"
|
csmith > "$path.c"
|
||||||
sed -i 's/^static \(.* func_\)/\1/g' "$path.c"
|
sed -i 's/^static \(.* func_\)/\1/g' "$path.c"
|
||||||
echo -ne "\r>>> $num.bin "
|
echo -ne "\r>>> $num.bin "
|
||||||
gcc -O2 -I/usr/include/csmith-2.3.0/ -w "$path.c" -o "$path.orig.bin"
|
$COMPILE_CMD -I/usr/include/csmith-2.3.0/ -w "$path.c" -o "$path.orig.bin"
|
||||||
objcopy --remove-section '.eh_frame' --remove-section '.eh_frame_hdr' \
|
objcopy --remove-section '.eh_frame' --remove-section '.eh_frame_hdr' \
|
||||||
"$path.orig.bin" "$path.bin"
|
"$path.orig.bin" "$path.bin"
|
||||||
echo -ne "\r>>> $num.eh.bin "
|
echo -ne "\r>>> $num.eh.bin "
|
||||||
|
|
Loading…
Reference in a new issue