出现问题:

$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!

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2021-05-22
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-06
  • 2021-05-17
  • 2022-03-07
  • 2022-12-23
  • 2021-09-11
  • 2021-09-30
  • 2022-12-23
相关资源
相似解决方案