1From 1f6c55d7318e7075169004b4314708f4766ec193 Mon Sep 17 00:00:00 2001 2From: Adam Duskett <aduskett@gmail.com> 3Date: Mon, 27 Sep 2021 12:55:09 -0700 4Subject: [PATCH] add qemu-wrapper support 5 6V8's JIT infrastructure requires binaries such as mksnapshot and mkpeephole to 7be run in the host during the build. However, these binaries must have the 8same bit-width as the target (e.g. a x86_64 host targeting ARMv6 needs to 9produce a 32-bit binary). To work around this issue, cross-compile the 10binaries for the target and run them on the host with QEMU, much like 11gobject-introspection. 12 13However, for the host-variant we do not want to use a 14qemu-wrapper, so add @MAYBE_WRAPPER@ to the needed files and sed the path to 15the qemu-wrapper on target builds, and remove @MAYBE_WRAPPER@ entirely on 16host-builds. 17 18[Adam: Update for 20.9.0] 19Signed-off-by: Adam Duskett <aduskett@gmail.com> 20--- 21 node.gyp | 6 ++++-- 22 tools/v8_gypfiles/v8.gyp | 10 +++++----- 23 2 files changed, 9 insertions(+), 7 deletions(-) 24 25diff --git a/node.gyp b/node.gyp 26index 97cdbb531d..db5cf51ce6 100644 27--- a/node.gyp 28+++ b/node.gyp 29@@ -662,7 +662,7 @@ 30 'action_name': 'node_mksnapshot', 31 'process_outputs_as_sources': 1, 32 'inputs': [ 33- '<(node_mksnapshot_exec)', 34+ @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)', 35 '<(node_snapshot_main)', 36 ], 37 'outputs': [ 38@@ -682,7 +682,7 @@ 39 'action_name': 'node_mksnapshot', 40 'process_outputs_as_sources': 1, 41 'inputs': [ 42- '<(node_mksnapshot_exec)', 43+ @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)', 44 ], 45 'outputs': [ 46 '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc', 47@@ -966,6 +966,7 @@ 48 'action_name': 'node_js2c', 49 'process_outputs_as_sources': 1, 50 'inputs': [ 51+ @MAYBE_WRAPPER@ 52 '<(node_js2c_exec)', 53 '<@(library_files)', 54 '<@(deps_files)', 55@@ -975,6 +976,7 @@ 56 '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', 57 ], 58 'action': [ 59+ @MAYBE_WRAPPER@ 60 '<(node_js2c_exec)', 61 '<@(_outputs)', 62 'lib', 63diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp 64index 73099a03e4..88ca91efb4 100644 65--- a/tools/v8_gypfiles/v8.gyp 66+++ b/tools/v8_gypfiles/v8.gyp 67@@ -81,7 +81,7 @@ 68 { 69 'action_name': 'run_torque_action', 70 'inputs': [ # Order matters. 71- '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', 72+ @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', 73 '<@(torque_files)', 74 ], 75 'outputs': [ 76@@ -112,7 +112,7 @@ 77 '<@(torque_outputs_inc)', 78 ], 79 'action': [ 80- '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', 81+ @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', 82 '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated', 83 '-v8-root', '<(V8_ROOT)', 84 '<@(torque_files_without_v8_root)', 85@@ -224,7 +224,7 @@ 86 { 87 'action_name': 'generate_bytecode_builtins_list_action', 88 'inputs': [ 89- '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', 90+ @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', 91 ], 92 'outputs': [ 93 '<(generate_bytecode_builtins_list_output)', 94@@ -401,7 +401,7 @@ 95 ], 96 }, 97 'inputs': [ 98- '<(mksnapshot_exec)', 99+ @MAYBE_WRAPPER@ '<(mksnapshot_exec)', 100 ], 101 'outputs': [ 102 '<(INTERMEDIATE_DIR)/snapshot.cc', 103@@ -1660,7 +1660,7 @@ 104 { 105 'action_name': 'run_gen-regexp-special-case_action', 106 'inputs': [ 107- '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', 108+ @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', 109 ], 110 'outputs': [ 111 '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc', 112-- 1132.37.3 114 115