9.7 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 a 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. The library is then consulted when an application or some other dynamic library links against the dynamic library. 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.



Mac OS X Panther for Unix Geeks
Mac OS X Panther for Unix Geeks
ISBN: 0596006071
EAN: 2147483647
Year: 2003
Pages: 212

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net