12.9. Performance Tools and Debugging Tools

 < Day Day Up > 

12.8. The Dynamic Linker dyld: Prebinding, the Pre-Tiger Way

Prior to Mac OS X 10.3.4, whenever you installed an update to the Mac OS X operating system, there was a long phase at the end called optimization . What the splash screen called "optimization" was a particular type of optimization, called prebinding , which applied only to Mach-O executables. The purpose of prebinding was to speed up launch times of applications.

12.8.1. Launching an Application Built Without Prebinding

Prior to Tiger when an application (or dynamic library) was built without prebinding, ld (the static linker) recorded the names of undefined symbols (i.e., the names of symbols that the application must link against). Later, when the application launched, the dynamic linker (dyld) had to bind the undefined references from the application to their definitions.

In contrast, if an executable or dynamic library was built with prebinding, the binding essentially occurred at build time. In particular, the library was predefined at a specified address range, a process that otherwise occurred when an application was launched. Rather than mark symbols as undefined, the dynamic linker could use address symbols in a prebound library to reference other application or dynamic library links against it. Additionally, if the prebound library depended on other libraries (a common situation), then the static linker recorded the timestamps of the other libraries. Later, when the prebound library was used, the dynamic linker checked the timestamps of the dependent libraries and checked for the existence of overlapping executable addresses.

If the timestamps didn't match those of the build timestamps, or if there were overlapping executable addresses, the prebinding was broken and normal binding was performed.

12.8.2. Tiger's dyld Renders Prebinding Unnecessary

The trouble with prebinding is that it slows installation time. For Mac OS X 10.3.4, dyld was overhauled to improve performance and to better support standards. In Tiger additional improvements were made to dyld so that prebinding of applications was made unnecessary. In Tiger, unprebound applications launch as fast as prebound applications. Prebinding in Tiger is deprecated.

12.8.3. Some New Features of dyld

Here are a few of dyld's new features, introduced in Tiger:

  • dyld runs all initializers as early as possible. Among other things, initializers and statically-linked libraries are run before main( ).

  • dyld runs all terminators in reverse order relative to the order in which the corresponding initializers were run. Prior to Tiger, multiple terminators in a linkage unit were run incorrectly, specifically, in the same order as the corresponding initializers.

  • dlopen( ), along with related functions, are now integrated into dyld. Panther supported these functions through emulation, while pre-Panther versions of Mac OS X lacked support for these functions altogether.

For more details on dyld, see its manpage and /Developer/ADC Reference Library/releasenotes/DeveloperTools/dyld.html.

     < Day Day Up > 


    Mac OS X Tiger for Unix Geeks
    Mac OS X Tiger for Unix Geeks
    ISBN: 0596009127
    EAN: 2147483647
    Year: 2006
    Pages: 176

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