| 1 | #!/bin/sh |
| 2 | |
| 3 | # export decorated symbols using undecorated ones from .asm |
| 4 | # $1 - .def |
| 5 | # $2 - .in_c |
| 6 | outf=$3 |
| 7 | |
| 8 | grep '@' $1 | grep -v '\<DATA\>' | grep -v '=' | \ |
| 9 | awk '{print $1}' > ${outf}_explist |
| 10 | |
| 11 | echo ".text" > $outf |
| 12 | echo ".align 4" >> $outf |
| 13 | |
| 14 | cat ${outf}_explist | while read i; do |
| 15 | s0=`echo $i | cut -c 1` |
| 16 | if [ "$s0" = "@" ]; then |
| 17 | sym=`echo $i | awk -F@ '{print $2}'` |
| 18 | pre="" |
| 19 | else |
| 20 | sym=`echo $i | awk -F@ '{print $1}'` |
| 21 | pre="_" |
| 22 | fi |
| 23 | if grep -q "$sym" $2; then |
| 24 | continue |
| 25 | fi |
| 26 | |
| 27 | echo ".globl $pre$i" >> $outf |
| 28 | echo "$pre$i:" >> $outf |
| 29 | echo " jmp $sym" >> $outf |
| 30 | echo >> $outf |
| 31 | done |