I'm currently working on a project where there is an executable that needs some C/++ injections to fix code from a DLL and, unfortunately, said exe happens to be compiled with Watcom -- meaning the usual methods of using visual c++ and clang both fail to call the existing code and inject custom functions without breaking parameters (already tried inlining some assembly to pass parameters with stubs, but with over 7000 methods that could arbitrarily be called, it would be a massive headache to maintain).
So, since I'm using Visual Studio 2019 and that has native integration with clang, I was thinking that maybe a good solution would be to use that compiler add implement a custom __watcom calling convention. Now the problem is: how do you even add a custom calling convention? Anybody ever tried doing something similar?
I'm scratching my head to figure out exactly what to change in LLVM or clang.