[gardening] Fix MSVC/arm64 build

MSVC/arm64 cross-build on x64 fails with errors

runtime\platform\unwinding_records.h(256): error C2607: static assertion failed

It is incorrect to validate consistency between O/S structure (host
declaration) and Dart VM structure (target declaration) in case of
a mismatch between host and target.

TEST=ci

Change-Id: Icd2729656ce51088010c192308733896ce40a1b1
Cq-Include-Trybots: luci.dart.try:vm-msvc-win-arm64-try,vm-msvc-win-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463401
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov
2025-11-20 12:30:16 -08:00
committed by Commit Queue
parent 6f0972fc7d
commit 85c5278b85
+13 -1
View File
@@ -47,6 +47,11 @@ typedef uint32_t DWORD;
#endif
#if defined(TARGET_ARCH_X64)
#if !defined(HOST_ARCH_X64)
#define UNWINDING_RECORDS_HOST_TARGET_MISMATCH 1
#endif
//
// Refer to https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64
//
@@ -120,6 +125,10 @@ struct CodeRangeUnwindingRecord {
#elif defined(TARGET_ARCH_ARM64)
#if !defined(HOST_ARCH_ARM64)
#define UNWINDING_RECORDS_HOST_TARGET_MISMATCH 1
#endif
// ARM64 unwind codes are defined in below doc.
// https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling#unwind-codes
enum UnwindOp8Bit {
@@ -252,7 +261,10 @@ struct CodeRangeUnwindingRecord {
//
// Make sure that the sizes match, so that TargetRuntimeFunction values
// can be used as RUNTIME_FUNCTION values and vice versa in the runtime.
#if defined(UNWINDING_RECORDS_WINDOWS_HOST)
// The check doesn't make sense when host and target platforms are different
// though, and no code depends on it in such cross-platform scenario.
#if defined(UNWINDING_RECORDS_WINDOWS_HOST) && \
!defined(UNWINDING_RECORDS_HOST_TARGET_MISMATCH)
static_assert(sizeof(TargetRuntimeFunction) == sizeof(RUNTIME_FUNCTION));
#endif