It has been a week for time travel. Looking in more detail at the Universal Binaries we’re just starting to see for the next processor transition, I’ve been taken back to 2006, when Macs moved to Intel. Then along came Felix Rieseberg’s amazing virtualisation of a Mac Quadra running System 8, and I found myself in 1997 again, when we were in the throes of the first processor transition to PowerPC.
I stole a little time to go back through some of my archives from 2006-07, and was reminded what had happened. At that time, I was writing for the former UK magazine MacUser, and one of my tasks was to prepare a list of significant software updates. I noticed some old friends among them, such as the text editor BBEdit, when it first went Universal. That’s a lot of versions before 13.1.2 which I still use daily.
We’ll get used to this again over the coming few years. Although I’m sure that Rosetta 2 will do an impressive job of translating Intel binaries to run on Apple Silicon, the big milestone for each app we use today will be its first release as a Universal App, as that’s when you’ll really be able to see how Apple’s new hardware is doing.
With around forty apps and command tools to port, I’m making an early start, with the aim of releasing full-functional Universal versions which are compatible with Big Sur, whether it’s running on existing Intel Macs or the new generation of Apple Silicon Macs.
Looking inside Mach-O Universal Binaries has been a real trip down memory lane, as I’ve stumbled into endianness for the first time since the last century. This used to be the bane of anyone migrating software across different processor architectures: the order in which each stores bytes in memory and files. Classic Macs use Motorola 68K processors, which are ‘big-endian’. Store an integer with them and the least significant byte is put into the higher end of the integer. For example, the decimal integer 12345, which is 0x3039 in hexadecimal, is stored with the 39 in a higher location in memory.
When Intel introduced its 8086 family of processors, it chose the other option: the most significant byte is put into the higher end, known as little-endian. What on a Motorola processor would be stored as 0x3039 then becomes 0x3930, with the 30 in the higher location.
I noticed this because the second item in the Mach-O Universal Header gives the number of different architectures supported in that Universal Binary. When I was expecting 2 (0x00000002 as a 32-bit integer), I was instead seeing 33554432. This is because the number was stored with the 02 byte in the highest location, in big-endian format, which was being read as the little-endian 0x02000000. If you think that’s confusing, when I tried to read the little-endian version of that integer, I was given 33554432, and it was only when I asked for the big-endian that I was rewarded with 2 instead.
Before you’re wondering why the Universal Header should still use Motorola’s big-endian format from the PowerPC transition, let me confuse you further by explaining that the Mach-O file was introduced with Mac OS X in 2000, over four years after Apple made its last Motorola-based Mac. PowerPC processors can operate in either mode, but in Macs were always used as big-endian. But to see why my integer in the Universal Header is still stubbornly in big-endian format we have to go back to the predecessor of Mac OS X, NeXTSTEP.
Steve Jobs’ first NeXT computers which ran the NeXTSTEP operating system and introduced multi-architecture Mach-O binaries used Motorola 68K processors. My big-endian integer had started life in the mid-1980s on the Motorola 68030, migrated with the NeXTSTEP operating system to other processors including Intel x86 in the early 1990s, was reformed into Mac OS X for its beta-release on PowerPC in 2000, returned to Intel x86 in 2006, and is now making its way onto Apple Silicon in 2020.
At which point, you might be exasperated to learn that the ARM cores inside Apple Silicon were originally little-endian, but quickly became bi-endian, which means they can switch between the two modes.
The transition to Apple Silicon might seem daunting, but we’ve been there before. And before. And even before that. All that history is written in a single file format.
Thanks to Tim for correcting me below: PowerPC processors in Macs operated in big-endian mode, not little-endian.