X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=run_exp.sh;h=319c2ab8511432e91648691278952796beed804f;hb=17ed469eafaf2698cd31cdf0b2cb0e35fa799cd7;hp=edcc3b01812cf34cee44a83f49550c4cda9a255b;hpb=74cea04842440af60865473b390bc452e9bd3fa3;p=ia32rtools.git diff --git a/run_exp.sh b/run_exp.sh index edcc3b0..319c2ab 100755 --- a/run_exp.sh +++ b/run_exp.sh @@ -1,15 +1,31 @@ #!/bin/sh -grep '@' $1 | awk '{print $1}' > $2_explist +# export decorated symbols using undecorated ones from .asm +# $1 - .def +# $2 - .in_c +outf=$3 -echo ".text" > $2 -echo ".align 4" >> $2 +grep '@' $1 | grep -v '\' | grep -v '=' | \ + awk '{print $1}' > ${outf}_explist -cat $2_explist | while read i; do - sym=`echo $i | awk -F@ '{print $1}'` +echo ".text" > $outf +echo ".align 4" >> $outf - echo ".globl _$i" >> $2 - echo "_$i:" >> $2 - echo " jmp $sym" >> $2 - echo >> $2 +cat ${outf}_explist | while read i; do + s0=`echo $i | cut -c 1` + if [ "$s0" = "@" ]; then + sym=`echo $i | awk -F@ '{print $2}'` + pre="" + else + sym=`echo $i | awk -F@ '{print $1}'` + pre="_" + fi + if grep -q "$sym" $2; then + continue + fi + + echo ".globl $pre$i" >> $outf + echo "$pre$i:" >> $outf + echo " jmp $sym" >> $outf + echo >> $outf done