Search code examples
linkermach-omach

In `/usr/include/mach-o/loader.h`, what's the mach filetype `mh_dylib_stub` for?


I'm reading mach-o/loader.h and noticed this file type and it's description:

#define MH_DYLIB_STUB   0x9     /* shared library stub for static */
                                /* linking only, no section contents */

This sounds almost like an import library for PE/COFF. Can anybody point me to something that talks about it?


Solution

  • This is a link-time only special object file which contains no code, but does contain symbols (LC_SYMTAB, DYSYMTAB) so that the linker can use it. It has made a cameo appearance around Xcode 7 before Apple moved to the proprietary ".tbd" files (which are textual).

    Source: MacOS/iOS Internals, 2nd Edition, Chapter 6.