我正在尝试将二进制文件编译为MACH_O对象文件,以便将其链接到dylib.dylib是用c/c ++编写的.
在linux上使用以下命令:ld -r -b binary -o foo.o foo.bin
我在OSX上尝试了各种选项,但无济于事:
ld -r foo.bin -o foo.o
gives:
ld: warning: -arch not specified
ld: warning: ignoring file foo.bin, file was built for unsupported file format which is not the architecture being linked (x86_64)
Run Code Online (Sandbox Code Playgroud)
创建一个空的.o文件
ld -arch x86_64 -r foo.bin -o foo.o
ld: warning: ignoring file foo.bin, file was built for unsupported file format which is not the architecture being linked (x86_64)
Run Code Online (Sandbox Code Playgroud)
再次创建空的.o文件.用nm检查文件给出:nm foo.o nm:没有名称列表
二进制文件实际上是将下载到外部设备的固件.
谢谢你的期待