Prebinding

Whenever you install an update to the Mac OS X operating system, there is a long phase at the end called optimization . What the splash screen calls “optimization” is a particular type of optimization, called prebinding, which applies only to Mach-O executables. We will only describe the essential idea behind prebinding. For more details and specific instructions on building libraries and executables with prebinding enabled, consult the document /Developer/Documentation/ReleaseNotes/Prebinding.html .

To understand what prebinding is and how it can speed up the launch of an application, let’s consider what happens when you launch an application that was built without prebinding. When such an application (or dynamic library) is built, ld (the static linker) records the names of undefined symbols (i.e., the names of symbols that the application must link against). Later, when the application is launched, the dynamic linker (dyld) must bind the undefined references from the application to their definitions.

In contrast, if an executable or dynamic library is built with prebinding, the binding essentially occurs at build time. In particular, the library is predefined at some specified address range, a process that would otherwise have to occur when an application is launched. Rather than mark symbols as undefined, the dynamic linker can use address symbols in a prebound library to reference when some other application or dynamic library links against it. Additionally, if ...

Get Mac OS X for Unix Geeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.