アセンブラからELF
64bitに以降したら
nasm -f elf test.asm ld test.o
としていたアセンブラから実行ファイルへの変換が動かなくなっていた
could not read symbols: File in wrong format
の様なエラーが出る。 どうやら-m elf_i386を指定しないといけないらしい。
#!/bin/sh
if [ ! $# -eq 1 ]; then
echo "please set asmfile"
exit 1
fi
if [ ! -f $1 ]; then
echo "file not fount" 1>&2
exit 1
fi
BASE_NAME=${1%.*}
nasm -f elf ${1} -o ${BASE_NAME}.o
ld -e main -m elf_i386 -o ${BASE_NAME} ${BASE_NAME}.o
rm -rf ${BASE_NAME}.o
こんな感じに修正した。