汇编: Linux中汇编程序的编译
时间:2021-03-14 13:55:34
收藏:0
阅读:22
NASM在Linux系统上创建汇编程序
NASM与ld不兼容
-
创建程序
nasm -f elf -g -F stabs helloworld.asmld -o helloworld helloworld.o- 可能出现错误:
ld: i386 architecture of input file ‘helloworld.o‘ is incompatible with i386:x86-64 output - 原因:
nasm编译器默认输出32位程序, 在而ld默认输出64位,不兼容
- 可能出现错误:
正确创建方法
-
64位
nasm -f elf64 -g -F stabs helloworld.asm -o helloworld.old -o helloworld helloworld.o -
32位
nasm -f elf -g -F stabs helloworld.asm -o helloworld.old -m elf_i386 -o helloworld helloworld.o
原文:https://www.cnblogs.com/ieeqc/p/14531991.html
评论(0)