The extended registers in Intel APX cannot be described in the current Windows x64 unwind information, this has made it neccesary to introduce a new version. While designing this new version, improvements have been made from the lessons learnt from the existing unwind information formats (both x64 and AArch64). Documentation for unwind v3 is available at: <https://learn.microsoft.com/en-us/cpp/build/x64-unwind-information-v3> This change: * Implements encoding unwind v3 information in MC. This includes support for non-mirror epilogs, WOD pool sharing and using large infos if required. * Add support for encoding push2/pop2 SEH info: a new `SEH_Push2Regs` pseudo-instruction and `.seh_push2regs` assembly directive. * Changes the prolog/epilog codegen to support unwind v3. Specifically, adding pseudos into the epilog (as non-mirror epilogs are permitted) and placing the pseudos in the prolog before the instruction instead of after (as v3 measures its offsets from the start rather than the end of an instruction). * Add an unwind v3 pass to chain unwind info if there are too many epilogs in a function and raise a fatal error if there are too many instructions in a prolog or epilog. * Changes the module flag and code gen enums to allow selecting "Default" vs "v1" vs "v2 best effort" vs "v2 required" vs "v3" unwind info version. * Adds new Clang and cc1 flags for selecting the unwind info version and deprecates the old v2 flag. The default unwind info version stays as v1 UNLESS the EGPR target feature is enabled (then it will use v3). Trying to enable EGPR when v1/v2 is explicitly enabled will result in an error. Windows 11 [build 29576](https://learn.microsoft.com/en-us/windows-insider/release-notes/experimental-future-platforms/preview-build-29576-1000) and above support unwind v3 in user-mode, but do not yet support large info.
16 lines
663 B
LLVM
16 lines
663 B
LLVM
; RUN: not llc -mtriple=x86_64-unknown-windows-msvc -mattr=+egpr -o /dev/null %s 2>&1 | FileCheck %s
|
|
; CHECK: error: {{.*}}: in function func {{.*}}: EGPR (R16-R31) requires V3 unwind info on Windows x64
|
|
|
|
; EGPR enabled without V3 unwind (default V1) should produce a recoverable
|
|
; backend diagnostic (no crash, no stack trace).
|
|
; The uwtable attribute and the call site force a stack frame and SEH unwind
|
|
; info emission so the V3 pass runs regardless of the host platform's default
|
|
; (matters for cross-compilation on Linux/macOS hosts targeting Windows).
|
|
|
|
declare void @other()
|
|
|
|
define dso_local void @func() uwtable {
|
|
entry:
|
|
call void @other()
|
|
ret void
|
|
}
|