linux(64位的系統)下nasm進行彙編連接時出現的問題

出現問題:linux

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

$ld -s hello.o -o helloinput

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

 

-------------------------------------------------------------------------------------------------------io

 

嘗試:asm

$ 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

sed

 -------------------------------------------------------------------------------------------------------file

 

 

解決:architecture

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

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

$./hello

  Hello, world!

相關文章
相關標籤/搜索