0001-add-qemu-wrapper-support.patch 3.8 KB

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