nasm生成程序
nasm 在x64机器上生成x86的程序
1 | nasm -f elf *.asm; ld -m elf_i386 -s -o demo *.o |
https://www.tutorialspoint.com/compile_asm_online.php 线上nasm编辑执行
- fib.asm => 生成fib.o
1 | dassein@pad:~/nasm_pjt/nasm_linux_vscode$ nasm -f elf fib.asm |
- 链接fib.o => 生成fib 可执行文件
compiling/linking 32-bit apps on x86_64, setting emulation to elf_i386
provides the correct elf format.
https://stackoverflow.com/questions/19200333/architecture-of-i386-input-file-is-incompatible-with-i386x86-64 compiling/linking 32-bit on x86_64
1 | dassein@pad:~/nasm_pjt/nasm_linux_vscode$ ld -m elf_i386 -s -o fib fib.o |
- 执行fib
1 | dassein@pad:~$ ./fib |