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 the prebound library depends on other
libraries (a common situation), then the static linker records the
timestamps of the other libraries. Later, when the prebound library
is used, the dynamic linker checks the timestamps of the dependent
libraries and checks for the existence of overlapping executable
addresses. If the timestamps do not match those of the build
timestamps, or if there are overlapping executable addresses, the
prebinding is broken and normal binding is performed.
 |  |  |
5.5. Creating and Linking Static Libraries |  | 5.7. Interesting and Important Libraries |