[CDG5] MPW and Trampoline

Max Poliakovski maximumspatium at googlemail.com
Tue Jan 8 23:05:07 AWST 2019


Hi guys,

happy new year!

> Quoting Elliot's mail from 05-02-2018:
> I have had some success getting Apple's 68k C compiler to produce
byte-accurate output. (A few things were in my favour here: simple C code,
a simple C compiler and some sources for a previous version of the binary.)
I always aim for byte-perfection after building my reversed sources
(admittedly mostly assembly) because it lets me know when I've messed up.
However, my approach is not always practical, and your focus on high-level
hacking is likely to be more rewarding.

I've played a couple of days with EMPW with the goal to get a byte-perfect
output for the string.c module that consists of seven short functions (3-7
statements).

As expected, I wasn't able to obtain byte-perfect output with MrC
regardless different optimizations and even compiler versions.

Below a short report:

MrC 4.1.0 from MPW 3.5 GM emits code that is far from the code located in
the Trampoline binary.

I therefore downgraded to MrC 3.0.1 from 02-20-1997 that can be obtained
here:
https://www.staticky.com/mirrors/ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_Website_Downloads/

With MrC 3.0.1, I was able to perfectly reconstruct strlen() and memset() -
both are very, very simple functions. After playing with optimization
settings abit, the code for strcpy() got very close to the Apple's binary
except a small difference in the register allocation ($r11 and $r12 are
swapped).

I also tried MrC 4.1a1 but it seems to go in the wrong direction.

I suspect that Apple might have used even an older compiler. The only
possibility to check that out is to get a copy of MPW 3.4 (1995) which
seems to be one of the first MPW versions including PowerPC compilers.

Does somebody own MPW 3.4? I've seen only 3.3, 3.5 and PR so far...

Cheers
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ucc.gu.uwa.edu.au/pipermail/cdg5/attachments/20190108/73df68aa/attachment.htm 


More information about the cdg5 mailing list