Link object files without libSystem macOS

牧云@^-^@ 提交于 2019-12-08 04:54:52

问题


I'm writing a compiler for macOS on x86-64, but when I link the object files together, ld says

ld: dynamic main executables must link with libSystem.dylib for inferred architecture x86_64

But since libSystem contains libc, I don't want to use it (it would give me lots of duplicates). How can I get around this?


回答1:


Use -macosx_version_min 10.6 as ld parameter. This will generate LC_UNIXTHREAD instead of LC_MAIN in your executable. If you want even more control you'd need to get rid of ld in your chain altogether.



来源:https://stackoverflow.com/questions/46039667/link-object-files-without-libsystem-macos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!