The patch differs from MSVC's in two aspects that I know about:
- Empty chunks in empty sections (that are discarded anyway) can cause weird empty regions on MSVC (a test for such conditions is in the patch). I skip empty chunks in createECCodeMap to avoid that, but we could potentially remove those skips.
- Range extension thunks may slip out of map ranges on MSVC if they are added after a chunk that is otherwise the last ARM64EC chunk in a range. I tested it locally (the test needs a patch to support ARM64EC to LLD first). To imitate MSVC behaviour, we could move createECCodeMap before finalizeAddresses.
Both of above seem like a bug in MSVC, but they should be easy to imitate if desired.