Guy Ephraim Guy Ephraim - 3 months ago 17
Objective-C Question

What does the -all_load linker flag do?

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

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

Answer Source

It is probably related to this technical note 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.