From: notaz Date: Wed, 29 Jan 2014 22:07:00 +0000 (+0200) Subject: make run_imp.sh more generic, add run_exp.sh X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74cea04842440af60865473b390bc452e9bd3fa3;p=ia32rtools.git make run_imp.sh more generic, add run_exp.sh .. for dll exports --- diff --git a/run_exp.sh b/run_exp.sh new file mode 100755 index 0000000..edcc3b0 --- /dev/null +++ b/run_exp.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +grep '@' $1 | awk '{print $1}' > $2_explist + +echo ".text" > $2 +echo ".align 4" >> $2 + +cat $2_explist | while read i; do + sym=`echo $i | awk -F@ '{print $1}'` + + echo ".globl _$i" >> $2 + echo "_$i:" >> $2 + echo " jmp $sym" >> $2 + echo >> $2 +done diff --git a/run_imp.sh b/run_imp.sh index 7c10376..1c9cf90 100755 --- a/run_imp.sh +++ b/run_imp.sh @@ -1,11 +1,12 @@ #!/bin/sh -grep 'extrn ' StarCraft.asm | awk '{print $2}' | awk -F: '{print $1}' > implist +grep 'extrn ' $1 | awk '{print $2}' | awk -F: '{print $1}' > $2_implist +extra_libs=`ls *.lib 2> /dev/null` -echo ".data" > $1 -echo ".align 4" >> $1 +echo ".data" > $2 +echo ".align 4" >> $2 -cat implist | while read i; do +cat $2_implist | while read i; do rm -f tmpsym case $i in __imp_*) @@ -16,7 +17,7 @@ cat implist | while read i; do ;; esac - grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* *.lib | awk '{print $3}' | \ + grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* $extra_libs | awk '{print $3}' | \ while read f; do sym=`i586-mingw32msvc-nm $f | grep "\<_$si\>" | grep ' T ' | awk '{print $3}'` if test -n "$sym"; then @@ -30,8 +31,8 @@ cat implist | while read i; do exit 1 fi - echo ".globl $i" >> $1 - echo "$i:" >> $1 - echo " .long $sym" >> $1 - echo >> $1 + echo ".globl $i" >> $2 + echo "$i:" >> $2 + echo " .long $sym" >> $2 + echo >> $2 done