1

我可以在 64 位上运行它吗?

 ;
 ; assemble and link with:
 ; nasm -f elf printf-test.asm && gcc -m32 -o printf-test printf-test.o
 ;
 section .text
 global main
 extern printf

 main:

  mov eax, 0xDEADBEEF
  push eax
  push message
  call printf
  add esp, 8
  ret

  message db "Register = %08X", 10, 0

我收到了这个错误

~/Desktop$ nasm -f elf printTest.asm
~/Desktop$ gcc -m32 -o printTest printTest.o
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc.a when searching for -lgcc
 /usr/bin/ld: cannot find -lgcc
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc_s.so when searching for -lgcc_s
 /usr/bin/ld: cannot find -lgcc_s
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libc.so when searching for -lc
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libc.a when searching for -lc
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
 /usr/bin/ld: cannot find -lc
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc.a when searching for -lgcc
 /usr/bin/ld: cannot find -lgcc
 /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc_s.so when searching for -lgcc_s
 /usr/bin/ld: cannot find -lgcc_s
 collect2: ld returned 1 exit status
4

0 回答 0