My Favorite 64-bit Porting Guide

Written 2011-02-16

Tags:Decompiler Boomerang (decompiler) 

By way of an almost unrelated Google search, I re-found my favorite 64-bit porting guide. http://www.ibm.com/developerworks/library/l-port64.html. The article takes you through a few different 64-bit systems, new alignment/packing issues, and how to do what you used to do (storing pointers in uints) in a more portable way(uintptr_t). I've had to refer to this a few times now when porting the boomerang decompiler to 64-bit linux. Boomerang is a particularly fun case because sometimes you need to store a pointer in a uint. Do you use uintptr_t? Sometimes. You can only safely use it to store a native pointer. Because potentially you could add disassembly for a 64 bit architecture, but build on a 32 bit machine, you still need an extra-big type capable of holding the biggest pointer you could get. Luckily for us, a 64-bit datatype covers most pointers. Sadly for AS/400 users, this effectively means that boomerang won't be able to decompile your stuff without a major overhaul.

There's also a small typo referencing the 'fred function' (fread)