Fun with universal binaries

December 08, 2006

Yesterday I had to debug a Mac OSX program and therefore I had to learn about how Mac Universal Binaries work.

Universal Binaries contain (most of the time) PowerPC code and Intel x86 code as well. While they could easily also feature code for other architectures, like your toaster or microwave, it usually looks somewhat like this: [Header|PowerPC|Intel]. The operating system decides which code it needs and executes the part of the file suitable for its architecture.

Now in order to see what kind of binary information is "sandwiched" in the file, there is a header, very nicely described in the Mac OS X ABI Mach-O File Format Reference.

It starts off with a "magical number", that funnily reads 0xCAFEBABE in hexadecimal. -- Cafe babe? Yup.

Cafebabe

Looks like the programmers had some fun coming up with a readable magic number. :)

For a more in-depth explanation of how universal binaries look like, I recommend this blog post.

(thanks to the t-shirt model ;) )

setTimeout in Python

Today in a threaded Python project I work on, I had to delay the execution of a function for a bit, much like the ubiquitous ``setTimeout...… Continue reading

Creating an Empty git branch

Published on October 24, 2014