This includes .seh_* directives for generating it from assembly.
It is designed fairly similarly to the ARM64 handling.
For .seh_handler directives, such as
".seh_handler __C_specific_handler, @except" (which is supported
on x86_64 and aarch64 so far), the "@except" bit doesn't work in
ARM assembly, as '@' is used as a comment character (on all current
platforms).
Allow using '%' instead of '@' for this purpose. This convention
is used by GAS in similar contexts already,
e.g. [1]:
Note on targets where the @ character is the start of a comment (eg ARM) then another character is used instead. For example the ARM port uses the % character.
In practice, this unfortunately means that all such .seh_handler
directives will need ifdefs for ARM.
Contrary to ARM64, on ARM, it's quite common that we can't evaluate
e.g. the function length at this point, due to instructions whose
length is finalized later. (Also, inline jump tables end with
a ".p2align 1".)
If unable to to evaluate the function length immediately, emit
it as an MCExpr instead. If we'd implement splitting the unwind
info for a function (which isn't implemented for ARM64 yet either),
we wouldn't know whether we need to split it though.
TODO: We probably should emit this with an ARM specific fixup, so
that we at least could implement range checking before writing the
final value after evaluating the MCExpr.
We maybe should rename MCWin64EH, as this is used on a 32 bit
architecture too.
[1] https://sourceware.org/binutils/docs/as/Section.html#Section
I guess it'd be much preferrable here, to change this into a map containing a struct instead, e.g.:
And if doing that, I guess it'd be best to do such a refactoring (without the Condition field) as a separate preceding commit. But posting it in this form for now, for potential comments on the rest of the changes.