Skip to content

Commit 15e31d6

Browse files
StefanStojanovicV8 LUCI CQ
authored andcommitted
[win][msvc] fix cross-compilation for arm64
Cross-compiling x64 to ARM64 on Windows fails with MSVC. The reason is the ProbeMemory function which uses asm() code prohibited in this case. This change adds conditionalizing on V8_TRAP_HANDLER_SUPPORTED thus removing the problematic parts of the code in MSVC cross-compilation. This extends https://chromium-review.googlesource.com/c/v8/v8/+/3964232 in a way, as it wraps ProbeMemory usage inside of the "#ifdef V8_TRAP_HANDLER_VIA_SIMULATOR" blocks. This follows https://chromium-review.googlesource.com/c/v8/v8/+/4403215 and https://chromium-review.googlesource.com/c/v8/v8/+/4489305 as a part of an effort to completely fix cross-compilation with MSVC. Change-Id: I59d9a995fbc8ee1cee2807429fd44d8043c178fb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4574697 Reviewed-by: Andreas Haas <[email protected]> Reviewed-by: Mark Seaborn <[email protected]> Commit-Queue: Mark Seaborn <[email protected]> Cr-Commit-Position: refs/heads/main@{#88147}
1 parent ae17cee commit 15e31d6

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/trap-handler/trap-handler-simulator.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
#include <cstdint>
99

1010
#include "include/v8config.h"
11+
#include "src/trap-handler/trap-handler.h"
1112

1213
// This header defines the ProbeMemory function to be used by simulators to
1314
// trigger a signal at a defined location, before doing an actual memory access.
1415

15-
// This implementation is only usable on an x64 host with non-x64 target (i.e. a
16-
// simulator build on x64).
17-
#if (!defined(_M_X64) && !defined(__x86_64__)) || defined(V8_TARGET_ARCH_X64)
18-
#error "Do only include this file on simulator builds on x64."
19-
#endif
16+
#ifdef V8_TRAP_HANDLER_VIA_SIMULATOR
2017

2118
namespace v8::internal::trap_handler {
2219

@@ -40,4 +37,6 @@ uintptr_t ProbeMemory(uintptr_t address, uintptr_t pc)
4037

4138
} // namespace v8::internal::trap_handler
4239

40+
#endif // V8_TRAP_HANDLER_VIA_SIMULATOR
41+
4342
#endif // V8_TRAP_HANDLER_TRAP_HANDLER_SIMULATOR_H_

test/unittests/wasm/trap-handler-simulator-unittest.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include "test/common/assembler-tester.h"
1414
#include "test/unittests/test-utils.h"
1515

16-
#if !V8_HOST_ARCH_X64 || !V8_TARGET_ARCH_ARM64
17-
#error "Only include this file on arm64 simulator builds on x64."
18-
#endif
16+
#ifdef V8_TRAP_HANDLER_VIA_SIMULATOR
1917

2018
namespace v8 {
2119
namespace internal {
@@ -151,3 +149,5 @@ TEST_F(SimulatorTrapHandlerTest, ProbeMemoryWithLandingPad) {
151149
} // namespace trap_handler
152150
} // namespace internal
153151
} // namespace v8
152+
153+
#endif // V8_TRAP_HANDLER_VIA_SIMULATOR

0 commit comments

Comments
 (0)