AIX:
$ uname -a
AIX enron 3 5 002F129D4C00
$ which df
/usr/bin/df
$ file /usr/bin/df
/usr/bin/df: executable (RISC System/6000) or object module
$ ldd /usr/bin/df
/usr/bin/df needs:
/usr/lib/libc.a(shr.o)
/unix
/usr/lib/libcrypt.a(shr.o)
$ oslevel -r
5300-05
OS/X:
Last login: Mon Feb 15 19:46:12 on ttys000
jaminwmdemacbook:~ jianmingxu$ uname -a
Darwin jaminwmdemacbook.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
jaminwmdemacbook:~ jianmingxu$ which df
/bin/df
jaminwmdemacbook:~ jianmingxu$ file /bin/df
/bin/df: Mach-O universal binary with 2 architectures
/bin/df (for architecture i386): Mach-O executable i386
/bin/df (for architecture ppc7400): Mach-O executable ppc
jaminwmdemacbook:~ jianmingxu$ otool -L /bin/df
/bin/df:
/usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
请注意!OS/X下面的可执行程序都不需要链接kernel
我们来看看这个神奇的/usr/lib/libSystem.B.dylib
jaminwmdemacbook:~ jianmingxu$ file /usr/lib/libSystem.B.dylib
/usr/lib/libSystem.B.dylib: Mach-O universal binary with 4 architectures
/usr/lib/libSystem.B.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc
/usr/lib/libSystem.B.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64
/usr/lib/libSystem.B.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/lib/libSystem.B.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
大概这就是Mach-O可执行格式跨硬件体系的奥妙之所在?
另外我们看到这个系统库是同时兼容32和64位的
而AIX用户应该都知道那个可恶的shr.o是有32位和64位之分的,不光是shr.o,AIX上面好多库都有64/32不同版本,一不小心链错了那可是要core dump的