创建程序
nasm -f elf -g -F stabs helloworld.asm
ld -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.o
ld -o helloworld helloworld.o
32位
nasm -f elf -g -F stabs helloworld.asm -o helloworld.o
ld -m elf_i386 -o helloworld helloworld.o
原文:https://www.cnblogs.com/ieeqc/p/14531991.html