当前位置:首页 > 操作系统 > Linux

linux(64位的系统)下nasm进行汇编链接时出现的问题

出现问题:

$nasm -f elf hello.asm -o hello.o

$ld -s hello.o -o hello

  ld: i386 architecture of input file `hello.o‘ is incompatible with i386:x86-64 output

 

尝试:

$ ld -m32 -s hello.o -o hello
  ld: unrecognised emulation mode: 32
  Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om i386pep i386pe

 

解决:

$nasm -f elf hello.asm -o hello.o

$ld -m elf_i386 -s hello.o -o hello

$./hello

  Hello, world!

 

原文:http://www.cnblogs.com/zyx1314/p/4705366.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐