alias pnasm64='_(){ local sel="";local file="${1}"; (($#<1))||[[ "${1}" =~ ^- || ! -e "${file}" ]]&&echo "Usage: pnasm64 <your.c> [-t (compile and link)]"&&return 1;rm -f "${file%.c}.o" "${file%.c}.asm";echo "Decompiling into object code.";gcc -fno-asynchronous-unwind-tables -s -c "${file}" -o "${file%.c}.o";echo "Converting to nasm.";objconv -fnasm "${file%.c}.o"; sed -i -e "s/align=1//g" -e "s/[a-z]*execute//g" -e "s/: *function//g" -e "/default *rel/d" "${file%.c}.asm";[[ -n "${2}" && "${2}" =~ "-t" ]]&&echo "Compiling with nasm..."&&nasm -felf64 -o "${file%.c}2.o" "${file%.c}.asm"&&echo "Linking with gcc..."&&gcc -fno-pie -no-pie -o "${file%.c}" "${file%.c}2.o";};_'
And this will only work out-of-the-box on simple C programs, to add libraries you'll need to hack it up and make it your own. Get the latest on GitHub.
No comments:
Post a Comment