This tool allows for individual functions within a C file to be replaced by assembly code, heavily inspired by asm-processor.
The MWCC compiler does support including raw assembly within a C file, however all variables and functions must be defined, this makes the traditional Ship of Theseus approach to matching decomp rather slow and painful.
Where asm-processor
uses an GLOBAL_ASM
pragma, mwccgap
uses INCLUDE_ASM
macro as the first project to use mwccgap
uses gcc
. In future support might be added to suppport either approach.
Functions that are INCLUDE_ASM
'd within the C file are expanded to nop
s of the appropriate size and the C file is compiled. These functions are then assembled separately, and the resulting object data is transplanted into the C object. Symbols and relocations are updated as necessary.
mwccgap input.c output.o [ -O4,p -sym on ... ]
mwccgap
supports the following arguments:
The path to the MWCC executable, defaults to mwccpsp.exe
The path to GNU as, defaults to mipsel-linux-gnu-as
Whether or not to prefix the call to the MWCC executable with wibo, defaults to false.
Path to wibo
(i.e. if wibo
is not on your path, or you wish to use wine
instead), defaults to wibo
.
Optional prefix for INCLUDE_ASM
files.
All additional arguments will be passed to the MWCC executable.
The limitations currently outnumber the features, PRs are very welcome to improve the tool.
This project is in it's infancy and is full of assumptions, and therefore likely riddled with bugs; again PRs are welcome!
Projects that use mwccgap
include: