A static library (a .a file) is a collection of object files. On MacOS X, executable binary files can contain code for multiple CPUs - that is, it can be be a collection of slices.
Those are called fat binaries. A fat binary contains a small header, followed by a sequence of slices that look like architecture specific executable binary files in Mach-O format, as is the MacOS X convention. Object files in a static library on MacOS X as Mach-O files as well. In a way, the two formats are similar - they both are containers for a set of Mach-O files. The fat binary format is defined by Apple. The Mach-O format itself did not originate at Apple, but MacOS X/iOS is the biggest platform to employ Mach-O binaries, so the Apple implementation and docs on Mach-O are the ones that matter. The static library format goes back to the early days of UNIX.So what happens when you build a fat static library? There are two options for nesting:
- Fat binary with .a libraries as slices
- A .a library with object files being fat
In reality, at least as of the time of its writing, it's option 1. It's an Apple outermost layer, then a non-Apple layer underneath, then an Apple format again.
No comments:
Post a Comment