Universal_binaries - heldersrvio/PureDarwin GitHub Wiki
The command-line tool lipo can be used to inspect and modify the architecture-related aspects of executable files and libraries.
To find ppc-only files, you can use
find /some/path -exec lipo -i {} 2>&1 ; | grep ppc | grep -v i386
Since the PureDarwin project currently supports only the i386 platform, you should be able to safely delete files found by the command above.
The old UNIX file command is also useful to determine fat file types.
file /usr/lib/libedit.2.dylib /usr/lib/libedit.2.dylib: Mach-O universal binary with 4 architectures /usr/lib/libedit.2.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc /usr/lib/libedit.2.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64 /usr/lib/libedit.2.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/libedit.2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Then we use lipo. Compare the size before thin (565K) and after (128K).
From /usr/share/file/magic:
# mach file description # # Since Java bytecode and Mach-O universal binaries have the same magic number the test # must be preformed in the same "magic" sequence to get both right. The long # at offset 4 in a universal binary tells the number of architectures. The short at # offset 4 in a Java bytecode file is the compiler minor version and the # short at offset 6 is the compiler major version. Since there are only # only 18 labeled Mach-O architectures at current, and the first released # Java class format was version 43.0, we can safely choose any number # between 18 and 39 to test the number of architectures against # (and use as a hack). [...]
0 belong&0xfffffffe 0xfeedface Mach-O [...]
- A file format
- An ABI (Application Binary Interface)
OSF (Open Software Foundation) for mach kernel.
- Processus address space
- Dynamic loader to use
- Shared library to load
+--------------------------------------------------------------------------+ | Header | | | +--------------------------------------------------------------------------+ | Load commands |
Segment command 1 |
Segment command 2 |
--------------------- |
+--------------------------------------------------------------------------+ |
Raw data |
+--------------------------------------+-------------------------------- |
------+ |
+--------------------------------------+-------------------------------- |
------+ |
+--------------------------------------+-------------------------------- |
------+ |
+--------------------------------------------------------------------------+ |
http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/introduction.html http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html
http://en.wikipedia.org/wiki/Mach-O
http://en.wikipedia.org/wiki/Universal_Binaries
man otool man dyld man Mach-o