darling/tools/gendirectmapassembly
2012-08-13 23:26:33 +02:00

28 lines
398 B
Bash
Executable File

#!/bin/bash
# Generates a direct mapping between two functions in assembly code
(
echo "section text"
echo
while read line; do
if [[ $line == ";;*" ]]; then
continue
fi
arrIN=(${line//;/ })
if [ ${#arrIN[@]} -ne 2 ]; then
continue
fi
echo "global ${arrIN[0]}"
echo "extern ${arrIN[1]}"
echo "${arrIN[0]}:"
echo " jmp ${arrIN[1]} WRT ..plt"
echo
done < "$1"
) > "${1%.lst}.asm"