Issue 163503
Summary Supporting Windows SEH without the ORC runtime
Labels orcjit
Assignees
Reporter lhames
    It'd be nice to get Windows SEH working without requiring the ORC runtime.

This would bring Windows into line with Darwin and Linux, both of which support exceptions in-process without the runtime.

`RtlAddFunctionTable` (https://learn.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtladdfunctiontable) and `RtlDeleteFunctionTable` seem to be the registration APIs.

`RtlAddFunctionTable` takes a base address and a pointer to a table where function addresses are expressed as 32-bit offsets from the base:
``
NTSYSAPI BOOLEAN RtlAddFunctionTable(
  [in] PRUNTIME_FUNCTION FunctionTable,
  [in] DWORD             EntryCount,
  [in] DWORD64 BaseAddress
);
```

I do not know whether the SEH runtime looks at any metadata at the base address, or whether it's used purely for address calculations, but I suspect the latter (or the various out-of-tree SEH experiments that people have gotten working would have blown up differently).

Assuming that `BaseAddress` is only used for address calculation then we can probably just find the lowest address in the graph and use that for each grab.

If `BaseAddress` needs to contain useful metadata (e.g. a COFF header) then we can do something similar to what we do for compact-unwind (see https://github.com/llvm/llvm-project/blob/d83fe1201e9d91da192d9292fea1a65579086e04/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h#L634)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to