Upstreaming Exception Handling support for Windows on ARM64

Hi,

We would like to upstream exception handling support for Windows on ARM64. Microsoft-published specifications can be found here:

a) https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling

b) https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions

We propose the following approach:

  1. Upstream miscellaneous clang and llvm patches that are needed for exception handling on ARM64 Windows. These are small patches that deal with the ABI, relocations, etc. There are around 8 or 9 patches to upstream.

  2. Upstream the MCLayer part. This mostly deals with unwinding opcodes that are described in a). This will probably consist of two patches.

  3. Upstream the AArch64 frame lowering part. This mostly deals with emitting unwinding opcodes, as well as some small changes to the exception handling tables. Probably two patches.

  4. Upstream setjmp support. This consists of two patches (one clang and one llvm).

Any thoughts?

Mandeep and I will start upstreaming shortly.

Thanks,

Sanjin

Reid is the person to ask about this, but he’s ooo for a few more days. Ping again next week if you haven’t heard back

I think your order of patches makes sense.

Do you plan to add assembler directives similar to the .cfi_* and .seh_* directives? The assembly examples in the Microsoft docs don’t have any, but I think it would be really valuable for MC to have some. It’s really useful to be able to modify compiler generated assembly manually, reassemble with a slightly different prologue, and have everything just work. For example, I’m imagining the assembler would be responsible for adding nop unwind codes for each non-prologue instruction interleaved in the prologue.

Hi Reid,

We plan to work on assembler directives after this set of patches is upstreamed. We currently emit the unwinding opcodes into object files only.

Thanks,

Sanjin