From 18a3f5529a079a34b0c01eced43ed3f439a2051f Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 10 Jan 2024 15:09:12 +0100 Subject: [PATCH] v8,tools: expose necessary V8 defines https://github.com/nodejs/node/pull/50820 --- ...compilation_fails_if_not_using_a_new.patch | 26 +++++------ ...pression_sandbox_is_enabled_on_64bit.patch | 44 +++---------------- 2 files changed, 17 insertions(+), 53 deletions(-) diff --git a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch index 35fcf28890a38..a64da6ee001d6 100644 --- a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch +++ b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch @@ -7,38 +7,36 @@ Subject: build: ensure native module compilation fails if not using a new This should not be upstreamed, it is a quality-of-life patch for downstream module builders. diff --git a/common.gypi b/common.gypi -index b7f9e44f827e58ac3b9376ec291f42cceb2b28bb..24cc9efe32c083d0cecd1ae94514b5a2d24ca2d6 100644 +index f52d4f805406c513904151be90e433948764b3ad..343bbafa9787f56646ee7332151d21152ecf5379 100644 --- a/common.gypi +++ b/common.gypi -@@ -79,6 +79,8 @@ - # TODO(refack): make v8-perfetto happen +@@ -86,6 +86,8 @@ 'v8_use_perfetto': 0, + 'tsan%': 0, + 'using_electron_config_gypi%': 0, + ##### end V8 defaults ##### # When building native modules using 'npm install' with the system npm, -@@ -282,6 +284,7 @@ - 'V8_DEPRECATION_WARNINGS', - 'V8_IMMINENT_DEPRECATION_WARNINGS', +@@ -285,6 +287,7 @@ + # Defines these mostly for node-gyp to pickup. + 'defines': [ '_GLIBCXX_USE_CXX11_ABI=1', + 'ELECTRON_ENSURE_CONFIG_GYPI', ], # Forcibly disable -Werror. We support a wide range of compilers, it's -@@ -388,6 +391,11 @@ - }], - ], +@@ -396,6 +399,9 @@ + ['v8_enable_v8_checks == 1', { + 'defines': ['V8_ENABLE_CHECKS'], }], + ['using_electron_config_gypi == 1', { -+ 'defines': [ -+ 'USING_ELECTRON_CONFIG_GYPI', -+ ], ++ 'defines': ['USING_ELECTRON_CONFIG_GYPI'], + }], ['v8_enable_pointer_compression == 1', { - 'defines': [ - 'V8_COMPRESS_POINTERS', + 'defines': ['V8_COMPRESS_POINTERS'], + }], diff --git a/configure.py b/configure.py index 7b80ec63a082ce93ba81ca6dd41ec03041534ff7..926659883d3bd6d447c89a50d6770988b59d6f88 100755 --- a/configure.py diff --git a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch index 7cc0e162df5bc..86af5a9c7fe33 100644 --- a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch +++ b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch @@ -7,49 +7,15 @@ Aligns common.gypi with the current build flag state of //v8. Specifically enables `V8_ENABLE_SANDBOX`, `V8_SANDBOXED_POINTERS`, `V8_COMPRESS_POINTERS` and `V8_COMPRESS_POINTERS_IN_SHARED_CAGE`. -diff --git a/common.gypi b/common.gypi -index 225b3df380caca809926d6af9fc1001057237752..b7f9e44f827e58ac3b9376ec291f42cceb2b28bb 100644 ---- a/common.gypi -+++ b/common.gypi -@@ -65,6 +65,7 @@ - # node-gyp to build addons. - 'v8_enable_pointer_compression%': 0, - 'v8_enable_31bit_smis_on_64bit_arch%': 0, -+ 'v8_enable_sandbox%': 0, - - # Disable v8 hugepage by default. - 'v8_enable_hugepage%': 0, -@@ -123,6 +124,7 @@ - ['target_arch in "arm ia32 mips mipsel ppc"', { - 'v8_enable_pointer_compression': 0, - 'v8_enable_31bit_smis_on_64bit_arch': 0, -+ 'v8_enable_sandbox': 0, - }], - ['target_arch in "ppc64 s390x"', { - 'v8_enable_backtrace': 1, -@@ -389,9 +391,12 @@ - ['v8_enable_pointer_compression == 1', { - 'defines': [ - 'V8_COMPRESS_POINTERS', -- 'V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE', -+ 'V8_COMPRESS_POINTERS_IN_SHARED_CAGE', - ], - }], -+ ['v8_enable_sandbox == 1', { -+ 'defines': ['V8_ENABLE_SANDBOX'] -+ }], - ['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', { - 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'], - }], diff --git a/configure.py b/configure.py -index 62f041ce52bf85136175e733216671e2811a337b..7b80ec63a082ce93ba81ca6dd41ec03041534ff7 100755 +index 84b016cd853080656d4dcf982e64855fcfa72a55..5ede37578480b06daf7ffab786a1361eeae3c6b4 100755 --- a/configure.py +++ b/configure.py -@@ -1497,6 +1497,7 @@ def configure_v8(o): - o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1 +@@ -1503,6 +1503,7 @@ def configure_v8(o): + o['variables']['v8_enable_maglev'] = 1 if options.v8_enable_maglev else 0 o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 + o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1 - o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 - o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) + o['variables']['v8_enable_extensible_ro_snapshot'] = 0 + o['variables']['v8_enable_v8_checks'] = 1 if options.debug else 0