hzq$ nasm -f macho64 -o helloworld  aa.asm

hzq$ ld -o helloworld.o -e _start helloworld
ld: warning: No version-min specified on command line
ld: dynamic main executables must link with libSystem.dylib for inferred architecture x86_64

hzq$ ld -macosx_version_min 10.14 -o helloworld.o -e _start helloworld
ld: dynamic main executables must link with libSystem.dylib for inferred architecture x86_64

 

加上libSystem.dylib动态库,因为我们是在系统上编程,所以要用系统的接口,需要系统库

hzq$ ld -macosx_version_min 10.14 -o helloworld.o -e _start helloworld -lSystem

-e _start   是指定入口函数,由global声明

hzq$ ./helloworld.o
Enter a character:  a
You have input:  a
hzq$

mac os 汇编helloworld

mac os 汇编helloworld

相关文章:

  • 2021-04-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-10-10
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2022-02-07
  • 2021-07-20
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案