[win] fix cross-compilation for arm64 Cross-compiling x64 to ARM64 on Windows fails with both clang and MSVC. The reason is the CONTEXT structure which does not have the Pc field. Using only CONTEXT.Rip fixes the compilation issue. This follows https://chromium-review.googlesource.com/c/v8/v8/+/4403215 as part of an effort to completely fix cross-compilation with MSVC. Change-Id: I2148349b316fb6f58e66ae69a3ef081624f4b422 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4489305 Commit-Queue: Clemens Backes <clemensb@chromium.org> Reviewed-by: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#87564}
diff --git a/test/cctest/test-stack-unwinding-win64.cc b/test/cctest/test-stack-unwinding-win64.cc index 61c9dc1..a88d84f 100644 --- a/test/cctest/test-stack-unwinding-win64.cc +++ b/test/cctest/test-stack-unwinding-win64.cc
@@ -2,6 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <windows.h> + +// This has to come after windows.h. +#include <versionhelpers.h> // For IsWindows8OrGreater(). + #include "include/v8-external.h" #include "include/v8-function.h" #include "include/v8-isolate.h" @@ -10,16 +15,15 @@ #include "src/base/macros.h" #include "test/cctest/cctest.h" -#if defined(V8_OS_WIN_X64) +#if defined(V8_OS_WIN_X64) // Native x64 compilation #define CONTEXT_PC(context) (context.Rip) #elif defined(V8_OS_WIN_ARM64) +#if defined(V8_HOST_ARCH_ARM64) // Native ARM64 compilation #define CONTEXT_PC(context) (context.Pc) +#else // x64 to ARM64 cross-compilation +#define CONTEXT_PC(context) (context.Rip) #endif - -#include <windows.h> - -// This has to come after windows.h. -#include <versionhelpers.h> // For IsWindows8OrGreater(). +#endif class UnwindingWin64Callbacks { public: