A.4. Universal BinariesWe discussed the structure of a Universal Binary in Chapter 2. In the x86 version of Mac OS X, almost all[2] Mach-O executablesincluding the kernelare Universal Binaries.
Even with a Universal installation of the entire operating system, for such an installation to boot on both the PowerPC and x86 platforms, the respective firmware implementations will have to understand the partitioning scheme in use. $ file /mach_kernel /mach_kernel: Mach-O universal binary with 2 architectures /mach_kernel (for architecture ppc): Mach-O executable ppc /mach_kernel (for architecture i386): Mach-O executable i386 $ lipo -thin ppc /mach_kernel -output /tmp/mach_kernel.ppc $ lipo -thin i386 /mach_kernel -output /tmp/mach_kernel.i386 $ ls -l /tmp/mach_kernel.* -rw-r----- 1 amit wheel 4023856 Feb 4 17:30 /tmp/mach_kernel.i386 -rw-r----- 1 amit wheel 4332672 Feb 4 17:30 /tmp/mach_kernel.ppc Note that the x86 kernel is somewhat smaller than the PowerPC kernel. Let us look at another examplethat of the system library. ... -rw-r----- 1 amit wheel 1873472 Feb 4 17:30 /tmp/libSystem.B.dylib.i386 -rw-r----- 1 amit wheel 2216288 Feb 4 17:30 /tmp/libSystem.B.dylib.ppc Again, we see that the x86 version of the system library is somewhat smaller. In general, x86 binaries are smaller than PowerPC binaries. One reason is that the latter has a fixed instruction size (4 bytes, with 4-byte alignment), whereas the x86 has variable-size instructions (ranging from 1 byte to over 10 bytes). Figure A3 shows a simple experiment to compare the size of an "empty" C program's executables when the program is compiled for x86, PowerPC, and 64-bit PowerPC. Figure A3. Compiling an "empty" C program on the x86, PowerPC, and 64-bit PowerPC
|