13 ms·
$ file /usr/bin/touch /usr/bin/touch: Mach-O universal binary with 2 architectures /usr/bin/touch (for architecture x86_64): Mach-O 64-bit executable x8
by lloeki 15y ago
$ file /usr/bin/touch
/usr/bin/touch: Mach-O universal binary with 2 architectures
/usr/bin/touch (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/touch (for architecture i386): Mach-O executable i386
So actually touch on Lion is ~half of 44016. But that's being nitpicky ;)
- 4ad 15y agoYou are assuming i386 and amd64 have the same code density, which is not true, also you are neglecting the Mach-O headers and how sections are zero-padded for alignment.
- lloeki 15y agocp /usr/bin/touch ./; for arch in i386 x86_64; do lipo -thin $arch touch -o touch.$arch; done; ls -l touch* -r-xr-xr-x 1 lloeki staff 44016 31 Oct 11:37 touch -r-xr-xr-x 1 lloeki staff 19440 31 Oct 11:37 touch.i386 -r-xr-xr-x 1 lloeki staff 19440 31 Oct 11:37 touch.x86_64
- 4ad 15y agoThe object code is significantly less then the size of the binaries, Mach-O files (and ELF files and PE-COFF files) zero pad sections, allign them and generally have extraneous sections. The boxes are the same, the content is different.
- lloeki 15y ago> cat touch.x86_64 | perl -p -e 's/\0//' | wc -c 19407 > cat touch.i386 | perl -p -e 's/\0//' | wc -c 19408 > otool -tV touch.x86_64 | wc -l 742 > otool -tV touch.i386 | wc -l 808 Hmmm. So, now what? The article mentioned Lion's touch(1) size, and I wanted to point out that it actually covers two arches. We know there is padding, alignment, headers and density whatnot. The end result is that makes a negligible difference between the two arches, hence "~half".