all_load链接器标记做什么?

时间:2022-09-27 04:55:12

I can't find anywhere what the -all_load flag do when compiling Objective-C code.

我在编译Objective-C代码时找不到-all_load标志的作用。

I have some issues uploading binaries to Apple, the they say it's because I didn't use this flag, but my code compiles even without it.

我有一些问题上传二进制文件给苹果,他们说这是因为我没有使用这个标志,但我的代码编译,即使没有它。

Can some one help me with that?

有人能帮我一下吗?

Thanks

谢谢

1 个解决方案

#1


139  

It is probably related to this technical note https://developer.apple.com/library/content/qa/qa1490/_index.html

它可能与这个技术说明相关:https://developer.apple.com/library/content/qa/qa1490/_index.html

IMPORTANT: For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags. -all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.

重要:对于64位和iPhone OS应用程序,有一个linker bug,它可以防止-ObjC从静态库中加载对象文件,这些文件只包含类别和没有类。解决方法是使用-all_load或-force_load标志。-all_load迫使链接器从它看到的每个归档文件中加载所有对象文件,甚至是那些没有Objective-C代码的归档文件。-force_load在Xcode 3.2和以后的版本中都有。它可以更好地控制存档加载的粒度。每个-force_load选项后面都必须有一个存档路径,该存档中的每个对象文件都将被加载。

#1


139  

It is probably related to this technical note https://developer.apple.com/library/content/qa/qa1490/_index.html

它可能与这个技术说明相关:https://developer.apple.com/library/content/qa/qa1490/_index.html

IMPORTANT: For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags. -all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.

重要:对于64位和iPhone OS应用程序,有一个linker bug,它可以防止-ObjC从静态库中加载对象文件,这些文件只包含类别和没有类。解决方法是使用-all_load或-force_load标志。-all_load迫使链接器从它看到的每个归档文件中加载所有对象文件,甚至是那些没有Objective-C代码的归档文件。-force_load在Xcode 3.2和以后的版本中都有。它可以更好地控制存档加载的粒度。每个-force_load选项后面都必须有一个存档路径,该存档中的每个对象文件都将被加载。