KMC
On the N64 decompilation world we refer to "KMC" as an specific compiler distributed by the Japanese company Kyoto Microcomputer, Co. Ltd. (hence the name). This toolchain is a mostly unchanged fork of GNU GCC 2.7.2 paired with a fork of GNU Binutils 2.6. The Binutils fork has some patches to work around hardware issues with the CPU used in the Nintendo 64 console as well as a patch to automatically align variables above a specific size to meet DMA alignment requirements for the N64's Reality Coprocessor. There are a few releases of the KMC toolchain, but they all seem to generate identical code.
Running the KMC Toolchain
The original KMC toolchain binaries are available, but were built as programs that were run with a DOS Extender under Windows XP. This meant they were compiled as 32-bit applications but used the DOS system calls to interface with the operating system. Trying to run them under more Windows versions either not work or lead to issues such as restricted maximum path lengths or memory allocation problems.
KMC Wrapper
The first mechanism to allow the KMC toolchain to run without issues was the KMC GCC wrapper made by community member Wiseguy. It loaded the original binaries into memory and patched them to replace DOS system calls with reimplementations using the C standard library. After patching, it would run them natively as 32-bit code. It also patched or replaced various functions to work around issues such as short maximum path lengths.
KMC Native Build
While the KMC wrapper allowed running the toolchain, it had issues with portability. As a replacement, Wiseguy reverse engineered the changes made to GCC and Binutils made by the original Kyoto Microcomputer team and replicated them in the source code of GCC 2.7.2/Binutils 2.6. This meant the KMC toolchain could now be built as a native executable for modern systems from source code, allowing it to run as a 64-bit executable and on other platforms such as Mac OS. Since then, several quality of life changes have been added to the toolchain. The two components of the toolchain are hosted in the decompals Github organization:
- GCC repository: https://github.com/decompals/mips-gcc-2.7.2
- binutils repository: https://github.com/decompals/mips-binutils-2.6
Projects using this compiler
The following is the list of known projects that use this compiler: