hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From fa09fa3ad6a21ae0b35fb860f76d1762e5f29972 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Mon, 27 Sep 2021 12:55:09 -0700
Subject: [PATCH] add qemu-wrapper support
 
V8's JIT infrastructure requires binaries such as mksnapshot and mkpeephole to
be run in the host during the build. However, these binaries must have the
same bit-width as the target (e.g. a x86_64 host targeting ARMv6 needs to
produce a 32-bit binary). To work around this issue, cross-compile the
binaries for the target and run them on the host with QEMU, much like
gobject-introspection.
 
However, for the host-variant we do not want to use a
qemu-wrapper, so add @MAYBE_WRAPPER@ to the needed files and sed the path to
the qemu-wrapper on target builds, and remove @MAYBE_WRAPPER@ entirely on
host-builds.
 
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
 node.gyp                 | 4 ++--
 tools/v8_gypfiles/v8.gyp | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
 
diff --git a/node.gyp b/node.gyp
index 8ba0dfeb..c77f6f7d 100644
--- a/node.gyp
+++ b/node.gyp
@@ -491,7 +491,7 @@
               'action_name': 'run_mkcodecache',
               'process_outputs_as_sources': 1,
               'inputs': [
-                '<(mkcodecache_exec)',
+                @MAYBE_WRAPPER@ '<(mkcodecache_exec)',
               ],
               'outputs': [
                 '<(SHARED_INTERMEDIATE_DIR)/node_code_cache.cc',
@@ -516,7 +516,7 @@
               'action_name': 'node_mksnapshot',
               'process_outputs_as_sources': 1,
               'inputs': [
-                '<(node_mksnapshot_exec)',
+                @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)',
               ],
               'outputs': [
                 '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index 48ec392b..f9bb0fbe 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -220,7 +220,7 @@
         {
           'action_name': 'run_torque_action',
           'inputs': [  # Order matters.
-            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
+            @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
             '<@(torque_files)',
           ],
           'outputs': [
@@ -351,7 +351,7 @@
         {
           'action_name': 'generate_bytecode_builtins_list_action',
           'inputs': [
-            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
+            @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
           ],
           'outputs': [
             '<(generate_bytecode_builtins_list_output)',
@@ -533,7 +533,7 @@
             ],
           },
           'inputs': [
-            '<(mksnapshot_exec)',
+            @MAYBE_WRAPPER@ '<(mksnapshot_exec)',
           ],
           'outputs': [
             '<(INTERMEDIATE_DIR)/snapshot.cc',
@@ -1448,7 +1448,7 @@
         {
           'action_name': 'run_gen-regexp-special-case_action',
           'inputs': [
-            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)',
+            @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc',
--
2.31.1