On the compiler side, dealing with all the edge cases for thunks and symbol mangling and aliases has turned out to be more complicated than I initially expected. I’ve been continuing work on it on an internal branch. I think I’ve got it mostly complete at this point… I’ll try to post an update in the next couple weeks or so.
I haven’t looked at the linker side of it at all, and I don’t have any immediate plans in that direction; just been treating MSVC link as a black box (and cursing at uninformative “internal error” messages). A couple notes about undocumented stuff you’re like to run into:
- ARM64EC uses IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY heavily; implementing that is probably a good first step for anything linker-related, since it’s mostly orthogonal to everything else. (I’m not sure what the exact semantics are.)
- The association between functions and their corresponding thunks is established using a table in the section hybmp$x. Each row in the table is three 32-bit values; the first is the symbol index of the function, the second is the symbol index of the associated thunk, the third is a flag indicating what kind of thunk it is. 1 is an entry thunk, 4 is an exit thunk, 0 is a runtime code patching thunk.
Let me know if you have any other questions I might be able to answer.