1 Backport V8_TRAP_HANDLER_SUPPORTED conditional compilation for trap
2 handler implementation.
4 See https://github.com/v8/v8/commit/e7bef8d4cc4f38cc3d5a532fbcc445dc62adc08f
6 E.g. when cross-compiling from aarch64-linux for x86_64-linux target,
7 handler-inside-posix.cc is built on aarch64-linux even though it is not
8 supported; see src/trap-handler/trap-handler.h in v8 for (host, target)
9 combinations where trap handler is supported.
11 Note that handler-inside-posix.cc fails to build in the case above.
13 diff --git a/deps/v8/src/trap-handler/handler-inside-posix.cc b/deps/v8/src/trap-handler/handler-inside-posix.cc
14 index e4454c378f..17af3d75dc 100644
15 --- a/deps/v8/src/trap-handler/handler-inside-posix.cc
16 +++ b/deps/v8/src/trap-handler/handler-inside-posix.cc
17 @@ -47,6 +47,8 @@ namespace v8 {
19 namespace trap_handler {
21 +#if V8_TRAP_HANDLER_SUPPORTED
24 #define CONTEXT_REG(reg, REG) &uc->uc_mcontext.gregs[REG_##REG]
26 @@ -181,6 +183,8 @@ void HandleSignal(int signum, siginfo_t* info, void* context) {
27 // TryHandleSignal modifies context to change where we return to.
32 } // namespace trap_handler
33 } // namespace internal
35 diff --git a/deps/v8/src/trap-handler/handler-inside-win.cc b/deps/v8/src/trap-handler/handler-inside-win.cc
36 index fcccc78ee5..3d7a2c416a 100644
37 --- a/deps/v8/src/trap-handler/handler-inside-win.cc
38 +++ b/deps/v8/src/trap-handler/handler-inside-win.cc
39 @@ -38,6 +38,8 @@ namespace v8 {
41 namespace trap_handler {
43 +#if V8_TRAP_HANDLER_SUPPORTED
45 // The below struct needed to access the offset in the Thread Environment Block
46 // to see if the thread local storage for the thread has been allocated yet.
48 @@ -129,6 +131,8 @@ LONG HandleWasmTrap(EXCEPTION_POINTERS* exception) {
49 return EXCEPTION_CONTINUE_SEARCH;
54 } // namespace trap_handler
55 } // namespace internal
57 diff --git a/deps/v8/src/trap-handler/handler-outside-simulator.cc b/deps/v8/src/trap-handler/handler-outside-simulator.cc
58 index 179eab0659..5e58719e7f 100644
59 --- a/deps/v8/src/trap-handler/handler-outside-simulator.cc
60 +++ b/deps/v8/src/trap-handler/handler-outside-simulator.cc
63 #include "include/v8config.h"
64 #include "src/trap-handler/trap-handler-simulator.h"
65 +#include "src/trap-handler/trap-handler.h"
67 +#if V8_TRAP_HANDLER_SUPPORTED
70 #define SYMBOL(name) "_" #name
71 @@ -35,3 +38,5 @@ asm(
72 SYMBOL(v8_probe_memory_continuation) ": \n"
73 // If the trap handler continues here, it wrote the landing pad in %rax.