Mixing OS X, AIX and Linux PPC assembler

Other than register usage and stack frame issues (which can be isolated into the prologue and epilogue sections of code), the only real difference between these assemblies lies in the way registers are addressed. Under Linux, all registers are addressed by their number only, whereas under OS X, integer registers are prefixed by r, and floating point registers are prefixed by f. Therefore, I usually write a routine with two different prologues and epilogues, and at the start of the file I do something like:
#if defined(ATL_GAS_LINUX_PPC) || defined(ATL_AS_AIX_PPC)
   #define r0 0
   #define r1 1
   #define r31 31

   #define f0 0
   #define f1 1
   #define f31 31
and then use the OS X-style of register naming.

Also, since I'm using cpp anyway, I use C style comments, to avoid problems with OS X and Linux having different comment characters.

Clint Whaley 2012-07-10